예제 #1
0
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'except' => ['view', 'index'], 'rules' => [['actions' => ['create', 'delete', 'update'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return OvcUser::isUserAdmin();
     }], ['actions' => ['update'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return OvcUser::isUserLecturer();
     }], ['actions' => ['my-courses'], 'allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
 }
예제 #2
0
 public static function getUserActionTemplate()
 {
     if (\app\components\OvcUser::isUserAdmin()) {
         return '<div class="width-50">{view}&nbsp;{update}&nbsp;{delete}</div>';
     } else {
         return '';
     }
 }
예제 #3
0
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return OvcUser::isUserAdmin();
     }]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
 }
예제 #4
0
            <?php 
if (app\components\OvcUser::getCurrentUser()->id == $comment->user_id) {
    ?>
                <span class="glyphicon glyphicon-edit comment-edit" title="edit" data-comment-id="<?php 
    echo $comment->id;
    ?>
" data-url='<?php 
    echo yii\helpers\Url::to(['comment/inline-update', 'id' => $comment->id]);
    ?>
'></span>
            <?php 
}
?>
            &nbsp;
            <?php 
if (app\components\OvcUser::getCurrentUser()->id == $comment->user_id || \app\components\OvcUser::isUserAdmin()) {
    ?>
                <span class="glyphicon glyphicon-trash comment-delete" data-url='<?php 
    echo yii\helpers\Url::to(['comment/delete', 'id' => $comment->id, 'video_id' => $comment->video_id]);
    ?>
' data-comment-id='<?php 
    echo $comment->id;
    ?>
' title="trash"></span>
            <?php 
}
?>
        </div>

        <p>
            <strong class="ucfirst"><?php 
예제 #5
0
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['create', 'update', 'delete'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return OvcUser::isUserAdmin() || OvcUser::isUserLecturer();
     }], ['actions' => ['view', 'index', 'latest-videos', 'play', 'get-comment-by-id', 'inline-update-comment'], 'allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
 }