ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSubStyleAssignmentGUI.php
Go to the documentation of this file.
1<?php
2include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
3include_once("Services/Style/System/classes/Utilities/class.ilSkinXML.php");
4include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
5include_once("Services/Style/System/classes/class.ilStyleDefinition.php");
6include_once("Services/Style/System/classes/class.ilSystemStyleSettings.php");
7include_once("Services/Style/System/classes/Exceptions/class.ilSystemStyleException.php");
8include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleMessageStack.php");
9include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleMessage.php");
10include_once("Services/Style/System/classes/Settings/class.ilSysStyleCatAssignmentTableGUI.php");
11
18{
22 protected $ctrl;
23
27 protected $lng;
28
32 protected $tpl;
33
37 protected $toolbar;
38
42 protected $parent_gui;
43
47 protected $tree;
48
49
54 {
55 global $DIC;
56
57 $this->ctrl = $DIC->ctrl();
58 $this->lng = $DIC->language();
59 $this->toolbar = $DIC->toolbar();
60 $this->tpl = $DIC["tpl"];
61 $this->parent_gui = $parent_gui;
62 $this->tree = $DIC["tree"];
63
64 }
65
71 function assignStyle(ilSkinXML $skin,ilSkinStyleXML $substyle)
72 {
73 $style = $skin->getStyle($substyle->getSubstyleOf());
74
75 $this->toolbar->addFormButton($this->lng->txt("sty_add_assignment"), "addAssignment");
76 $this->toolbar->setFormAction($this->ctrl->getFormAction($this->getParentGui()));
77
78 $tab = new ilSysStyleCatAssignmentTableGUI($this->getParentGui(), "assignStyleToCat",$skin->getId(), $style->getId(),
79 $substyle->getId());
80
81 $this->tpl->setContent($tab->getHTML());
82 }
83
84
88 function addAssignment()
89 {
90
91 include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
92 $exp = new ilSearchRootSelector(
93 $this->ctrl->getLinkTarget($this->getParentGui(),'addStyleCatAssignment'));
94 $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $this->tree->readRootId());
95 $exp->setExpandTarget($this->ctrl->getLinkTarget($this->getParentGui(),'addAssignment'));
96 $exp->setTargetClass(get_class($this->getParentGui()));
97 $exp->setCmd('saveAssignment');
98 $exp->setClickableTypes(["cat"]);
99
100 $exp->setOutput(0);
101 $this->tpl->setContent($exp->getOutput());
102 }
103
104
111 function saveAssignment(ilSkinXML $skin,ilSkinStyleXML $substyle)
112 {
113 $style = $skin->getStyle($substyle->getSubstyleOf());
114 try{
116 $substyle->getId(), $_GET["root_id"]);
117 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
118 }catch(ilSystemStyleException $e){
119 ilUtil::sendFailure($this->lng->txt("msg_assignment_failed").$e->getMessage(), true);
120
121 }
122
123
124 $this->ctrl->redirect($this->getParentGui(), "assignStyle");
125 }
126
134 {
135 $style = $skin->getStyle($substyle->getSubstyleOf());
136
137
138 if (is_array($_POST["id"]))
139 {
140 foreach ($_POST["id"] as $id)
141 {
142 $id_arr = explode(":", $id);
144 $substyle->getId(), $id_arr[1]);
145 }
146 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
147 }else{
148 ilUtil::sendFailure($this->lng->txt("no_style_selected"), true);
149 }
150
151 $this->ctrl->redirect($this->getParentGui(), "assignStyle");
152 }
153
157 public function getParentGui()
158 {
159 return $this->parent_gui;
160 }
161
165 public function setParentGui($parent_gui)
166 {
167 $this->parent_gui = $parent_gui;
168 }
169
170
171}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
getSubstyleOf()
Returns the parent style of this style if set.
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin.
assignStyle(ilSkinXML $skin, ilSkinStyleXML $substyle)
Assign styles to categories.
deleteAssignments(ilSkinXML $skin, ilSkinStyleXML $substyle)
Delete system style to category assignments.
saveAssignment(ilSkinXML $skin, ilSkinStyleXML $substyle)
Save style category assignment.
__construct(ilSystemStyleSettingsGUI $parent_gui)
Constructor.
addAssignment()
Add style category assignment.
TableGUI class for system style to category assignments.
Class for advanced editing exception handling in ILIAS.
static writeSystemStyleCategoryAssignment($a_skin_id, $a_style_id, $a_substyle, $a_ref_id)
Sets a substyle category assignment.
static deleteSystemStyleCategoryAssignment($a_skin_id, $a_style_id, $a_substyle, $a_ref_id)
Deletes all sub style category assignment of a system style.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$style
Definition: example_012.php:70
global $DIC