public function addFeedbackQuestion($attr) { if (is_array($attr)) { $model = new FeedbackQuestion(); $model->setAttributes($attr); if ($model->save(FALSE)) { return TRUE; } } return FALSE; }
public function addQuestionFeedback($attr) { if (is_array($attr)) { $model = new FeedbackQuestion(); $model->created_at = time(); $model->updated_at = time(); $model->setAttributes($attr); if ($model->save(FALSE)) { return TRUE; } } return FALSE; }
public function getQuestions() { if ($this->questions == null) { $criteria = new CDBCriteria(); $criteria->compare('eventId', $this->eventId); $criteria->order = 'position ASC'; $questionData = FeedbackQuestion::model()->findAll($criteria); $questions = array(); foreach ($questionData as $question) { $questions[$question['id']] = array('id' => $question['id'], 'question' => $question['question'], 'controls' => $this->parseControls($question['controls'], $question['id'])); } $this->questions = $questions; } return $this->questions; }
<?php echo $form->labelEx($model, 'phone'); ?> <?php echo $form->textField($model, 'phone', array('placeHolder' => $model->getAttributeLabel('phone'))); ?> <?php echo $form->error($model, 'phone'); ?> </div> <div class="fa_form-row select-wrap"> <?php echo $form->labelEx($model, 'question_id'); ?> <?php echo $form->dropDownList($model, 'question_id', CHtml::listData(array(-1 => array('id' => null)) + FeedbackQuestion::items(), 'id', 'value')); ?> <?php echo $form->error($model, 'question_id'); ?> </div> <div class="fa_form-row"> <?php echo $form->labelEx($model, 'text'); ?> <?php echo $form->textArea($model, 'text', array('placeHolder' => $model->getAttributeLabel('text'))); ?> <?php echo $form->error($model, 'text'); ?>
public function loadModel($id) { $model = FeedbackQuestion::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'Запись не найдена.'); } return $model; }