Blame view

common/components/nodge/eauth/src/views/widget.php 1012 Bytes
14a09168   Alex Savenko   init commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  <?php

  

  use yii\helpers\Html;

  use yii\web\View;

  

  /** @var $this View */

  /** @var $id string */

  /** @var $services stdClass[] See EAuth::getServices() */

  /** @var $action string */

  /** @var $popup bool */

  /** @var $assetBundle string Alias to AssetBundle */

  

  Yii::createObject(['class' => $assetBundle])->register($this);

  

  // Open the authorization dilalog in popup window.

  if ($popup) {

  	$options = [];

  	foreach ($services as $name => $service) {

  		$options[$service->id] = $service->jsArguments;

  	}

  	$this->registerJs('$("#' . $id . '").eauth(' . json_encode($options) . ');');

  }

  

  ?>

  <div class="eauth" id="<?php echo $id; ?>">

  	<ul class="eauth-list">

  		<?php

  		foreach ($services as $name => $service) {

  			echo '<li class="eauth-service eauth-service-id-' . $service->id . '">';

  			echo Html::a($service->title, [$action, 'service' => $name], [

  				'class' => 'eauth-service-link',

  				'data-eauth-service' => $service->id,

  			]);

  			echo '</li>';

  		}

  		?>

  	</ul>

  </div>