'countUsersOnline' => $this->getUserModule()->getRepository()->countUsersOnline(), | 'countUsersOnline' => $this->getUserModule()->getRepository()->countUsersOnline(), | ||||
'countTicketsAdminOpen' => $this->getTicketModule()->getRepository()->countTicketsAdminStatusOpen(), | 'countTicketsAdminOpen' => $this->getTicketModule()->getRepository()->countTicketsAdminStatusOpen(), | ||||
'countTicketsAdminUnread' => $this->getTicketModule()->getRepository()->countTicketsAdminUnreadByUser($this->getUserCurrent()), | 'countTicketsAdminUnread' => $this->getTicketModule()->getRepository()->countTicketsAdminUnreadByUser($this->getUserCurrent()), | ||||
'statisticsCacheHtml' => \Yii::$app->cache->get('dashboard_statistics10') ?: '' | |||||
'usersWithStatusProducerOnlineArray' => $this->getUserModule()->getRepository()->findUsersWithStatusProducerAndOnline() | |||||
//'statisticsCacheHtml' => \Yii::$app->cache->get('dashboard_statistics12') ?: '', | |||||
]); | ]); | ||||
} | } | ||||
public function actionAjaxStatisticsHtml() | public function actionAjaxStatisticsHtml() | ||||
{ | { | ||||
return \Yii::$app->cache->getOrSet('dashboard_statistics10', function () { | |||||
return \Yii::$app->cache->getOrSet('dashboard_statistics12', function () { | |||||
$producerModule = $this->getProducerModule(); | $producerModule = $this->getProducerModule(); | ||||
$pointSaleModule = $this->getPointSaleModule(); | $pointSaleModule = $this->getPointSaleModule(); | ||||
$userModule = $this->getUserModule(); | $userModule = $this->getUserModule(); |
<?php | <?php | ||||
use common\helpers\AdminLTE; | use common\helpers\AdminLTE; | ||||
use common\helpers\Image; | |||||
use yii\helpers\Html; | |||||
$this->setTitle('Tableau de bord'); | $this->setTitle('Tableau de bord'); | ||||
$this->setMetaRefresh(true); | |||||
?> | ?> | ||||
Yii::$app->urlManager->createUrl('online-admin/index') | Yii::$app->urlManager->createUrl('online-admin/index') | ||||
) ?> | ) ?> | ||||
</div> | </div> | ||||
<div class="col-lg-6 col-xs-6" id="producers-online"> | |||||
<!--<h3>Producteurs en ligne :</h3>--> | |||||
<?php if($usersWithStatusProducerOnlineArray && count($usersWithStatusProducerOnlineArray) > 0): ?> | |||||
<?php foreach ($usersWithStatusProducerOnlineArray as $userWithStatusProducerOnline): ?> | |||||
<?php $producer = $userWithStatusProducerOnline->producer; ?> | |||||
<?php if($producer): ?> | |||||
<a class="btn btn-default" title="Aller sur le compte de ce producteur" href="<?= $this->getUrlManagerBackend()->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>"> | |||||
<?= $producer->name; ?> | |||||
</a> | |||||
<?php endif; ?> | |||||
<?php endforeach; ?> | |||||
<div class="clr"></div> | |||||
<?php else: ?> | |||||
<div class="alert alert-info">Aucun producteur en ligne actuellement.</div> | |||||
<?php endif; ?> | |||||
</div> | |||||
</div> | </div> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-lg-6 col-xs-6"> | <div class="col-lg-6 col-xs-6"> | ||||
</div> | </div> | ||||
<div id="dashboard-admin-statistics-html"> | <div id="dashboard-admin-statistics-html"> | ||||
<?= $statisticsCacheHtml ?> | |||||
<a class="btn btn-default btn-load" href="javascript:void(0);">Charger les statistiques</a> | |||||
</div> | </div> | ||||
</div> | </div> |
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>" | src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>" | ||||
alt="Logo <?= Html::encode($producer->name) ?>"> | alt="Logo <?= Html::encode($producer->name) ?>"> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
<h3 class="profile-username text-center"> | <h3 class="profile-username text-center"> | ||||
<a title="Aller sur le compte de ce producteur" href="<?= $this->getUrlManagerBackend()->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>"> | <a title="Aller sur le compte de ce producteur" href="<?= $this->getUrlManagerBackend()->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>"> | ||||
<?= $producer->name; ?> | <?= $producer->name; ?> |
color: white; | color: white; | ||||
} | } | ||||
/* line 4, ../sass/dashboard-admin/_index.scss */ | |||||
.dashboard-admin-index #producers-online h3 { | |||||
margin-top: 0px; | |||||
} | |||||
/** | /** | ||||
Copyright distrib (2018) | Copyright distrib (2018) | ||||
function opendistrib_dashboard_admin_statistics() { | function opendistrib_dashboard_admin_statistics() { | ||||
var selector = '#dashboard-admin-statistics-html'; | var selector = '#dashboard-admin-statistics-html'; | ||||
if($(selector).length) { | if($(selector).length) { | ||||
$.get(UrlManager.getBaseUrl() + 'dashboard-admin/ajax-statistics-html', {}, function(result) { | |||||
$(selector).html(result); | |||||
$(selector+' .btn-load').click(function() { | |||||
$(selector).html('Chargement ...'); | |||||
$.get(UrlManager.getBaseUrl() + 'dashboard-admin/ajax-statistics-html', {}, function(result) { | |||||
$(selector).html(result); | |||||
}); | |||||
}); | }); | ||||
} | } | ||||
} | } |
.dashboard-admin-index { | .dashboard-admin-index { | ||||
#producers-online { | |||||
h3 { | |||||
margin-top: 0px; | |||||
} | |||||
} | |||||
} | } |