Ejemplo n.º 1
0
 /**
  * Creates the form for the Polskala templates
  * @param
  */
 function createTemplateFormFree(&$question)
 {
     global $evalID;
     $answer = $question->getNextChild();
     $tableA = new HTM("table");
     $tableA->attr("border", "0");
     $tableA->attr("cellpadding", "2");
     $tableA->attr("cellspacing", "0");
     $tableA->attr("width", "100%");
     $trA = new HTM("tr");
     $tdA = new HTM("td");
     $tdA->attr("class", "table_header_bold");
     $tdA->attr("align", "left");
     $tdA->html("<b>" . (strstr($this->getPageCommand(), "create") ? _("Freitextvorlage erstellen") : _("Freitextvorlage bearbeiten")) . "</b>");
     $trA->cont($tdA);
     $tableA->cont($trA);
     $trA = new HTM("tr");
     $tdA = new HTM("td");
     $form = new HTM("form");
     $form->attr("action", URLHelper::getLink("?page=edit&evalID=" . $evalID));
     $form->attr("method", "post");
     $form->html(CSRFProtection::tokenTag());
     $b = new HTM("b");
     $b->cont(_("Name") . ": ");
     $form->cont($b);
     $input = new HTMpty("input");
     $input->attr("type", "text");
     $input->attr("name", "template_name");
     $name = $question->getText();
     $input->attr("value", $question->getText());
     //    $input->attr( "value", $name );
     $input->attr("style", "vertical-align:middle;");
     $input->attr("size", 22);
     $input->attr("maxlength", 22);
     $form->cont($input);
     $input = new HTMpty("input");
     $input->attr("type", "hidden");
     $input->attr("name", "template_id");
     $input->attr("value", $question->getObjectID());
     $form->cont($input);
     $input = new HTMpty("input");
     $input->attr("type", "hidden");
     $input->attr("name", "template_type");
     $input->attr("value", $question->getType());
     $form->cont($input);
     $input = new HTMpty("input");
     $input->attr("type", "hidden");
     $input->attr("name", "template_multiple");
     $input->attr("value", NO);
     $form->cont($input);
     $img = new HTMpty("img");
     $img->attr("src", Icon::create('info-circle', 'inactive')->asImagePath(16));
     $img->attr("class", "middle");
     $img->stri(tooltip(_("Geben Sie hier einen Namen für Ihre Vorlage ein. Ändern Sie den Namen, um eine neue Vorlage anzulegen."), FALSE, TRUE));
     $form->cont($img);
     $form->cont($this->BR);
     //$answer = $question->getNextChild();
     //$answer->toString();
     /* Anzahl Zeilen------------------------------------------------------ */
     $form->cont($this->createSubHeadline(_("Anzahl Zeilen") . ": "));
     $select = new HTM("select");
     $select->attr("name", "template_add_num_answers");
     $select->attr("size", "1");
     $select->attr("style", "vertical-align:middle;");
     for ($i = 1; $i <= 25; $i++) {
         $option = new HTM("option");
         $option->attr("value", $i);
         $option->cont($i);
         if ($i == $answer->getRows()) {
             $option->addAttr("selected", "selected");
         }
         $select->cont($option);
     }
     $form->cont($select);
     $form->cont($this->BR);
     /* uebernehmen / loeschen Button ---------------------------- */
     $input = Button::create(_('Übernehmen'), 'template_savefree_button');
     $odb = new EvaluationObjectDB();
     //if($odb->getGlobalPerm()=="root"){
     //  $myuserid = 0;
     //}
     //else{
     //   $myuserid = $user->id;
     //}
     //if($question->getParentID()==$myuserid){
     //   $loesch=1;
     if (!strstr($this->command, "create")) {
         $showDelete = YES;
         $input2 = Button::createAccept(_('Löschen'), 'template_delete_button');
     }
     $table = new HTM("table");
     $table->attr("border", "0");
     $table->attr("align", "center");
     $table->attr("cellspacing", "0");
     $table->attr("cellpadding", "3");
     $table->attr("width", "100%");
     $tr = new HTM("tr");
     $td = new HTM("td");
     $td->attr("class", "content_body");
     $td->attr("align", "center");
     $td->cont($input);
     $tr->cont($td);
     if ($showDelete) {
         $td = new HTM("td");
         $td->attr("class", "content_body");
         $td->attr("align", "center");
         $td->cont($input2);
         $tr->cont($td);
     }
     $table->cont($tr);
     $form->cont($table);
     $tdA->cont($form);
     $trA->cont($tdA);
     $tableA->cont($trA);
     return $tableA;
 }