Public Member Functions

ilObjStyleSettingsGUI Class Reference

Inheritance diagram for ilObjStyleSettingsGUI:
Collaboration diagram for ilObjStyleSettingsGUI:

Public Member Functions

 ilObjStyleSettingsGUI ($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
 Constructor public.
 saveObject ()
 save object public
 viewObject ()
 view list of styles
 displayStyleSettings ()
 displays style settings
 saveStyleSettingsObject ()
 save skin and style settings
 deleteStyleObject ($a_error=false)
 display deletion confirmation screen
 confirmedDeleteObject ()
 delete selected style objects
 toggleGlobalDefaultObject ()
 toggle global default style
 toggleGlobalFixedObject ()
 toggle global fixed style
 showActions ($with_subobjects=false)
 show possible action (form buttons)
 getTabs (&$tabs_gui)
 get tabs public

Detailed Description

Definition at line 36 of file class.ilObjStyleSettingsGUI.php.


Member Function Documentation

ilObjStyleSettingsGUI::confirmedDeleteObject (  ) 

delete selected style objects

Reimplemented from ilObjectGUI.

Definition at line 411 of file class.ilObjStyleSettingsGUI.php.

References $_SESSION, $id, ilObjectGUI::$ilias, ilObjectGUI::getReturnLocation(), and ilUtil::redirect().

        {
                global $ilias;
                
                foreach($_SESSION["saved_post"] as $id)
                {
                        $this->object->removeStyle($id);
                        $style_obj =& $ilias->obj_factory->getInstanceByObjId($id);
                        $style_obj->delete();
                }
                $this->object->update();
                
                ilUtil::redirect($this->getReturnLocation("delete",$this->ctrl->getLinkTarget($this,"")));
        }

Here is the call graph for this function:

ilObjStyleSettingsGUI::deleteStyleObject ( a_error = false  ) 

display deletion confirmation screen

public

Definition at line 353 of file class.ilObjStyleSettingsGUI.php.

References $_GET, $_POST, $_SESSION, $counter, $id, ilObject::_lookupTitle(), ilObjectGUI::getFormAction(), ilUtil::getImagePath(), sendInfo(), and ilUtil::switchColor().

        {
                if (!isset($_POST["id"]))
                {
                        $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
                }

                // SAVE POST VALUES
                $_SESSION["saved_post"] = $_POST["id"];

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html");

                if(!$a_error)
                {
                        sendInfo($this->lng->txt("info_delete_sure"));
                }

                $this->tpl->setVariable("FORMACTION", $this->getFormAction("delete",
                        "adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=gateway"));

                // BEGIN TABLE HEADER
                $this->tpl->setCurrentBlock("table_header");
                $this->tpl->setVariable("TEXT", $this->lng->txt("objects"));
                $this->tpl->parseCurrentBlock();
                
                // END TABLE HEADER

                // BEGIN TABLE DATA
                $counter = 0;

                foreach ($_POST["id"] as $id)
                {
                        $this->tpl->setCurrentBlock("table_row");
                        $this->tpl->setVariable("IMG_OBJ",ilUtil::getImagePath("icon_styf.gif"));
                        $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
                        $this->tpl->setVariable("TEXT_CONTENT",ilObject::_lookupTitle($id));
                        $this->tpl->parseCurrentBlock();
                }
                
                // END TABLE DATA

                // BEGIN OPERATION_BTN
                $buttons = array("confirmedDelete"  => $this->lng->txt("confirm"),
                        "cancelDelete"  => $this->lng->txt("cancel"));
                foreach ($buttons as $name => $value)
                {
                        $this->tpl->setCurrentBlock("operation_btn");
                        $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
                        $this->tpl->setVariable("BTN_NAME",$name);
                        $this->tpl->setVariable("BTN_VALUE",$value);
                        $this->tpl->parseCurrentBlock();
                }
        }

Here is the call graph for this function:

ilObjStyleSettingsGUI::displayStyleSettings (  ) 

displays style settings

Definition at line 200 of file class.ilObjStyleSettingsGUI.php.

References $settings, $styleDefinition, $templates, ilObjUser::_getNumberOfUsersForStyle(), and ilObjStyleSettings::_lookupActivatedStyle().

Referenced by viewObject().

        {
                global $styleDefinition;
                
                $this->tpl->addBlockFile("SYSTEMSETTINGS", "style_settings", "tpl.stys_settings.html");
                $this->tpl->setCurrentBlock("style_settings");

                $settings = $this->ilias->getAllSettings();

                $this->tpl->setVariable("FORMACTION_STYLESETTINGS", $this->ctrl->getFormAction($this));         
                $this->tpl->setVariable("TXT_STYLE_SETTINGS", $this->lng->txt("system_style_settings"));
                $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
                $this->tpl->setVariable("TXT_DEFAULT_SKIN_STYLE", $this->lng->txt("default_skin_style"));
                $this->tpl->setVariable("TXT_SKIN_STYLE_ACTIVATION", $this->lng->txt("style_activation"));
                $this->tpl->setVariable("TXT_NUMBER_OF_USERS", $this->lng->txt("num_users"));
                $this->tpl->setVariable("TXT_MOVE_USERS_TO_STYLE", $this->lng->txt("move_users_to_style"));
                
                // get all templates
                $templates = $styleDefinition->getAllTemplates();

                foreach ($templates as $template)
                {
                        // get styles definition for template
                        $styleDef =& new ilStyleDefinition($template["id"]);
                        $styleDef->startParsing();
                        $styles = $styleDef->getStyles();

                        foreach ($styles as $style)
                        {
                                if ($this->ilias->ini->readVariable("layout","skin") == $template["id"] &&
                                        $this->ilias->ini->readVariable("layout","style") == $style["id"])
                                {
                                        $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
                                }

                                // default selection list
                                $this->tpl->setCurrentBlock("selectskin");
                                $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
                                $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
                                $this->tpl->parseCurrentBlock();
                                
                                // can be optimized
                                foreach ($templates as $template2)
                                {
                                        // get styles definition for template
                                        $styleDef2 =& new ilStyleDefinition($template2["id"]);
                                        $styleDef2->startParsing();
                                        $styles2 = $styleDef2->getStyles();
                
                                        foreach ($styles2 as $style2)
                                        {
                                                if (ilObjStyleSettings::_lookupActivatedStyle($template2["id"], $style2["id"]))
                                                {
                                                        $this->tpl->setCurrentBlock("move_to_skin");
                                                        $this->tpl->setVariable("TOSKINVALUE", $template2["id"].":".$style2["id"]);
                                                        $this->tpl->setVariable("TOSKINOPTION", $styleDef2->getTemplateName()." / ".$style2["name"]);
                                                        $this->tpl->parseCurrentBlock();
                                                }
                                        }
                                }
                                
                                // activation list
                                $this->tpl->setCurrentBlock("style_activation");
                                $this->tpl->setVariable("TXT_SKIN_STYLE_TITLE", 
                                        $styleDef->getTemplateName()." / ".$style["name"]);
                                $this->tpl->setVariable("VAL_SKIN_STYLE", $template["id"].":".$style["id"]);
                                $num_users = ilObjUser::_getNumberOfUsersForStyle($template["id"], $style["id"]);
                                $this->tpl->setVariable("VAL_NUM_USERS", $num_users);
                                if (ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"]))
                                {
                                        $this->tpl->setVariable("CHK_SKIN_STYLE", " checked=\"1\" ");
                                }
                                $this->tpl->parseCurrentBlock();
                        }
                }

                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjStyleSettingsGUI::getTabs ( &$  tabs_gui  ) 

get tabs public

Parameters:
object tabs gui object

Reimplemented from ilObjectGUI.

Definition at line 535 of file class.ilObjStyleSettingsGUI.php.

        {
                // tabs are defined manually here. The autogeneration via objects.xml will be deprecated in future
                // for usage examples see ilObjGroupGUI or ilObjSystemFolderGUI
        }

ilObjStyleSettingsGUI::ilObjStyleSettingsGUI ( a_data,
a_id,
a_call_by_reference,
a_prepare_output = true 
)

Constructor public.

Definition at line 42 of file class.ilObjStyleSettingsGUI.php.

References ilObjectGUI::ilObjectGUI().

        {
                $this->type = "stys";
                $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
        }

Here is the call graph for this function:

ilObjStyleSettingsGUI::saveObject (  ) 

save object public

Reimplemented from ilObjectGUI.

Definition at line 52 of file class.ilObjStyleSettingsGUI.php.

References $rbacadmin, ilObjectGUI::getReturnLocation(), ilUtil::redirect(), and sendInfo().

        {
                global $rbacadmin;

                // create and insert forum in objecttree
                $newObj = parent::saveObject();

                // setup rolefolder & default local roles
                //$roles = $newObj->initDefaultRoles();

                // ...finally assign role to creator of object
                //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");

                // put here object specific stuff
                        
                // always send a message
                sendInfo($this->lng->txt("object_added"),true);
                
                ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
        }

Here is the call graph for this function:

ilObjStyleSettingsGUI::saveStyleSettingsObject (  ) 

save skin and style settings

Definition at line 282 of file class.ilObjStyleSettingsGUI.php.

References $_POST, $styleDefinition, $templates, ilObjStyleSettings::_activateStyle(), ilObjStyleSettings::_deactivateStyle(), ilObjUser::_getNumberOfUsersForStyle(), ilObjUser::_moveUsersToStyle(), and ilUtil::redirect().

        {
                global $styleDefinition;
                
                // check if one style is activated
                if (count($_POST["st_act"]) < 1)
                {
                        $this->ilias->raiseError($this->lng->txt("at_least_one_style"), $this->ilias->error_obj->MESSAGE);
                }
                
                // check if a style should be deactivated, that still has
                // a user assigned to
                $templates = $styleDefinition->getAllTemplates();
                foreach ($templates as $template)
                {
                        // get styles definition for template
                        $styleDef =& new ilStyleDefinition($template["id"]);
                        $styleDef->startParsing();
                        $styles = $styleDef->getStyles();
                        foreach ($styles as $style)
                        {
                                if (!isset($_POST["st_act"][$template["id"].":".$style["id"]]))
                                {
                                        if (ilObjUser::_getNumberOfUsersForStyle($template["id"], $style["id"]) > 1)
                                        {
                                                $this->ilias->raiseError($this->lng->txt("cant_deactivate_if_users_assigned"), $this->ilias->error_obj->MESSAGE);
                                        }
                                        else
                                        {
                                                ilObjStyleSettings::_deactivateStyle($template["id"], $style["id"]);
                                        }
                                }
                                else
                                {
                                        ilObjStyleSettings::_activateStyle($template["id"], $style["id"]);
                                }
                        }
                }
                
                // move users to other skin
                foreach($_POST["move_users"] as $key => $value)
                {
                        if ($value != "")
                        {
                                $from = explode(":", $key);
                                $to = explode(":", $value);
                                ilObjUser::_moveUsersToStyle($from[0],$from[1],$to[0],$to[1]);
                        }
                }
                
                //set default skin and style
                if ($_POST["default_skin_style"] != "")
                {
                        $sknst = explode(":", $_POST["default_skin_style"]);

                        if ($this->ilias->ini->readVariable("layout","style") != $sknst[1] ||
                                $this->ilias->ini->readVariable("layout","skin") != $sknst[0])
                        {
                                $this->ilias->ini->setVariable("layout","skin", $sknst[0]);
                                $this->ilias->ini->setVariable("layout","style",$sknst[1]);
                        }
                }
                $this->ilias->ini->write();
                ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
        }

Here is the call graph for this function:

ilObjStyleSettingsGUI::showActions ( with_subobjects = false  ) 

show possible action (form buttons)

Parameters:
boolean public

Reimplemented from ilObjectGUI.

Definition at line 498 of file class.ilObjStyleSettingsGUI.php.

References ilUtil::getImagePath(), and ilObjectGUI::showPossibleSubObjects().

Referenced by viewObject().

        {

                // delete
                $this->tpl->setCurrentBlock("tbl_action_btn");
                $this->tpl->setVariable("BTN_NAME", "deleteStyle");
                $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
                $this->tpl->parseCurrentBlock();

                // set global default
                $this->tpl->setCurrentBlock("tbl_action_btn");
                $this->tpl->setVariable("BTN_NAME", "toggleGlobalDefault");
                $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalDefault"));
                $this->tpl->parseCurrentBlock();
                
                // set global default
                $this->tpl->setCurrentBlock("tbl_action_btn");
                $this->tpl->setVariable("BTN_NAME", "toggleGlobalFixed");
                $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalFixed"));
                $this->tpl->parseCurrentBlock();

                if ($with_subobjects === true)
                {
                        $this->showPossibleSubObjects();
                }
                
                $this->tpl->setCurrentBlock("tbl_action_row");
                $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjStyleSettingsGUI::toggleGlobalDefaultObject (  ) 

toggle global default style

public

Definition at line 432 of file class.ilObjStyleSettingsGUI.php.

References $_POST, ilObjectGUI::$ilias, and ilUtil::redirect().

        {
                global $ilias;
                
                if (!isset($_POST["id"]))
                {
                        $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
                }
                if(count($_POST["id"]) > 1)
                {
                        $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
                }

                $ilias->deleteSetting("fixed_content_style_id");
                $def_style = $ilias->getSetting("default_content_style_id");
                
                if ($def_style != $_POST["id"][0])
                {
                        $ilias->setSetting("default_content_style_id", $_POST["id"][0]);
                }
                else
                {
                        $ilias->deleteSetting("default_content_style_id");
                }
                
                ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
        }

Here is the call graph for this function:

ilObjStyleSettingsGUI::toggleGlobalFixedObject (  ) 

toggle global fixed style

public

Definition at line 465 of file class.ilObjStyleSettingsGUI.php.

References $_POST, ilObjectGUI::$ilias, and ilUtil::redirect().

        {
                global $ilias;
                
                if (!isset($_POST["id"]))
                {
                        $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
                }
                if(count($_POST["id"]) > 1)
                {
                        $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
                }

                $ilias->deleteSetting("default_content_style_id");
                $fixed_style = $ilias->getSetting("fixed_content_style_id");
                if ($fixed_style == $_POST["id"][0])
                {
                        $ilias->deleteSetting("fixed_content_style_id");
                }
                else
                {
                        $ilias->setSetting("fixed_content_style_id", $_POST["id"][0]);
                }
                ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
        }

Here is the call graph for this function:

ilObjStyleSettingsGUI::viewObject (  ) 

view list of styles

Reimplemented from ilObjectGUI.

Definition at line 76 of file class.ilObjStyleSettingsGUI.php.

References $_GET, ilObjectGUI::$ilias, $num, $rbacsystem, $tbl, ilObject::_lookupDescription(), displayStyleSettings(), and showActions().

        {
                global $rbacsystem, $ilias;
                
                if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
                {
                        $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
                }
                
                include_once "./classes/class.ilTableGUI.php";

                // load template for table
                $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
                
                // load template for table content data
                $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.styf_row.html");

                $num = 0;

                $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");

                // create table
                $tbl = new ilTableGUI();

                // title & header columns
                $tbl->setTitle($this->lng->txt("content_styles"),"icon_styf.gif",
                        $this->lng->txt("content_styles"));

                //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));

                // title
                $header_names = array("", $this->lng->txt("title"),
                        $this->lng->txt("purpose"));
                $tbl->setHeaderNames($header_names);

                $header_params = array("ref_id" => $this->ref_id);
                $tbl->setHeaderVars(array("", "title", "purpose"), $header_params);
                $tbl->setColumnWidth(array("0%", "80%", "20%"));

                // control
                $tbl->setOrderColumn($_GET["sort_by"]);
                $tbl->setOrderDirection($_GET["sort_order"]);
                $tbl->setLimit($_GET["limit"]);
                $tbl->setOffset($_GET["offset"]);
                
                // get style ids
                $style_entries = array();
                $styles = $this->object->getStyles();
                foreach($styles as $style)
                {
                        $style_entries[$style["title"].":".$style["id"]]
                                = $style;
                }
                ksort($style_entries);
                
                // todo
                $tbl->setMaxCount(count($style_entries));

                $this->tpl->setVariable("COLUMN_COUNTS", 3);

                // footer
                $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));

                $this->showActions(true);

                include_once ("classes/class.ilObjStyleSheet.php");
                
                $fixed_style = $ilias->getSetting("fixed_content_style_id");
                $default_style = $ilias->getSetting("default_content_style_id");

                foreach ($style_entries as $style)
                {
                        $this->tpl->setCurrentBlock("style_row");
                
                        // color changing
                        $css_row = ($css_row == "tblrow2")
                                ? "tblrow1"
                                : "tblrow2";

                        $this->tpl->setVariable("CHECKBOX_ID", $style["id"]);
                        $this->tpl->setVariable("TXT_TITLE", $style["title"]);
                        $this->tpl->setVariable("TXT_DESC", ilObject::_lookupDescription($style["id"]));
                        $this->tpl->setVariable("LINK_STYLE",
                                "adm_object.php?ref_id=".$_GET["ref_id"].
                                "&obj_id=".$style["id"]);
                        $this->tpl->setVariable("ROWCOL", $css_row);
                        if ($style["id"] == $fixed_style)
                        {
                                $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_fixed"));
                        }
                        if ($style["id"] == $default_style)
                        {
                                $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("global_default"));
                        }
                        $this->tpl->parseCurrentBlock();

                        $this->tpl->setCurrentBlock("tbl_content");
                        $this->tpl->parseCurrentBlock();

                } //if is_array
                
                if (count($style_entries) == 0)
                {
            $tbl->disable("header");
                        $tbl->disable("footer");
                        
                        $this->tpl->setCurrentBlock("text");
                        $this->tpl->setVariable("TXT_CONTENT", $this->lng->txt("obj_not_found"));
                        $this->tpl->parseCurrentBlock();
                        
                        $this->tpl->setCurrentBlock("tbl_content");
                        $this->tpl->parseCurrentBlock();
                }

                // render table
                $tbl->render();
                
                $this->displayStyleSettings();
        }

Here is the call graph for this function:


The documentation for this class was generated from the following file: