Drupal investigation

AdminToolsController.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\controllers;
  3. use Yii;
  4. use yii\filters\AccessControl;
  5. use yii\web\Controller;
  6. class AdminToolsController 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','userimport'],
  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 actionUserimport()
  38. {
  39. return $this->render('userimport');
  40. }
  41. }