Since: 3.0.0
Author: Jack P.
Inheritance: extends Avalon\Http\Controller
Esempio n. 1
0
File: Wiki.php Progetto: 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();
         }
     });
 }
Esempio n. 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']);
 }
Esempio n. 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);
 }
Esempio n. 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();
         });
     }
 }
Esempio n. 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();
         }
     });
 }
Esempio n. 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();
         });
     }
 }
Esempio n. 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();
         }
     });
 }
Esempio n. 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);
         }
     });
 }
Esempio n. 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();
         }
     });
 }
Esempio n. 10
0
 public function __construct()
 {
     parent::__construct();
     $this->title($this->translate('timeline'));
     require __DIR__ . '/../Helpers/timeline.php';
 }
Esempio n. 11
0
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('timeline'), routeUrl('timeline'));
 }
Esempio n. 12
0
 public function __construct()
 {
     parent::__construct();
     $this->addCrumb($this->translate('roadmap'), $this->generateUrl('roadmap'));
 }