<?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; ?>">
    <!--<p>Войти, используя соцсети:</p>-->
	<ul class="eauth-list">
		<?php foreach ($services as $name => $service) {
            if($service->id == 'google'){
               $image = '<img src="images/button_g.jpg" height="39" width="186" alt="">';
            }
            elseif($service->id == 'vk'){
                $image = '<img src="images/button_vk.jpg" height="39" width="186" alt="">';
            } 
            elseif($service->id == 'facebook'){
                $image = '<img src="images/button_f.jpg" height="39" width="186" alt="">'; 
            }
			//echo '<li class="eauth-service eauth-service-id-' . $service->id . '"><p>';
            echo '<li class="eauth-service-id-' . $service->id . '"><p>';
			echo Html::a($image, [$action, 'service_eauth' => $name], [
				//'class' => 'eauth-service-link',
				'data-eauth-service' => $service->id,
			]);
            
			echo '</p></li>';
		}
		?>
	</ul>
</div>
