示例#1
0
<?php

use yii\helpers\Html;
use app\models\Board;
use app\models\DataCenter;
use app\models\UiListView;
use yii\widgets\Pjax;
?>
<div id="board-content" style="padding: 0 0 0 10px; width: 100%;">
	<?php 
Pjax::begin(['id' => 'board-list']);
?>
        <?php 
echo UiListView::widget(['dataProvider' => DataCenter::recentBoard(Yii::$app->session->get('boardSize')), 'options' => ['class' => 'ui fitted items', 'id' => 'bm'], 'layout' => '{items}', 'itemView' => '_board-list']);
?>
	<?php 
Pjax::end();
?>
	<div style="text-align: center; margin: 10px 0;"><button id="view-more-board" class="ui fluid basic small circular button">View More</button></div>
</div>
				<div class="page-title">
					<h3 style="margin: 0; padding: 0;">Hi <?php 
echo ucfirst(Yii::$app->user->identity->username);
?>
!</h3>
				</div>
			</div>
    	</div>
    </div>
    <div class="item">
    	<div style="font-size: 16px;">Request Data Access</div>
		<br>
		<p><input id="req_form" type="text" name="request_text" placeholder="Student ID#" class="form-control pva-form-control"></p>
		<p>
			<?php 
if (DataCenter::dataAccessRequest() === 0) {
    ?>
				<?php 
    echo Html::button('Send Request', ['id' => 'req_access', 'class' => 'ui fluid big positive button']);
    ?>
			<?php 
} else {
    ?>
				<?php 
    echo Html::button('<i class="lock icon"></i>&nbsp; Send Request', ['class' => 'ui fluid big disabled button']);
    ?>
			<?php 
}
?>
		</p>
    </div>
if (AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'dev' || AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'master' || AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'admin' || AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'principal') {
    ?>
    <div id="announcement-wrap" class="menu" style="height: 475px;">
<?php 
} else {
    ?>
    <div id="announcement-wrap" class="menu" style="height: 360px;">
<?php 
}
?>
    <div id="announcement-ctr">
        <?php 
Pjax::begin(['id' => 'anc-list-modal', 'timeout' => 360000]);
?>
            <?php 
echo UiListView::widget(['dataProvider' => DataCenter::recentAnnouncement(Yii::$app->session->get('announcementSize')), 'options' => ['class' => 'ui divided relaxed items', 'style' => 'padding-top: 10px;'], 'layout' => '{items}', 'itemView' => '_announcement-list']);
?>
        <?php 
Pjax::end();
?>
        <div style="text-align: center; margin-bottom: -15px; margin-top: 10px; padding-bottom: 15px;">
            <button id="view-more-announcement" class="ui fluid basic small circular icon button">View More</button>
        </div>
        <br>
    </div>
    <?php 
if (AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'dev' || AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'master' || AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'admin' || AuthAssignment::getAssignment(Yii::$app->user->identity->id) === 'principal') {
    ?>
    <div class="announcement-write">
        <div class="ui fluid container">
            <?php 
 public function actionLogin()
 {
     if (!Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $lwe = Yii::$app->params['lwe'];
     $model = $lwe ? new LoginForm(['scenario' => 'lwe']) : new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $user = User::findOne(Yii::$app->user->identity->id);
         $user->last_login = time();
         $user->save();
         Yii::$app->session->set('announcementCount', DataCenter::countAnnouncement());
         Yii::$app->session->set('announcementSize', 10);
         Yii::$app->session->set('boardCount', DataCenter::countBoard());
         Yii::$app->session->set('boardSize', 50);
         Yii::$app->session->set('impact', 1);
         Yii::$app->session->set('sidebar', '');
         return $this->redirect(Yii::$app->request->baseUrl . '/dashboard');
     } elseif ($model->status === User::STATUS_INACTIVE) {
         Yii::$app->session->setFlash('error', 'You have to activate your account first. Please check your email.');
         return $this->refresh();
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }