- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
if(isset($_POST['submit']) AND $_POST['submit'] == 'add_program')
{
if($this->form_validation->run('add_program') == TRUE)
{
// Добавляем программу обучения
$this->Settings_model->add_program($_POST['title']);
$id = $this->db->insert_id();
for ($x = 0; $x < 61; $x++)
{
if ($x <= 12)
{
$title = $x;
$year = 1;
}
elseif ($x > 12 AND $x <= 24)
{
if($x == 13) {$title = 1;}
if($x == 14) {$title = 2;}
if($x == 15) {$title = 3;}
if($x == 16) {$title = 4;}
if($x == 17) {$title = 5;}
if($x == 18) {$title = 6;}
if($x == 19) {$title = 7;}
if($x == 20) {$title = 8;}
if($x == 21) {$title = 9;}
if($x == 22) {$title = 10;}
if($x == 23) {$title = 11;}
if($x == 24) {$title = 12;}
$year = 2;
}
elseif ($x > 24 AND $x <= 36)
{
if($x == 25) {$title = 1;}
if($x == 26) {$title = 2;}
if($x == 27) {$title = 3;}
if($x == 28) {$title = 4;}
if($x == 29) {$title = 5;}
if($x == 30) {$title = 6;}
if($x == 31) {$title = 7;}
if($x == 32) {$title = 8;}
if($x == 33) {$title = 9;}
if($x == 34) {$title = 10;}
if($x == 35) {$title = 11;}
if($x == 36) {$title = 12;}
$year = 3;
}
elseif ($x > 36 AND $x <= 48)
{
if($x == 37) {$title = 1;}
if($x == 38) {$title = 2;}
if($x == 39) {$title = 3;}
if($x == 40) {$title = 4;}
if($x == 41) {$title = 5;}
if($x == 42) {$title = 6;}
if($x == 43) {$title = 7;}
if($x == 44) {$title = 8;}
if($x == 45) {$title = 9;}
if($x == 46) {$title = 10;}
if($x == 47) {$title = 11;}
if($x == 48) {$title = 12;}
$year = 4;
}
else
{
if($x == 49) {$title = 1;}
if($x == 50) {$title = 2;}
if($x == 51) {$title = 3;}
if($x == 52) {$title = 4;}
if($x == 53) {$title = 5;}
if($x == 54) {$title = 6;}
if($x == 55) {$title = 7;}
if($x == 56) {$title = 8;}
if($x == 57) {$title = 9;}
if($x == 58) {$title = 10;}
if($x == 59) {$title = 11;}
if($x == 60) {$title = 12;}
$year = 5;
}
if($x != 0)
{
// Добавляем месяцы обучения
$this->Settings_model->add_tutorial_months($id,$year,$title);
}
}
wvxvw 23.03.2015 19:06 # 0
guest 31.03.2015 22:47 # +1
[code=php]
// ...
// Добавляем программу обучения
$this->Settings_model->add_program($_POST['title']);
if(!empty($x) && is_numeric($x) && $x>-1 && $x<61) {
$curr_month = ($x % 12);
$year = floor($x / 12) + (int)!!$curr_month;
$title = $curr_month ? : 12;
$id = $this->db->insert_id();
// Добавляем месяцы обучения
$this->Settings_model->add_tutorial_months($id, $year, $title);
}
[code]