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


PHP Gender::find方法代码示例

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


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

示例1: getChartData

 public function getChartData()
 {
     $testId = Input::get('test');
     $startDate = date('Y-m-d', strtotime(Input::get('startDate')));
     $endDate = date('Y-m-d', strtotime(Input::get('endDate') . ' + 1 days'));
     $sportId = Input::get("sport");
     $genderId = Input::get("gender");
     $filteredTests = $this->getFilteredTests($testId, $startDate, $endDate, $sportId, $genderId);
     $test = $filteredTests['test'];
     $answeredTests = $filteredTests['answeredTests'];
     $ranges = $test->scales[0]->ranges;
     $scales = $test->scales;
     $responseData = array('cols' => array(), 'rows' => array());
     // Inserción de columnas
     $responseData['cols'][] = $this->createColumn('Escalas', 'string');
     $ranges = $test->scales[0]->ranges;
     foreach ($ranges as $range) {
         $label = 'Deportistas en: ' . $range->description . ' (' . $range->min . ', ' . $range->max . ')';
         $responseData['cols'][] = $this->createColumn($label, 'number');
     }
     // Preparación de datos de renglones
     $scalesResults = array();
     foreach ($scales as $scale) {
         $rangesValues = array();
         for ($i = 0; $i < $ranges->count(); $i++) {
             $rangesValues[] = 0;
         }
         $scalesResults[$scale->description] = $rangesValues;
     }
     // Cálculo de valores
     foreach ($answeredTests as $answeredTest) {
         $resultsByScale = $this->getResultsByScale($scales, $answeredTest->userAnswers);
         foreach ($resultsByScale as $resultByScale) {
             $scale = $resultByScale['scale'];
             $result = $resultByScale['result'];
             $rangeIndex = $this->getRangeIndex($ranges, $result);
             $scalesResults[$scale->description][$rangeIndex]++;
         }
     }
     // Inserción de renglones
     foreach ($scalesResults as $scaleName => $results) {
         $row = array();
         $row[] = $scaleName;
         foreach ($results as $result) {
             $row[] = $result;
         }
         $responseData['rows'][] = $this->createRow($row);
     }
     // Preparar encabezado y subtítulos
     $title = $test->name;
     $date = 'De ' . Input::get('startDate') . ' a ' . Input::get('endDate');
     $sport;
     $gender;
     if ($sportId != -1) {
         $sport = ' Deporte: ' . Sport::find($sportId)->description;
     } else {
         $sport = ' Deporte: Sin Especificar';
     }
     if ($genderId != -1) {
         $gender = ' Género: ' . Gender::find($genderId)->description;
     } else {
         $gender = ' Género: Sin Especificar';
     }
     return array('title' => $title, 'date' => $date, 'sport' => $sport, 'gender' => $gender, 'table' => $responseData);
 }
开发者ID:ebuzz,项目名称:SAPE_CAR,代码行数:65,代码来源:ResultsController.php


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