// Html::tag('p', Html::encode($data->text)); } /*echo '<pre>'.print_r($data->link, true).'</pre>'; die('-en-'); return Html::a(Html::encode($data->text),'site/index');*/ }], 'user_created' => ['label' => 'Автор питання', 'attribute' => 'user_created', 'options' => ['style' => 'min-width: 150px'], 'format' => 'raw', 'value' => function ($data) { $user = $data->users; $res = '<span class="itUser"><a href="http://vk.com/id' . $user->vk_id . '" target="_blank"><img class="userAva thumbnail" src="' . Need::getAva($user) . '" /></a> <span class="userName">' . $user->username . '</span></span>'; if (Yii::$app->user->id == $data->user_created) { $res = '<strong>' . $res . '</strong>'; } return $res; }], ['class' => 'yii\\grid\\ActionColumn', 'template' => Yii::$app->user->can('edit-7progress') ? '{update}' : ':)', 'controller' => 'question']]]); ?> <?php Pjax::end(); ?> </div> </div> <? Need::per(['name'=>'slaawwa'], 'title'); ?> </div> <?php $this->registerJsFile('/web/js/newQ.js', ['depends' => [yii\web\JqueryAsset::className()]]); $this->registerCssFile('/web/css/newQ.css', ['depends' => [yii\bootstrap\BootstrapAsset::className()]]); ?>
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('--'); }
$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; ?>