public static function getOnlyPredmetGrupa($id_grupa) { $model = new PredmetHasStudentGrupa(); $criteria = new CDbCriteria(); $criteria->with = array('StudentPredmets'); $criteria->condition = "student_grupa_id='{$id_grupa}'"; $obj = $model->model()->findAll($criteria); $array = array(); $arrayZag = array(); foreach ($obj as $arr) { foreach ($arr->StudentPredmets as $k => $v) { $array[$k] = $v; } $arrayZag[] = $array; } return $arrayZag; }
public static function getGrupaOnlyThisFacultAll() { $facultet_id = Facult::getFacultId(); $model = new StudentGrupa(); $arr = $model->model()->findAll("facultet_id='{$facultet_id}'"); $arrayZag = array(); foreach ($arr as $array) { $arrayGrupa = array(); $id_grupa = $array->id; /***************************************************************масив з предметами кожноъ групи*****************************************************/ $modelPredmetHasStudentGrupa = new PredmetHasStudentGrupa(); $arrPredObj = $modelPredmetHasStudentGrupa->model()->findAll("student_grupa_id='{$id_grupa}'"); $arrayPred = array(); foreach ($arrPredObj as $a) { $id = $a->student_predmet_id; $arrayPred[$id] = StudentPredmet::returnPredmetName($id); } /******************************************************************масив з предметами кожноъ групи кінець**************************************************/ $arrayGrupa[$id_grupa] = $array->grupa_title; $arrayGrupa['predmet'] = $arrayPred; $arrayZag[$id_grupa] = $arrayGrupa; } return $arrayZag; }