Public Member Functions

ilObjExternalToolsSettingsGUI Class Reference

Inheritance diagram for ilObjExternalToolsSettingsGUI:
Collaboration diagram for ilObjExternalToolsSettingsGUI:

Public Member Functions

 ilObjExternalToolsSettingsGUI ($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
 Constructor public.
 viewObject ()
 display settings menu
 getTabs (&$tabs_gui)
 get tabs public
 editiLincObject ()
 Configure iLinc settings.
 saveiLincObject ()
 validates all input data, save them to database if correct and active chosen extt mode

Detailed Description

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


Member Function Documentation

ilObjExternalToolsSettingsGUI::editiLincObject (  ) 

Configure iLinc settings.

public

Definition at line 106 of file class.ilObjExternalToolsSettingsGUI.php.

References $_SESSION, $rbacreview, $rbacsystem, $settings, and ilObjectGUI::getTemplateFile().

        {
                global $rbacsystem, $rbacreview;
                
                if (!$rbacsystem->checkAccess("write",$this->object->getRefId()))
                {
                        $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
                }
                
                if ($_SESSION["error_post_vars"])
                {
                        if ($_SESSION["error_post_vars"]["ilinc"]["active"] == "1")
                        {
                                $this->tpl->setVariable("CHK_ILINC_ACTIVE", "checked=\"checked\"");
                        }
                        
                        $this->tpl->setVariable("ILINC_SERVER", $_SESSION["error_post_vars"]["ilinc"]["server"]);
                        $this->tpl->setVariable("ILINC_REGISTRAR_LOGIN", $_SESSION["error_post_vars"]["ilinc"]["registrar_login"]);
                        $this->tpl->setVariable("ILINC_REGISTRAR_PASSWD", $_SESSION["error_post_vars"]["ilinc"]["registrar_passwd"]);
                        $this->tpl->setVariable("ILINC_CUSTOMER_ID", $_SESSION["error_post_vars"]["ilinc"]["customer_id"]);
                }
                else
                {
                        // set already saved data or default value for port
                        $settings = $this->ilias->getAllSettings();

                        if ($settings["ilinc_active"] == "1")
                        {
                                $this->tpl->setVariable("CHK_ILINC_ACTIVE", "checked=\"checked\"");
                        }

                        $this->tpl->setVariable("ILINC_SERVER", $settings["ilinc_server"].$settings["ilinc_path"]);
                        $this->tpl->setVariable("ILINC_REGISTRAR_LOGIN", $settings["ilinc_registrar_login"]);
                        $this->tpl->setVariable("ILINC_REGISTRAR_PASSWD", $settings["ilinc_registrar_passwd"]);
                        $this->tpl->setVariable("ILINC_CUSTOMER_ID", $settings["ilinc_customer_id"]);
                        
                        if (empty($settings["ilinc_port"]))
                        {
                                $this->tpl->setVariable("ILINC_PORT", ILINC_DEFAULT_HTTP_PORT);
                        }
                        else
                        {
                                $this->tpl->setVariable("ILINC_PORT", $settings["ilinc_port"]);                 
                        }

                        if ($settings["ilinc_protocol"] == "https")
                        {
                                $this->tpl->setVariable("ILINC_PROTOCOL_SSL_SEL", "selected=\"selected\"");
                        }
                        else
                        {
                                $this->tpl->setVariable("ILINC_PROTOCOL_HTTP_SEL", "selected=\"selected\"");            
                        }
                        
                        if (empty($settings["ilinc_timeout"]))
                        {
                                $this->tpl->setVariable("ILINC_TIMEOUT", ILINC_DEFAULT_TIMEOUT);
                        }
                        else
                        {
                                $this->tpl->setVariable("ILINC_TIMEOUT", $settings["ilinc_timeout"]);                   
                        }               
                }

                $this->getTemplateFile("ilinc");
                
                $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."&cmd=gateway");
                $this->tpl->setVariable("TXT_ILINC_TITLE", $this->lng->txt("extt_ilinc_configure"));
                $this->tpl->setVariable("TXT_ILINC_ACTIVE", $this->lng->txt("extt_ilinc_enable"));
                $this->tpl->setVariable("TXT_OPTIONS", $this->lng->txt("options"));
                $this->tpl->setVariable("TXT_ILINC_SERVER", $this->lng->txt("extt_ilinc_server"));
                $this->tpl->setVariable("TXT_ILINC_PROTOCOL_PORT", $this->lng->txt("extt_ilinc_protocol_port"));
                $this->tpl->setVariable("TXT_ILINC_TIMEOUT", $this->lng->txt("extt_ilinc_timeout"));
                $this->tpl->setVariable("ILINC_DEFAULT_HTTP_PORT", ILINC_DEFAULT_HTTP_PORT);
                $this->tpl->setVariable("ILINC_DEFAULT_SSL_PORT", ILINC_DEFAULT_SSL_PORT);
                $this->tpl->setVariable("TXT_HTTP", $this->lng->txt('http'));
                $this->tpl->setVariable("TXT_SSL", $this->lng->txt('ssl'));
                
                $this->tpl->setVariable("TXT_SECONDS", $this->lng->txt("seconds"));
                $this->tpl->setVariable("TXT_ILINC_REGISTRAR_LOGIN", $this->lng->txt("extt_ilinc_registrar_login"));
                $this->tpl->setVariable("TXT_ILINC_REGISTRAR_PASSWD", $this->lng->txt("extt_ilinc_registrar_passwd"));
                $this->tpl->setVariable("TXT_ILINC_CUSTOMER_ID", $this->lng->txt("extt_ilinc_customer_id"));

                $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
                $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
                $this->tpl->setVariable("CMD_SUBMIT", "saveiLinc");
        }

Here is the call graph for this function:

ilObjExternalToolsSettingsGUI::getTabs ( &$  tabs_gui  ) 

get tabs public

Parameters:
object tabs gui object

Reimplemented from ilObjectGUI.

Definition at line 95 of file class.ilObjExternalToolsSettingsGUI.php.

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

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

Constructor public.

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

References ilObjectGUI::ilObjectGUI().

        {
                $this->type = "extt";
                $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
                
                define ("ILINC_DEFAULT_HTTP_PORT",80);
                define ("ILINC_DEFAULT_SSL_PORT",443);
                define ("ILINC_DEFAULT_TIMEOUT",30);
        }

Here is the call graph for this function:

ilObjExternalToolsSettingsGUI::saveiLincObject (  ) 

validates all input data, save them to database if correct and active chosen extt mode

public

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

References $_POST, $ilUser, ilObjectGUI::getReturnLocation(), ilUtil::isDN(), ilUtil::isIPv4(), ilUtil::redirect(), and sendInfo().

        {
         global $ilUser;

        // validate required data 
                if (!$_POST["ilinc"]["server"] or !$_POST["ilinc"]["port"] or !$_POST["ilinc"]["registrar_login"] or !$_POST["ilinc"]["registrar_passwd"] or !$_POST["ilinc"]["customer_id"])
                {
                        $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
                }
                
                // validate port
                if ((preg_match("/^[0-9]{0,5}$/",$_POST["ilinc"]["port"])) == false)
                {
                        $this->ilias->raiseError($this->lng->txt("err_invalid_port"),$this->ilias->error_obj->MESSAGE);
                }
                
                if (substr($_POST["ilinc"]["server"],0,8) != "https://" and substr($_POST["ilinc"]["server"],0,7) != "http://")
                {
                        $_POST["ilinc"]["server"] = $_POST["ilinc"]["protocol"]."://".$_POST["ilinc"]["server"];
                }
                
                $url = parse_url($_POST["ilinc"]["server"]);
                
                if (!ilUtil::isIPv4($url["host"]) and !ilUtil::isDN($url["host"]))
                {
                        $this->ilias->raiseError($this->lng->txt("err_invalid_server"),$this->ilias->error_obj->MESSAGE);
                }
                
                if (is_numeric($_POST["ilinc"]["timeout"]))
                {
                        $this->ilias->setSetting("ilinc_timeout", $_POST["ilinc"]["timeout"]);
                }

                // all ok. save settings
                $this->ilias->setSetting("ilinc_server", $url["host"]);
                $this->ilias->setSetting("ilinc_path", $url["path"]);
                $this->ilias->setSetting("ilinc_protocol", $_POST["ilinc"]["protocol"]);
                $this->ilias->setSetting("ilinc_port", $_POST["ilinc"]["port"]);
                $this->ilias->setSetting("ilinc_active", $_POST["ilinc"]["active"]);
                $this->ilias->setSetting("ilinc_registrar_login", $_POST["ilinc"]["registrar_login"]);
                $this->ilias->setSetting("ilinc_registrar_passwd", $_POST["ilinc"]["registrar_passwd"]);
                $this->ilias->setSetting("ilinc_customer_id", $_POST["ilinc"]["customer_id"]);

                sendInfo($this->lng->txt("extt_ilinc_settings_saved"),true);
                ilUtil::redirect($this->getReturnLocation("view",$this->ctrl->getLinkTarget($this,"")));
        }

Here is the call graph for this function:

ilObjExternalToolsSettingsGUI::viewObject (  ) 

display settings menu

public

Reimplemented from ilObjectGUI.

Definition at line 57 of file class.ilObjExternalToolsSettingsGUI.php.

References $rbacsystem, and ilObjectGUI::getTemplateFile().

        {
                global $rbacsystem;
                
                if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
                {
                        $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
                }
                
                $this->getTemplateFile("general");
                
                $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."&cmd=gateway");
                $this->tpl->setVariable("TXT_EXTT_TITLE", $this->lng->txt("extt_title_configure"));

                $this->tpl->setVariable("TXT_EXTT_NAME", $this->lng->txt("extt_name"));
                $this->tpl->setVariable("TXT_EXTT_ACTIVE", $this->lng->txt("active")."?");
                $this->tpl->setVariable("TXT_EXTT_DESC", $this->lng->txt("description"));

                $this->tpl->setVariable("TXT_CONFIGURE", $this->lng->txt("extt_configure"));
                $this->tpl->setVariable("TXT_EXTT_REMARK", $this->lng->txt("extt_remark"));

                // ilinc
                $this->tpl->setVariable("TXT_EXTT_ILINC_NAME", $this->lng->txt("extt_ilinc"));
                $this->tpl->setVariable("TXT_EXTT_ILINC_DESC", $this->lng->txt("extt_ilinc_desc"));

        
                // icon handlers
                $icon_ok = "<img src=\"".ilUtil::getImagePath("icon_ok.gif")."\" alt=\"".$this->lng->txt("enabled")."\" title=\"".$this->lng->txt("enabled")."\" border=\"0\" vspace=\"0\"/>";
                $icon_not_ok = "<img src=\"".ilUtil::getImagePath("icon_not_ok.gif")."\" alt=\"".$this->lng->txt("disabled")."\" title=\"".$this->lng->txt("disabled")."\" border=\"0\" vspace=\"0\"/>";

                $this->tpl->setVariable("EXTT_ILINC_ACTIVE", $this->ilias->getSetting('ilinc_active') ? $icon_ok : $icon_not_ok);
        }

Here is the call graph for this function:


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