当前位置: 首页>>代码示例>>PHP>>正文


PHP Module::findFirst方法代码示例

本文整理汇总了PHP中Module::findFirst方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::findFirst方法的具体用法?PHP Module::findFirst怎么用?PHP Module::findFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Module的用法示例。


在下文中一共展示了Module::findFirst方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getindividualComprehensive

 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;
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:55,代码来源:ProjectData.php

示例2: getComprehensiveData

 public function getComprehensiveData($project_id)
 {
     $this->project_check($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_name_array = array("心理健康" => '职业心理', "素质结构" => '职业素质', "智体结构" => '智体结构', "能力结构" => '职业能力');
     $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('AVG(IndexAns.score) as score', 'Index.chs_name as chs_name', 'Index.id as id'))->from('Examinee')->join('IndexAns', 'IndexAns.examinee_id = Examinee.id AND Examinee.type = 0 AND Examinee.project_id = ' . $project_id)->join('Index', 'Index.id = IndexAns.index_id')->inwhere('Index.name', $children_array)->groupBy('Index.name')->orderBy('AVG(IndexAns.score) desc')->getQuery()->execute();
         $tmp = array();
         $tmp['children'] = $result_1->toArray();
         $count = count($result_1);
         $sum = 0;
         foreach ($tmp['children'] as &$svalue) {
             $sum += sprintf('%.2f', $svalue['score']);
         }
         if ($count == 0) {
             throw new Exception('系统错误-模块下属指标的数量为0');
         }
         $tmp['value'] = sprintf('%.2f', $sum / $count);
         $tmp['name'] = $module_name_array[$key];
         $tmp['name_in_table'] = $value;
         $module_array_score[] = $tmp;
     }
     return $module_array_score;
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:38,代码来源:ProjectComData.php

示例3: getmoduleAction

 public function getmoduleAction()
 {
     $manager = $this->session->get('Manager');
     if ($manager) {
         $result = array();
         $result['state'] = false;
         $result['ans'] = null;
         $project_detail = ProjectDetail::findFirst(array("project_id=?1", "bind" => array(1 => $manager->project_id)));
         if (!isset($project_detail->project_id)) {
             $this->dataReturn(array('success' => $result));
             return;
         }
         $module_name = array();
         $module_names = $project_detail->module_names;
         $module_name = explode(',', $module_names);
         if (empty($module_name)) {
             $this->dataReturn(array('success' => $result));
             return;
         }
         $ans = array();
         foreach ($module_name as $name) {
             $module = Module::findFirst(array('name=?1', 'bind' => array(1 => $name)));
             $ans[] = $module->chs_name;
         }
         $result['state'] = true;
         $result['ans'] = implode('|', $ans);
         $this->dataReturn(array("success" => $result));
         return;
     } else {
         $this->dataReturn(array('error' => "您的身份验证出错,请重新登录"));
         return;
     }
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:33,代码来源:PmController.php

示例4: getindividualComprehensive

 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;
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:27,代码来源:CheckoutData.php

示例5: getModuleDetail

 /**
  * 通过模块名称查询模块详情 $rt->children;
  */
 public static function getModuleDetail($module_name)
 {
     self::checkConnect();
     return Module::findFirst(array("name = ?1", 'bind' => array(1 => $module_name), 'hydration' => \Phalcon\Mvc\Model\Resultset\Simple::HYDRATE_ARRAYS, 'cache' => array('key' => 'module_detail_name_' . $module_name)));
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:8,代码来源:MemoryCache.php

示例6: getIndexName

 /**
  *@usage input 模块的英文名数组
  *@return 模块下属指标的集合 array
  */
 public static function getIndexName($module_names)
 {
     $index_names = array();
     foreach ($module_names as $value) {
         $module = Module::findFirst(array('name=?1', 'bind' => array(1 => $value)));
         $children_str = $module->children;
         $children_array = explode(",", $children_str);
         foreach ($children_array as $value) {
             $index_names[] = $value;
         }
     }
     return array_unique($index_names);
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:17,代码来源:PmDB.php

示例7: report

 public function report($project_id)
 {
     $data = new ProjectComData();
     $data->project_check($project_id);
     $chart = new WordChart();
     $project = Project::findFirst($project_id);
     //-----------------------------------
     \PhpOffice\PhpWord\Autoloader::register();
     $this->wordHandle = new \PhpOffice\PhpWord\PhpWord();
     // layout
     $sectionStyle = array('orientation' => 'portrait', 'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(2.2), 'marginRight' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(2.2), 'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(2.2), 'marginBottom' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(1.9), 'pageSizeW' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(21), 'pageSizeH' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(29.7), 'headerHeight' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(1), 'footerHeight' => \PhpOffice\PhpWord\Shared\Converter::cmToTwip(0.8));
     //add section
     $section = $this->wordHandle->addSection($sectionStyle);
     $section->getStyle()->setPageNumberingStart(1);
     $header = $section->addHeader();
     $header = $header->createTextrun();
     $header->addImage('reportimage/logo_2.jpg', array('marginTop' => -1, 'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToInch(1), 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(5.98), 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1.54), 'wrappingStyle' => 'square'));
     $header->addText($project->name . "总体分析报告", array('color' => 'red', 'size' => 11), array('lineHeight' => 1, 'alignment' => 'right'));
     $footer = $section->addFooter();
     $footer->addPreserveText('{PAGE}', array('size' => 10, 'color' => '000000'), array('alignment' => 'center', 'lineHeight' => 1));
     //cover part
     $paragraphStyle = array('alignment' => 'center', 'lineHeight' => 1.5);
     $defaultParagraphStyle = array('lineHeight' => 1.5);
     $captionFontStyle = array('name' => 'Microsoft YaHei', 'size' => 22, 'color' => 'red', 'bold' => true);
     $section->addTextBreak(6);
     $section->addText($project->name . "总体分析报告", $captionFontStyle, $paragraphStyle);
     $section->addPageBreak();
     //set title style---TOC
     $this->wordHandle->addTitleStyle(1, array('size' => 16, 'bold' => true), array('lineHeight' => 1.5));
     $this->wordHandle->addTitleStyle(2, array('size' => 15, 'bold' => true), array('lineHeight' => 1.5));
     $this->wordHandle->addTitleStyle(3, array('size' => 12, 'bold' => true), array('lineHeight' => 1.5));
     //catalog part
     $section->addText("目录", array('color' => 'blue', 'size' => 12), $paragraphStyle);
     $section->addTOC(array('size' => 12), \PhpOffice\PhpWord\Style\TOC::TABLEADER_LINE, 1, 3);
     $section->addPageBreak();
     $captionFontStyle2 = array('name' => 'Microsoft YaHei', 'size' => 18, 'color' => 'red', 'bold' => true);
     $section->addText($project->name . "总体分析报告", $captionFontStyle2, $paragraphStyle);
     //part1  项目背景
     $section->addTitle("一、项目背景", 1);
     //-------------------------------------------------------------------------
     $examinee = Examinee::find(array('project_id=?1 AND type = 0 ', 'bind' => array(1 => $project_id)));
     $examinee = $examinee->toArray();
     $examinee_num = count($examinee);
     //总人数
     $exam_date_start = explode(' ', $project->begintime)[0];
     //开始时间
     $exam_date_end = explode(' ', $project->endtime)[0];
     //结束时间
     $min_time = 0;
     $total_time = 0;
     $level_array = array(1 => 0, 2 => 0, 3 => 0, 4 => 0);
     foreach ($examinee as $examinee_record) {
         if ($min_time == 0 || $min_time > $examinee_record['exam_time']) {
             $min_time = $examinee_record['exam_time'];
         }
         $total_time += $examinee_record['exam_time'];
         $level = ReportData::getLevel($examinee_record['id']);
         $level_array[$level]++;
     }
     $min_time_str = null;
     foreach (array(3600 => '小时', 60 => '分', 1 => '秒') as $key => $value) {
         if ($min_time >= $key) {
             $min_time_str .= floor($min_time / $key) . $value;
             $min_time %= $key;
         }
     }
     //最短答题时间
     $average_time = $total_time / $examinee_num;
     $average_time_str = null;
     foreach (array(3600 => '小时', 60 => '分', 1 => '秒') as $key => $value) {
         if ($average_time >= $key) {
             $average_time_str .= floor($average_time / $key) . $value;
             $average_time %= $key;
         }
     }
     //平均答题时间
     $rate_1 = sprintf('%.2f', $level_array[1] / $examinee_num) * 100 . '%';
     //优秀率
     $rate_2 = sprintf('%.2f', $level_array[2] / $examinee_num) * 100 . '%';
     //良好率
     $rate_3 = sprintf('%.2f', $level_array[3] / $examinee_num) * 100 . '%';
     //中等率
     //	---------------------------------------------------------
     $section->addText("    为了充分开发中青年人才资源,了解中青年人才水平、培养有潜力人才及科技骨干、选拔一批经验丰富,德才兼备的中青年高技能人才,北京XXX集团(后简称“集团”),采用第三方北京技术交流培训中心(以下简称“中心”)自主研发26年,通过上下、左右、前后六维(简称“6+1”)测评技术,对集团" . $examinee_num . "名中青年人才进行了一次有针对性的测评。从" . $exam_date_start . "到" . $exam_date_end . ",在集团培训中心进行上机测试。规定测评时间为3小时,最短完成时间为" . $min_time_str . ",一般为" . $average_time_str . "左右。 ", $defaultParagraphStyle);
     $section->addText("    测评后进行专家(四位局级以上领导干部)与中青年人才一对一人均半小时的沟通(简称“面询”), 这是区别国内所有综合测评机构的独有特色。面询内容有三:一是根据测评结果按优劣势分析归纳与评价;二是双方互动理解与确认测评结果;三是现场解答每位人才提出的问题,并给予针对性、个性化的解决方案与建议。", $defaultParagraphStyle);
     $section->addText("    通过对" . $examinee_num . "位中青年人才综合统计分析,按优良中差排序结果为:全体优秀率达" . $rate_1 . ",良好" . $rate_2 . "。在测评和专家面询后,对全部人才进行了无记名的满意度调查,参加调查83人,回收有效问卷83份,有效率100%,满意度100%。(满意度调查报告详见附件1) ", $defaultParagraphStyle);
     $section->addTitle("1、测评目的", 2);
     $section->addTitle("第一、为中青年人才培训提供科学参考依据", 3);
     $section->addText("    在传统的人事管理信息系统中,人与人之间的差别只体现在性别、年龄、职务、工种、学历、职称、工作经历上,而却忽略了内隐素质能力上的差异。综合测评可以帮助集团领导了解中青年人才更多重要的信息,为个性化培养与培训提供科学、准确的依据。在对人才进行精准识别后,还进行了人岗匹配,针对岗位胜任程度和潜质提出了使用与培养的建议。通过本次测评,清晰了集团中青年人才职业心理、职业素质、智体结构、职业能力和发展潜质,为集团下一步的培训工作提供了科学、客观、准确的依据。", $defaultParagraphStyle);
     $section->addTitle("第二、为中青年人才提供自我认知和自我提升的工具", 3);
     $section->addText("    通过综合测评,帮助了这些人才全面、系统、客观、准确了解自我;通过结合岗位职责一对一面询,让这些人才更加明确自身优势与劣势;清晰哪些技能和素质需要进一步培训,在实际工作中扬长避短,促进自我职业生涯与集团战略的有机结合。", $defaultParagraphStyle);
     $section->addTitle("2、测评流程", 2);
     $section->addText("    综合测评分为五个阶段:", $defaultParagraphStyle);
     $section->addText("    一是测评前准备。这一阶段确定测试人才的人数、测评时间、测评内容、测评群体的总体情况;收集测评人才简历;编制测评总体需求量表。", $defaultParagraphStyle);
     $section->addText("    二是人机对话测评。通过“6+1”系统综合测评,人均获取近1000个定性与定量数据,经过数据处理与统计分析,为专家面询提供科学、准确、客观、真实的测评结果。", $defaultParagraphStyle);
     $section->addText("    三是专家面询。这一过程人均半小时,目的是让有较高领导岗位经历和复合学科背景的专家依据测评结果,与中青年人才一对一的互动沟通:首先,帮他们清晰自己的优劣势;其次,为他们排忧解惑;最后,为每位中青年人才梳理出与集团发展匹配的对策。", $defaultParagraphStyle);
     $section->addText("    四是撰写总体与个体报告。依据对“6+1”大数据分析结果撰写总体综合素质分析报告;整合个人测评结果和专家面询评价,撰写每位人才的综合测评分析报告。", $defaultParagraphStyle);
     $section->addText("    五是汇报与反馈。向集团领导汇报总体与个体测评结果,反馈无记名满意度调查报告等,针对集团发展战略和现代人力资源管理提出针对性的建议与对策。", $defaultParagraphStyle);
     $section->addTitle("3、技术路径", 2);
     $section->addText("    “中心”的综合测评系统始于1988年博士研究成果,经历了26年实践检验,其过程(1)测评地域:北京、上海、天津、广东、山西、湖南、湖北、陕西、内蒙、海南、浙江、山东、辽宁、河南等省市;(2)年龄:20~68岁;(3)学历:大专~博士后;(4)职称:初级~两院士;(5)职务:初、中级~政府副部长、部队中将(陆海空);(6)类型:跨国公司高管、各类企业高管与技术人才;(7)测评人数:3万多人;(8)测评数据:每人925个;(9)获得荣誉:7次获国家自然科学基金资助,2次获航空科学基金资助,4次获省部级科学技术进步二等奖和管理成果一等奖;在国内外核心刊物发表论文30多篇,专著一本;测评软件50多套;培养出3名博士、9名硕士;经调查,客户反映测评准确率高、效果明显,平均满意度达97.8%,受到被测评人才和用人单位的普遍欢迎和认可。", $defaultParagraphStyle);
//.........这里部分代码省略.........
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:101,代码来源:ProjectComExport.php

示例8: getindividualComprehensive

 public function getindividualComprehensive($examinee_id)
 {
     $project_id = $this->self_check($examinee_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 name'))->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();
         $result_2 = $this->modelsManager->createBuilder()->columns(array('AVG(IndexAns.score) as avg'))->from('Index')->inwhere('Index.name', $children_array)->join('IndexAns', 'IndexAns.index_id = Index.id AND IndexAns.examinee_id = ' . $examinee_id)->getQuery()->execute();
         $result_2 = $result_2->toArray();
         $module_array_score[$key][] = sprintf('%.2f', $result_2[0]['avg']);
         $result_1 = $result_1->toArray();
         $module_array_score[$key][] = array_splice($result_1, 0, 3);
     }
     return $module_array_score;
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:26,代码来源:individualComData.php


注:本文中的Module::findFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。