Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
EAuthWidget Class Reference

Public Member Functions

 init ()
 run ()

Public Attributes

 $component = 'eauth'
 $services = null
 $popup = null
 $action = null

Protected Member Functions

 registerAssets ()

Detailed Description

Definition at line 14 of file EAuthWidget.php.

Member Function Documentation

EAuthWidget::init ( )

Initializes the widget. This method is called by CBaseController::createWidget and CBaseController::beginWidget after the widget's properties have been initialized.

Definition at line 43 of file EAuthWidget.php.

{
// EAuth component
$component = Yii::app()->{$this->component};
// Some default properties from component configuration
if (!isset($this->services))
$this->services = $component->getServices();
if (!isset($this->popup))
$this->popup = $component->popup;
// Set the current route, if it is not set.
if (!isset($this->action))
$this->action = Yii::app()->urlManager->parseUrl(Yii::app()->request);
}
EAuthWidget::registerAssets ( )
protected

Register CSS and JS files.

Definition at line 78 of file EAuthWidget.php.

{
$cs = Yii::app()->clientScript;
$cs->registerCoreScript('jquery');
$assets_path = dirname(__FILE__).DIRECTORY_SEPARATOR.'assets';
$url = Yii::app()->assetManager->publish($assets_path, false, -1, YII_DEBUG);
$cs->registerCssFile($url.'/css/auth.css');
// Open the authorization dilalog in popup window.
if ($this->popup) {
$cs->registerScriptFile($url.'/js/auth.js', CClientScript::POS_HEAD);
$js = '';
foreach ($this->services as $name => $service) {
$args = $service->jsArguments;
$args['id'] = $service->id;
$js .= '$(".auth-service.'.$service->id.' a").eauth('.json_encode($args).');'."\n";
}
$cs->registerScript('eauth-services', $js, CClientScript::POS_READY);
}
}
EAuthWidget::run ( )

Executes the widget. This method is called by CBaseController::endWidget.

Definition at line 64 of file EAuthWidget.php.

{
$this->registerAssets();
$this->render('auth', array(
'id' => $this->getId(),
'services' => $this->services,
'action' => $this->action,
));
}

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