/** * undocumented function * * @param string $officeId * @return void * @access public */ function admin_activate($officeId = null) { if ($officeId == Configure::read('Office.id')) { $msg = __('This office is already active.', true); return $this->Message->add($msg, 'ok'); } Assert::true(Office::isOwn($officeId), '403'); $office = $this->Office->find('first', array('conditions' => array('Office.id' => $officeId), 'contain' => array('SubOffice', 'ParentOffice'))); Assert::notEmpty($office, '404'); $this->Office->activate($office['Office']['id']); $msg = __('The office was successfully activated!', true); return $this->Message->add($msg, 'ok', true, Controller::referer()); }