/**
 * Saves a SurveyMultipleChoiceQuestion object to a database
 *
 * @access public
 */
 function saveToDb($original_id = "")
 {
     global $ilDB;
     $affectedRows = parent::saveToDb($original_id);
     if ($affectedRows == 1) {
         $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s", array('integer'), array($this->getId()));
         $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, orientation, use_min_answers, nr_min_answers, nr_max_answers) VALUES (%s, %s, %s, %s, %s)", array('integer', 'text', 'integer', 'integer', 'integer'), array($this->getId(), $this->getOrientation(), $this->use_min_answers ? 1 : 0, $this->nr_min_answers > 0 ? $this->nr_min_answers : null, $this->nr_max_answers > 0 ? $this->nr_max_answers : null));
         // saving material uris in the database
         $this->saveMaterial();
         $this->saveCategoriesToDb();
     }
 }
 /**
 * Saves a SurveyMetricQuestion object to a database
 *
 * @access public
 */
 function saveToDb($original_id = "")
 {
     global $ilDB;
     $affectedRows = parent::saveToDb($original_id);
     if ($affectedRows == 1) {
         $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s", array('integer'), array($this->getId()));
         $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, subtype) VALUES (%s, %s)", array('integer', 'text'), array($this->getId(), $this->getSubType()));
         // saving material uris in the database
         $this->saveMaterial();
         // save categories
         $affectedRows = $ilDB->manipulateF("DELETE FROM svy_variable WHERE question_fi = %s", array('integer'), array($this->getId()));
         if (preg_match("/[\\D]/", $this->maximum) or strcmp($this->maximum, "∞") == 0) {
             $max = -1;
         } else {
             $max = $this->getMaximum();
         }
         $next_id = $ilDB->nextId('svy_variable');
         $affectedRows = $ilDB->manipulateF("INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, value2, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)", array('integer', 'integer', 'integer', 'float', 'float', 'integer', 'integer'), array($next_id, 0, $this->getId(), $this->getMinimum(), $max, 0, time()));
     }
 }
 /**
 * Saves a SurveyMatrixQuestion object to a database
 *
 * @access public
 */
 function saveToDb($original_id = NULL, $withanswers = true)
 {
     global $ilDB;
     $affectedRows = parent::saveToDb($original_id);
     if ($affectedRows == 1) {
         $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s", array('integer'), array($this->getId()));
         $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (\n\t\t\t\tquestion_fi, subtype, column_separators, row_separators, neutral_column_separator,column_placeholders,\n\t\t\t\tlegend, singleline_row_caption, repeat_column_header, column_header_position, random_rows,\n\t\t\t\tcolumn_order, column_images, row_images, bipolar_adjective1, bipolar_adjective2, layout, tstamp)\n\t\t\t\tVALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", array('integer', 'integer', 'text', 'text', 'text', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer'), array($this->getId(), $this->getSubtype(), $this->getColumnSeparators(), $this->getRowSeparators(), $this->getNeutralColumnSeparator(), $this->getColumnPlaceholders(), $this->getLegend(), $this->getSingleLineRowCaption(), $this->getRepeatColumnHeader(), $this->getColumnHeaderPosition(), $this->getRandomRows(), $this->getColumnOrder(), $this->getColumnImages(), $this->getRowImages(), $this->getBipolarAdjective(0), $this->getBipolarAdjective(1), serialize($this->getLayout()), time()));
         // saving material uris in the database
         $this->saveMaterial();
         $this->saveColumnsToDb();
         $this->saveRowsToDb();
     }
 }
 /**
 * Saves a SurveyTextQuestion object to a database
 *
 * @access public
 */
 function saveToDb($original_id = "")
 {
     global $ilDB;
     $affectedRows = parent::saveToDb($original_id);
     if ($affectedRows == 1) {
         $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s", array('integer'), array($this->getId()));
         $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, maxchars, width, height) VALUES (%s, %s, %s, %s)", array('integer', 'integer', 'integer', 'integer'), array($this->getId(), $this->getMaxChars(), $this->getTextWidth(), $this->getTextHeight()));
         $this->saveMaterial();
     }
 }
 /**
 * Saves a SurveySingleChoiceQuestion object to a database
 *
 * @access public
 */
 function saveToDb($original_id = "")
 {
     global $ilDB;
     $affectedRows = parent::saveToDb($original_id);
     if ($affectedRows == 1) {
         $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s", array('integer'), array($this->getId()));
         $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, orientation) VALUES (%s, %s)", array('integer', 'text'), array($this->getId(), $this->getOrientation()));
         $this->saveMaterial();
         $this->saveCategoriesToDb();
     }
 }