public function executeUpdate() { $task = TaskPeer::retrieveByUuid($this->getRequestParameter('task')); $this->forward404Unless($task); $this->forward404Unless($task->isAuthorized($this->getUser()->getId()), 'User not authorized to edit tasks for this project'); $project = $task->getProject(); $task->setName($this->getRequestParameter('name')); $task->setDescription($this->getRequestParameter('description')); if ($this->getRequestParameter('begin')) { list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture()); $task->setBegin("{$y}-{$m}-{$d}"); } if ($this->getRequestParameter('finish')) { list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture()); $task->setFinish("{$y}-{$m}-{$d}"); } $task->setStatus($this->getRequestParameter('status', sfConfig::get('app_task_status_open'))); $task->setPriority($this->getRequestParameter('priority')); $task->clearUsers(); $user = sfGuardUserProfilePeer::retrieveByUuid($this->getRequestParameter('task_user')); $task->addUser($user->getUserId()); $task->save(); $this->task = $task; $this->project = $project; $this->setTemplate('show'); return $this->redirect('project/showTask?tab=tasks&task=' . $task->getUuid()); }
public function executeLatest() { // TODO: Add a unique UUID key to the profile, which will serve as the "KEY" to accessing a user's feed. Brilliant. $user = sfGuardUserProfilePeer::retrieveByUuid($this->getRequestParameter('feed')); $this->forward404Unless($user, 'Feed not found for user'); $feed = $user->getDefaultFeed(); $this->feed = $feed; }
public function executeForgotPasswordText() { sfPropelApprovableBehavior::disable(); $this->user = sfGuardUserProfilePeer::retrieveByUuid($this->getRequest()->getAttribute('user_id')); sfPropelApprovableBehavior::disable(); $this->token = $this->user->getsfGuardUser()->getToken(); $this->user = $this->user->getUuid(); }
/** * Executes showTodo action * */ public function executeShowTodo() { $this->forward404Unless($this->profile = sfGuardUserProfilePeer::retrieveByUuid($this->getRequestParameter('user')), 'User not found'); $this->forward404Unless($this->todo = ToDoPeer::retrieveByUserIdSlug($this->profile->getUserId(), $this->getRequestParameter('todo')), 'Todo not found by user_id:slug, [' . $this->profile->getUserId() . ']:[' . $this->getRequestParameter('todo') . ']'); $this->forward404Unless($this->todo->getOwnerId() == $this->getUser()->getId(), 'Owner doesn\'t match current user'); }
public function executeAjaxAssignTaskUsers() { $task = TaskPeer::retrieveByUuid($this->getRequestParameter('task')); $user_ids = $this->getRequestParameter('taskusers', array()); $this->forward404Unless($task, 'Task not found, unable to assign users'); $this->output = ''; $users = array(); // TODO: send message to alert users if they have been added or removed from task // TODO: make sure users passed is correct $task->clearUsers(); foreach ($user_ids as $user_id) { $user = sfGuardUserProfilePeer::retrieveByUuid($user_id); $this->logMessage('assigning task-user [' . $task->getName() . ']:[' . $user->getFullName() . ']'); $task->addUser($user); } $this->task = $task; $this->projectUsers = $this->task->getProject()->getApprovedUsers(); //$this->setTemplate('ajaxGenericOutput'); }
public function clonePositionAcceptApplicant($position_uuid, $user_uuid) { // retrieve desired position $position_old = ProjectPositionPeer::retrieveByUuid($position_uuid); // clone position $position = $position_old->copy(); // clear uuid so it will regenerate a unique one, save $position->setUuid(NULL); $position->setFilled(true); $position->save(); // grab desired user $user = sfGuardUserProfilePeer::retrieveByUuid($user_uuid); // remove applicant from old position $positionUser = ProjectUserPeer::retrieveByPositionIdUserId($position_old->getId(), $user->getUserId()); if ($positionUser == null) { sfContext::getInstance()->getLogger()->info('Old PositionUser not found, unable to clone and accept applicant'); return false; } $positionUser->delete(); // build a new positionUser object $positionUser = new ProjectUser(); $positionUser->setPositionId($position->getId()); $positionUser->setUserId($user->getUserId()); $positionUser->setStatus(1); // Status(1): Accepted $positionUser->save(); if ($position == null || $user == null || $positionUser == null) { sfContext::getInstance()->getLogger()->info('Position, user, or PositionUser not found, unable to accept applicant'); return false; } // Assign user to members group $user = $user->getSfGuardUser(); $this->addUserToGroup($user, 'members'); return true; }