ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilOpenIdSettingsGUI Class Reference

Open ID Settings GUI More...

+ Collaboration diagram for ilOpenIdSettingsGUI:

Public Member Functions

 __construct ($a_ref_id)
 Constructor.
 executeCommand ()
 Execute control command.
 getRefId ()
 Get ref id of settings object.

Protected Member Functions

 settings ()
 Show general settings.
 save ()
 Save settings.
 provider ()
 Administrate openid provider.
 deleteProvider ()
 Delete selected provider.
 addProvider ()
 Create new provider.
 editProvider ()
 Create new provider.
 createProvider ()
 Create new provider.
 updateProvider ()
 Update provider settings.
 initFormProvider ($a_mode= 'edit')
 Show provider form.
 initProvider ($a_provider_id)
 Init provider.
 loadProviderFromPost ()
 load provider from post

Private Member Functions

 setSubTabs ()
 Set sub tabs for open id section.
 prepareRoleSelection ()
 Prepare default role selection.

Private Attributes

 $ctrl
 $lng
 $tpl
 $ref_id
 $settings
 $form = null
 $provider = null

Detailed Description

Open ID Settings GUI

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

ilOpenIdSettingsGUI: ilObjAuthSettingsGUI

Definition at line 13 of file class.ilOpenIdSettingsGUI.php.

Constructor & Destructor Documentation

ilOpenIdSettingsGUI::__construct (   $a_ref_id)

Constructor.

Definition at line 29 of file class.ilOpenIdSettingsGUI.php.

References $GLOBALS, ilOpenIdSettings\getInstance(), and settings().

{
$this->ref_id = $a_ref_id;
$this->ctrl = $GLOBALS['ilCtrl'];
$this->lng = $GLOBALS['lng'];
$this->tpl = $GLOBALS['tpl'];
$this->lng->loadLanguageModule('auth');
}

+ Here is the call graph for this function:

Member Function Documentation

ilOpenIdSettingsGUI::addProvider ( )
protected

Create new provider.

Returns

Definition at line 215 of file class.ilOpenIdSettingsGUI.php.

References initFormProvider(), initProvider(), and setSubTabs().

{
global $ilTabs;
$this->setSubTabs();
$ilTabs->setSubTabActive('auth_openid_provider');
$this->initProvider(0);
$this->initFormProvider('add');
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

ilOpenIdSettingsGUI::createProvider ( )
protected

Create new provider.

Returns

Definition at line 249 of file class.ilOpenIdSettingsGUI.php.

References $tpl, initFormProvider(), initProvider(), loadProviderFromPost(), provider(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $tpl;
$this->initProvider(0);
$this->initFormProvider('add');
if(!$this->form->checkInput())
{
$this->form->setValuesByPost();
ilUtil::sendFailure($this->lng->txt('err_check_input'));
$tpl->setContent($this->form->getHTML());
return false;
}
$this->provider->add();
ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'provider');
}

+ Here is the call graph for this function:

ilOpenIdSettingsGUI::deleteProvider ( )
protected

Delete selected provider.

Returns

Definition at line 193 of file class.ilOpenIdSettingsGUI.php.

References $_POST, $provider, initProvider(), provider(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if(!isset($_POST['provider_ids']) or !$_POST['provider_ids'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->provider();
return true;
}
foreach($_POST['provider_ids'] as $provider)
{
$this->initProvider($provider);
$this->provider->delete();
}
ilUtil::sendSuccess($this->lng->txt('auth_openid_deleted_provider'),TRUE);
$this->ctrl->redirect($this,'provider');
}

+ Here is the call graph for this function:

ilOpenIdSettingsGUI::editProvider ( )
protected

Create new provider.

Returns

Definition at line 231 of file class.ilOpenIdSettingsGUI.php.

References $_GET, initFormProvider(), initProvider(), and setSubTabs().

{
global $ilTabs;
$this->setSubTabs();
$ilTabs->setSubTabActive('auth_openid_provider');
$this->ctrl->setParameter($this,'provider_id',$_GET['provider_id']);
$this->initProvider((int) $_GET['provider_id']);
$this->initFormProvider('edit');
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

ilOpenIdSettingsGUI::executeCommand ( )

Execute control command.

Returns

Definition at line 43 of file class.ilOpenIdSettingsGUI.php.

References $cmd, $ilErr, and $lng.

{
global $ilAccess, $ilErr, $lng;
if(!$ilAccess->checkAccess('read','',$this->getRefId()))
{
$ilErr->raiseError($lng->txt('msg_no_perm_read'),$ilErr->WARNING);
}
switch($this->ctrl->getNextClass($this))
{
default:
if(!$cmd = $this->ctrl->getCmd())
{
$cmd = 'settings';
}
$this->$cmd();
break;
}
}
ilOpenIdSettingsGUI::getRefId ( )

Get ref id of settings object.

Returns
int

Definition at line 87 of file class.ilOpenIdSettingsGUI.php.

References $ref_id.

{
return $this->ref_id;
}
ilOpenIdSettingsGUI::initFormProvider (   $a_mode = 'edit')
protected

Show provider form.

Parameters
string$a_mode[optional] add | edit
Returns

Definition at line 298 of file class.ilOpenIdSettingsGUI.php.

References $title, provider(), and ilTextInputGUI\setValidationRegexp().

Referenced by addProvider(), createProvider(), editProvider(), and updateProvider().

{
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this,'provider'));
$this->form->setTableWidth('75%');
switch($a_mode)
{
case 'edit':
$this->form->setTitle($this->lng->txt('auth_openid_provider_edit'));
$this->form->addCommandButton('updateProvider', $this->lng->txt('save'));
$this->form->addCommandButton('provider', $this->lng->txt('cancel'));
break;
case 'add':
$this->form->setTitle($this->lng->txt('auth_openid_provider_add'));
$this->form->addCommandButton('createProvider', $this->lng->txt('btn_add'));
$this->form->addCommandButton('provider', $this->lng->txt('cancel'));
break;
}
$title = new ilTextInputGUI($this->lng->txt('title'),'title');
$title->setRequired(true);
$title->setMaxLength(128);
$title->setSize(32);
$title->setValue($this->provider->getName());
$this->form->addItem($title);
$url = new ilTextInputGUI($this->lng->txt('url'),'url');
$url->setValidationRegexp('/http.*%s.*/');
$url->setRequired(true);
$url->setMaxLength(255);
$url->setSize(32);
$url->setInfo($this->lng->txt('auth_openid_url_info'));
$url->setValue($this->provider->getURL());
$this->form->addItem($url);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOpenIdSettingsGUI::initProvider (   $a_provider_id)
protected

Init provider.

Parameters
object$a_provider_id
Returns

Definition at line 342 of file class.ilOpenIdSettingsGUI.php.

References $provider, and provider().

Referenced by addProvider(), createProvider(), deleteProvider(), editProvider(), and updateProvider().

{
include_once './Services/OpenId/classes/class.ilOpenIdProvider.php';
$this->provider = new ilOpenIdProvider($a_provider_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOpenIdSettingsGUI::loadProviderFromPost ( )
protected

load provider from post

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

References provider().

Referenced by createProvider(), and updateProvider().

{
$this->provider->setName($this->form->getInput('title'));
$this->provider->setURL($this->form->getInput('url'));
return $this->provider();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOpenIdSettingsGUI::prepareRoleSelection ( )
private

Prepare default role selection.

Returns

Definition at line 365 of file class.ilOpenIdSettingsGUI.php.

References ilObject\_lookupTitle(), and ilUtil\_sortIds().

Referenced by settings().

{
global $rbacreview,$ilObjDataCache;
$global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(),
'object_data',
'title',
'obj_id');
$select[0] = $this->lng->txt('links_select_one');
foreach($global_roles as $role_id)
{
$select[$role_id] = ilObject::_lookupTitle($role_id);
}
return $select;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOpenIdSettingsGUI::provider ( )
protected

Administrate openid provider.

Returns

Definition at line 174 of file class.ilOpenIdSettingsGUI.php.

References $GLOBALS, and setSubTabs().

Referenced by createProvider(), deleteProvider(), initFormProvider(), initProvider(), loadProviderFromPost(), and updateProvider().

{
global $ilTabs;
$this->setSubTabs();
$ilTabs->setSubTabActive('auth_openid_provider');
include_once './Services/OpenId/classes/class.ilOpenIdProviderTableGUI.php';
$table = new ilOpenIdProviderTableGUI($this,'provider');
$table->parse();
$GLOBALS['tpl']->setContent($table->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOpenIdSettingsGUI::save ( )
protected

Save settings.

Returns

Definition at line 156 of file class.ilOpenIdSettingsGUI.php.

References $_POST, ilUtil\sendSuccess(), and settings().

{
$this->settings->setActive((int) $_POST['active']);
$this->settings->forceProviderSelection((int) !$_POST['free']);
$this->settings->enableCreation((int) $_POST['sync']);
$this->settings->enableAccountMigration((int) $_POST['migration']);
$this->settings->setDefaultRole((int) $_POST['role']);
$this->settings->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'settings');
}

+ Here is the call graph for this function:

ilOpenIdSettingsGUI::setSubTabs ( )
private

Set sub tabs for open id section.

private

Definition at line 68 of file class.ilOpenIdSettingsGUI.php.

Referenced by addProvider(), editProvider(), provider(), and settings().

{
global $ilTabs;
$ilTabs->addSubTabTarget(
"auth_openid_settings",
$this->ctrl->getLinkTarget($this,'settings')
);
$ilTabs->addSubTabTarget(
'auth_openid_provider',
$this->ctrl->getLinkTarget($this,'provider')
);
}

+ Here is the caller graph for this function:

ilOpenIdSettingsGUI::settings ( )
protected

Show general settings.

Returns

Definition at line 96 of file class.ilOpenIdSettingsGUI.php.

References $lng, $tpl, prepareRoleSelection(), ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), and setSubTabs().

Referenced by __construct(), and save().

{
global $tpl,$lng,$ilTabs;
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.openid_settings.html','Services/OpenId');
$this->setSubTabs();
$ilTabs->setSubTabActive('auth_openid_settings');
$this->form = new ilPropertyFormGUI();
$this->form->setTableWidth('75%');
$this->form->setFormAction($this->ctrl->getFormAction($this,'save'));
$this->form->setTitle($this->lng->txt('auth_openid_configure'));
// Activation
$check = new ilCheckboxInputGUI($this->lng->txt('auth_openid_enable'),'active');
$check->setChecked($this->settings->isActive() ? 1 : 0);
$check->setValue(1);
$this->form->addItem($check);
// Selection
$sel = new ilCheckboxInputGUI($this->lng->txt('auth_openid_uncontrolled_selection'),'free');
$sel->setChecked(!$this->settings->forcedProviderSelection() ? 1 : 0);
$sel->setValue(1);
$sel->setInfo($this->lng->txt('auth_openid_uncontrolled_selection_info'));
$this->form->addItem($sel);
// Creation
$check = new ilCheckboxInputGUI($this->lng->txt('auth_openid_sync'),'sync');
$check->setInfo($this->lng->txt('auth_openid_sync_info'));
$check->setChecked($this->settings->isCreationEnabled() ? 1 : 0);
$check->setValue(1);
// Role selection
$select = new ilSelectInputGUI($this->lng->txt('auth_openid_role_select'),'role');
$select->setOptions($this->prepareRoleSelection());
$select->setValue($this->settings->getDefaultRole());
$check->addSubItem($select);
$migr = new ilCheckboxInputGUI($this->lng->txt('auth_openid_migration'),'migration');
$migr->setInfo($this->lng->txt('auth_openid_migration_info'));
$migr->setChecked($this->settings->isAccountMigrationEnabled() ? 1 : 0);
$migr->setValue(1);
$check->addSubItem($migr);
$this->form->addItem($check);
$this->form->addCommandButton('save',$this->lng->txt('save'));
$tpl->setVariable('SETTINGS_FORM',$this->form->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOpenIdSettingsGUI::updateProvider ( )
protected

Update provider settings.

Returns

Definition at line 273 of file class.ilOpenIdSettingsGUI.php.

References $_GET, $tpl, initFormProvider(), initProvider(), loadProviderFromPost(), provider(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $tpl;
$this->initProvider((int) $_GET['provider_id']);
$this->initFormProvider('edit');
if(!$this->form->checkInput())
{
$this->form->setValuesByPost();
ilUtil::sendFailure($this->lng->txt('err_check_input'));
$tpl->setContent($this->form->getHTML());
return false;
}
$this->provider->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'provider');
}

+ Here is the call graph for this function:

Field Documentation

ilOpenIdSettingsGUI::$ctrl
private

Definition at line 15 of file class.ilOpenIdSettingsGUI.php.

ilOpenIdSettingsGUI::$form = null
private

Definition at line 22 of file class.ilOpenIdSettingsGUI.php.

ilOpenIdSettingsGUI::$lng
private

Definition at line 16 of file class.ilOpenIdSettingsGUI.php.

Referenced by executeCommand(), and settings().

ilOpenIdSettingsGUI::$provider = null
private

Definition at line 23 of file class.ilOpenIdSettingsGUI.php.

Referenced by deleteProvider(), and initProvider().

ilOpenIdSettingsGUI::$ref_id
private

Definition at line 19 of file class.ilOpenIdSettingsGUI.php.

Referenced by getRefId().

ilOpenIdSettingsGUI::$settings
private

Definition at line 20 of file class.ilOpenIdSettingsGUI.php.

ilOpenIdSettingsGUI::$tpl
private

Definition at line 17 of file class.ilOpenIdSettingsGUI.php.

Referenced by createProvider(), settings(), and updateProvider().


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