コード例 #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 pointAction($examinee_id)
 {
     $examinee = Examinee::findFirst($examinee_id);
     $level = ReportData::getLevel($examinee_id);
     $level1 = '';
     $level2 = '';
     $level3 = '';
     $level4 = '';
     if ($level == '优') {
         $level1 = '√';
     } else {
         if ($level == '良') {
             $level2 = '√';
         } else {
             if ($level == '中') {
                 $level3 = '√';
             } else {
                 if ($level == '差') {
                     $level4 = '号√';
                 }
             }
         }
     }
     $this->view->setVar('level1', $level1);
     $this->view->setVar('level2', $level2);
     $this->view->setVar('level3', $level3);
     $this->view->setVar('level4', $level4);
     $this->view->setVar('name', $examinee->name);
     $this->view->setVar('examinee_id', $examinee_id);
     $this->view->setTemplateAfter('base2');
     $this->leftRender('填 写 面 询 意 见');
 }
コード例 #3
0
 public function getindividualComprehensive($examinee_id)
 {
     $project_id = Examinee::findFirst($examinee_id)->project_id;
     $project_detail = ProjectDetail::findFirst(array("project_id = :project_id:", 'bind' => array('project_id' => $project_id)));
     if (empty($project_detail) || empty($project_detail->module_names)) {
         throw new Exception('项目配置信息有误');
     }
     $exist_module_array = explode(',', $project_detail->module_names);
     $module_array = array("心理健康" => 'mk_xljk', "素质结构" => 'mk_szjg', "智体结构" => 'mk_ztjg', "能力结构" => 'mk_nljg');
     $module_array_score = array();
     foreach ($module_array as $key => $value) {
         if (!in_array($value, $exist_module_array)) {
             continue;
         }
         $module_record = Module::findFirst(array("name = ?1", 'bind' => array(1 => $value)));
         $children = $module_record->children;
         $children_array = explode(',', $children);
         $result_1 = $this->modelsManager->createBuilder()->columns(array('Index.chs_name as chs_name', 'Index.name as name', 'IndexAns.score as score', 'Index.children as children'))->from('Index')->inwhere('Index.name', $children_array)->join('IndexAns', 'IndexAns.index_id = Index.id AND IndexAns.examinee_id = ' . $examinee_id)->orderBy('IndexAns.score desc')->getQuery()->execute()->toArray();
         //进行规范排序
         $module_array_score[$key] = array();
         foreach ($result_1 as &$result_1_record) {
             $skey = array_search($result_1_record['name'], $children_array);
             $module_array_score[$key][$skey] = $result_1_record;
         }
         //对指标层进行遍历查找中间层,以及children
         foreach ($module_array_score[$key] as &$index_info) {
             $middle = array();
             $middle = MiddleLayer::find(array('father_chs_name=?1', 'bind' => array(1 => $index_info['chs_name'])))->toArray();
             $children = array();
             $index_info['count'] = count(explode(',', $index_info['children']));
             $children = $this->getChildrenOfIndexDesc($index_info['name'], $index_info['children'], $examinee_id);
             $tmp = array();
             $children = $this->foo($children, $tmp);
             $tmp_detail = array();
             foreach ($middle as $middle_info) {
                 $outter_tmp = array();
                 $middle_children = explode(',', $middle_info['children']);
                 $outter_tmp_score = 0;
                 foreach ($middle_children as $children_name) {
                     $skey = array_search($children_name, $children);
                     $inner_tmp = array();
                     $inner_tmp['name'] = $children_name;
                     $inner_tmp['score'] = $children[$skey + 1];
                     $outter_tmp_score += $inner_tmp['score'];
                     $tmp_detail[] = $inner_tmp;
                 }
                 $outter_tmp['name'] = null;
                 $outter_tmp['score'] = $outter_tmp_score;
                 $tmp_detail[] = $outter_tmp;
             }
             $index_info['detail'] = $tmp_detail;
         }
     }
     return $module_array_score;
 }
コード例 #4
0
 public function self_check($examinee_id)
 {
     //check
     $examinee = Examinee::findFirst($examinee_id);
     if (!isset($examinee->id)) {
         throw new Exception('被试id不存在');
     }
     if ($examinee->state < 5) {
         throw new Exception('被试基础算分未完成');
     }
     return $examinee->project_id;
 }
コード例 #5
0
 public function listinfoAction()
 {
     $examinee_id = $this->request->getPost('examinee_id', 'int');
     if (empty($examinee_id)) {
         $this->dataReturn(array('error' => '查询的id号为空,请返回'));
         return;
     }
     $examinee_info = Examinee::findFirst($examinee_id);
     if (!isset($examinee_info->id)) {
         $this->dataReturn(array('error' => '不存在的用户id号,请返回'));
         return;
     }
     $question = array();
     $question['name'] = $examinee_info->name;
     $question['sex'] = $examinee_info->sex == 1 ? '男' : '女';
     $question['education'] = $examinee_info->education;
     $question['degree'] = $examinee_info->degree;
     $question['birthday'] = $examinee_info->birthday;
     $question['politics'] = $examinee_info->politics;
     $question['native'] = $examinee_info->native;
     $question['professional'] = $examinee_info->professional;
     $question['employer'] = $examinee_info->employer;
     $question['unit'] = $examinee_info->unit;
     $question['duty'] = $examinee_info->duty;
     $question['team'] = $examinee_info->team;
     $others = json_decode($examinee_info->other, true);
     $question['educations'] = $others['education'];
     $question['works'] = $others['work'];
     //用户信息修改判断
     $init_data = json_decode($examinee_info->init_data, true);
     $diff_comm_array = array();
     $diff_other_array = array();
     $diff_other_array['education'] = array();
     $diff_other_array['work'] = array();
     if (!empty($init_data)) {
         foreach ($init_data as $key => $svalue) {
             if ($key == 'other') {
                 if (!isset($svalue['education'])) {
                     $svalue['education'] = array();
                 }
                 if (!isset($svalue['work'])) {
                     $svalue['work'] = array();
                 }
                 $tmp_edu_init = array();
                 $tmp_wor_init = array();
                 $this->foo($svalue['education'], $tmp_edu_init);
                 $this->foo($svalue['work'], $tmp_wor_init);
                 $tmp_edu_new = array();
                 $tmp_wor_new = array();
                 $this->foo($question['educations'], $tmp_edu_new);
                 $this->foo($question['works'], $tmp_wor_new);
                 $diff_1 = array_diff($tmp_edu_init, $tmp_edu_new) || array_diff($tmp_edu_new, $tmp_edu_init);
                 $diff_2 = array_diff($tmp_wor_init, $tmp_wor_new) || array_diff($tmp_wor_new, $tmp_wor_init);
                 if (!empty($diff_1)) {
                     $tmp = array();
                     $tmp['id'] = 'eduactions';
                     $tmp['value'] = $tmp_edu_init;
                     $tmp['svalue'] = $tmp_edu_new;
                     $diff_other_array['education'] = $tmp;
                 }
                 if (!empty($diff_2)) {
                     $tmp = array();
                     $tmp['id'] = 'works';
                     $tmp['value'] = $tmp_wor_init;
                     $tmp['svalue'] = $tmp_wor_new;
                     $diff_other_array['work'] = $tmp;
                 }
             } else {
                 if ($init_data[$key] != $question[$key]) {
                     $tmp = array();
                     $tmp['id'] = $key;
                     $tmp['value'] = $init_data[$key];
                     $tmp['svalue'] = $question[$key];
                     $diff_comm_array[] = $tmp;
                 }
             }
         }
     }
     $question['diff_comm'] = $diff_comm_array;
     $question['diff_other'] = $diff_other_array;
     #添加用户是否修改相应信息的判断以及修改的结果予以反馈
     $this->dataReturn(array('success' => $question));
     return;
 }
コード例 #6
0
 public function updateexamineeAction()
 {
     $oper = $this->request->getPost('oper', 'string');
     if ($oper == 'edit') {
         $id = $this->request->getPost('id', 'int');
         $examinee = Examinee::findFirst($id);
         $examinee->name = $this->request->getPost('name', 'string');
         $examinee->password = $this->request->getPost('password', 'string');
         $examinee->project_id = $this->request->getPost('project_id', 'int');
         if (!$examinee->save()) {
             foreach ($examinee->getMessages() as $message) {
                 echo $message;
             }
         }
     }
     if ($oper == 'del') {
         $id = $this->request->getPost('id', 'int');
         $examinee = Examinee::findFirst($id);
         if (!$examinee->delete()) {
             foreach ($examinee->getMessages() as $message) {
                 echo $message;
             }
         }
     }
 }
コード例 #7
0
 public function getindividualComprehensive($examinee_id)
 {
     $project_id = Examinee::findFirst($examinee_id)->project_id;
     $project_detail = ProjectDetail::findFirst(array("project_id = :project_id:", 'bind' => array('project_id' => $project_id)));
     if (empty($project_detail) || empty($project_detail->module_names)) {
         throw new Exception('项目配置信息有误');
     }
     $exist_module_array = explode(',', $project_detail->module_names);
     $module_array = array("心理健康" => 'mk_xljk', "素质结构" => 'mk_szjg', "智体结构" => 'mk_ztjg', "能力结构" => 'mk_nljg');
     $module_array_score = array();
     foreach ($module_array as $key => $value) {
         if (!in_array($value, $exist_module_array)) {
             continue;
         }
         $module_record = Module::findFirst(array("name = ?1", 'bind' => array(1 => $value)));
         $children = $module_record->children;
         $children_array = explode(',', $children);
         $result_1 = $this->modelsManager->createBuilder()->columns(array('Index.chs_name as chs_name', 'Index.name as name', 'IndexAns.score as score', 'Index.children as children'))->from('Index')->inwhere('Index.name', $children_array)->join('IndexAns', 'IndexAns.index_id = Index.id AND IndexAns.examinee_id = ' . $examinee_id)->orderBy('IndexAns.score desc')->getQuery()->execute()->toArray();
         //进行规范排序
         $module_array_score[$key] = array();
         foreach ($result_1 as &$result_1_record) {
             $skey = array_search($result_1_record['name'], $children_array);
             $module_array_score[$key][$skey] = $result_1_record;
         }
     }
     return $module_array_score;
 }
コード例 #8
0
 public function examinee_check($examinee_id)
 {
     //check
     $examinee = Examinee::findFirst($examinee_id);
     if (empty($examinee)) {
         throw new Exception('被试id不存在');
     }
     if ($examinee->type == 1) {
         throw new Exception('绿色通道人员不参与项目的胜任力报告生成');
     }
     //个人被试的状态必须是指标层完成
     if ($examinee->state < 4) {
         throw new Exception('被试基础算分未完成');
     }
     //项目检测
     $project_id = $examinee->project_id;
     $team_members = Examinee::find(array("project_id = ?1  AND type = 0", 'bind' => array(1 => $project_id)));
     $members_count = count($team_members);
     if ($members_count == 0) {
         throw new Exception('项目中的人数为0,无法进行个人胜任力报告生成');
     }
     foreach ($team_members as $value) {
         if ($value->state < 4) {
             $members_not_finished[$value->number] = $value->name;
         }
     }
     if (isset($members_not_finished)) {
         $list = '项目中部分成员未完成测评过程,如下:<br/>';
         foreach ($members_not_finished as $key => $value) {
             $list .= $key . ':' . $value . '<br/>';
         }
         throw new Exception(print_r($list, true));
     }
     return $project_id;
 }
コード例 #9
0
 /**
  * @usage 完成基础得分计算后的被试状态转换
  * @param int $examinee_id
  * @throws Exception
  * @return boolean
  */
 public static function finishedBasic($examinee_id)
 {
     $examinee_info = Examinee::findFirst(array("id = :id:", 'bind' => array('id' => $examinee_id)));
     #如果examinee_id为空,这种处理也合适
     if (isset($examinee_info->id)) {
         try {
             $manager = new TxManager();
             $transaction = $manager->get();
             $examinee_info->setTransaction($transaction);
             $examinee_info->state = 2;
             if ($examinee_info->save() == false) {
                 $transaction->rollback(self::$error_state . '-数据库插入失败-' . print_r($examinee_info, true));
             }
             $transaction->commit();
             return true;
         } catch (TxFailed $e) {
             throw new Exception($e->getMessage());
         }
     } else {
         throw new Exception(self::$error_state . '-不存在该账号的用户-' . $examinee_id);
     }
 }
コード例 #10
0
 public function getpersonalresultsbyprojectAction()
 {
     set_time_limit(0);
     $this->view->disable();
     //十项报表的导出必须是manager pm & interviwer
     $manager = $this->session->get('Manager');
     if (empty($manager)) {
         $this->dataReturn(array('error' => '用户信息失效,请重新登录!'));
         return;
     }
     //获取项目中完成测评的人员列表----全部都是除去了绿色通道人员 ---- 且被试已经完成了指标算分
     $examinees = $this->modelsManager->createBuilder()->columns(array('number'))->from('Examinee')->where('Examinee.project_id = ' . $manager->project_id . ' AND Examinee.type = 0 AND Examinee.state >= 4 ')->getQuery()->execute()->toArray();
     if (empty($examinees)) {
         $this->dataReturn(array('error' => '目前没有被试完成测评,无法生成十项报表'));
         return;
     }
     // 根据目录结构判断文件是否存在
     $year = floor($manager->project_id / 100);
     $path = './project/' . $year . '/' . $manager->project_id . '/individual/personal_result/';
     $path_url = '/project/' . $year . '/' . $manager->project_id . '/individual/personal_result/';
     //遍历完成的被试集判断其是否已经生成了十项报表
     $finished_list = array();
     $not_finished_list = array();
     foreach ($examinees as $examinee) {
         $name = $examinee['number'] . '_personal_result.xls';
         if (file_exists($path . $name)) {
             $finished_list[] = $examinee['number'];
         } else {
             try {
                 $examinee_info = Examinee::findFirst(array('number=?1', 'bind' => array(1 => $examinee['number'])));
                 $checkout_excel = new CheckoutExcel();
                 $report_tmp_name = $checkout_excel->excelExport($examinee_info);
                 $report_name = $path . $name;
                 $file = new FileHandle();
                 $file->movefile($report_tmp_name, $report_name);
                 //清空临时文件 主要在tmp中
                 $file->clearfiles('./tmp/', $examinee_info->id);
                 $finished_list[] = $examinee['number'];
             } catch (Exception $e) {
                 $not_finished_list[] = $examinee['number'] . '-生成失败-原因:' . $e->getMessage();
             }
         }
     }
     if (empty($finished_list)) {
         $this->dataReturn(array('error' => array('error' => $not_finished_list)));
         return;
     }
     //打包已完成的人员十项报表
     //$path 存在
     try {
         $file_name = 'personal_results_package';
         $zipfile = new FileHandle();
         $zipfile->clearfiles('./tmp/', $manager->project_id);
         $file_path = $zipfile->packageZip($path, $manager->project_id, $file_name);
         $this->dataReturn(array('success' => array('success' => $file_path, 'error' => $not_finished_list)));
         return;
     } catch (Exception $e) {
         $this->dataReturn(array('error' => $e->Message()));
         return;
     }
 }
コード例 #11
0
ファイル: Examinee.php プロジェクト: Brucewyh/Questionnaire
 public static function checkLogin($username, $password)
 {
     $examinee = Examinee::findFirst(array("number = :str:", "bind" => array("str" => $username)));
     if (!$examinee) {
         return -1;
     }
     if ($password == $examinee->password) {
         return $examinee;
     } else {
         return 0;
     }
 }
コード例 #12
0
 /**
  * @usage 个体胜任力报告生成
  * @param
  */
 public function individualCompetencyReport($examinee_id)
 {
     //check examinee_id - - - get basic info
     $data = new CompetencyData();
     $examinee_data = $data->getExamineeData($examinee_id);
     $examinee = Examinee::findFirst($examinee_id);
     $project_id = $examinee->project_id;
     $project_data = $data->getProjectAvgIndex($project_id, $examinee_data);
     \PhpOffice\PhpWord\Autoloader::register();
     $this->wordHandle = new \PhpOffice\PhpWord\PhpWord();
     //set default style
     $this->wordHandle->setDefaultFontName("Microsoft YaHei");
     $titleFontStyle = array('color' => 'blue', 'size' => 12, 'bold' => true);
     $fontStyle2 = array('color' => 'blue');
     //set table style
     $labelFontStyle = array('bold' => true, 'size' => 12);
     $labelParagraphStyle = array('alignment' => 'center');
     $valueFontStyle = array('size' => 12);
     $valuePragraphStyle = array('alignment' => 'center');
     $styleTable = array('borderSize' => 6, 'borderColor' => 'black', 'cellMargin' => 80);
     $section = $this->wordHandle->createSection();
     $table = $section->addTable($styleTable);
     $table->addRow();
     $cell1_19 = $table->addCell(1000);
     $cell1_19->getStyle()->setGridSpan(9);
     $cell1_19->addText("胜任力模型+述职、民主生活会、民主集中制、四个全面", array('color' => 'red', 'bold' => true, 'size' => 16), array('alignment' => 'center'));
     $table->addRow();
     $table->addCell(1000)->addText("姓名", $labelFontStyle, $labelParagraphStyle);
     $table->addCell(1000)->addText($examinee->name, $valueFontStyle, $valuePragraphStyle);
     $table->addCell(1000)->addText("性别", $labelFontStyle, $labelParagraphStyle);
     $table->addCell(1000)->addText($examinee->sex == 1 ? '男' : '女', $valueFontStyle, $valuePragraphStyle);
     $table->addCell(1000)->addText("年龄", $labelFontStyle, $labelParagraphStyle);
     //个体年龄取整
     $age = floor(FactorScore::calAge($examinee->birthday, $examinee->last_login));
     $table->addCell(1000)->addText($age, $valueFontStyle, $valuePragraphStyle);
     $table->addCell(1000)->addText("职位", $labelFontStyle, $labelParagraphStyle);
     $cell2_89 = $table->addCell(1000);
     $cell2_89->getStyle()->setGridSpan(2);
     $cell2_89->addText($examinee->duty, $valueFontStyle, $valuePragraphStyle);
     $table->addRow();
     $cell3_19 = $table->addCell(1000);
     $cell3_19->getStyle()->setGridSpan(9);
     $cell3_19->addText('胜任素质评分', $titleFontStyle, $labelParagraphStyle);
     $table->addRow();
     foreach ($examinee_data['advantage']['value'] as $key => $value) {
         $table->addCell(1000)->addText($value['chs_name'], $labelFontStyle, $labelParagraphStyle);
     }
     foreach ($examinee_data['disadvantage']['value'] as $key => $value) {
         $table->addCell(1000)->addText($value['chs_name'], $labelFontStyle, $labelParagraphStyle);
     }
     $table->addCell(1000)->addText('总分', $labelFontStyle, $labelParagraphStyle);
     $table->addRow();
     foreach ($examinee_data['advantage']['value'] as $key => $value) {
         $table->addCell(1000)->addText($value['score'], $valueFontStyle, $valuePragraphStyle);
     }
     foreach ($examinee_data['disadvantage']['value'] as $key => $value) {
         $table->addCell(1000)->addText($value['score'], $valueFontStyle, $valuePragraphStyle);
     }
     $table->addCell(1000)->addText($examinee_data['value'], $valueFontStyle, $valuePragraphStyle);
     $table->addRow();
     $cell6_19 = $table->addCell(1000);
     $cell6_19->getStyle()->setGridSpan(9);
     $cell6_19->addText("胜任力模型+述职", $titleFontStyle, $labelParagraphStyle);
     $table->addRow();
     $cell7_19 = $table->addCell(1000);
     $cell7_19->getStyle()->setGridSpan(9);
     //add chart
     $chart = new WordChart();
     $fileName = $chart->radarGraph_3($examinee_data, $project_data, $project_id);
     if (file_exists($fileName)) {
         $cell7_19->addImage($fileName, array('width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(9.31), 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(6.46), 'wrappingStyle' => 'square'));
     }
     $cell7_19->addText("主要优势有五点:", $titleFontStyle);
     $array1 = array('一', '二', '三', '四', '五');
     $i = 0;
     foreach ($examinee_data['advantage']['value'] as $key => $value) {
         $cell7_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell7_19->addText("有待改进有三点:", $titleFontStyle);
     $array2 = array('一', '二', '三');
     $i = 0;
     foreach ($examinee_data['disadvantage']['value'] as $key => $value) {
         $cell7_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell7_19->addText("述职报告结果:", $titleFontStyle);
     $cell7_19->addTextBreak();
     $table->addRow();
     $cell8_19 = $table->addCell(1000);
     $cell8_19->getStyle()->setGridSpan(9);
     $cell8_19->addText("胜任力模型+民主生活会", $titleFontStyle, $labelParagraphStyle);
     $table->addRow();
     $cell9_19 = $table->addCell(1000);
     $cell9_19->getStyle()->setGridSpan(9);
     if (file_exists($fileName)) {
         $cell9_19->addImage($fileName, array('width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(9.31), 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(6.46), 'wrappingStyle' => 'square'));
     }
     $cell9_19->addText("主要优势有五点:", $titleFontStyle);
     $array1 = array('一', '二', '三', '四', '五');
     $i = 0;
     foreach ($examinee_data['advantage']['value'] as $key => $value) {
         $cell9_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell9_19->addText("有待改进有三点:", $titleFontStyle);
     $array2 = array('一', '二', '三');
     $i = 0;
     foreach ($examinee_data['disadvantage']['value'] as $key => $value) {
         $cell9_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell9_19->addText("民主生活会指标描述:", $titleFontStyle);
     $cell9_19->addTextBreak();
     $table->addRow();
     $cell10_19 = $table->addCell(1000);
     $cell10_19->getStyle()->setGridSpan(9);
     $cell10_19->addText("胜任力模型+民主集中制", $titleFontStyle, $labelParagraphStyle);
     $table->addRow();
     $cell11_19 = $table->addCell(1000);
     $cell11_19->getStyle()->setGridSpan(9);
     if (file_exists($fileName)) {
         $cell11_19->addImage($fileName, array('width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(9.31), 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(6.46), 'wrappingStyle' => 'square'));
     }
     $cell11_19->addText("主要优势有五点:", $titleFontStyle);
     $array1 = array('一', '二', '三', '四', '五');
     $i = 0;
     foreach ($examinee_data['advantage']['value'] as $key => $value) {
         $cell11_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell11_19->addText("有待改进有三点:", $titleFontStyle);
     $array2 = array('一', '二', '三');
     $i = 0;
     foreach ($examinee_data['disadvantage']['value'] as $key => $value) {
         $cell11_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell11_19->addText("民主集中制指标描述:", $titleFontStyle);
     $cell11_19->addTextBreak();
     $table->addRow();
     $cell12_19 = $table->addCell(1000);
     $cell12_19->getStyle()->setGridSpan(9);
     $cell12_19->addText("胜任力模型+四个全面", $titleFontStyle, $labelParagraphStyle);
     $table->addRow();
     $cell13_19 = $table->addCell(1000);
     $cell13_19->getStyle()->setGridSpan(9);
     if (file_exists($fileName)) {
         $cell13_19->addImage($fileName, array('width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(9.31), 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(6.46), 'wrappingStyle' => 'square'));
     }
     $cell13_19->addText("主要优势有五点:", $titleFontStyle);
     $array1 = array('一', '二', '三', '四', '五');
     $i = 0;
     foreach ($examinee_data['advantage']['value'] as $key => $value) {
         $cell13_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell13_19->addText("有待改进有三点:", $titleFontStyle);
     $array2 = array('一', '二', '三');
     $i = 0;
     foreach ($examinee_data['disadvantage']['value'] as $key => $value) {
         $cell13_19->addText($array1[$i++] . "是" . $value['comment'], array('size' => 12));
     }
     $cell13_19->addText("四个全面指标描述:", $titleFontStyle);
     $cell13_19->addTextBreak();
     //命名
     //临时文件命名规范    $project_id_$date_rand(100,900)
     $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($this->wordHandle, 'Word2007');
     $date = date('H_i_s');
     $stamp = rand(100, 900);
     $fileName = './tmp/' . $examinee_id . '_' . $date . '_' . $stamp . '.docx';
     $objWriter->save($fileName);
     return $fileName;
 }
コード例 #13
0
 /**
  * @usage 个体综合报告生成
  * @param
  */
 private function getBasic($examinee_id)
 {
     //---------------------------------------------------
     // basic
     //check examinee_id;
     $report = new individualComData();
     $project_id = $report->self_check($examinee_id);
     //get basic info
     $examinee = Examinee::findFirst($examinee_id);
     //get all data
     $data = array();
     $data['name'] = $examinee->name;
     $data['sex'] = $examinee->sex == 1 ? '男' : '女';
     $data['birth'] = $examinee->birthday;
     $data['test_date'] = explode(' ', $examinee->last_login)[0];
     $json = json_decode($examinee->other, true);
     $data['school'] = '';
     $data['degree'] = '';
     if (isset($json['education'])) {
         if (isset($json['education'][0])) {
             //必须是有相应的记录项
             $data['school'] = $json['education'][0]['school'];
             $data['degree'] = $json['education'][0]['degree'];
         }
     }
     $time_str = '';
     $time = $examinee->exam_time;
     foreach (array(3600 => '小时', 60 => '分', 1 => '秒') as $key => $value) {
         if ($time >= $key) {
             $time_str .= floor($time / $key) . $value;
             $time %= $key;
         }
     }
     $data['exam_time'] = $time_str;
     $data['works'] = '';
     if (isset($json['work'])) {
         if (isset($json['work'][0])) {
             //必须是有相应的记录项
             $data['works'] = $json['work'];
         }
     }
     $data['exam_time_flag'] = array();
     if ($examinee->exam_time > 10800) {
         $data['exam_time_flag']['key'] = 1;
         $data['exam_time_flag']['value'] = '未在规定时间内完成';
     } else {
         if ($examinee->exam_time > 8400) {
             $data['exam_time_flag']['key'] = 2;
             $data['exam_time_flag']['value'] = '在规定时间内完成';
         } else {
             if ($examinee->exam_time > 5400) {
                 $data['exam_time_flag']['key'] = 3;
                 $data['exam_time_flag']['value'] = '比正常快近三分之一';
             } else {
                 $data['exam_time_flag']['key'] = 4;
                 $data['exam_time_flag']['value'] = '比正常快近二分之一';
             }
         }
     }
     $data['exam_auth_flag'] = array();
     $data['exam_auth_flag']['key'] = $report->IsHidden($examinee_id);
     $data['exam_auth_flag']['value'] = $data['exam_auth_flag']['key'] ? '真实(掩饰性系数低于平均水平)' : '不真实(掩饰性系数高于平均水平)';
     if ($data['exam_time_flag']['key'] > 1 && $data['exam_auth_flag']['key']) {
         $data['exam_evalute'] = '不仅快且准确';
     } else {
         if ($data['exam_time_flag']['key'] > 1 && !$data['exam_auth_flag']['key']) {
             $data['exam_evalute'] = '虽然快但不准确';
         } else {
             if ($data['exam_time_flag']['key'] == 1 && $data['exam_auth_flag']['key']) {
                 $data['exam_evalute'] = '虽然慢但准确';
             } else {
                 $data['exam_evalute'] = '不仅慢且不准确';
             }
         }
     }
     $tmp_systemCom = $report->getSystemComprehensive($examinee_id);
     $data['excellent_rate'] = $tmp_systemCom['value'];
     $data['excellent_evaluate_key'] = $tmp_systemCom['level'];
     switch ($data['excellent_evaluate_key']) {
         case 1:
             $data['excellent_evaluate'] = '优';
             break;
         case 2:
             $data['excellent_evaluate'] = '良';
             break;
         case 3:
             $data['excellent_evaluate'] = '中';
             break;
         case 4:
             $data['excellent_evaluate'] = '差';
             break;
     }
     $data['advantage'] = $report->getAdvantages($examinee_id);
     $data['disadvantage'] = $report->getDisadvantages($examinee_id);
     $data['com'] = $report->getindividualComprehensive($examinee_id);
     foreach ($data['com'] as $key => $value) {
         switch ($key) {
             case "心理健康":
                 $data['com'][$key]['name'] = '职业心理';
                 $data['com'][$key]['des'] = '职业心理共有七项指标';
                 break;
             case "素质结构":
                 $data['com'][$key]['name'] = '职业素质';
                 $data['com'][$key]['des'] = '职业素质共有八项指标';
                 break;
             case "智体结构":
                 $data['com'][$key]['name'] = '三商与身体';
                 $data['com'][$key]['des'] = '三商与身体共有六项指标';
                 break;
             case "能力结构":
                 $data['com'][$key]['name'] = '职业能力';
                 $data['com'][$key]['des'] = '职业能力共有七项指标';
                 break;
         }
     }
     $tmp_interview = $report->getComments($examinee_id);
     $data['remark'] = $tmp_interview['remark'];
     $data['advantages'] = $tmp_interview['advantage'];
     $data['disadvantages'] = $tmp_interview['disadvantage'];
     return $data;
 }
コード例 #14
0
 public function getotherAction($examinee_id)
 {
     $examinee = Examinee::findFirst($examinee_id);
     $this->dataBack(array("other" => $examinee->other));
 }