created profile in parent view

This commit is contained in:
Tóth Richárd
2018-06-11 23:51:23 +02:00
parent f98f1fe6e2
commit a50eab7528
8 changed files with 202 additions and 9 deletions

View File

@@ -7,9 +7,9 @@ class milestone
{
private $ms_id;
private $ms_type_mt_id;
private $ms_training_mst_id;
private $ms_competition_msc_id;
private $ms_camp_msca_id;
private $ms_training_mst_id = null;
private $ms_competition_msc_id = null;
private $ms_camp_msca_id = null;
private $ms_user_kid_uk_id;
public function set_ms_data_by_id($_ms_id) {
@@ -20,9 +20,31 @@ class milestone
foreach ($cat_array as $field => $value) {
$function_name = "set_" . $field;
$this->$function_name($value);
}
//todo: egyéb objektumok
if ($field == 'ms_type_mt_id' && $value != null) {
$new_mt = new milestone_type();
$new_mt->set_mt_data_by_id($value);
$this->set_ms_type_mt_id($new_mt);
}
if ($field == 'ms_training_mst_id' && $value != null) {
$new_mst = new milestone_training();
$new_mst->set_mst_data_by_id($value);
$this->set_ms_training_mst_id($new_mst);
}
if ($field == 'ms_competition_msc_id' && $value != null) {
$new_msc = new milestone_competition();
$new_msc->set_msc_data_by_id($value);
$this->set_ms_competition_msc_id($new_msc);
}
if ($field == 'ms_camp_msca_id' && $value != null) {
$new_msca = new milestone_camp();
$new_msca->set_msca_data_by_id($value);
$this->set_ms_camp_msca_id($new_msca);
}
}
}
public static function create_ms($_mt, $_uk, $_mst = null, $_msc = null, $_msca = null)
@@ -37,6 +59,18 @@ class milestone
), false);
}
public function get_ms_month() {
if (null !== $this->ms_competition_msc_id) {
return $this->ms_competition_msc_id->get_msc_month();
}
elseif (null !== $this->ms_training_mst_id) {
return $this->ms_training_mst_id->get_mst_month();
}
elseif (null !== $this->ms_camp_msca_id) {
return $this->ms_camp_msca_id->get_msca_month();
}
}
/**
@@ -177,7 +211,7 @@ class milestone
$sql->execute_query('DELETE milestone_camp FROM milestone_camp JOIN milestone ON ms_camp_msca_id= msca_id WHERE ms_user_kid_uk_id = ' . $kid);
$content = file($_FILES['fileToUpload']['tmp_name']); //makes array
//var_dump($content);
for ($i=0; $i < count($content); $i++) {
$line = $content[$i];
@@ -247,7 +281,7 @@ class milestone
++$i; //mérkőzések szöveg
$matches = '';
do {
$matches .= trim($content[$i]);
$matches .= trim($content[$i]) . '\n';
++$i;
} while (isset($content[$i]) && !empty(trim($content[$i])));
}