ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSubStyleAssignmentGUI.php
Go to the documentation of this file.
1 <?php
2 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
3 include_once("Services/Style/System/classes/Utilities/class.ilSkinXML.php");
4 include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
5 include_once("Services/Style/System/classes/class.ilStyleDefinition.php");
6 include_once("Services/Style/System/classes/class.ilSystemStyleSettings.php");
7 include_once("Services/Style/System/classes/Exceptions/class.ilSystemStyleException.php");
8 include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleMessageStack.php");
9 include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleMessage.php");
10 include_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 
70  public function assignStyle(ilSkinXML $skin, ilSkinStyleXML $substyle)
71  {
72  $style = $skin->getStyle($substyle->getSubstyleOf());
73 
74  $this->toolbar->addFormButton($this->lng->txt("sty_add_assignment"), "addAssignment");
75  $this->toolbar->setFormAction($this->ctrl->getFormAction($this->getParentGui()));
76 
78  $this->getParentGui(),
79  "assignStyleToCat",
80  $skin->getId(),
81  $style->getId(),
82  $substyle->getId()
83  );
84 
85  $this->tpl->setContent($tab->getHTML());
86  }
87 
88 
92  public function addAssignment()
93  {
94  include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
95  $exp = new ilSearchRootSelector(
96  $this->ctrl->getLinkTarget($this->getParentGui(), 'addStyleCatAssignment')
97  );
98  $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $this->tree->readRootId());
99  $exp->setExpandTarget($this->ctrl->getLinkTarget($this->getParentGui(), 'addAssignment'));
100  $exp->setTargetClass(get_class($this->getParentGui()));
101  $exp->setCmd('saveAssignment');
102  $exp->setClickableTypes(["cat"]);
103 
104  $exp->setOutput(0);
105  $this->tpl->setContent($exp->getOutput());
106  }
107 
108 
115  public function saveAssignment(ilSkinXML $skin, ilSkinStyleXML $substyle)
116  {
117  $style = $skin->getStyle($substyle->getSubstyleOf());
118  try {
120  $skin->getId(),
121  $style->getId(),
122  $substyle->getId(),
123  $_GET["root_id"]
124  );
125  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
126  } catch (ilSystemStyleException $e) {
127  ilUtil::sendFailure($this->lng->txt("msg_assignment_failed") . $e->getMessage(), true);
128  }
129 
130 
131  $this->ctrl->redirect($this->getParentGui(), "assignStyle");
132  }
133 
140  public function deleteAssignments(ilSkinXML $skin, ilSkinStyleXML $substyle)
141  {
142  $style = $skin->getStyle($substyle->getSubstyleOf());
143 
144 
145  if (is_array($_POST["id"])) {
146  foreach ($_POST["id"] as $id) {
147  $id_arr = explode(":", $id);
149  $skin->getId(),
150  $style->getId(),
151  $substyle->getId(),
152  $id_arr[1]
153  );
154  }
155  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
156  } else {
157  ilUtil::sendFailure($this->lng->txt("no_style_selected"), true);
158  }
159 
160  $this->ctrl->redirect($this->getParentGui(), "assignStyle");
161  }
162 
166  public function getParentGui()
167  {
168  return $this->parent_gui;
169  }
170 
174  public function setParentGui($parent_gui)
175  {
176  $this->parent_gui = $parent_gui;
177  }
178 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static writeSystemStyleCategoryAssignment( $a_skin_id, $a_style_id, $a_substyle, $a_ref_id)
Sets a substyle category assignment.
$style
Definition: example_012.php:70
static deleteSystemStyleCategoryAssignment( $a_skin_id, $a_style_id, $a_substyle, $a_ref_id)
Deletes all sub style category assignment of a system style.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
getSubstyleOf()
Returns the parent style of this style if set.
if(!array_key_exists('StateId', $_REQUEST)) $id
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
TableGUI class for system style to category assignments.
addAssignment()
Add style category assignment.
deleteAssignments(ilSkinXML $skin, ilSkinStyleXML $substyle)
Delete system style to category assignments.
Class for advanced editing exception handling in ILIAS.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
saveAssignment(ilSkinXML $skin, ilSkinStyleXML $substyle)
Save style category assignment.
__construct(ilSystemStyleSettingsGUI $parent_gui)
Constructor.
assignStyle(ilSkinXML $skin, ilSkinStyleXML $substyle)
Assign styles to categories.
$_POST["username"]