Esempio n. 1
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->last_items = TimeLogItemTable::getInstance()->getLastTimeItems($this->getUser()->getId(), $request->getParameter('timeitemcount', 10));
     $this->no_bookings_pager = new sfDoctrinePager('MissingTimeItemEntry', 10);
     $this->no_bookings_pager->setQuery(MissingTimeItemEntryTable::getInstance()->getForUserQuery($this->getUser()->getId()));
     $this->no_bookings_pager->setPage($request->getParameter('missing_page', 1));
     $this->no_bookings_pager->init();
     $time_range = $request->getParameter('total_filter_by', 'this_month');
     $this->project_totals = ProjectTable::getInstance()->getTimeTotals($this->getUser()->getId(), $time_range);
 }
Esempio n. 2
0
 public function executeUnlock(sfWebRequest $request)
 {
     $project = ProjectTable::getInstance()->find($request->getParameter('id'));
     $this->forward404Unless($project);
     if ($project->account_id != $this->getUser()->getAttribute('account_id')) {
         $this->redirect('default/secure');
     }
     if ($project->Account->hasEnoughLicensesToAddProject() == false) {
         $this->getUser()->setFlash('error.license_count', 1);
     } else {
         $project->deactivated = false;
         $project->save();
     }
     $this->redirect('adminProject/list');
 }
Esempio n. 3
0
 public function executeField(sfWebRequest $request)
 {
     $this->weekstart = $request->getParameter('weekstart');
     $account_id = $this->getUser()->getAttribute('account_id');
     $query = new Doctrine_Query();
     $project = ProjectTable::getInstance()->find($request->getParameter('project_id'));
     $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;
     }
     $this->setLayout(false);
     return $this->renderPartial('timeitem', array('item_types' => $item_types, 'weekstart' => $this->weekstart, 'project' => $project, 'weekday' => $request->getParameter('weekday'), 'default_item_type_name' => $this->default_item_type_name));
 }
Esempio n. 4
0
 public function executeProjectTotal(sfWebRequest $request)
 {
     $filter = $this->checkFilter($request);
     $account_id = $this->getUser()->getAttribute('account_id');
     $this->types = TimeItemTypeTable::getInstance()->findByAccountId($account_id);
     $this->user = UserTable::getInstance()->find($this->getUser()->getAttribute('uid'));
     $this->users = UserTable::getInstance()->findByAccountId($account_id);
     if ($this->getUser()->getAttribute('overlord', false) == true) {
         $this->projects = ProjectTable::getInstance()->findByAccountId($account_id);
     } else {
         if (array_key_exists('user', $filter)) {
             $this->user = UserTable::getInstance()->find($filter['user']);
             $this->projects = $this->user->Projects;
         } else {
             $this->projects = $this->user->Projects;
         }
     }
     $this->project_totals = TimeLogItemTable::getInstance()->prepareTotalReport($filter, $this->projects, $this->user, $account_id);
 }