19 public $component =
'eauth';
25 public $services = null;
35 public $action = null;
47 $component = Yii::app()->{$this->component};
50 if (!isset($this->services))
51 $this->services = $component->getServices();
52 if (!isset($this->popup))
53 $this->popup = $component->popup;
56 if (!isset($this->action))
57 $this->action = Yii::app()->urlManager->parseUrl(Yii::app()->request);
64 public function run() {
67 $this->registerAssets();
68 $this->render(
'auth', array(
69 'id' => $this->getId(),
70 'services' => $this->services,
71 'action' => $this->action,
79 $cs = Yii::app()->clientScript;
80 $cs->registerCoreScript(
'jquery');
82 $assets_path = dirname(__FILE__).DIRECTORY_SEPARATOR.
'assets';
83 $url = Yii::app()->assetManager->publish($assets_path,
false, -1, YII_DEBUG);
84 $cs->registerCssFile($url.
'/css/auth.css');
88 $cs->registerScriptFile($url.
'/js/auth.js', CClientScript::POS_HEAD);
90 foreach ($this->services as $name => $service) {
91 $args = $service->jsArguments;
92 $args[
'id'] = $service->id;
93 $js .=
'$(".auth-service.'.$service->id.
' a").eauth('.json_encode($args).
');'.
"\n";
95 $cs->registerScript(
'eauth-services', $js, CClientScript::POS_READY);