示例#1
1
 /**
  * 存储完整意见--$comments
  */
 public static function insertComment($array, $examinee_id, $manager_id)
 {
     try {
         $manager = new TxManager();
         $transaction = $manager->get();
         $interview = Interview::findFirst(array('manager_id=?0 and examinee_id=?1', 'bind' => array(0 => $manager_id, 1 => $examinee_id)));
         $interview->setTransaction($transaction);
         $advantage = array('advantage1' => $array['advantage1'], 'advantage2' => $array['advantage2'], 'advantage3' => $array['advantage3'], 'advantage4' => $array['advantage4'], 'advantage5' => $array['advantage5']);
         $interview->advantage = json_encode($advantage, JSON_UNESCAPED_UNICODE);
         $disadvantage = array('disadvantage1' => $array['disadvantage1'], 'disadvantage2' => $array['disadvantage2'], 'disadvantage3' => $array['disadvantage3']);
         $interview->disadvantage = json_encode($disadvantage, JSON_UNESCAPED_UNICODE);
         $interview->remark = $array['remark'];
         $examinee = Examinee::findFirst($examinee_id);
         $examinee->setTransaction($transaction);
         $examinee->state = 5;
         if ($interview->save() == false || $examinee->save() == false) {
             $transaction->rollback("数据插入失败");
         }
         $transaction->commit();
         return true;
     } catch (TxFailed $e) {
         throw new Exception($e->getMessage());
     }
 }
示例#2
0
 public function getdetailAction()
 {
     $this->view->disable();
     $manager = $this->session->get('Manager');
     if (empty($manager)) {
         $this->dataReturn(array('error' => '用户信息失效,请重新登录!'));
         return;
     }
     $project_id = $manager->project_id;
     $project = Project::findFirst($project_id);
     if (!isset($project->id)) {
         $this->dataReturn(array('error' => '项目不存在,请联系管理员'));
         return;
     }
     $ans_array = array();
     $ans_array['project_name'] = $project->name;
     $ans_array['begintime'] = $project->begintime;
     $ans_array['endtime'] = $project->endtime;
     $ans_array['state'] = $project->state == 2 ? true : false;
     $ans_array['inquery'] = false;
     $ans_array['exam'] = false;
     if ($project->state == 1) {
         $inquery = InqueryQuestion::findFirst(array('project_id=?1', 'bind' => array(1 => $project_id)));
         if (isset($inquery->project_id)) {
             $ans_array['inquery'] = true;
         } else {
             $ans_array['exam'] = true;
         }
     }
     if ($project->state == 2) {
         $ans_array['inquery'] = true;
         $ans_array['exam'] = true;
     }
     //项目详情只显示被试
     $examinees = Examinee::find(array('project_id=?1 AND type = 0', 'bind' => array(1 => $project_id)));
     //获取该项目下答题的总人数
     $ans_array['exam_count'] = count($examinees);
     $examinee_com = 0;
     $examinee_coms = array();
     $examinee_not_coms = array();
     foreach ($examinees as $examinee) {
         if ($examinee->state > 0) {
             $examinee_com++;
             $examinee_coms[$examinee_com - 1] = $examinee->id;
         } else {
             $examinee_not_coms[] = $examinee->id;
         }
     }
     //答题完成人数
     $ans_array['exam_finish'] = $examinee_com;
     $interview_com = 0;
     for ($i = 0; $i < $examinee_com; $i++) {
         $interview = Interview::findFirst(array("examinee_id =:id:", 'bind' => array('id' => $examinee_coms[$i])));
         //判定条件
         if (!empty($interview->advantage) && !empty($interview->disadvantage) && !empty($interview->remark)) {
             $interview_com++;
         }
     }
     $ans_array['interview_finish'] = $interview_com;
     $this->dataReturn(array('success' => $ans_array));
     return;
 }
 public function getpointAction($examinee_id)
 {
     $interviewer = $this->session->get('Manager');
     if (empty($interviewer)) {
         $this->dataReturn(array('error' => '用户信息获取失败,请重新登录'));
         return;
     } else {
         $level = ReportData::getLevel($examinee_id);
         $interview = Interview::findFirst(array('examinee_id =?0 and manager_id =?1', 'bind' => array(0 => $examinee_id, 1 => $interviewer->id)));
         if (empty($interview->advantage)) {
             $point = json_decode($interview->comments_incomplete, true);
             $point['level'] = $level;
         } else {
             $advantage = json_decode($interview->advantage, true);
             $disadvantage = json_decode($interview->disadvantage, true);
             $point = array('advantage1' => $advantage['advantage1'], 'advantage2' => $advantage['advantage2'], 'advantage3' => $advantage['advantage3'], 'advantage4' => $advantage['advantage4'], 'advantage5' => $advantage['advantage5'], 'disadvantage1' => $disadvantage['disadvantage1'], 'disadvantage2' => $disadvantage['disadvantage2'], 'disadvantage3' => $disadvantage['disadvantage3'], 'remark' => $interview->remark, 'level' => $level);
         }
         $this->dataReturn(array('point' => $point));
         return;
     }
 }
 public function getdetailAction()
 {
     $this->view->disable();
     $id = $this->request->getPost('id', 'int');
     $project = Project::findFirst($id);
     if (!isset($project->id)) {
         $this->dataReturn(array('error' => '该编号下的项目不存在,请返回刷新!'));
         return;
     }
     $ans_array = array();
     $ans_array['project_name'] = $project->name;
     $ans_array['begintime'] = $project->begintime;
     $ans_array['endtime'] = $project->endtime;
     //添加绿色通道与正常被试判断
     $examinees = Examinee::find(array('project_id=?1 AND type= 0', 'bind' => array(1 => $id)));
     //获取该项目下答题的总人数
     $ans_array['exam_count'] = count($examinees);
     $examinee_com = 0;
     $examinee_coms = array();
     $examinee_not_coms = array();
     foreach ($examinees as $examinee) {
         if ($examinee->state > 0) {
             $examinee_com++;
             $examinee_coms[$examinee_com - 1] = $examinee->id;
         } else {
             $examinee_not_coms[] = $examinee->id;
         }
     }
     //答题完成人数
     $ans_array['exam_finish'] = $examinee_com;
     $interview_com = 0;
     for ($i = 0; $i < $examinee_com; $i++) {
         $interview = Interview::findFirst(array("examinee_id =:id:", 'bind' => array('id' => $examinee_coms[$i])));
         //判定条件
         if (!empty($interview->advantage) && !empty($interview->disadvantage) && !empty($interview->remark)) {
             $interview_com++;
         }
     }
     $ans_array['interview_finish'] = $interview_com;
     $this->dataReturn(array('success' => $ans_array));
     return;
 }
示例#5
0
 /**
  * 取消面询分配
  */
 public static function delallocExaminees($data, $interviewer_id)
 {
     try {
         $manager = new TxManager();
         $transaction = $manager->get();
         foreach ($data as $value) {
             $interview = Interview::findFirst(array('examinee_id = ?1 AND manager_id = ?2', 'bind' => array(1 => $value, 2 => $interviewer_id)));
             if (!isset($interview->examinee_id)) {
                 continue;
             }
             $interview->setTransaction($transaction);
             if ($interview->delete() == false) {
                 $transaction->rollback("数据删除失败");
             }
         }
         $transaction->commit();
         return true;
     } catch (TxFailed $e) {
         throw new Exception($e->getMessage());
     }
 }
 public function getComments($examinee_id)
 {
     $interview = Interview::findFirst(array('examinee_id=?1', 'bind' => array(1 => $examinee_id)));
     if (!isset($interview->examinee_id)) {
         throw new Exception($examinee_id . '-专家面询未完成');
     }
     $advantage = json_decode($interview->advantage, true);
     $disadvantage = json_decode($interview->disadvantage, true);
     $comments = array('advantage' => $advantage, 'disadvantage' => $disadvantage, 'remark' => $interview->remark);
     return $comments;
 }