protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $form->setFieldValue('discussions_status_id', $form['discussions_status_id']->getValue()); $form->setFieldValue('projects_status_id', $form['projects_status_id']->getValue()); $form->setFieldValue('projects_type_id', $form['projects_type_id']->getValue()); $form->setFieldValue('projects_id', $form['projects_id']->getValue()); $discussions_reports = $form->save(); switch ($request->getParameter('redirect_to')) { case 'view': $this->redirect('discussionsReports/view?id=' . $discussions_reports->getId()); break; default: $this->redirect('discussionsReports/index'); break; } } }
protected function processForm(sfWebRequest $request, sfForm $form) { $files = $request->getFiles(); $userPhoto = $files['users']['photo']['name']; $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $user = $this->getUser()->getAttribute('user'); $this->checkUser($form['email']->getValue(), $user->getId()); $form->setFieldValue('users_group_id', $user->getUsersGroupId()); $form->setFieldValue('active', $user->getActive()); if (isset($form['new_password'])) { if (strlen($form['new_password']->getValue()) > 0) { $form->setFieldValue('password', md5($form['new_password']->getValue())); } } if (strlen($userPhoto) > 0) { $userPhoto = rand(111111, 999999) . '-' . $userPhoto; $filename = sfConfig::get('sf_upload_dir') . '/users/' . $userPhoto; move_uploaded_file($files['users']['photo']['tmp_name'], $filename); $form->setFieldValue('photo', $userPhoto); app::image_resize($filename, $filename); } else { $form->setFieldValue('photo', $form['photo_preview']->getValue()); } if ($form['remove_photo']->getValue() == 1 && strlen($form['photo_preview']->getValue()) > 0) { unlink(sfConfig::get('sf_upload_dir') . '/users/' . $form['photo_preview']->getValue()); $form->setFieldValue('photo', ''); } $users = $form->save(); $this->getUser()->setAttribute('user', $users); $this->getUser()->setCulture($users->getCulture()); ExtraFieldsList::setValues($request->getParameter('extra_fields'), $users->getId(), 'users', $this->getUser()); $this->getUser()->setFlash('userNotices', t::__('Account Updated')); $this->redirect('myAccount/index'); } }
protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { if ($form->getObject()->isNew()) { $tasks = Doctrine_Core::getTable('Tasks')->find($request->getParameter('tasks_id')); if ($form->getValue('tasks_priority_id') > 0) { $tasks->setTasksPriorityId($form->getValue('tasks_priority_id')); } else { unset($form['tasks_priority_id']); } if ($request->getParameter('tasks_labels_id') > 0) { $tasks->setTasksLabelId($request->getParameter('tasks_labels_id')); } if ($request->getParameter('tasks_types_id') > 0) { $tasks->setTasksTypeId($request->getParameter('tasks_types_id')); } if (strlen($form->getValue('due_date')) > 0) { $tasks->setDueDate($form->getValue('due_date')); } else { unset($form['due_date']); } if ($request->getParameter('progress') > 0) { $tasks->setProgress($request->getParameter('progress')); } if ($form->getValue('tasks_status_id') > 0) { $tasks->setTasksStatusId($form->getValue('tasks_status_id')); if (in_array($form->getValue('tasks_status_id'), app::getStatusByGroup('closed', 'TasksStatus'))) { $tasks->setClosedDate(date('Y-m-d H:i:s')); $tasks->save(); } if (!in_array($form->getValue('tasks_status_id'), app::getStatusByGroup('closed', 'TasksStatus'))) { $tasks->setClosedDate(null); $tasks->save(); } } else { unset($form['tasks_status_id']); } $tasks->save(); } if ($form->getObject()->isNew() and sfConfig::get('app_allow_adit_tasks_comments_date') != 'on') { $form->setFieldValue('created_at', date('Y-m-d H:i:s')); } $tasks_comments = $form->save(); Attachments::insertAttachments($request->getFiles(), 'comments', $tasks_comments->getId(), $request->getParameter('attachments_info'), $this->getUser()); TasksComments::sendNotification($this, $tasks_comments, $this->getUser()); $this->redirect('tasksComments/index?projects_id=' . $request->getParameter('projects_id') . '&tasks_id=' . $request->getParameter('tasks_id')); } }
protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { if ($form->getObject()->isNew()) { $project = Doctrine_Core::getTable('Projects')->find($request->getParameter('projects_id')); if ($request->getParameter('projects_types_id') > 0) { $project->setProjectsTypesId($request->getParameter('projects_types_id')); } if ($request->getParameter('projects_status_id') > 0) { $project->setProjectsStatusId($request->getParameter('projects_status_id')); } $project->save(); } if ($form->getObject()->isNew()) { $form->setFieldValue('created_at', date('Y-m-d H:i:s')); } $projects_comments = $form->save(); Attachments::insertAttachments($request->getFiles(), 'projectsComments', $projects_comments->getId(), $request->getParameter('attachments_info'), $this->getUser()); ProjectsComments::sendNotification($this, $projects_comments, $this->getUser()); $this->redirect('projectsComments/index?projects_id=' . $projects_comments->getProjectsId()); } }
protected function processForm(sfWebRequest $request, sfForm $form) { $files = $request->getFiles(); $userPhoto = $files['users']['photo']['name']; $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $this->checkUser($form['email']->getValue(), $request->getParameter('id')); if (isset($form['password'])) { $form->setFieldValue('password', md5($form['password']->getValue())); } if (isset($form['new_password'])) { if (strlen($form['new_password']->getValue()) > 0) { $form->setFieldValue('password', md5($form['new_password']->getValue())); } } if (strlen($userPhoto) > 0) { $userPhoto = rand(111111, 999999) . '-' . $userPhoto; $filename = sfConfig::get('sf_upload_dir') . '/users/' . $userPhoto; if (getimagesize($files['users']['photo']['tmp_name'])) { move_uploaded_file($files['users']['photo']['tmp_name'], $filename); $form->setFieldValue('photo', $userPhoto); app::image_resize($filename, $filename); } else { $form->setFieldValue('photo', $form['photo_preview']->getValue()); } } else { $form->setFieldValue('photo', $form['photo_preview']->getValue()); } if ($form['remove_photo']->getValue() == 1 && strlen($form['photo_preview']->getValue()) > 0) { unlink(sfConfig::get('sf_upload_dir') . '/users/' . $form['photo_preview']->getValue()); $form->setFieldValue('photo', ''); } $users = $form->save(); ExtraFieldsList::setValues($request->getParameter('extra_fields'), $users->getId(), 'users', $this->getUser(), $request); if ($form['notify']->getValue() == 1) { $this->notifyUser($users, $form['password']->getValue()); } $this->redirect('users/index'); } }
protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $form->setFieldValue('assigned_to', implode(',', $form['assigned_to']->getValue())); $send_to = $this->getSendTo($form); if ($form->getObject()->isNew()) { $previeous_status = false; } else { $previeous_status = $form->getObject()->getDiscussionsStatusId(); } if ($form->getObject()->isNew()) { $form->setFieldValue('created_at', date('Y-m-d H:i:s')); } $discussions = $form->save(); ExtraFieldsList::setValues($request->getParameter('extra_fields'), $discussions->getId(), 'discussions', $this->getUser(), $request); Attachments::insertAttachments($request->getFiles(), 'discussions', $discussions->getId(), $request->getParameter('attachments_info'), $this->getUser()); $discussions = $this->addCommentIfStatusChanged($previeous_status, $discussions); $discussions = $this->checkIfAssignedToChanged($send_to, $discussions); $this->addRelatedItems($discussions, $request); Discussions::sendNotification($this, $discussions, $send_to, $this->getUser()); $this->redirect_to($request->getParameter('redirect_to'), $discussions->getProjectsId(), $discussions->getId(), $request); } }