__construct() public method

Always call this when defining __construct() in sub-classes.
public __construct ( )
Example #1
0
File: Wiki.php Project: nirix/traq
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('wiki'), $this->generateUrl('wiki'));
     // Add before filter to show 404 if the wiki is disabled.
     if (!$this->currentProject->enable_wiki) {
         $this->before('*', function () {
             return $this->show404();
         });
     }
     // Get the page.
     $this->before(['revisions', 'edit', 'save', 'destroy'], function () {
         $this->page = $this->currentProject->wikiPages()->where('slug = :slug')->setParameter('slug', Request::$properties->get('slug'))->fetch();
         if (!$this->page) {
             return $this->show404();
         }
         $this->addCrumb($this->page['title'], routeUrl('wiki_page'));
     });
     // Check permissions
     $this->before(['new', 'create', 'edit', 'save', 'destroy'], function () {
         $action = Request::$properties->get('action');
         if (($action == 'new' || $action == 'create') && !$this->hasPermission('create_wiki_page')) {
             return $this->show403();
         } elseif (($action == 'edit' || $action == 'save') && !$this->hasPermission('edit_wiki_page')) {
             return $this->show403();
         } elseif ($action == 'destroy' && !$this->hasPermission('delete_wiki_page')) {
             return $this->show403();
         }
     });
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->title($this->translate('wiki'));
     $this->before(['new', 'create', 'edit', 'save', 'delete', 'destroy'], [$this, 'checkPermission']);
     $this->before(['edit', 'save', 'delete', 'destroy'], [$this, 'getPage']);
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('tickets'), $this->generateUrl('tickets'));
     // Custom fields
     $this->customFields = CustomField::forProject($this->currentProject['id']);
     $this->set('customFields', $this->customFields);
 }
Example #4
0
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('admincp'), $this->generateUrl('admincp'));
     // Admins only, kthnxbai
     if (!$this->currentUser || !$this->currentUser->isAdmin()) {
         $this->before('*', function () {
             return $this->show403();
         });
     }
 }
Example #5
0
 public function __construct()
 {
     parent::__construct();
     $this->before('*', function () {
         $this->set('user', clone $this->currentUser);
         // Make sure the user is logged in
         if (!$this->currentUser) {
             $this->layout = "default.phtml";
             return $this->show403();
         }
     });
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     // Add 'Settings' to the page title
     $this->addCrumb($this->translate('settings'), $this->generateUrl('project_settings'));
     // Make sure this is a project and the user has the correct permission to access the area.
     if (!$this->currentProject || !$this->currentUser || !$this->hasPermission('project_settings') && !$this->currentUser->isAdmin()) {
         $this->before('*', function () {
             return $this->show403();
         });
     }
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     // Add 'Settings' to the page title
     $this->title($this->translate('settings'));
     // Make sure this is a project and the user has the correct permission to access the area.
     $this->before('*', function () {
         if (!$this->currentProject || !$this->hasPermission('project_settings') && !$this->currentUser['is_admin']) {
             $this->layout = 'default.phtml';
             return $this->show403();
         }
     });
 }
Example #8
0
 /**
  * Constructor!
  */
 public function __construct()
 {
     parent::__construct();
     // Set the admin layout.
     $this->title($this->translate('admincp'));
     // Make sure the user is logged in and is an admin.
     $this->before('*', function () {
         if ($this->currentUser and !$this->currentUser['is_admin']) {
             return $this->show403();
         } elseif (!$this->currentUser) {
             return $this->showLogin(Request::$requestUri);
         }
     });
 }
Example #9
0
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('tickets'), $this->generateUrl('tickets'));
     $this->before(['new', 'create'], function () {
         if (!$this->hasPermission('create_tickets')) {
             return $this->show403();
         }
     });
     $this->before(['editDescription', 'saveDescription'], function () {
         if (!$this->hasPermission('edit_ticket_description')) {
             return $this->show403();
         }
     });
 }
Example #10
0
 public function __construct()
 {
     parent::__construct();
     $this->title($this->translate('timeline'));
     require __DIR__ . '/../Helpers/timeline.php';
 }
Example #11
0
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('timeline'), routeUrl('timeline'));
 }
Example #12
0
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('roadmap'), $this->generateUrl('roadmap'));
 }