Beispiel #1
0
 public static function checkQ()
 {
     $maxPub = Question::find()->max('publiced');
     $tDay = 3600 * 24;
     // $maxPubNow = time() + $tDay *
     $maxPubNew = time() + Need::pro7gress('reserv') * $tDay;
     // User::per($maxPub, 'test', false);
     // User::per($maxPubNew, 'test', false);
     $cday = (int) round(($maxPubNew - $maxPub) / $tDay);
     // User::per($cday, 'cday', false);
     $res = Question::find()->where('npp=0')->orderBy('rand()')->limit($cday)->all();
     // ->asArray()
     $count = 0;
     foreach ($res as $a) {
         $count++;
         $tmp = $maxPub + $tDay * $count;
         $a->publiced = $tmp;
         $maxNpp = Question::find()->max('npp');
         $wday3 = Need::ua('wday3', getdate($tmp)['wday']);
         $a->user_take = Need::day2user($wday3);
         // User::per(User::day2user($wday3), 'wday3', false);
         $a->npp = $maxNpp + 1;
         $a->save();
         // User::per($a->publiced, 'item: '.$a->id, false);
     }
     // User::per($res[0]->id, 'test', false);
     // die('--');
 }
Beispiel #2
0
$this->head();
?>
</head>
<body>

<?php 
$this->beginBody();
?>
    <div class="wrap">
        <?php 
NavBar::begin(['brandLabel' => 'VK-face.com', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
if (Yii::$app->user->isGuest) {
    $items = [['label' => '<span class="glyphicon glyphicon-user"></span> Вхід', 'url' => ['/site/login']]];
} else {
    echo Nav::widget(['options' => ['class' => 'navbar-nav'], 'items' => []]);
    $items = [['label' => '<img class="thumbnail" style="width: 40px;margin: 0;display: inline;" src="' . (Yii::$app->user->identity->ava ? Yii::$app->user->identity->ava : Need::pro7gress('defAva')) . '"/> ' . Yii::$app->user->identity->username, 'options' => ['class' => 'userBut', 'style' => 'padding: 0px;'], 'items' => [Yii::$app->user->identity->vk_id ? ['label' => '<li role="presentation"><span class="glyphicon glyphicon-user"></span> Вконтакті</li>', 'url' => 'http://vk.com/id' . Yii::$app->user->identity->vk_id, 'linkOptions' => ['target' => '_blank']] : '<li></li>', '<li role="presentation" class="divider"></li>', ['label' => '<span class="glyphicon glyphicon-off"></span> Вийти', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]]];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'encodeLabels' => false, 'items' => $items]);
NavBar::end();
?>

        <div class="container">
            <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
            <?php 
echo Alert::widget();
?>
            <?php 
echo $content;
?>