public static function addDataPropusk($post) { $data_propusk = $post['data_propusk']; $data_vnes = date("Y-m-d"); $id_predm = $_GET['propuskPredmet']; $id_grupa = $_GET['propuskGrupa']; foreach ($post['StudentPropusk']['id'] as $k => $v) { if ($v != 0) { $model = new StudentPropusk(); $model->id_stud = substr(substr($k, 1), 0, -1); $model->id_predm = $id_predm; $model->id_grupa = $id_grupa; $model->form_navch_id = StudentGrupa::getIdFormaNavchanya($id_grupa); $model->propusk_god = $post['StudentPropusk']['propusk_god'][$k]; $model->id_fakult = Facult::getFacultId(); $model->data_propusk = $data_propusk; $model->data_vnes = $data_vnes; $model->id_vikl = $post['StudentPropusk']['id_vikl']; $model->save(); } // $model->id_stud=substr(substr($id_stud,1),0,-1); // $model->id_predm=$id_predm; // $model->id_grupa=$id_grupa; // $model->form_navch_id=$form_navch_id; // $model->propusk_god=$propusk_god; // $model->id_fakult=Facult::getFacultId(); //if($model->save()) Yii::app()->getController()->redirect($_SERVER['HTTP_REFERER']); } }
public static function getIdFormaNavchanya($id) { $model = new StudentGrupa(); $data = $model->model()->find("id='{$id}'"); //return $data->grupaShufr->title."-".$data->kurs_id."".$data->pidgrupa."".$data->formaNavch->title_small; return $data->forma_navch_id; }
public static function HextCourse($id) { $next_course = $_GET['HextCourse']; $old_grupa = StudentGrupa::getNameGrupa($id); $arr = explode("-", $old_grupa); $string = substr($arr[1], 2); $alias_grupa = $arr[0]; $number1 = substr($arr[1], 0, strpos($arr[1], $string) - 1); $number2 = substr($arr[1], 1, strpos($arr[1], $string) - 1); $new_group = $alias_grupa . "-" . (1 + $number1) . "" . $number2 . "" . $string; $id_new_grupa = StudentGrupa::getGrupaId($new_group); if (isset($_GET['finish']) and !empty($_GET['finish'])) { if ($id_new_grupa) { $array = StudentLogin::model()->findAll("student_grupa_id='{$id}'"); foreach ($array as $arr) { $id = $arr->id; StudentLogin::model()->updateAll(array("student_grupa_id" => $id_new_grupa), "id='{$id}'"); } echo "<script>\n alert('Всіх студентів переведено на інший курс');\n </script>"; } else { echo "<script>\n alert('Неможливо перевести студентів. Групи {$new_group} не існує');\n\n </script>"; } } else { echo "<script>\n var b;\n b=confirm('Перевести студентів групи {$old_grupa} в групу {$new_group} ?');\n if (b == true) {\n window.location.href='/index.php/student/TransferStudent/HextCourse/{$next_course}/next/{$id}/finish/1';\n }\n </script>"; } }