Exemplo n.º 1
0
 public function saveExamGroupInfo($data, $course_id)
 {
     $group = ExamGroup::model()->findByPk($data->getProperty('id'));
     if ($group == null) {
         $group = new ExamGroup();
     }
     $course = new Courses();
     $course = Courses::model()->findByPk($course_id);
     $group->eid = $data->getProperty('id');
     $group->name = $data->getProperty('name');
     //$datetime->add(new DateInterval('PT1H'));
     $group->email = $data->getProperty('email');
     if (null != $data->getProperty('owner')) {
         $group->owner_id = $data->getProperty('owner')->getProperty('id');
         $this->saveMemberInfo($data->getProperty('owner'));
         $this->saveGroupMember($data->getProperty('owner'), $data->getProperty('id'), 'Exam');
     }
     $group->description = $data->getProperty('description');
     $group->courses_id = $course_id;
     if (isset($course)) {
         $group->degree_id = $course->degree_id;
     }
     $degreeGroup = DegreeGroup::model()->findByAttributes(array('degree_id' => $course->degree_id));
     if ($degreeGroup != null) {
         $group->degree_group_id = $degreeGroup->cid;
     }
     $group->save();
 }