Beispiel #1
0
 /**
  * When saved, redirect to either the project or client this is attached to
  *
  * @param  feature $model
  */
 public function onModelSaved($model)
 {
     // If there's a parent to be linked to, catch and set that here
     if ($this->_getParam('parentfeature')) {
         // link it using the item link service
         $parent = $this->byId($this->_getParam('parentfeature'));
         if ($parent) {
             $this->itemLinkService->parentChildLink($parent, $model);
         }
     }
     $project = $this->projectService->getProject($model->projectid);
     if ($project) {
         $this->projectService->saveProject($project);
     }
     if ($this->_getParam('_ajax')) {
         $f = $model->unBind(true);
         $f = Zend_Json::encode($f);
         echo "<p>Please wait... </p>\n\t\t\t<script>\n\t\t\tRelapse.Features.updateFeatureList({$f});\n\t\t\tRelapse.closeDialog('featuredialog');\n\t\t\t// and just in case we're in the sidebar...\n\t\t\t</script>";
     } else {
         if ($model->projectid) {
             // Not editing
             $this->redirect('project', 'view', array('id' => $model->projectid, '#features'));
         } else {
             $this->redirect('project');
         }
     }
 }
Beispiel #2
0
 /**
  * Saves an object. is declared as a protected method to allow
  * subclasses to override how parameters are saved if needbe. 
  */
 protected function saveObject($params, $modelType)
 {
     // if it's a project, we'll use the project service to save stuff
     if ($modelType == 'Project') {
         return $this->projectService->saveProject($params);
     } else {
         return parent::saveObject($params, $modelType);
     }
 }
Beispiel #3
0
 /**
  * Get the support project for this client 
  *
  * @param Client $client
  * @return Project
  */
 public function getClientSupportProject(Client $client)
 {
     $project = $this->projectService->getProjectByField('title', $client->title . ' Support');
     if (!$project) {
         $params = array();
         $params['title'] = $client->title . ' Support';
         $params['clientid'] = $client->id;
         $project = $this->projectService->saveProject($params);
     }
     /* @var $project Project */
     if ($project->deleted) {
         $project->deleted = false;
         $this->projectService->saveProject($project);
     }
     return $project;
 }
 /**
  * Update Project
  * @param sfWebRequest $request
  * @return unknown_type
  */
 public function executeUpdateProject(sfWebRequest $request)
 {
     $projectService = new ProjectService();
     $project = $projectService->getProjectById($request->getParameter('id'));
     $this->project = $project;
     if ($request->isMethod('post')) {
         $project->setCustomerId($request->getParameter('cmbCustomerId'));
         $project->setName($request->getParameter('txtName'));
         $project->setDescription($request->getParameter('txtDescription'));
         $projectService->saveProject($project);
         $this->setMessage('SUCCESS', array(TopLevelMessages::UPDATE_SUCCESS));
         $this->redirect('admin/listProject');
     }
     $companyService = new CompanyService();
     $customerService = new CustomerService();
     $this->listCustomer = $customerService->getCustomerList();
     $this->projectAdmins = $projectService->getProjectAdminByProjectId($project);
     $this->empJson = $companyService->getEmployeeListAsJson();
 }