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


PHP Evaluation::fetchAll方法代码示例

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


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

示例1: profileAction

 public function profileAction()
 {
     $username = $this->_getParam('username');
     if (!empty($username)) {
         $db = Zend_Db_Table::getDefaultAdapter();
         $this->view->user = $db->fetchRow($db->quoteInto("SELECT username, first_name, last_name, CONVERT(licence, UNSIGNED) licence, CONVERT(own_car, UNSIGNED) own_car FROM User WHERE username = ?", $username));
         require_once APPLICATION_PATH . "/model/Evaluation.php";
         $eval = new Evaluation();
         $this->view->evaluations = $eval->fetchAll($eval->select()->from($eval, array('date', 'rating', 'motivation', 'evaluator'))->where('evaluated_user = ?', $username))->toArray();
     }
     $this->view->evaluationInserted = $this->_getParam('evaluationInserted');
 }
开发者ID:Kjir,项目名称:carpond,代码行数:12,代码来源:UserController.php

示例2: evaluationResultsAction

 /**
  * Displays the results of an evaluation as long as the user requesting the
  * page is an instructor of the event.
  *
  */
 public function evaluationResultsAction()
 {
     $get = Zend_Registry::get('getFilter');
     if (!isset($get->eventId)) {
         throw new Ot_Exception_Input('msg-error-eventIdNotSet');
     }
     $event = new Event();
     $thisEvent = $event->find($get->eventId);
     if (is_null($thisEvent)) {
         throw new Ot_Exception_Data('msg-error-noEvent');
     }
     $this->view->event = $thisEvent->toArray();
     $workshop = new Workshop();
     $thisWorkshop = $workshop->find($thisEvent->workshopId);
     if (is_null($thisWorkshop)) {
         throw new Ot_Exception_Data('msg-error-noWorkshop');
     }
     $this->view->workshop = $thisWorkshop->toArray();
     $location = new Location();
     $thisLocation = $location->find($thisEvent->locationId);
     if (is_null($thisLocation)) {
         throw new Ot_Exception_Data('msg-error-noLocation');
     }
     $this->view->location = $thisLocation->toArray();
     $instructor = new Event_Instructor();
     $instructors = $instructor->getInstructorsForEvent($thisEvent->eventId);
     $instructorList = array();
     foreach ($instructors as $i) {
         $instructorList[] = $i['firstName'] . ' ' . $i['lastName'];
     }
     $this->view->instructors = $instructorList;
     $this->_checkValidViewer($instructors);
     if ($thisEvent['evaluationType'] == 'custom') {
         // get the evaluationId from the eventId
         $evaluation = new Evaluation();
         $where = $evaluation->getAdapter()->quoteInto('eventId = ?', $thisEvent->eventId);
         $evaluations = $evaluation->fetchAll($where);
         if ($evaluations->count() == 0) {
             $this->view->noEvaluationsYet = true;
         }
         $this->view->totalEvaluations = $evaluations->count();
         $ca = new Ot_Custom();
         $questions = $ca->getAttributesForObject('evaluations');
         foreach ($questions as &$q) {
             $q['options'] = $ca->convertOptionsToArray($q['options']);
             $answers = array();
             foreach ($evaluations as $e) {
                 $tmpAnswers = $ca->getData($q['objectId'], $e->evaluationId);
                 $tmp = array();
                 foreach ($tmpAnswers as $ta) {
                     $tmp[$ta['attribute']['attributeId']] = $ta['value'];
                 }
                 $answers[] = $tmp;
             }
             if ($q['type'] == 'ranking' || $q['type'] == 'select' || $q['type'] == 'radio') {
                 foreach ($q['options'] as $value) {
                     $answerCount = 0;
                     foreach ($answers as $a) {
                         if ($a[$q['attributeId']] == $value) {
                             $answerCount++;
                         }
                     }
                     $q['results'][] = array('answerLabel' => $value, 'answerCount' => $answerCount);
                 }
             } else {
                 foreach ($answers as $a) {
                     $q['results'][] = $a[$q['attributeId']];
                 }
             }
         }
         $this->view->evaluationResults = $questions;
     } elseif ($thisEvent['evaluationType'] == 'google') {
         $evaluationKeys = new Evaluation_Key();
         $keys = $evaluationKeys->find($get->eventId);
         if (is_null($keys)) {
             throw new Ot_Exception_Data('msg-error-noFormKey');
         }
         $this->view->keys = $keys->toArray();
     }
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/jquery.gchart.min.js');
 }
开发者ID:ncsuwebdev,项目名称:classmate,代码行数:86,代码来源:InstructorController.php


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