Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->actionUrl) {
         $this->actionUrl = ['/' . Module::getInstance()->id . '/site/search'];
     }
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if (!$this->actionUrl) {
         $this->actionUrl = ['/' . Module::getInstance()->id . '/site/search'];
     }
 }
Ejemplo n.º 3
0
<?php

/**
 * @var $this yii\web\View
 * @var string $content
 */
use maddoger\admin\Module;
use maddoger\admin\widgets\Alerts;
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
$this->params['bodyClass'] = 'skin-blue';
/**
 * @var \maddoger\admin\Module $adminModule
 */
$adminModule = Module::getInstance();
//Logo text
$logo = $adminModule->logoText ?: Yii::$app->name;
if ($adminModule->logoImageUrl) {
    $logo = Html::img($adminModule->logoImageUrl, ['alt' => $logo, 'class' => 'img-responsive']);
}
$this->beginContent('@maddoger/admin/views/layouts/base.php');
?>
    <!-- Site wrapper -->
    <div class="wrapper">

        <header class="main-header">
            <!-- Logo -->
            <a href="<?php 
echo Yii::$app->getHomeUrl();
?>
" class="logo">
Ejemplo n.º 4
0
 /**
  * @return string
  */
 public function actionError()
 {
     if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
         return '';
     }
     if ($exception instanceof HttpException) {
         $code = $exception->statusCode;
     } else {
         $code = $exception->getCode();
     }
     if ($exception instanceof Exception) {
         $name = $exception->getName();
     } else {
         $name = Yii::t('maddoger/admin', 'Error');
     }
     if ($code) {
         $name .= " (#{$code})";
     }
     if ($exception instanceof UserException) {
         $message = $exception->getMessage();
     } else {
         $message = Yii::t('maddoger/admin', 'An internal server error occurred.');
         if (Module::getInstance()->sendSystemMessageOnServerError) {
             SystemMessage::send($name . ' ' . Yii::$app->request->url, $exception->getMessage(), 'error', $exception->getTraceAsString());
         }
     }
     if (Yii::$app->getRequest()->getIsAjax()) {
         return "{$name}: {$message}";
     } else {
         return $this->render('error', ['name' => $name, 'message' => $message, 'exception' => $exception]);
     }
 }
Ejemplo n.º 5
0
 /**
  * @return string
  */
 public function actionIndex()
 {
     $view = Module::getInstance()->dashboardView ?: 'dashboard';
     return $this->render($view, ['menu' => Module::getInstance()->getSidebarMenu(), 'messages' => Yii::$app->user->can('admin.log') ? Log::findLastMessages()->limit(10)->all() : false]);
 }
Ejemplo n.º 6
0
<?php

use maddoger\admin\Module;
?>
<div class="pull-right hidden-xs">
    <?php 
echo Yii::t('maddoger/admin', 'Version');
?>
: <?php 
echo Yii::$app->version;
?>
</div>
<?php 
echo Yii::t('maddoger/admin', 'Copyright &copy; {years}, {company}. All rights reserved.', ['years' => date('Y'), 'company' => Module::getInstance()->logoText ?: Yii::$app->name]);
Ejemplo n.º 7
0
 /**
  * @return array
  */
 public function getSidebarMenu()
 {
     $menu = null;
     $cacheKey = 'ADMIN_SIDEBAR_MENU';
     if ($this->sidebarMenuCache !== false) {
         $menu = Yii::$app->cache->get($cacheKey);
     } else {
         Yii::$app->cache->delete($cacheKey);
     }
     if (!$menu) {
         $menu = $this->sidebarMenu ?: [['label' => Yii::t('maddoger/admin', 'Dashboard'), 'icon' => 'fa fa-dashboard', 'url' => ['/' . Module::getInstance()->id . '/site/index'], 'sort' => -1]];
         if ($this->sidebarMenuUseModules) {
             $sortIndex = 0;
             //Get navigation from modules
             foreach (Yii::$app->modules as $moduleId => $module) {
                 if (!$module instanceof \yii\base\Module) {
                     $module = Yii::$app->getModule($moduleId, true);
                 }
                 if ($module instanceof BackendModule) {
                     $sort = $module->sortNumber ?: ++$sortIndex * 100;
                     $navigation = $module->getNavigation();
                     foreach ($navigation as $key => $value) {
                         if (!isset($navigation[$key]['sort'])) {
                             $navigation[$key]['sort'] = $sort;
                         }
                     }
                     $menu = array_merge($menu, $navigation);
                 }
             }
             //Sort
             usort($menu, function ($a, $b) {
                 $res = 0;
                 if ($a['sort'] != $b['sort']) {
                     $res = $a['sort'] > $b['sort'] ? 1 : -1;
                 }
                 /*if (!$res) {
                       $res = strcmp($a['label'], $b['label']);
                   }*/
                 return $res;
             });
         }
         if ($this->sidebarMenuCache !== false) {
             Yii::$app->cache->set($cacheKey, $menu, $this->sidebarMenuCache);
         }
     }
     return $menu;
 }
Ejemplo n.º 8
0
<?php

/* @var $this yii\web\View */
use maddoger\admin\Module;
use maddoger\admin\widgets\Menu;
use maddoger\core\models\SystemMessage;
use yii\helpers\Html;
$this->title = Yii::t('maddoger/admin', 'Dashboard');
/**
 * @var maddoger\admin\models\User $user
 */
$user = Yii::$app->user->identity;
$menu = Module::getInstance()->getSidebarMenu();
?>
<div class="dashboard">
    <?php 
echo Menu::widget(['items' => $menu, 'activateParents' => true, 'labelTemplate' => '<a href="#">{icon}{label}</a>', 'submenuTemplate' => "\n<ul class=\"menu\">\n{items}\n</ul>\n", 'submenuItemClass' => 'treeview', 'options' => ['class' => 'dashboard-menu']]);
?>

    <?php 
if (Yii::$app->user->can('admin.system-messages.viewList')) {
    ?>
        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-warning"></i>&nbsp;<?php 
    echo Yii::t('maddoger/admin', 'System messages');
    ?>
                    <small><?php 
    echo Html::a(Yii::t('maddoger/admin', 'more info'), ['system-messages/index']);
    ?>
</small>