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
 cancelObject ()
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 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
 __initSubTabs ($a_cmd)
executeCommand ()
 execute command

Detailed Description

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


Member Function Documentation

ilObjExternalToolsSettingsGUI::__initSubTabs ( a_cmd  ) 

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

Referenced by editiLincObject(), and viewObject().

        {
                $ilinc = ($a_cmd == 'editiLinc') ? true : false;
                $overview = ($a_cmd == 'view' or $a_cmd == '') ? true : false;

                $this->tabs_gui->addSubTabTarget("overview", $this->ctrl->getLinkTarget($this, "view"),
                                                                                 "", "", "", $overview);
                $this->tabs_gui->addSubTabTarget("extt_ilinc", $this->ctrl->getLinkTarget($this, "editiLinc"),
                                                                                 "", "", "", $ilinc);
        }

Here is the caller graph for this function:

ilObjExternalToolsSettingsGUI::cancelObject (  ) 

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

References sendInfo().

        {
                sendInfo($this->lng->txt("msg_cancel"),true);
                $this->ctrl->redirect($this, "view");
        }

Here is the call graph for this function:

ilObjExternalToolsSettingsGUI::editiLincObject (  ) 

Configure iLinc settings.

public

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

References $_SESSION, $rbacreview, $rbacsystem, __initSubTabs(), 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);
                }
                
                $this->__initSubTabs("editiLinc");
                
                if ($_SESSION["error_post_vars"])
                {
                        if ($_SESSION["error_post_vars"]["ilinc"]["active"] == "1")
                        {
                                $this->tpl->setVariable("CHK_ILINC_ACTIVE", "checked=\"checked\"");
                        }
                        
                        if ($_SESSION["error_post_vars"]["ilinc"]["akclassvalues_active"] == "1")
                        {
                                $this->tpl->setVariable("CHK_ILINC_AKCLASSVALUES_ACTIVE", "checked=\"checked\"");
                        }
                        
                        if ($_SESSION["error_post_vars"]["ilinc"]["akclassvalues_required"] == "1")
                        {
                                $this->tpl->setVariable("CHK_ILINC_AKCLASSVALUES_REQUIRED", "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"]);                   
                        }

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

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

                $this->getTemplateFile("ilinc");
                
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $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_ILINC_CONNECTION_DATA", $this->lng->txt("extt_ilinc_connection_data"));
                $this->tpl->setVariable("TXT_ILINC_ADDITIONAL_OPTIONS", $this->lng->txt("extt_ilinc_additional_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_ILINC_AKCLASSVALUES_ACTIVE", $this->lng->txt("extt_ilinc_akclassvalues_active"));
                $this->tpl->setVariable("TXT_ILINC_AKCLASSVALUES_ACTIVE_INFO", $this->lng->txt("extt_ilinc_akclassvalues_active_info"));
                $this->tpl->setVariable("TXT_ILINC_AKCLASSVALUES_REQUIRED", $this->lng->txt("extt_ilinc_akclassvalues_required"));
                $this->tpl->setVariable("TXT_ILINC_AKCLASSVALUES_REQUIRED_INFO", $this->lng->txt("extt_ilinc_akclassvalues_required_info"));

                $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::executeCommand (  ) 

execute command

Reimplemented from ilObjectGUI.

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

References $cmd, and ilObjectGUI::prepareOutput().

        {
                $next_class = $this->ctrl->getNextClass($this);
                $cmd = $this->ctrl->getCmd();
                $this->prepareOutput();

                switch($next_class)
                {
                        case 'ilpermissiongui':
                                include_once("./classes/class.ilPermissionGUI.php");
                                $perm_gui =& new ilPermissionGUI($this);
                                $ret =& $this->ctrl->forwardCommand($perm_gui);
                                break;

                        default:
                                if(!$cmd)
                                {
                                        $cmd = "view";
                                }
                                $cmd .= "Object";
                                $this->$cmd();

                                break;
                }
                return true;
        }

Here is the call graph for this function:

ilObjExternalToolsSettingsGUI::getAdminTabs ( &$  tabs_gui  ) 

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

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

References getTabs().

        {
                $this->getTabs($tabs_gui);
        }       

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 111 of file class.ilObjExternalToolsSettingsGUI.php.

References $rbacsystem.

Referenced by getAdminTabs().

        {
                global $rbacsystem;

                $this->ctrl->setParameter($this,"ref_id",$this->object->getRefId());

                if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
                {
                        $tabs_gui->addTarget("settings",
                                $this->ctrl->getLinkTarget($this, "view"), array("view","editiLinc",""), "", "");
                }

                if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
                {
                        $tabs_gui->addTarget("perm_settings",
                                $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
                }
        }

Here is the caller graph for this function:

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

Constructor public.

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

References ilObjectGUI::ilObjectGUI().

        {
                $this->type = "extt";
                $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
                
                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 257 of file class.ilObjExternalToolsSettingsGUI.php.

References $_POST, ilUtil::isDN(), ilUtil::isIPv4(), 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"]);
                
                $this->ilias->setSetting("ilinc_akclassvalues_active", $_POST["ilinc"]["akclassvalues_active"]);
                $this->ilias->setSetting("ilinc_akclassvalues_required", $_POST["ilinc"]["akclassvalues_required"]);

                sendInfo($this->lng->txt("extt_ilinc_settings_saved"),true);
                $this->ctrl->redirect($this,'editiLinc');
        }

Here is the call graph for this function:

ilObjExternalToolsSettingsGUI::viewObject (  ) 

display settings menu

public

Reimplemented from ilObjectGUI.

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

References $rbacsystem, __initSubTabs(), 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->__initSubTabs("view");
                
                $this->getTemplateFile("general");
                
                $this->tpl->setVariable("FORMACTION",
                        $this->ctrl->getFormAction($this));
                $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: