Пример #1
0
 /**
  * Render form controls for a date question
  *
  * @param  ModelQuestionModel question being rendered
  * @return string
  */
 public function renderDate(ModelQuestionModel $question)
 {
     $name = "response[{$question->questionID}][target]";
     $value = $question->hasModelResponse() ? $question->nextModelResponse()->target : null;
     return $this->view->formText($name, $value, array('class' => 'calendarText', 'size' => 13, 'readonly' => 1)) . $this->view->linkTo('#showCalendar', $this->view->imageTag('icons/calendar.png', array('id' => "c{$question->questionID}", 'class' => 'calendarButton', 'title' => 'calendar')));
 }
Пример #2
0
 /**
  * Save action.  Save a model.
  */
 public function saveAction()
 {
     // don't really need this but it should help with query caching efficiency
     $page = new ModelPageModel(array('modelID' => $this->model->modelID, 'pageID' => $this->view->currentPageID, 'depth' => 'response'));
     $responses = $this->_getParam('response');
     foreach ($responses as $questionID => $response) {
         $question = new ModelQuestionModel(array('modelID' => $this->model->modelID, 'questionID' => $questionID, 'depth' => 'response'));
         if ($question->nextModelResponse() !== null) {
             $question->delete();
         }
         if (!$this->isBlank($response)) {
             if ($response['noinclude']) {
                 $question->createModelResponse('no preference', '-');
             } else {
                 if ($response['target']) {
                     $this->setModelResponse($question, $response['target']);
                 }
                 if ($response['remediationInfoMod'] == 1) {
                     $question->createModelResponse('remediation info', -1, $response['remediationInfo']);
                 }
                 if ($response['requireAttachment'] == 1) {
                     $question->createModelResponse('require attachment', -1);
                 }
             }
         }
     }
     $this->flash('notice', 'Model saved successfully');
     $this->_redirector->gotoUrl("/compare/edit/{$this->model->modelID}?page={$page->pageID}");
 }