Drupal investigation

HrToolsController.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\controllers;
  3. use Yii;
  4. use yii\filters\AccessControl;
  5. use yii\web\Controller;
  6. class HrToolsController extends Controller
  7. {
  8. public function behaviors()
  9. {
  10. return [
  11. 'access' => [
  12. 'class' => AccessControl::className(),
  13. 'rules' => [
  14. [
  15. 'actions' => ['error'],
  16. 'allow' => true,
  17. ],
  18. [
  19. 'actions' => ['index','groups','tasks','workflow'],
  20. 'allow' => true,
  21. 'roles' => ['@'],
  22. ],
  23. ],
  24. ]
  25. ];
  26. }
  27. //This method should be in every controller
  28. public function init(){
  29. if (!Yii::$app->user->isGuest){
  30. Yii::$app->language = Yii::$app->user->identity->lang;
  31. }
  32. }
  33. public function actionIndex()
  34. {
  35. return $this->render('index');
  36. }
  37. public function actionWorkflow(){
  38. return $this->render('workflow');
  39. }
  40. public function actionGroups(){
  41. return $this->render('groups');
  42. }
  43. public function actionTasks(){
  44. return $this->render('tasks');
  45. }
  46. }