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']]]]; }
public static function getUserActionTemplate() { if (\app\components\OvcUser::isUserAdmin()) { return '<div class="width-50">{view} {update} {delete}</div>'; } else { return ''; } }
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']]]]; }
<?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 } ?> <?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
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']]]]; }