/** * Construct company invoices controller * * @param Request $request * @return CompanyInvoicesController */ function __construct($request) { parent::__construct($request); if (!Invoice::canAccessCompanyInvoices($this->logged_user, $this->active_company)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $this->wireframe->current_menu_item = 'invoicing'; $this->wireframe->page_actions = array(); $this->wireframe->addBreadCrumb(lang('Invoices'), assemble_url('people_company_invoices', array('company_id' => $this->active_company->getId()))); $invoice_id = $this->request->getId('invoice_id'); if ($invoice_id) { $this->active_invoice = Invoices::findById($invoice_id); } // if if (instance_of($this->active_invoice, 'Invoice')) { if ($this->active_invoice->getCompanyId() != $this->active_company->getId()) { $this->httpError(HTTP_ERR_CONFLICT); } // if $this->wireframe->addBreadCrumb($this->active_invoice->getName(), $this->active_invoice->getCompanyViewUrl()); } else { $this->active_invoice = new Invoice(); } // if $this->smarty->assign(array('active_invoice' => $this->active_invoice, 'page_tab' => 'invoices')); js_assign('invoicing_precision', INVOICE_PRECISION); }
/** * Construct Profile Controller * * @param void * @return null */ function __construct($request) { parent::__construct($request); $user_id = $this->request->get('user_id'); if ($user_id) { $this->active_user = Users::findById($user_id); } // if if (instance_of($this->active_user, 'User')) { if (!in_array($this->active_user->getId(), $this->logged_user->visibleUserIds())) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if $this->wireframe->addBreadCrumb($this->active_user->getName(), $this->active_user->getViewUrl()); if ($this->active_user->getId() == $this->logged_user->getId()) { $this->wireframe->current_menu_item = 'profile'; } // if } else { $this->active_user = new User(); } // if $this->smarty->assign('active_user', $this->active_user); }