public function executeNew(sfWebRequest $request) { $account_id = $this->getUser()->getAttribute('account_id'); $account = AccountTable::getInstance()->find($account_id); if ($account->hasEnoughLicensesToAddUser() == false) { $this->getUser()->setFlash('error.license_count', 1); $this->redirect('adminUser/list'); } $this->form = new UserForm(); }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $this->week = $request->getParameter('week', date('W')); $this->year = $request->getParameter('year', date('Y')); $days = DateTimeHelper::create()->getDaysOfWeek($this->week, $this->year); $this->weekstart = $days[1]; $account_id = $this->getUser()->getAttribute('account_id'); $this->projects = ProjectTable::getInstance()->findByAccountId($account_id); $this->user = UserTable::getInstance()->find($this->getUser()->getAttribute('uid')); $this->item_types = TimeItemTypeTable::getInstance()->findByAccountId($account_id); $this->default_item_type = TimeItemTypeTable::getInstance()->findDefaultForAccount($account_id); if ($this->default_item_type) { $this->default_item_type_name = $this->default_item_type->getName(); } else { $this->default_item_type_name = null; } $items = Doctrine_Query::create()->from('TimeLogItem ti')->where('ti.itemdate >= ? and itemdate <= ? and ti.user_id = ?', array(date('Y-m-d', $days[1]), date('Y-m-d', $days[1] + 5 * 24 * 60 * 60), $this->getUser()->getAttribute('uid')))->execute(); $this->time_items = new TimeItemSelector($items); $this->account = AccountTable::getInstance()->find($account_id); }