Example #1
0
 function write()
 {
     $write = '$' . $this->getName() . ' = new Template(';
     $write .= '\'' . $this->getName() . '\', ';
     $write .= array_search($this->getType(), returnConstants("TEMPLATE_")) . ', ';
     $write .= '\'' . addcslashes($this->getLocation(), '\'') . '\', ';
     $write .= arrayToString($this->content);
     //        $write .= arrayToString($this->getContent());
     //        $write .= '\'' . addcslashes($this->getContent(), '\'') . '\'';
     $write .= ');';
     return $write;
 }
Example #2
0
 function showTemplateEdit($template)
 {
     echo '<div class="well" style="background: white;">';
     echo '<form method=post>';
     echo '<input type=hidden name=page value="survey.section.template.save">';
     echo '<table style="border-spacing: 5px; border-collapse: separate;">';
     echo '<tr><td width=100px>Name</td><td><input type=text class="form-control" name="name" value="' . $template->getName() . '"></td></tr>';
     echo '<tr><td width=100px>Type</td><td>';
     echo '<select name="type" class="form-control">';
     foreach (returnConstants("TEMPLATE_") as $constant => $key) {
         $selected = $key == $template->getType() ? ' SELECTED' : '';
         echo '<option value="' . $key . '"' . $selected . '>' . $constant . '</option>';
     }
     echo '</select>';
     echo '</td></tr>';
     echo '<tr><td width=100px>Location</td><td><input type=text class="form-control" name="location" value="' . $template->getLocation() . '"></td></tr>';
     echo '<tr><td valign=top>Content</td><td><textarea name="content" class="form-control" cols=50 rows=4>' . $template->getContent() . '</textarea></td></tr>';
     echo '</table>';
     echo $this->displayWhenWritable(prependPath($this->survey->getTemplatesLocation()), '<input type=submit class="btn btn-default">', 'templates');
     echo '</form>';
 }
Example #3
0
 function write()
 {
     global $survey;
     $write = '$' . $this->getName() . ' = new Type(';
     $write .= '\'' . $this->getName() . '\', ';
     $write .= array_search($this->getAnswerType(), returnConstants("QUESTION_TYPE_")) . ', ';
     $write .= $this->writeDetails();
     //$write .= '\'' . addcslashes($this->getContent(), '\'') . '\'';
     $write .= ');' . "\n";
     $write .= '$' . $this->getName() . '->setTemplate($' . $this->getTemplate()->getName() . ');' . "\n";
     if ($this->ShowDKButton() != $survey->ShowDKButton()) {
         //different than survey: write!
         $write .= '$' . $this->getName() . '->setShowDKButton(' . var_export($this->showDKButton(), true) . ');' . "\n";
     }
     if ($this->ShowRFButton() != $survey->ShowRFButton()) {
         //different than survey: write!
         $write .= '$' . $this->getName() . '->setShowRFButton(' . var_export($this->showRFButton(), true) . ');' . "\n";
     }
     if ($this->getInputWidth() != TYPE_STANDARD_WIDTH) {
         $write .= '$' . $this->getName() . '->setInputWidth(\'' . $this->getInputWidth() . '\');' . "\n";
     }
     if ($this->getInputHeight() != TYPE_STANDARD_HEIGHT) {
         $write .= '$' . $this->getName() . '->setInputHeight(\'' . $this->getInputHeight() . '\');' . "\n";
     }
     if ($this->getValidationOption() != $survey->getValidationOption()) {
         $write .= '$' . $this->getName() . '->setValidationOption(' . array_search($this->getValidationOption(), returnConstants("VALIDATION_OPTION_")) . ');' . "\n";
     }
     return $write;
 }