|  |  |  | <?php
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Created by Error202
 | 
					
						
							|  |  |  |  * Date: 17.08.2018
 | 
					
						
							|  |  |  |  */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use core\entities\ModuleRecord;
 | 
					
						
							|  |  |  | use yii\helpers\Html;
 | 
					
						
							|  |  |  | use core\helpers\ModuleHelper;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @var $this \yii\web\View
 | 
					
						
							|  |  |  |  * @var $modules \core\entities\ModuleRecord[]
 | 
					
						
							|  |  |  |  */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $this->title = Yii::t('main', 'Modules');
 | 
					
						
							|  |  |  | $this->params['breadcrumbs'][] = $this->title;
 | 
					
						
							|  |  |  | ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div class="row">
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <?php foreach ($modules as $module): ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<?php
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$color = $module->isEnabled() ? '#00aced' : '#cccccc';
 | 
					
						
							|  |  |  | 		if ($module->isDisabled()) {
 | 
					
						
							|  |  |  | 			ModuleHelper::addModuleAdminTranslation($module->name);
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$module_name = in_array($module->name, array_keys(Yii::$app->getI18n()->translations)) ? Yii::t($module->name, $module->name) : $module->name;
 | 
					
						
							|  |  |  | 		$module_description = in_array($module->name, array_keys(Yii::$app->getI18n()->translations)) ? Yii::t($module->name, $module->description) : $module->description;
 | 
					
						
							|  |  |  | 	?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<div class="col-md-4">
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<div class="box">
 | 
					
						
							|  |  |  | 			<div class="box-header with-border">
 | 
					
						
							|  |  |  | 				<h3 class="box-title"><i class="fa fa-power-off" aria-hidden="true" style="color: <?= $color ?>"></i> <?= $module_name ?></h3>
 | 
					
						
							|  |  |  | 			</div>
 | 
					
						
							|  |  |  | 			<div class="box-body">
 | 
					
						
							|  |  |  | 				<?= $module_description ?>
 | 
					
						
							|  |  |  | 			</div>
 | 
					
						
							|  |  |  | 			<div class="box-footer" style="text-align: right">
 | 
					
						
							|  |  |  | 				<?php if ($module->isEnabled()): ?>
 | 
					
						
							|  |  |  | 					<?= Html::a(Yii::t('main', 'Disable'), ['module/disable', 'id' => $module->id], [
 | 
					
						
							|  |  |  | 						'class' => 'btn btn-default btn-sm',
 | 
					
						
							|  |  |  | 						'data' => [
 | 
					
						
							|  |  |  | 							'method' => 'post',
 | 
					
						
							|  |  |  | 						],
 | 
					
						
							|  |  |  | 					]) ?>
 | 
					
						
							|  |  |  | 				<?php else: ?>
 | 
					
						
							|  |  |  | 					<?= Html::a(Yii::t('main', 'Enable'), ['module/enable', 'id' => $module->id], [
 | 
					
						
							|  |  |  | 						'class' => 'btn btn-default btn-sm',
 | 
					
						
							|  |  |  | 						'data' => [
 | 
					
						
							|  |  |  | 							'method' => 'post',
 | 
					
						
							|  |  |  | 						],
 | 
					
						
							|  |  |  | 					]) ?>
 | 
					
						
							|  |  |  | 				<?php endif; ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				<?= Html::a(Yii::t('buttons', 'Delete'), ['module/delete', 'id' => $module->id], [
 | 
					
						
							|  |  |  | 					'class' => 'btn btn-danger btn-sm',
 | 
					
						
							|  |  |  | 					'data' => [
 | 
					
						
							|  |  |  | 						'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'),
 | 
					
						
							|  |  |  | 						'method' => 'post',
 | 
					
						
							|  |  |  | 					],
 | 
					
						
							|  |  |  | 				]) ?>
 | 
					
						
							|  |  |  | 			</div>
 | 
					
						
							|  |  |  | 		</div>
 | 
					
						
							|  |  |  | 	</div>
 | 
					
						
							|  |  |  | <?php endforeach; ?>
 | 
					
						
							|  |  |  | </div>
 |