36 require_once
"./classes/class.ilObjectGUI.php";
37 require_once
"./Services/Style/classes/class.ilObjStyleSheet.php";
56 $this->lng->loadLanguageModule(
"style");
59 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
67 $next_class = $this->ctrl->getNextClass($this);
68 $cmd = $this->ctrl->getCmd(
"edit");
101 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"sty_create_new_stylesheet"));
103 $this->tpl->setVariable(
"TXT_STYLE_BY_IMPORT", $this->lng->txt(
"sty_import_stylesheet"));
104 $this->tpl->setVariable(
"TXT_STYLE_BY_COPY", $this->lng->txt(
"sty_copy_other_stylesheet"));
105 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"import_file"));
106 $this->tpl->setVariable(
"TXT_SOURCE", $this->lng->txt(
"sty_source"));
107 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
108 $this->tpl->setVariable(
"TXT_DESC", $this->lng->txt(
"description"));
110 $this->ctrl->setParameter($this,
"new_type",
"sty");
111 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
112 $this->tpl->setVariable(
"TXT_SAVE", $this->lng->txt(
"save"));
113 $this->tpl->setVariable(
"TXT_IMPORT", $this->lng->txt(
"import"));
114 $this->tpl->setVariable(
"TXT_COPY", $this->lng->txt(
"copy"));
115 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
116 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
121 $this->tpl->setVariable(
"SOURCE_SELECT", $select);
130 global $rbacsystem,
$lng;
135 $this->tpl->setCurrentBlock(
"ContentStyle");
136 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
137 $this->object->getContentStylePath($this->object->getId()));
138 $this->tpl->parseCurrentBlock();
141 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"edit_stylesheet"));
144 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
147 $this->tpl->setCurrentBlock(
"btn_cell");
148 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"exportStyle"));
149 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"export"));
150 $this->tpl->parseCurrentBlock();
153 $avail_pars = $this->
object->getAvailableParameters();
154 $style = $this->
object->getStyle();
155 foreach($style as $tag)
157 foreach($tag as $par)
159 $this->tpl->setCurrentBlock(
"StyleParameter");
160 $this->tpl->setVariable(
"PAR_ID", $par[
"id"]);
161 $var = str_replace(
"-",
"_", $par[
"parameter"]);
165 $location = array(
"bottom",
"top",
"left",
"right");
168 if (is_int(strpos($var,
"_".$loc)))
170 $var = str_replace(
"_".$loc,
"", $var);
171 $add =
", ".$this->lng->txt(
"sty_".$loc);
174 $this->tpl->setVariable(
"TXT_PAR",
175 $this->lng->txt(
"sty_".$var).$add);
177 if (count($avail_pars[$par[
"parameter"]]) == 0)
179 $input =
"<input type=\"text\" size=\"30\" maxlength=\"100\" ".
180 "name=\"styval[".$par[
"id"].
"]\" value=\"".$par[
"value"].
"\"";
184 $sel_avail_vals = array();
185 foreach($avail_pars[$par[
"parameter"]] as $key => $val)
187 $sel_avail_vals[$val] = $val;
189 $input =
ilUtil::formSelect($par[
"value"],
"styval[".$par[
"id"].
"]", $sel_avail_vals,
false,
true);
191 $this->tpl->setVariable(
"INPUT_VAL", $input);
192 $this->tpl->parseCurrentBlock();
194 if ((!is_int(strpos($tag[0][
"class"],
":hover"))) &&
195 (!is_int(strpos($tag[0][
"class"],
":visited"))) &&
196 (!is_int(strpos($tag[0][
"class"],
":active")))
199 $this->tpl->setCurrentBlock(
"Example_".$tag[0][
"tag"]);
200 $this->tpl->setVariable(
"EX_CLASS",
"ilc_".$tag[0][
"class"]);
201 $this->tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
202 $this->tpl->parseCurrentBlock();
205 $this->tpl->setCurrentBlock(
"StyleTag");
206 $tag_str = $tag[0][
"tag"].
".".$tag[0][
"class"];
207 $this->tpl->setVariable(
"TXT_TAG", $tag_str);
208 $this->tpl->setVariable(
"TXT_EDIT", $this->lng->txt(
"edit"));
209 $this->ctrl->setParameter($this,
"tag", $tag_str);
210 $this->tpl->setVariable(
"LINK_EDIT_TAG_STYLE",
211 $this->ctrl->getLinkTarget($this,
"editTagStyle"));
212 $this->tpl->setVariable(
"STY_ROWSPAN", (count($tag) + 1));
213 $this->tpl->setVariable(
"TXT_PARAMETER", $this->lng->txt(
"parameter"));
214 $this->tpl->setVariable(
"TXT_VALUE", $this->lng->txt(
"value"));
215 $this->tpl->parseCurrentBlock();
219 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
220 $this->tpl->setVariable(strtoupper(
"TITLE"), $this->object->getTitle());
221 $this->tpl->setVariable(
"TXT_DESC", $this->lng->txt(
"description"));
222 $this->tpl->setVariable(strtoupper(
"DESCRIPTION"), $this->object->getDescription());
223 $this->tpl->parseCurrentBlock();
226 $temptags = $this->
object->getAvailableTags();
228 foreach($temptags as $key => $val)
233 foreach($avail_pars as $key => $val)
235 $sel_avail_pars[$key] = $key;
237 $this->tpl->setVariable(
"SELECT_TAG", $tag_select);
239 $this->tpl->setVariable(
"SELECT_PAR", $par_select);
240 $this->tpl->setVariable(
"TXT_NEW_PAR", $this->lng->txt(
"add"));
242 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
243 $this->tpl->setVariable(
"TXT_SAVE", $this->lng->txt(
"save_return"));
244 $this->tpl->setVariable(
"BTN_SAVE",
"update");
245 $this->tpl->setVariable(
"TXT_REFRESH", $this->lng->txt(
"save_refresh"));
246 $this->tpl->setVariable(
"BTN_REFRESH",
"refresh");
247 $this->tpl->setVariable(
"TXT_DELETE", $this->lng->txt(
"delete_selected"));
248 $this->tpl->setVariable(
"BTN_DELETE",
"deleteStyleParameter");
249 $this->tpl->setVariable(
"BTN_NEW_PAR",
"newStyleParameter");
250 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
258 global $rbacsystem,
$lng;
263 $this->tpl->setCurrentBlock(
"ContentStyle");
264 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
265 $this->object->getContentStylePath($this->object->getId()));
266 $this->tpl->parseCurrentBlock();
267 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
268 "tpl.sty_tag_edit.html",
false,
false);
269 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"edit_stylesheet"));
272 $avail_pars = $this->
object->getAvailableParameters();
273 $style = $this->
object->getStyle();
274 $this->tpl->setVariable(
"TXT_TEXT", $this->lng->txt(
"sty_text"));
275 $this->tpl->setVariable(
"TXT_MARGIN_AND_PADDING", $this->lng->txt(
"sty_margin_and_padding"));
276 $this->tpl->setVariable(
"TXT_ALL", $this->lng->txt(
"sty_all"));
277 $this->tpl->setVariable(
"TXT_TOP", $this->lng->txt(
"sty_top"));
278 $this->tpl->setVariable(
"TXT_BOTTOM", $this->lng->txt(
"sty_bottom"));
279 $this->tpl->setVariable(
"TXT_LEFT", $this->lng->txt(
"sty_left"));
280 $this->tpl->setVariable(
"TXT_RIGHT", $this->lng->txt(
"sty_right"));
281 $this->tpl->setVariable(
"TXT_BORDER", $this->lng->txt(
"sty_border"));
282 $this->tpl->setVariable(
"TXT_BACKGROUND", $this->lng->txt(
"sty_background"));
283 $this->tpl->setVariable(
"TXT_SPECIAL", $this->lng->txt(
"sty_special"));
285 $cur = explode(
".",
$_GET[
"tag"]);
287 $cur_class = $cur[1];
290 $this->tpl->setCurrentBlock(
"Example_".$cur_tag);
291 $this->tpl->setVariable(
"EX_CLASS",
"ilc_".$cur_class);
292 $this->tpl->setVariable(
"EX_TEXT",
"ABC abc 123");
293 $this->tpl->parseCurrentBlock();
296 foreach ($avail_pars as $par => $vals)
298 $var = str_replace(
"-",
"_", $par);
299 $up_par = strtoupper($var);
300 $this->tpl->setVariable(
"TXT_".$up_par, $this->lng->txt(
"sty_".$var));
303 if (count($avail_pars[$par]) > 0)
305 $sel_avail_vals = array(
"" =>
"");
306 foreach($avail_pars[$par] as $key => $val)
308 $sel_avail_vals[$val] = $val;
311 $this->tpl->setVariable(
"SEL_".$up_par, $sel_str);
315 $this->tpl->setVariable(
"VAL_".$up_par, $parameters[$par]);
392 $this->ctrl->setParameter($this,
"tag",
$_GET[
"tag"]);
393 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
394 $this->tpl->setVariable(
"TXT_SAVE", $this->lng->txt(
"save_return"));
395 $this->tpl->setVariable(
"BTN_SAVE",
"updateTagStyle");
396 $this->tpl->setVariable(
"TXT_REFRESH", $this->lng->txt(
"save_refresh"));
397 $this->tpl->setVariable(
"BTN_REFRESH",
"refreshTagStyle");
405 $avail_pars = $this->
object->getAvailableParameters();
406 $cur = explode(
".",
$_GET[
"tag"]);
408 $cur_class = $cur[1];
409 foreach ($avail_pars as $par => $vals)
411 $var = str_replace(
"-",
"_", $par);
412 if ($_POST[$var] !=
"")
414 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $_POST[$var]);
418 $this->
object->deleteStylePar($cur_tag, $cur_class, $par);
423 $this->
object->update();
432 $avail_pars = $this->
object->getAvailableParameters();
433 $cur = explode(
".",
$_GET[
"tag"]);
435 $cur_class = $cur[1];
436 foreach ($avail_pars as $par => $vals)
438 $var = str_replace(
"-",
"_", $par);
439 if ($_POST[$var] !=
"")
441 $this->
object->replaceStylePar($cur_tag, $cur_class, $par, $_POST[$var]);
445 $this->
object->deleteStylePar($cur_tag, $cur_class, $par);
450 $this->
object->update();
464 $parameters = array();
465 foreach($a_style as $tag)
467 foreach($tag as $par)
469 if ($par[
"tag"] == $a_tag && $par[
"class"] == $a_class)
471 $parameters[$par[
"parameter"]] = $par[
"value"];
483 $this->
object->addParameter($_POST[
"tag"], $_POST[
"parameter"]);
494 $this->
object->setTitle($_POST[
"style_title"]);
495 $this->
object->setDescription($_POST[
"style_description"]);
497 foreach($_POST[
"styval"] as $id => $value)
499 $this->
object->updateStyleParameter($id, $value);
501 $this->
object->update();
514 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.confirm_deletion.html");
521 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
524 $this->tpl->setCurrentBlock(
"table_header");
525 $this->tpl->setVariable(
"TEXT", $this->lng->txt(
"objects"));
526 $this->tpl->parseCurrentBlock();
533 $this->tpl->setCurrentBlock(
"table_row");
537 $this->tpl->parseCurrentBlock();
542 $buttons = array(
"confirmedDelete" => $this->lng->txt(
"confirm"),
543 "cancelDelete" => $this->lng->txt(
"cancel"));
544 foreach ($buttons as $name => $value)
546 $this->tpl->setCurrentBlock(
"operation_btn");
548 $this->tpl->setVariable(
"BTN_NAME",$name);
549 $this->tpl->setVariable(
"BTN_VALUE",$value);
550 $this->tpl->parseCurrentBlock();
560 $this->ctrl->returnToParent($this);
570 $this->
object->delete();
572 $this->ctrl->returnToParent($this);
580 if (is_array($_POST[
"sty_select"]))
582 foreach($_POST[
"sty_select"] as $id => $dummy)
584 $this->
object->deleteParameter($id);
587 $this->
object->read();
588 $this->
object->writeCSSFile();
598 $class_name =
"ilObjStyleSheet";
599 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
601 $newObj->setTitle($_POST[
"style_title"]);
602 $newObj->setDescription($_POST[
"style_description"]);
607 if (
$_GET[
"ref_id"] > 0)
611 if ($fold->getType() ==
"stys")
613 $fold->addStyle($newObj->getId());
616 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
620 return $newObj->getId();
630 $this->
object->setTitle($_POST[
"style_title"]);
631 $this->
object->setDescription($_POST[
"style_description"]);
633 foreach($_POST[
"styval"] as $id => $value)
635 $this->
object->updateStyleParameter($id, $value);
637 $this->
object->update();
639 if (
$_GET[
"ref_id"] > 0)
643 if ($fold->getType() ==
"stys")
645 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
646 "editContentStyles");
650 $this->ctrl->returnToParent($this);
660 if ($_POST[
"source_style"] > 0)
661 $style_obj =& $ilias->obj_factory->getInstanceByObjId($_POST[
"source_style"]);
662 $new_id = $style_obj->ilClone();
666 if (
$_GET[
"ref_id"] > 0)
670 if ($fold->getType() ==
"stys")
672 $fold->addStyle($new_id);
675 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
688 $source = $_FILES[
"stylefile"][
"tmp_name"];
689 if (($source ==
'none') || (!$source))
691 $this->ilias->raiseError(
"No file selected!",$this->ilias->error_obj->MESSAGE);
695 $info = pathinfo($_FILES[
"stylefile"][
"name"]);
696 if (strtolower($info[
"extension"]) !=
"xml")
698 $this->ilias->raiseError(
"File must be a xml file!",$this->ilias->error_obj->MESSAGE);
701 $class_name =
"ilObjStyleSheet";
702 require_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
706 $newObj->createFromXMLFile($_FILES[
"stylefile"][
"tmp_name"]);
710 if (
$_GET[
"ref_id"] > 0)
714 if ($fold->getType() ==
"stys")
716 $fold->addStyle($newObj->getId());
719 $this->ctrl->redirectByClass(
"ilobjstylesettingsgui",
"editContentStyles");
723 return $newObj->getId();
734 $this->ctrl->returnToParent($this);
753 #include_once("classes/class.ilTabsGUI.php");
754 #$tabs_gui =& new ilTabsGUI();
755 $this->
getTabs($this->tabs_gui);
756 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
758 if (strtolower(get_class($this->
object)) ==
"ilobjstylesheet")
760 $this->tpl->setVariable(
"HEADER", $this->object->getTitle());
764 $this->tpl->setVariable(
"HEADER", $lng->txt(
"create_stylesheet"));
776 $tabs_gui->addTarget(
"cont_back",
777 $this->ctrl->getParentReturn($this),
"",
789 if (
$_GET[
"admin_mode"] ==
"settings")
791 $ilLocator->addItem($this->lng->txt(
"administration"),
792 $this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
797 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
"view"));
799 if (
$_GET[
"obj_id"] > 0)
801 $ilLocator->addItem($this->object->getTitle(),
802 $this->ctrl->getLinkTarget($this,
"edit"));
816 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
819 $this->ctrl->getLinkTargetByClass(
"ilobjstylesettingsgui",
820 "editContentStyles"));