本文整理汇总了PHP中Evaluation::form方法的典型用法代码示例。如果您正苦于以下问题:PHP Evaluation::form方法的具体用法?PHP Evaluation::form怎么用?PHP Evaluation::form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evaluation
的用法示例。
在下文中一共展示了Evaluation::form方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* Handles the evaluation for an event. Shows the user the evaluation and
* saves the data from the evaluation.
*
*/
public function indexAction()
{
$get = Zend_Registry::get('getFilter');
if (!isset($get->eventId)) {
throw new Ot_Exception_Input('msg-error-eventIdNotSet');
}
$event = new Event();
$eu = new Evaluation_User();
$evaluation = new Evaluation();
$thisEvent = $event->find($get->eventId);
if (is_null($thisEvent)) {
throw new Ot_Exception_Data('msg-error-noEvent');
}
$this->view->event = $thisEvent->toArray();
$thisAccount = Zend_Auth::getInstance()->getIdentity();
$status = $event->getStatusOfUserForEvent($thisAccount->accountId, $thisEvent->eventId);
if ($status == "instructor") {
throw new Ot_Exception_Access('msg-error-cannotEval');
}
if ($status != "attending") {
throw new Ot_Exception_Access('msg-error-notAttended');
}
$config = Zend_Registry::get('config');
$endDt = strtotime($thisEvent->date . " " . $thisEvent->endTime);
if (time() > $endDt + $config->user->numHoursEvaluationAvailability->val * 3600) {
throw new Ot_Exception_Access('msg-error-evalEnded');
}
if ($eu->hasCompleted($thisAccount->accountId, $thisEvent->eventId)) {
throw new Ot_Exception_Access('msg-error-alreadyEval');
}
$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();
$instructor = new Event_Instructor();
$instructors = $instructor->getInstructorsForEvent($thisEvent->eventId);
$inst = array();
foreach ($instructors as $i) {
$inst[] = $i['firstName'] . ' ' . $i['lastName'];
}
$this->view->instructors = $inst;
// lookup the location of the event
$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();
if ($thisEvent->evaluationType == 'custom') {
$form = $evaluation->form();
$this->view->form = $form;
}
if ($this->_request->isPost()) {
if ($thisEvent->evaluationType == 'custom') {
if ($form->isValid($_POST)) {
$custom = new Ot_Custom();
$attributes = $custom->getAttributesForObject('evaluations');
$data = array();
foreach ($attributes as $a) {
$data[$a['attributeId']] = is_null($form->getValue('custom_' . $a['attributeId'])) ? '' : $form->getValue('custom_' . $a['attributeId']);
}
// custom attributes is the custom array that will be save by the CustomAttributes model
$evaluation->saveEvaluation($thisEvent->eventId, $thisAccount->accountId, $data);
$this->_helper->flashMessenger->addMessage('msg-info-evalThanks');
$this->_redirect('/');
}
} elseif ($thisEvent->evaluationType == 'google' && isset($_POST['googleSubmit'])) {
$eu = new Evaluation_User();
$dba = $eu->getAdapter();
$dba->beginTransaction();
$data = array('eventId' => $get->eventId, 'accountId' => $thisAccount->accountId);
try {
$eu->insert($data);
} catch (Exception $e) {
$dba->rollBack();
throw $e;
}
$dba->commit();
$this->_helper->flashMessenger->addMessage('msg-info-evalThanks');
$this->_redirect('/');
}
}
if ($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->_helper->pageTitle('workshop-evaluate-index:title');
}