public function executeIndex(sfWebRequest $request) { $this->checkProjectsAccess('view'); if (!$this->getUser()->hasAttribute('projects_filter')) { $this->getUser()->setAttribute('projects_filter', Projects::getDefaultFilter($this->getUser())); } $this->filter_by = $this->getUser()->getAttribute('projects_filter'); if ($fb = $request->getParameter('filter_by')) { $this->filter_by[key($fb)] = current($fb); $this->getUser()->setAttribute('projects_filter', $this->filter_by); $this->redirect('projects/index'); } if ($request->hasParameter('remove_filter')) { unset($this->filter_by[$request->getParameter('remove_filter')]); $this->getUser()->setAttribute('projects_filter', $this->filter_by); $this->redirect('projects/index'); } if ($request->hasParameter('user_filter')) { $this->filter_by = Projects::useProjectsFilter($request->getParameter('user_filter'), $this->getUser()); $this->getUser()->setAttribute('projects_filter', $this->filter_by); $this->redirect('projects/index'); } if ($set_order = $request->getParameter('set_order')) { $this->getUser()->setAttribute('projects_listing_order', $set_order); $this->redirect('projects/index'); } app::setPageTitle('Projects', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { app::setPageTitle('Projects Phases', $this->getResponse()); $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->checkTasksAccess($this->projects); $this->projects_phasess = Doctrine_Core::getTable('ProjectsPhases')->createQuery('a')->addWhere('projects_id=?', $this->projects->getId())->orderBy('name')->execute(); }
public function executeIndex(sfWebRequest $request) { app::setPageTitle('Gantt Chart', $this->getResponse()); if ($request->hasParameter('projects_id')) { $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->checkProjectsAccess($this->projects); $this->checkTasksAccess('view', false, $this->projects); } else { $this->checkTasksAccess('view'); } if (!$this->getUser()->hasAttribute('gantt_filter' . $this->get_pid($request))) { $this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), Tasks::getDefaultFilter($request, $this->getUser(), 'ganttChart')); } $this->filter_by = $this->getUser()->getAttribute('gantt_filter' . $this->get_pid($request)); if ($fb = $request->getParameter('filter_by')) { $this->filter_by[key($fb)] = current($fb); $this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), $this->filter_by); $this->redirect('ganttChart/index' . $this->add_pid($request)); } if ($request->hasParameter('remove_filter')) { unset($this->filter_by[$request->getParameter('remove_filter')]); $this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), $this->filter_by); $this->redirect('ganttChart/index' . $this->add_pid($request)); } $this->tasks_tree = array(); $this->tasks_list = $this->getTasks($request, $this->tasks_tree); }
public function executeIndex(sfWebRequest $request) { if ($request->hasParameter('projects_id')) { $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->checkProjectsAccess($this->projects); $this->checkTasksAccess('view', false, $this->projects); } else { $this->checkTasksAccess('view'); } $this->set_fitlers($request); $this->filter_by = $this->getUser()->getAttribute('tasks_filter' . $this->get_pid($request)); if ($fb = $request->getParameter('filter_by')) { $this->filter_by[key($fb)] = current($fb); $this->getUser()->setAttribute('tasks_filter' . $this->get_pid($request), $this->filter_by); $this->redirect('tasks/index' . $this->add_pid($request)); } if ($request->hasParameter('remove_filter')) { unset($this->filter_by[$request->getParameter('remove_filter')]); $this->getUser()->setAttribute('tasks_filter' . $this->get_pid($request), $this->filter_by); $this->redirect('tasks/index' . $this->add_pid($request)); } if ($set_order = $request->getParameter('set_order')) { $this->getUser()->setAttribute('tasks_listing_order' . $this->get_pid($request), $set_order); $this->redirect('tasks/index' . $this->add_pid($request)); } app::setPageTitle('Tasks', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { if (!$this->getUser()->hasAttribute('users_filter')) { $this->getUser()->setAttribute('users_filter', array()); } $this->filter_by = $this->getUser()->getAttribute('users_filter'); if ($fb = $request->getParameter('filter_by')) { $this->filter_by[key($fb)] = current($fb); $this->getUser()->setAttribute('users_filter', $this->filter_by); $this->redirect('users/index'); } if ($request->hasParameter('remove_filter')) { unset($this->filter_by[$request->getParameter('remove_filter')]); $this->getUser()->setAttribute('users_filter', $this->filter_by); $this->redirect('users/index'); } $q = Doctrine_Core::getTable('Users')->createQuery('u')->leftJoin('u.UsersGroups ug'); if ($request->hasParameter('search')) { $q = app::addSearchQuery($q, $request->getParameter('search'), 'UsersComments', 'u', $request->getParameter('search_by_extrafields')); } else { $q = Users::addFiltersToQuery($q, $this->getUser()->getAttribute('users_filter')); } $this->userss = $q->orderBy('ug.name, u.name')->execute(); app::setPageTitle('Users', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->checkProjectsAccess($this->projects); $this->projects_comments = Doctrine_Core::getTable('ProjectsComments')->createQuery('pc')->leftJoin('pc.Users u')->addWhere('projects_id=?', $request->getParameter('projects_id'))->orderBy('created_at desc')->fetchArray(); app::setPageTitle($this->projects->getName(), $this->getResponse()); }
public function executePersonal(sfWebRequest $request) { $this->checkAccess($this->getUser()->getAttribute('id'), 'view'); if (!$this->getUser()->hasAttribute('personal_scheduler_current_time')) { $this->getUser()->setAttribute('personal_scheduler_current_time', time()); } if ($request->hasParameter('month')) { $this->changeMonth($request->getParameter('month'), 'personal_scheduler_current_time'); $this->redirect('scheduler/personal'); } app::setPageTitle('Personal Scheduler', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->forward404Unless($this->tasks = Doctrine_Core::getTable('Tasks')->createQuery()->addWhere('id=?', $request->getParameter('tasks_id'))->addWhere('projects_id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object tasks does not exist (%s).', $request->getParameter('id'))); $this->checkProjectsAccess($this->projects); $this->checkTasksAccess('view', $this->tasks, $this->projects); if (!$this->getUser()->hasAttribute('tasks_filter' . $request->getParameter('projects_id'))) { $this->getUser()->setAttribute('tasks_filter' . $request->getParameter('projects_id'), Tasks::getDefaultFilter($request, $this->getUser())); } $this->tasks_comments = Doctrine_Core::getTable('TasksComments')->createQuery('tc')->leftJoin('tc.Users u')->addWhere('tc.tasks_id=?', $request->getParameter('tasks_id'))->orderBy('tc.created_at desc')->fetchArray(); $this->more_actions = $this->getMoreActions($request); app::setPageTitle(t::__('Task') . ' | ' . ($this->tasks->getTasksLabelId() > 0 ? $this->tasks->getTasksLabels()->getName() . ': ' : '') . $this->tasks->getName(), $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { if ($request->getParameter('projects_id') > 0) { $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->checkProjectsAccess($this->projects); $this->checkTicketsAccess('view', false, $this->projects); } else { $this->checkTicketsAccess('view'); } if (!$this->getUser()->hasAttribute('tickets_filter' . $this->get_pid($request))) { $this->getUser()->setAttribute('tickets_filter' . $this->get_pid($request), Tickets::getDefaultFilter($request, $this->getUser())); } $this->filter_by = $this->getUser()->getAttribute('tickets_filter' . $this->get_pid($request)); if ($fb = $request->getParameter('filter_by')) { $this->filter_by[key($fb)] = current($fb); $this->getUser()->setAttribute('tickets_filter' . $this->get_pid($request), $this->filter_by); $this->redirect('tickets/index' . $this->add_pid($request)); } if ($request->hasParameter('remove_filter')) { unset($this->filter_by[$request->getParameter('remove_filter')]); $this->getUser()->setAttribute('tickets_filter' . $this->get_pid($request), $this->filter_by); $this->redirect('tickets/index' . $this->add_pid($request)); } if ($request->hasParameter('user_filter')) { $this->filter_by = Tickets::useTicketsFilter($request, $this->getUser()); $this->getUser()->setAttribute('tickets_filter' . $this->get_pid($request), $this->filter_by); $this->redirect('tickets/index' . $this->add_pid($request)); } if ($request->hasParameter('delete_user_filter')) { app::deleteUserFilter($request->getParameter('delete_user_filter'), 'TicketsReports', $this->getUser()); $this->getUser()->setFlash('userNotices', t::__('Filter Deleted')); $this->redirect('tickets/index' . $this->add_pid($request)); } if ($request->hasParameter('edit_user_filter')) { $this->setTemplate('editFilter', 'app'); } if ($request->hasParameter('sort_filters')) { $this->setTemplate('sortFilters', 'app'); } if ($set_order = $request->getParameter('set_order')) { $this->getUser()->setAttribute('tickets_listing_order' . $this->get_pid($request), $set_order); $this->redirect('tickets/index' . $this->add_pid($request)); } app::setPageTitle('Tickets', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { if ($request->hasParameter('delete_logo')) { if (is_file(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_app_logo'))) { unlink(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_app_logo')); } } if ($request->hasParameter('cfg')) { $cfg = $request->getParameter('cfg'); foreach ($cfg as $key => $value) { $configuration = Doctrine_Core::getTable('Configuration')->createQuery('c')->addWhere('c.key = ?', $key)->fetchOne(); if (is_array($value)) { $value = implode(',', $value); } if ($key == 'app_app_logo') { $file = $request->getFiles(); if (strlen($file['cfg_app_app_logo_file']['name']) > 0) { if (getimagesize($file['cfg_app_app_logo_file']['tmp_name'])) { move_uploaded_file($file['cfg_app_app_logo_file']['tmp_name'], sfConfig::get('sf_upload_dir') . '/' . $file['cfg_app_app_logo_file']['name']); $value = $file['cfg_app_app_logo_file']['name']; } } } if ($configuration) { $configuration->setValue($value); $configuration->save(); } else { $sql = "INSERT INTO configuration (configuration.key, configuration.value) VALUES ('" . $key . "', '" . $value . "')"; $connection = Doctrine_Manager::connection(); $connection->execute($sql); } } $this->getUser()->setFlash('userNotices', t::__('Configuration has been successfully updated')); $this->redirect('configuration/index?type=' . $request->getParameter('type')); } app::setPageTitle('Configuration', $this->getResponse()); }
public function executeXlsTasksImport(sfWebRequest $request) { app::setPageTitle('Import Spreadsheet', $this->getResponse()); if ($request->isMethod(sfRequest::PUT)) { if ($request->hasParameter('import_file')) { if (is_file($import_spreadsheet_file = sfConfig::get('sf_upload_dir') . '/' . $request->getParameter('import_file'))) { $import_fields = $this->getUser()->getAttribute('import_fields'); $data = new Spreadsheet_Excel_Reader($import_spreadsheet_file); $projects_id = $request->getParameter('projects_id'); if ($request->getParameter('import_first_row') == 1) { $first_row = 1; } elseif ($data->rowcount() > 2) { $first_row = 2; } else { $first_row = 1; } for ($i = $first_row; $i <= $data->rowcount(); $i++) { $t = new Tasks(); $t->setCreatedBy($this->getUser()->getAttribute('id'))->setCreatedAt(date('Y-m-d H:i:s'))->setProjectsId($request->getParameter('projects_id')); $extra_fields = array(); for ($j = 1; $j <= $data->colcount(); $j++) { if (isset($import_fields[$j])) { $v = $data->val($i, $j); if (strlen(trim($v)) == 0) { continue; } switch ($import_fields[$j]) { case 'TasksGroups': if ($id = app::getProjectCfgItemIdByName($v, 'TasksGroups', $projects_id)) { $t->setTasksGroupsId($id); } else { $cfg = new TasksGroups(); $cfg->setName($v); $cfg->setProjectsId($projects_id); $cfg->save(); $t->setTasksGroupsId($cfg->getId()); } break; case 'Versions': if ($id = app::getProjectCfgItemIdByName($v, 'Versions', $projects_id)) { $t->setVersionsId($id); } else { $cfg = new Versions(); $cfg->setName($v); $cfg->setProjectsId($projects_id); $cfg->save(); $t->setVersionsId($cfg->getId()); } break; case 'ProjectsPhases': if ($id = app::getProjectCfgItemIdByName($v, 'ProjectsPhases', $projects_id)) { $t->setProjectsPhasesId($id); } else { $cfg = new ProjectsPhases(); $cfg->setName($v); $cfg->setProjectsId($projects_id); $cfg->save(); $t->setProjectsPhasesId($cfg->getId()); } break; case 'TasksPriority': if ($id = app::getCfgItemIdByName($v, 'TasksPriority')) { $t->setTasksPriorityId($id); } else { $cfg = new TasksPriority(); $cfg->setName($v); $cfg->save(); $t->setTasksPriorityId($cfg->getId()); } break; case 'TasksLabels': if ($id = app::getCfgItemIdByName($v, 'TasksLabels')) { $t->setTasksLabelId($id); } else { $cfg = new TasksLabels(); $cfg->setName($v); $cfg->save(); $t->setTasksLabelId($cfg->getId()); } break; case 'name': $t->setName($v); break; case 'TasksStatus': if ($id = app::getCfgItemIdByName($v, 'TasksStatus')) { $t->setTasksStatusId($id); } else { $cfg = new TasksStatus(); $cfg->setName($v); $cfg->save(); $t->setTasksStatusId($cfg->getId()); } break; case 'TasksTypes': if ($id = app::getCfgItemIdByName($v, 'TasksTypes')) { $t->setTasksTypeId($id); } else { $cfg = new TasksTypes(); $cfg->setName($v); $cfg->save(); $t->setTasksTypeId($cfg->getId()); } break; break; case 'assigned_to': $assigned_to = array(); foreach (explode(',', $v) as $n) { if ($user = Doctrine_Core::getTable('Users')->createQuery()->addWhere('name=?', trim($n))->fetchOne()) { $assigned_to[] = $user->getId(); } } $t->setAssignedTo(implode(',', $assigned_to)); break; case 'estimated_time': $t->setEstimatedTime($v); break; case 'start_date': $t->setStartDate(date('Y-m-d', strtotime($v))); break; case 'due_date': $t->setDueDate(date('Y-m-d', strtotime($v))); break; case 'progress': $t->setProgress($v); break; } if (strstr($import_fields[$j], 'extra_field_')) { $extra_fields[str_replace('extra_field_', '', $import_fields[$j])] = $v; } } } $t->save(); foreach ($extra_fields as $id => $v) { $f = new ExtraFieldsList(); $f->setBindId($t->getId()); $f->setExtraFieldsId($id); $f->setValue($v); $f->save(); } } $this->getUser()->setFlash('userNotices', t::__('Spreadsheet imported')); $this->redirect('tasks/index?projects_id=' . $request->getParameter('projects_id')); } } elseif (($projects_id = $request->getParameter('projects_id')) > 0) { $f = $request->getFiles(); if ($f['import_file']) { $this->getUser()->setAttribute('import_fields', array()); move_uploaded_file($f['import_file']['tmp_name'], sfConfig::get('sf_upload_dir') . '/' . $f['import_file']['name']); $this->import_file = $f['import_file']['name']; if (is_file($import_spreadsheet_file = sfConfig::get('sf_upload_dir') . '/' . $this->import_file)) { $this->data = new Spreadsheet_Excel_Reader($import_spreadsheet_file); $this->setTemplate('xlsTasksImportBind'); } else { $this->getUser()->setFlash('userNotices', array('type' => 'error', 'text' => t::__('There is an error with uploading file. Please try again with less file size.'))); $this->redirect('tools/xlsTasksImport'); } } } } }
public function executeView(sfWebRequest $request) { $this->forward404Unless($this->tickets_reports = Doctrine_Core::getTable('TicketsReports')->find(array($request->getParameter('id'))), sprintf('Object tickets_reports does not exist (%s).', $request->getParameter('id'))); $this->checkAccess($this->tickets_reports, true); app::setPageTitle($this->tickets_reports->getName(), $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { $this->departmentss = Doctrine_Core::getTable('Departments')->createQuery()->orderBy('sort_order,name')->execute(); app::setPageTitle('Departments', $this->getResponse()); }
public function executeLdap(sfWebRequest $request) { $this->form = new LdapLoginForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $ldap = new ldapLogin(); $user_attr = $ldap->doLdapLogin($this->form['user']->getValue(), $this->form['password']->getValue()); if ($user_attr['status'] == true) { $userName = $this->form['user']->getValue(); $userEmail = $this->form['user']->getValue() . '@localhost.com'; if (strlen($user_attr['email']) > 0) { $userEmail = $user_attr['email']; } if (strlen($user_attr['name']) > 0) { $userName = $user_attr['name']; } $q = Doctrine_Core::getTable('Users')->createQuery()->addWhere('email=?', $userEmail); if (!($user = $q->fetchOne())) { $user = new Users(); $user->setUsersGroupId(sfConfig::get('app_ldap_default_user_group')); $user->setName($userName); $user->setEmail($userEmail); $user->setPassword(md5($this->form['password']->getValue())); $user->setActive(1); $user->setCulture(sfConfig::get('sf_default_culture')); $user->save(); } else { if ($user->getActive() != 1) { $this->getUser()->setFlash('userNotices', I18NText::__('Your account is not active')); $this->redirect('login/ldap'); } } $this->doUserLogin($user, $request); } else { $this->getUser()->setFlash('userNotices', t::__($user_attr['msg'])); $this->redirect('login/ldap'); } } } app::setPageTitle('LDAP Login', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { app::setPageTitle('Phase Status', $this->getResponse()); $this->phases_statuss = Doctrine_Core::getTable('PhasesStatus')->createQuery('a')->orderBy('sort_order, name')->execute(); }
public function executeIndex(sfWebRequest $request) { $this->phasess = Doctrine_Core::getTable('Phases')->createQuery('a')->orderBy('name')->execute(); app::setPageTitle('Default Phases', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { $this->forward404Unless($request->hasParameter('bind_type'), 'bind_type is not defined'); $this->extra_fieldss = Doctrine_Core::getTable('ExtraFields')->createQuery('ef')->addWhere('ef.bind_type=?', $request->getParameter('bind_type', 'projects'))->orderBy('ef.sort_order, ef.name')->execute(); app::setPageTitle('Extra Fields', $this->getResponse()); }
public function executeIndex(sfWebRequest $request) { $this->projects_typess = Doctrine_Core::getTable('ProjectsTypes')->createQuery('a')->orderBy('sort_order, name')->execute(); app::setPageTitle('Projects Types', $this->getResponse()); }
public function executeMyTimeReport(sfWebRequest $request) { if (!$this->getUser()->hasCredential('reports_access_time_personal')) { $this->redirect('accessForbidden/index'); } $this->checkTasksAccess('view'); if (!$this->getUser()->hasAttribute('my_time_report_filter')) { $this->getUser()->setAttribute('my_time_report_filter', Tasks::getDefaultFilter($request, $this->getUser(), 'timeReport')); } $this->filter_by = $this->getUser()->getAttribute('my_time_report_filter'); if ($fb = $request->getParameter('filter_by')) { foreach ($fb as $k => $v) { $this->filter_by[$k] = $v; } $this->getUser()->setAttribute('my_time_report_filter', $this->filter_by); $this->redirect('timeReport/myTimeReport'); } if ($request->hasParameter('remove_filter')) { unset($this->filter_by[$request->getParameter('remove_filter')]); $this->getUser()->setAttribute('my_time_report_filter', $this->filter_by); $this->redirect('timeReport/myTimeReport'); } $this->filter_by['CommentCreatedBy'] = $this->getUser()->getAttribute('id'); $this->getUser()->setAttribute('my_time_report_filter', $this->filter_by); app::setPageTitle('My Time Report', $this->getResponse()); $this->tasks_comments = $this->getTasksComments($request, 'my_time_report_filter'); $this->setTemplate('index'); }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { app::setPageTitle('Access Forbidden', $this->getResponse()); }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { app::setPageTitle('My Account', $this->getResponse()); $this->forward404Unless($users = Doctrine_Core::getTable('Users')->find($this->getUser()->getAttribute('id')), sprintf('Object users does not exist (%s).', $this->getUser()->getAttribute('id'))); $this->form = new UsersForm($users, array('sf_user' => $this->getUser())); }
public function executeIndex(sfWebRequest $request) { $this->users_groupss = Doctrine_Core::getTable('UsersGroups')->createQuery('a')->orderBy('name')->execute(); app::setPageTitle('User Groups', $this->getResponse()); }