Ejemplo n.º 1
0
 /**
  * Update table template
  */
 function updateTemplateObject($a_refresh = false)
 {
     global $tpl, $ilCtrl, $lng;
     $ilCtrl->setParameter($this, "t_id", $_GET["t_id"]);
     $this->initTemplateForm("edit");
     if ($this->form_gui->checkInput()) {
         if ($this->object->templateExists($_POST["name"]) && $_POST["name"] != ilObjStyleSheet::lookupTemplateName($_GET["t_id"])) {
             $name_input = $this->form_gui->getItemByPostVar("name");
             $name_input->setAlert($lng->txt("sty_template_already_exists"));
         } else {
             $classes = array();
             foreach (ilObjStyleSheet::_getTemplateClassTypes($_GET["temp_type"]) as $tct => $ct) {
                 $classes[$tct] = $_POST[$tct . "_class"];
             }
             $this->object->updateTemplate($_GET["t_id"], $_POST["name"], $classes);
             $this->object->writeTemplatePreview($_GET["t_id"], $this->getTemplatePreview($_GET["temp_type"], $_GET["t_id"], true));
             if (!$a_refresh) {
                 $ilCtrl->redirect($this, "listTemplates");
             }
         }
     }
     $this->form_gui->setValuesByPost();
     $this->displayTemplateEditForm();
 }