2 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
3 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
4 include_once(
"Services/Style/System/classes/Less/class.ilSystemStyleLessFile.php");
5 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleMessageStack.php");
55 $this->ctrl = $DIC->ctrl();
56 $this->lng = $DIC->language();
57 $this->tpl = $DIC[
"tpl"];
62 $skin_id =
$_GET[
"skin_id"];
64 if ($style_id ==
"") {
65 $style_id =
$_GET[
"style_id"];
84 $cmd = $this->ctrl->getCmd();
105 $style_id =
$_GET[
'style_id'];
110 if (file_exists($less_path)) {
111 $less_variables_name = $this->
getStyleContainer()->getLessVariablesName($style_id);
114 $content = file_get_contents($less_path);
122 $reg_exp =
"/" . preg_quote($less_variables_name,
"/") .
"/";
124 if (!preg_match($reg_exp, $content)) {
126 new ilSystemStyleMessage($this->lng->txt(
"less_variables_file_not_included") .
" " . $less_variables_name
148 if (!PATH_TO_LESSC) {
153 } elseif (!shell_exec(PATH_TO_LESSC)) {
163 if (!
$pass && shell_exec(
"which lessc")) {
187 $this->tpl->setContent(
$form->getHTML());
201 $form->setTitle($this->lng->txt(
"adapt_less"));
202 $form->setDescription($this->lng->txt(
"adapt_less_description"));
203 $focus_variable =
$_GET[
'id_less_variable'];
204 if ($focus_variable) {
205 $this->tpl->addOnLoadCode(
"setTimeout(function() { $('#" . $focus_variable .
"').focus();}, 100);");
208 foreach ($this->
getLessFile()->getCategories() as $category) {
210 $section->setTitle($category->getName());
211 $section->setInfo($category->getComment());
214 foreach ($this->
getLessFile()->getVariablesPerCategory($category->getName()) as $variable) {
216 $input->setRequired(
true);
217 $input->setDisabled(!$modify);
219 $references = $this->
getLessFile()->getReferencesToVariableAsString($variable->getName());
221 if ($references !=
"") {
222 if ($variable->getComment()) {
223 $info = $variable->getComment() .
"</br>" . $this->lng->txt(
"usages") .
" " . $references;
225 $info = $this->lng->txt(
"usages") .
" " . $references;
228 $info = $variable->getComment();
237 $form->addCommandButton(
"update", $this->lng->txt(
"update_variables"));
238 $form->addCommandButton(
"reset", $this->lng->txt(
"reset_variables"));
239 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
243 $form->setFormAction($this->ctrl->getFormAction($this));
255 foreach ($this->
getLessFile()->getCategories() as $category) {
256 foreach ($this->
getLessFile()->getVariablesPerCategory($category->getName()) as $variable) {
257 $values[$variable->getName()] = $variable->getValue();
272 ilUtil::sendSuccess($this->lng->txt(
"less_file_reset"));
284 if (!
$form->checkInput()) {
286 foreach ($this->
getLessFile()->getCategories() as $category) {
287 foreach ($this->
getLessFile()->getVariablesPerCategory($category->getName()) as $variable) {
288 if (
$form->getInput($variable->getName()) ==
"") {
289 $empty_fields[$variable->getName()] = $this->
getLessFile()->getVariableByName($variable->getName())->getValue();
290 $item =
$form->getItemByPostVar($variable->getName());
291 $item->setAlert($this->lng->txt(
"less_variable_empty"));
295 if (!empty($empty_fields)) {
296 $form->setValuesByPost();
297 $form->setValuesByArray($empty_fields,
true);
299 $this->tpl->setContent(
$form->getHTML());
303 foreach ($this->
getLessFile()->getCategories() as $category) {
304 foreach ($this->
getLessFile()->getVariablesPerCategory($category->getName()) as $variable) {
305 $variable->setValue(
$form->getInput($variable->getName()));
312 $skin->getVersionStep($skin->getVersion());
314 ilUtil::sendSuccess($this->lng->txt(
"less_file_updated"));
320 $form->setValuesByPost();
321 $this->tpl->setContent(
$form->getHTML());
executeCommand()
Execute command.
__construct($skin_id="", $style_id="")
ilSystemStyleLessGUI constructor.
setMessageStack($message_stack)
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
getVariablesValues(ilPropertyFormGUI $form)
setStyleContainer($style_container)
Class for advanced editing exception handling in ILIAS.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Used to stack messages to be shown to the user.
initSystemStyleLessForm($modify=true)