Esempio n. 1
0
 public function update($args)
 {
     parent::update($args);
     $this->choices = array();
     foreach ($args['choices'] as $val) {
         if (trim($val) || trim($val) == '0') {
             $this->choices[] = $val;
         }
     }
 }
Esempio n. 2
0
 /**
  * Writes the surveys questions to the database.
  * 
  * @since 0.1
  * 
  * @return boolean Success indicator
  */
 public function writeQuestionsToDB()
 {
     $success = true;
     $dbw = wfGetDB(DB_MASTER);
     $dbw->begin();
     SurveyQuestion::update(array('removed' => 1), array('survey_id' => $this->getId()));
     foreach ($this->questions as $question) {
         $question->setField('survey_id', $this->getId());
         $success = $question->writeToDB() && $success;
     }
     $dbw->commit();
     return $success;
 }