/** * Sets the passed in user as the authenticated * user of the application. Will generate a ticket * for this user which will be used for subsequent * requests. * * @param NovemberUser $user */ public function setAuthenticatedUser(NovemberUser $user, $regenTicket = true) { if ($regenTicket) { $user->ticket = $this->generateTicket($user->getUsername()); } $today = date('Y-m-d H:i:s'); $user->setLastLogin($today); $this->dbService->updateObject($user); za()->setUser($user); }
/** * The user is held in the application object * for quick and easy access * * @param ZendUser $user */ public function setUser(NovemberUser $user) { $this->getSession()->CURRENT_USER_NAME = $user->getUsername(); $this->getSession()->CURRENT_USER_TICKET = $user->getTicket(); $this->user = $user; }
/** * Sets the passed in user as the authenticated * user of the application. Will generate a ticket * for this user which will be used for subsequent * requests. * * @param NovemberUser $user */ public function setAuthenticatedUser(NovemberUser $user) { $user->ticket = $this->generateTicket($user->getUsername()); za()->setUser($user); }
/** * Get a detailed timesheet * * If an explicit timesheet id is passed in, only records that have * been locked off against that timesheet will be included in the * result. * * @param NovemberUser $user * @param int $taskid * @param int $projectid * @param int $clientid * @param int $timesheet * @param int $start * @param int $end * @return ArrayObject */ public function getDetailedTimesheet($user = null, $taskid = null, $projectid = null, $clientid = null, $timesheet = -1, $start = null, $end = null, $categories = array(), $order = 'endtime DESC') { $select = $this->dbService->select(); /* @var $select Zend_Db_Select */ $select->from('timesheetrecord', '*')->joinLeft('task', new Zend_Db_Expr('task.id=timesheetrecord.taskid'), new Zend_Db_Expr('task.title as tasktitle, task.category as taskcategory')); //-> if (count($categories)) { $this->dbService->applyWhereToSelect(array('task.category' => $categories), $select); } $select = $this->filterBaseTimesheetQuery($select, $taskid, $projectid, $clientid, $start, $end); // If passed a user object, just filter their timesheet entries if ($user != null) { $select->where('timesheetrecord.userid = ?', $user->getUsername()); } // If a timesheet is -1, it means we're just generating dynamic reports, // and it doesn't matter if we include the already accounted for timesheet // records if ($timesheet >= 0) { $select->where('timesheetrecord.timesheetid = ?', $timesheet); } $select->order($order); return $this->dbService->fetchObjects('TimesheetRecord', $select); }