예제 #1
0
 public function actionIndex()
 {
     $my_link = [];
     $my_t = [];
     if (!Yii::$app->user->isGuest) {
         $my_t = T::find()->where(['admin_id' => Yii::$app->user->id])->all();
         $my_link = Link::find()->where(['admin_id' => Yii::$app->user->id])->all();
     }
     return $this->render('index', ['my_t' => $my_t, 'my_link' => $my_link]);
 }
예제 #2
0
파일: _header.php 프로젝트: Nechhist/to.ru
<?php

use app\models\User;
use app\models\T;
use app\models\Link;
use yii\helpers\Html;
//////////////////// USER //////////////////////
$count_links = 0;
if (!Yii::$app->user->isGuest) {
    $my_t = T::find()->where(['admin_id' => Yii::$app->user->id])->count();
    $my_link = Link::find()->where(['admin_id' => Yii::$app->user->id])->count();
    $count_links = $my_link + $my_t;
}
?>

<style>
    .header-table-small td{
        border: 2px solid <?php 
echo Yii::$app->params['color']['table_bg_dark'];
?>
;
        margin: 0;
        padding: 3px 15px;
        background-color: <?php 
echo Yii::$app->params['color']['table_bg_dark'];
?>
;
        color: #ffffff;
        font-weight: bold;
        font-size: 16px;
    }
예제 #3
0
 public function actionAjaxsearch()
 {
     if (isset($_GET['text']) and $_GET['text'] != null) {
         if (strlen($_GET['text']) > 3) {
             $ts = T::find()->where(['like', 'name', $_GET['text']])->limit(200)->orderBy('id DESC')->all();
             echo $this->renderAjax('_resultSearch.php', ['ts' => $ts]);
         } else {
             echo 'Строка запроса не может быть меньше 4 символов';
         }
     } else {
         echo 'Пустой запрос...';
     }
 }