Beispiel #1
0
">Послания</a></li>
<li<?php 
if (Url::to(['page/news']) == Url::current() or Yii::$app->controller->action->id == 'news_item') {
    echo ' class="active"';
}
?>
><a href="<?php 
echo Url::to(['page/news']);
?>
">Новости</a></li>

<?php 
if (!\Yii::$app->user->isGuest) {
    ?>
    <?php 
    $c = \app\services\SiteUpdateItemsCounter::getValue();
    $this->registerJs("\$('#linkUpdates').tooltip({placement:'right'})");
    if ($c > 0) {
        $class = 'danger';
    } else {
        $class = 'default';
    }
    ?>
    <li>
        <a href="<?php 
    echo Url::to(['site/site_update']);
    ?>
">
            <span title="Обновления" id="linkUpdates" class="label label-<?php 
    echo $class;
    ?>
Beispiel #2
0
 public function actionSite_update()
 {
     \app\services\SiteUpdateItemsCounter::clear();
     \app\services\UserLastActive::updateNow();
     return $this->render(['list' => SiteUpdate::query()->orderBy(['date_insert' => SORT_DESC])->limit(50)->all()]);
 }
Beispiel #3
0
<?php

$params = (require __DIR__ . '/params.php');
$config = ['id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'language' => 'ru', 'aliases' => ['@web' => __DIR__ . '/public_html/', '@csRoot' => __DIR__ . '/../app', '@upload' => __DIR__ . '/public_html/upload'], 'components' => ['assetManager' => ['appendTimestamp' => true], 'request' => ['cookieValidationKey' => '', 'enableCookieValidation' => false, 'enableCsrfValidation' => false], 'cache' => YII_ENV_PROD ? ['class' => 'yii\\caching\\MemCache', 'servers' => [['host' => 'localhost', 'port' => 11211]]] : ['class' => 'yii\\caching\\FileCache'], 'deviceDetect' => ['class' => 'app\\services\\DeviceDetect', 'setParams' => 'false'], 'user' => ['identityClass' => 'app\\models\\User', 'enableAutoLogin' => true, 'loginUrl' => ['auth/login']], 'errorHandler' => ['errorAction' => 'site/error'], 'urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false, 'enableStrictParsing' => true, 'suffix' => '', 'rules' => require __DIR__ . '/urlRules.php'], 'mailer' => require __DIR__ . '/mailerTransport.php', 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning'], 'maxLogFiles' => 1], ['class' => 'yii\\log\\DbTarget', 'categories' => ['gs\\*']], ['class' => 'yii\\log\\EmailTarget', 'levels' => ['error', 'warning'], 'categories' => ['yii\\db\\*'], 'message' => ['from' => ['*****@*****.**'], 'to' => ['*****@*****.**'], 'subject' => 'GALAXYSSS.RU ERROR']]]], 'db' => require __DIR__ . '/db.php', 'authClientCollection' => ['class' => 'yii\\authclient\\Collection', 'clients' => require __DIR__ . '/authClientCollection.php'], 'formatter' => ['dateFormat' => 'dd.MM.yyyy', 'timeFormat' => 'php:H:i:s', 'datetimeFormat' => 'php:d.m.Y H:i', 'decimalSeparator' => '.', 'thousandSeparator' => ' ', 'currencyCode' => 'RUB', 'locale' => 'ru-RU', 'nullDisplay' => ''], 'view' => ['renderers' => ['tpl' => ['class' => 'yii\\smarty\\ViewRenderer', 'cachePath' => '@runtime/Smarty/cache', 'widgets' => ['blocks' => ['ActiveForm' => 'yii\\widgets\\ActiveForm']]]]]], 'params' => $params, 'controllerMap' => ['upload' => 'cs\\Widget\\FileUploadMany\\UploadController', 'comment' => 'app\\modules\\Comment\\Controller', 'html_content' => 'cs\\Widget\\HtmlContent\\Controller', 'check_box_tree_mask' => 'cs\\Widget\\CheckBoxTreeMask\\Controller', 'cabinet_shop_check_box_tree_mask' => 'app\\modules\\Shop\\services\\CheckBoxTreeMask\\Controller'], 'on ' . \yii\base\Application::EVENT_BEFORE_REQUEST => function ($event) {
    \Yii::$app->session->remove(\app\services\SiteUpdateItemsCounter::SESSION_KEY);
    if (!\Yii::$app->user->isGuest) {
        \app\services\SiteUpdateItemsCounter::calc();
        \app\services\UserLastActive::update();
    }
}];
if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = 'yii\\debug\\Module';
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\\gii\\Module';
}
return $config;