Public Member Functions | Protected Member Functions | Protected Attributes

ilECSSettingsGUI Class Reference
[Services/WebServices/ECS]

Public Member Functions

 __construct ()
 Constructor.
 executeCommand ()
 Execute command.

Protected Member Functions

 settings ()
 show settings
 initSettingsForm ()
 init settings form
 saveSettings ()
 save settings
 initSettings ()
 Init settings.

Protected Attributes

 $tpl
 $lng
 $ctrl

Detailed Description

Author:
Stefan Meyer <smeyer@databay.de>
Version:
$Id$

ilECSSettingsGUI:

Definition at line 33 of file class.ilECSSettingsGUI.php.


Constructor & Destructor Documentation

ilECSSettingsGUI::__construct (  ) 

Constructor.

public

Definition at line 45 of file class.ilECSSettingsGUI.php.

References $ilCtrl, $lng, $tpl, and initSettings().

        {
                global $lng,$tpl,$ilCtrl;
                
                $this->tpl = $tpl;
                $this->lng = $lng;
                $this->ctrl = $ilCtrl;
                
                $this->initSettings();
        }

Here is the call graph for this function:


Member Function Documentation

ilECSSettingsGUI::executeCommand (  ) 

Execute command.

public

Parameters:
 

Definition at line 63 of file class.ilECSSettingsGUI.php.

References $cmd.

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

                switch($next_class)
                {
                        default:
                                if(!$cmd)
                                {
                                        $cmd = "settings";
                                }
                                $this->$cmd();
                                break;
                }
                return true;
        }

ilECSSettingsGUI::initSettings (  )  [protected]

Init settings.

protected

Definition at line 253 of file class.ilECSSettingsGUI.php.

References ilECSSettings::_getInstance(), and settings().

Referenced by __construct().

        {       
                include_once('Services/WebServices/ECS/classes/class.ilECSSettings.php');
                $this->settings = ilECSSettings::_getInstance();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilECSSettingsGUI::initSettingsForm (  )  [protected]

init settings form

protected

Definition at line 132 of file class.ilECSSettingsGUI.php.

References ilECSSettings::PROTOCOL_HTTPS, and settings().

Referenced by settings().

        {
                if(is_object($this->form))
                {
                        return true;
                }
                include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
                
                $this->form = new ilPropertyFormGUI();
                $this->form->setFormAction($this->ctrl->getFormAction($this,'settings'));
                $this->form->setTitle($this->lng->txt('ecs_settings'));
                
                $ena = new ilCheckboxInputGUI($this->lng->txt('ecs_active'),'active');
                $ena->setChecked($this->settings->isEnabled());
                $ena->setValue(1);
                $this->form->addItem($ena);
                
                $ser = new ilTextInputGUI($this->lng->txt('ecs_server'),'server');
                $ser->setValue($this->settings->getServer());
                $ser->setRequired(true);
                $this->form->addItem($ser);
                
                $pro = new ilSelectInputGUI($this->lng->txt('ecs_protocol'),'protocol');
                // fixed to https
                #$pro->setOptions(array(ilECSSettings::PROTOCOL_HTTP => $this->lng->txt('http'),
                #               ilECSSettings::PROTOCOL_HTTPS => $this->lng->txt('https')));
                $pro->setOptions(array(ilECSSettings::PROTOCOL_HTTPS => 'HTTPS'));
                $pro->setValue($this->settings->getProtocol());
                $pro->setRequired(true);
                $this->form->addItem($pro);
                
                $por = new ilTextInputGUI($this->lng->txt('ecs_port'),'port');
                $por->setSize(5);
                $por->setMaxLength(5);
                $por->setValue($this->settings->getPort());
                $por->setRequired(true);
                $this->form->addItem($por);
                
                $cer = new ilTextInputGUI($this->lng->txt('ecs_client_cert'),'client_cert');
                $cer->setValue($this->settings->getClientCertPath());
                $cer->setRequired(true);
                $this->form->addItem($cer);
                
                $cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'),'ca_cert');
                $cer->setValue($this->settings->getCACertPath());
                $cer->setRequired(true);
                $this->form->addItem($cer);

                $cer = new ilTextInputGUI($this->lng->txt('ecs_cert_key'),'key_path');
                $cer->setValue($this->settings->getKeyPath());
                $cer->setRequired(true);
                $this->form->addItem($cer);
                
                $cer = new ilTextInputGUI($this->lng->txt('ecs_key_password'),'key_password');
                $cer->setValue($this->settings->getKeyPassword());
                $cer->setInputType('password');
                $cer->setRequired(true);
                $this->form->addItem($cer);

                $loc = new ilFormSectionHeaderGUI();
                $loc->setTitle($this->lng->txt('ecs_local_settings'));
                $this->form->addItem($loc);
                
                $pol = new ilDurationInputGUI($this->lng->txt('ecs_polling'),'polling');
                $pol->setShowDays(false);
                $pol->setShowHours(false);
                $pol->setShowMinutes(true);
                $pol->setShowSeconds(true);
                $pol->setSeconds($this->settings->getPollingTimeSeconds());
                $pol->setMinutes($this->settings->getPollingTimeMinutes());
                $pol->setRequired(true);
                $this->form->addItem($pol);
                
                $imp = new ilTextInputGUI($this->lng->txt('import_id'),'import_id');
                $imp->setSize(5);
                $imp->setMaxLength(6);
                $imp->setValue($this->settings->getImportId() ? $this->settings->getImportId() : '');
                $this->form->addItem($imp);
                
                $this->form->addCommandButton('saveSettings',$this->lng->txt('save'));
                $this->form->addCommandButton('settings',$this->lng->txt('cancel'));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilECSSettingsGUI::saveSettings (  )  [protected]

save settings

protected

Definition at line 220 of file class.ilECSSettingsGUI.php.

References ilUtil::sendInfo(), settings(), and ilUtil::stripSlashes().

        {
                $this->settings->setEnabledStatus((int) $_POST['active']);
                $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
                $this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
                $this->settings->setProtocol(ilUtil::stripSlashes($_POST['protocol']));
                $this->settings->setClientCertPath(ilUtil::stripSlashes($_POST['client_cert']));
                $this->settings->setCACertPath(ilUtil::stripSlashes($_POST['ca_cert']));
                $this->settings->setKeyPath(ilUtil::stripSlashes($_POST['key_path']));
                $this->settings->setKeyPassword(ilUtil::stripSlashes($_POST['key_password']));
                $this->settings->setImportId(ilUtil::stripSlashes($_POST['import_id']));
                $this->settings->setPollingTimeMS((int) $_POST['polling']['mm'],(int) $_POST['polling']['ss']);
                $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
                
                if($this->settings->validate())
                {
                        $this->settings->save();
                        ilUtil::sendInfo($this->lng->txt('settings_saved'));
                }
                else
                {
                        ilUtil::sendInfo($this->lng->txt('fill_out_all_required_fields'));
                }
                $this->settings();
                return true;
        }

Here is the call graph for this function:

ilECSSettingsGUI::settings (  )  [protected]

show settings

protected

Definition at line 86 of file class.ilECSSettingsGUI.php.

References $res, and initSettingsForm().

Referenced by initSettings(), initSettingsForm(), and saveSettings().

        {
                $this->initSettingsForm();
                
                $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_settings.html','Services/WebServices/ECS');
                $this->tpl->setVariable('SETTINGS_TABLE',$this->form->getHTML());
                
                include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
                include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
                
                try
                {
                        $connector = new ilECSConnector();
                        $res = $connector->getResources();
                        #var_dump("<pre>",$res->getResult(),"</pre>");
                        
                        #$connector = new ilECSConnector();
                        #$res = $connector->addResource(json_encode($res->getResult()));
                        #var_dump("<pre>",$res->getResult(),"</pre>");
                        
                        #$connector = new ilECSConnector();
                        #$res = $connector->deleteResource(4);
                        #var_dump("<pre>",$res->getResult(),"</pre>");
                        
                        $json_arr = $res->getResult();
                        $json_arr[0]->lecturer[] = 'Stefan Meyer';
                        $json_arr[0]->credits = 99;
                        
                        $connector = new ilECSConnector();
                        $res = $connector->updateResource($json_arr[0]->eid,json_encode($json_arr[0]));
                        
                        var_dump("<pre>",$res->getResult(),$res->getPlainResultString(),"</pre>");
                        
                }
                catch(ilECSConnectorException $exc)
                {
                        var_dump("<pre>",$exc->getMessage(),"</pre>");
                }               
                
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilECSSettingsGUI::$ctrl [protected]

Definition at line 37 of file class.ilECSSettingsGUI.php.

ilECSSettingsGUI::$lng [protected]

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

Referenced by __construct().

ilECSSettingsGUI::$tpl [protected]

Definition at line 35 of file class.ilECSSettingsGUI.php.

Referenced by __construct().


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