public function configure() { $this->widgetSchema['phases_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('PhasesStatus'))); $this->setDefault('phases_status_id', app::getDefaultValueByTable('PhasesStatus')); $this->widgetSchema['projects_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['due_date'] = new sfWidgetFormInput(array(), array('class' => 'datepicker')); $this->widgetSchema['name']->setAttributes(array('class' => 'required')); $this->widgetSchema->setLabels(array('phases_status_id' => 'Status', 'due_date' => 'Due Date')); }
public function configure() { $this->widgetSchema['projects_types_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('ProjectsTypes'))); $this->setDefault('projects_types_id', app::getDefaultValueByTable('ProjectsTypes')); $this->widgetSchema['projects_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('ProjectsStatus'))); $this->setDefault('projects_status_id', app::getDefaultValueByTable('ProjectsStatus')); $this->widgetSchema['name']->setAttributes(array('size' => '60', 'class' => 'required')); $this->widgetSchema['description']->setAttributes(array('class' => 'editor')); $this->widgetSchema['created_by'] = new sfWidgetFormInputHidden(); $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden(); $this->setDefault('created_at', date('Y-m-d H:i:s')); $this->widgetSchema->setLabels(array('projects_types_id' => 'Type', 'projects_status_id' => 'Status')); }
public function configure() { $discussions = $this->getOption('discussions'); if ($this->getObject()->isNew()) { $this->widgetSchema['discussions_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('DiscussionsStatus', true))); } else { $this->widgetSchema['discussions_status_id'] = new sfWidgetFormInputHidden(); } $this->widgetSchema['users_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden(); $this->setDefault('created_at', date('Y-m-d H:i:s')); $this->widgetSchema['description']->setAttributes(array('class' => 'editor')); $this->widgetSchema['discussions_id'] = new sfWidgetFormInputHidden(); $this->setDefault('discussions_id', $discussions->getId()); $this->widgetSchema->setLabels(array('discussions_status_id' => 'Status')); }
public function configure() { $tickets = $this->getOption('tickets'); if ($this->getObject()->isNew()) { $this->widgetSchema['tickets_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TicketsStatus', true))); } else { $this->widgetSchema['tickets_status_id'] = new sfWidgetFormInputHidden(); } $this->widgetSchema['users_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden(); $this->setDefault('created_at', date('Y-m-d H:i:s')); $this->widgetSchema['description']->setAttributes(array('class' => 'editor')); $this->widgetSchema['tickets_id'] = new sfWidgetFormInputHidden(); $this->setDefault('tickets_id', $tickets->getId()); $this->widgetSchema->setLabels(array('tickets_priority_id' => 'Priority', 'tickets_types_id' => 'Type', 'tickets_groups_id' => 'Group', 'tickets_status_id' => 'Status')); }
public function configure() { $projects = $this->getOption('projects'); $sf_user = $this->getOption('sf_user'); $this->widgetSchema['discussions_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('DiscussionsStatus'))); $this->setDefault('discussions_status_id', app::getDefaultValueByTable('DiscussionsStatus')); $this->widgetSchema['assigned_to'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'discussions'), 'expanded' => true, 'multiple' => true)); if (Users::hasAccess('edit', 'projects', $sf_user, $projects->getId())) { $this->widgetSchema['users_id'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'discussions_insert'))); } else { $this->widgetSchema['users_id'] = new sfWidgetFormInputHidden(); } $this->widgetSchema['name']->setAttributes(array('size' => '60', 'class' => 'required')); $this->widgetSchema['description']->setAttributes(array('class' => 'editor')); $this->widgetSchema['projects_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema->setLabels(array('discussions_status_id' => 'Status', 'assigned_to' => 'Assigned To', 'users_id' => 'Created By')); }
public function configure() { $projects = $this->getOption('projects'); $sf_user = $this->getOption('sf_user'); $this->widgetSchema['tasks_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksStatus'))); $this->setDefault('tasks_status_id', app::getDefaultValueByTable('TasksStatus')); $this->widgetSchema['tasks_priority_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksPriority'))); $this->setDefault('tasks_priority_id', app::getDefaultValueByTable('TasksPriority')); $this->widgetSchema['tasks_type_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksTypes'))); $this->setDefault('tasks_type_id', app::getDefaultValueByTable('TasksTypes')); $this->widgetSchema['tasks_label_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksLabels'))); $this->setDefault('tasks_label_id', app::getDefaultValueByTable('TasksLabels')); $this->widgetSchema['tasks_groups_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksGroups', true, $projects->getId()))); $this->widgetSchema['projects_phases_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('ProjectsPhases', true, $projects->getId()))); $this->widgetSchema['versions_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('Versions', true, $projects->getId()))); $this->widgetSchema['progress'] = new sfWidgetFormChoice(array('choices' => Tasks::getProgressChoices())); $this->widgetSchema['assigned_to'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'tasks'), 'expanded' => true, 'multiple' => true)); if (Users::hasAccess('edit', 'projects', $sf_user, $projects->getId())) { $this->widgetSchema['created_by'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'tasks_insert'))); } else { $this->widgetSchema['created_by'] = new sfWidgetFormInputHidden(); } $this->widgetSchema['name']->setAttributes(array('size' => '60', 'class' => 'required')); $this->widgetSchema['description']->setAttributes(array('class' => 'editor')); $this->widgetSchema['estimated_time']->setAttributes(array('size' => '4')); $this->widgetSchema['start_date'] = new sfWidgetFormInput(array(), array('class' => 'datetimepicker')); $this->widgetSchema['due_date'] = new sfWidgetFormInput(array(), array('class' => 'datetimepicker')); $this->widgetSchema['projects_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['closed_date'] = new sfWidgetFormInputHidden(); $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden(); $this->setDefault('created_at', date('Y-m-d H:i:s')); $this->widgetSchema->setLabels(array('tasks_priority_id' => 'Priority', 'tasks_type_id' => 'Type', 'tasks_label_id' => 'Label', 'projects_phases_id' => 'Phase', 'versions_id' => 'Version', 'tasks_groups_id' => 'Group', 'tasks_status_id' => 'Status', 'estimated_time' => 'Estimated Time', 'start_date' => 'Start Date', 'due_date' => 'Due Date', 'created_by' => 'Created By')); unset($this->widgetSchema['discussion_id']); unset($this->widgetSchema['tickets_id']); unset($this->widgetSchema['work_hours']); unset($this->validatorSchema['discussion_id']); unset($this->validatorSchema['tickets_id']); unset($this->validatorSchema['work_hours']); }
public function configure() { $tasks = $this->getOption('tasks'); if ($this->getObject()->isNew()) { $this->widgetSchema['tasks_priority_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksPriority', true))); $this->widgetSchema['tasks_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksStatus', true))); $this->widgetSchema['due_date'] = new sfWidgetFormInput(array(), array('class' => 'datetimepicker')); } else { $this->widgetSchema['tasks_priority_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['tasks_status_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['due_date'] = new sfWidgetFormInputHidden(); } $this->widgetSchema['created_by'] = new sfWidgetFormInputHidden(); if (sfConfig::get('app_allow_adit_tasks_comments_date') == 'off') { $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden(); } $this->setDefault('created_at', date('Y-m-d H:i:s')); $this->widgetSchema['description']->setAttributes(array('class' => 'editor')); $this->widgetSchema['worked_hours']->setAttributes(array('size' => '4')); $this->widgetSchema['tasks_id'] = new sfWidgetFormInputHidden(); $this->setDefault('tasks_id', $tasks->getId()); $this->widgetSchema->setLabels(array('tasks_priority_id' => 'Priority', 'tasks_types_id' => 'Type', 'tasks_labels_id' => 'Label', 'tasks_status_id' => 'Status', 'worked_hours' => 'Work Hours', 'due_date' => 'Due Date', 'created_at' => 'Created At')); }
public function configure() { $projects = $this->getOption('projects'); $sf_user = $this->getOption('sf_user'); $this->widgetSchema['departments_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('Departments')), array('class' => 'required')); $this->widgetSchema['tickets_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TicketsStatus'))); $this->setDefault('tickets_status_id', app::getDefaultValueByTable('TicketsStatus')); $this->widgetSchema['tickets_types_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TicketsTypes'))); $this->setDefault('tickets_types_id', app::getDefaultValueByTable('TicketsTypes')); if ($projects) { if (Users::hasAccess('edit', 'projects', $sf_user, $projects->getId())) { $this->widgetSchema['users_id'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'tickets_insert'))); } else { $this->widgetSchema['users_id'] = new sfWidgetFormInputHidden(); } } $this->widgetSchema['name']->setAttributes(array('size' => '60', 'class' => 'required')); $this->widgetSchema['description']->setAttributes(array('class' => 'editor')); $this->widgetSchema['projects_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden(); $this->setDefault('created_at', date('Y-m-d H:i:s')); $this->widgetSchema->setLabels(array('tickets_types_id' => 'Type', 'tickets_status_id' => 'Status', 'departments_id' => 'Department', 'name' => 'Subject', 'users_id' => 'Created By')); }
</tr> <?php } ?> <?php if (app::countItemsByTable('TasksTypes') > 0) { ?> <tr> <th><?php echo __('Type'); ?> </th> <td> <?php echo select_tag('tasks_types_id', '', array('choices' => app::getItemsChoicesByTable('TasksTypes', true))); ?> </td> </tr> <?php } ?> <tr> <th><?php echo $form['due_date']->renderLabel(); ?> </th> <td> <?php echo $form['due_date']->renderError();
public function executeMultipleEdit(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('edit', false, $this->projects); } else { $this->checkTicketsAccess('edit'); } $this->fields = array(); if ($request->getParameter('projects_id') > 0) { $this->fields['departments_id'] = array('title' => t::__('Department'), 'choices' => app::getItemsChoicesByTable('Departments', true)); } $choices = app::getItemsChoicesByTable('TicketsStatus', true); if (count($choices) > 1) { $this->fields['tickets_status_id'] = array('title' => t::__('Status'), 'choices' => $choices); } $choices = app::getItemsChoicesByTable('TicketsTypes', true); if (count($choices) > 1) { $this->fields['tickets_types_id'] = array('title' => t::__('Type'), 'choices' => $choices); } if ($request->getParameter('fields')) { if (strlen($request->getParameter('selected_items') == 0)) { exit; } foreach ($request->getParameter('fields') as $key => $value) { if (strlen($value) == 0 and !is_array($value)) { continue; } if ($key == 'tickets_status_id') { foreach (explode(',', $request->getParameter('selected_items')) as $pid) { if ($p = Doctrine_Core::getTable('Tickets')->find($pid)) { if ($p->getTicketsStatusId() != $value) { $p->setTicketsStatusId($value); $p->save(); if ($p->getDepartmentsId() > 0) { Tickets::sendNotification($this, $p, array('status' => explode(',', $p->getDepartments()->getUsersId())), $this->getUser()); } $c = new TicketsComments(); $c->setTicketsStatusId($value); $c->setTicketsId($pid); $c->setCreatedAt(date('Y-m-d H:i:s')); $c->setUsersId($this->getUser()->getAttribute('id')); $c->save(); } } } } elseif ($key == 'departments_id') { foreach (explode(',', $request->getParameter('selected_items')) as $pid) { if ($p = Doctrine_Core::getTable('Tickets')->find($pid)) { if ($p->getDepartmentsId() != $value) { $p->setDepartmentsId($value); $p->save(); if ($p->getDepartmentsId() > 0) { Tickets::sendNotification($this, $p, array('new' => explode(',', $p->getDepartments()->getUsersId())), $this->getUser()); } } } } } else { Doctrine_Query::create()->update('Tickets')->set($key, $value)->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute(); } } $this->redirect_to($request->getParameter('redirect_to'), $request->getParameter('projects_id'), $request->getParameter('tickets_id')); } }
<?php } ?> <?php if (app::countItemsByTable('ProjectsStatus') > 0 and $form->getObject()->isNew()) { ?> <tr> <th><?php echo __('Status'); ?> </th> <td> <?php echo select_tag('projects_status_id', '', array('choices' => app::getItemsChoicesByTable('ProjectsStatus', true))); ?> </td> </tr> <?php } ?> <tr> <th><?php echo $form['description']->renderLabel(); ?> </th> <td> <?php echo $form['description']->renderError(); ?>
echo app::getReportFormFilterByTable('Type', 'projects_reports[projects_type_id]', 'ProjectsTypes', $form['projects_type_id']->getValue()); ?> </tr> </table> </td> <?php if (count($choices = app::getProjectChoicesByUser($sf_user, true)) > 0) { if (!is_string($v = $form['projects_id']->getValue())) { $v = ''; } echo '<td style="padding-right: 10px;"><b>' . __('Projects') . '</b><br>' . select_tag('projects_reports[projects_id]', explode(',', $v), array('choices' => $choices, 'multiple' => true), array('style' => 'height: 400px; width: 250px;')) . '</td>'; } if (count($choices = app::getItemsChoicesByTable('Users', true)) > 0 and (Users::hasAccess('insert', 'projects', $sf_user) or Users::hasAccess('edit', 'projects', $sf_user))) { if (!is_string($v = $form['in_team']->getValue())) { $v = ''; } echo '<td style="padding-right: 10px;"><b>' . __('In Team') . '</b><br>' . select_tag('projects_reports[in_team]', explode(',', $v), array('choices' => $choices), array('style' => 'width: 250px;')) . '</td>'; } ?> </tr> </table> </div> </div> <br> <input type="submit" value="<?php echo __('Save');
public function executeMultipleEdit(sfWebRequest $request) { Users::checkAccess($this, 'edit', $this->getModuleName(), $this->getUser()); $this->fields = array(); $choices = app::getItemsChoicesByTable('ProjectsStatus', true); if (count($choices) > 1) { $this->fields['projects_status_id'] = array('title' => t::__('Status'), 'choices' => $choices); } $choices = app::getItemsChoicesByTable('ProjectsTypes', true); if (count($choices) > 1) { $this->fields['projects_types_id'] = array('title' => t::__('Type'), 'choices' => $choices); } if ($request->getParameter('fields')) { if (strlen($request->getParameter('selected_items') == 0)) { exit; } foreach ($request->getParameter('fields') as $key => $value) { if (strlen($value) == 0 and !is_array($value)) { continue; } if ($key == 'projects_status_id') { foreach (explode(',', $request->getParameter('selected_items')) as $pid) { if ($p = Doctrine_Core::getTable('Projects')->find($pid)) { if ($p->getProjectsStatusId() != $value) { $p->setProjectsStatusId($value); $p->save(); if (strlen($p->getTeam()) > 0) { Projects::sendNotification($this, $p, array('status' => explode(',', $p->getTeam())), $this->getUser()); } } } } } else { Doctrine_Query::create()->update('Projects')->set($key, $value)->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute(); } } $this->redirect_to($request->getParameter('redirect_to')); } }
public function executeMultipleEdit(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('edit', false, $this->projects); } else { $this->checkTasksAccess('edit'); } $this->fields = array(); $this->numeric_fields = array(); $choices = app::getItemsChoicesByTable('TasksPriority', true); if (count($choices) > 1) { $this->fields['tasks_priority_id'] = array('title' => t::__('Priority'), 'choices' => $choices); } $choices = app::getItemsChoicesByTable('TasksLabels', true); if (count($choices) > 1) { $this->fields['tasks_label_id'] = array('title' => t::__('Label'), 'choices' => $choices); } $choices = app::getItemsChoicesByTable('TasksStatus', true); if (count($choices) > 1) { $this->fields['tasks_status_id'] = array('title' => t::__('Status'), 'choices' => $choices); } $choices = app::getItemsChoicesByTable('TasksTypes', true); if (count($choices) > 1) { $this->fields['tasks_type_id'] = array('title' => t::__('Type'), 'choices' => $choices); } if ($request->hasParameter('projects_id')) { $choices = app::getItemsChoicesByTable('TasksGroups', true, $request->getParameter('projects_id')); if (count($choices) > 1) { $this->fields['tasks_groups_id'] = array('title' => t::__('Group'), 'choices' => $choices); } $choices = app::getItemsChoicesByTable('Versions', true, $request->getParameter('projects_id')); if (count($choices) > 1) { $this->fields['versions_id'] = array('title' => t::__('Version'), 'choices' => $choices); } $choices = app::getItemsChoicesByTable('ProjectsPhases', true, $request->getParameter('projects_id')); if (count($choices) > 1) { $this->fields['projects_phases_id'] = array('title' => t::__('Phase'), 'choices' => $choices); } } $this->fields['progress'] = array('title' => t::__('Progress'), 'choices' => Tasks::getProgressChoices()); $extra_fields = ExtraFieldsList::getFieldsByType('tasks', $this->getUser(), false, array('all' => true)); $this->numeric_fields['estimated_time'] = array('title' => t::__('Estimated Time')); foreach ($extra_fields as $v) { if (in_array($v['type'], array('number'))) { $this->numeric_fields['extra_field_' . $v['id']] = array('title' => $v['name']); } } if ($request->getParameter('fields')) { if (strlen($request->getParameter('selected_items') == 0)) { exit; } foreach ($request->getParameter('fields') as $key => $value) { if (strlen($value) == 0 and !is_array($value)) { continue; } if ($key == 'tasks_status_id') { foreach (explode(',', $request->getParameter('selected_items')) as $pid) { if ($p = Doctrine_Core::getTable('Tasks')->find($pid)) { if ($p->getTasksStatusId() != $value) { $p->setTasksStatusId($value); if (in_array($value, app::getStatusByGroup('closed', 'TasksStatus'))) { $p->setClosedDate(date('Y-m-d H:i:s')); } if (!in_array($value, app::getStatusByGroup('closed', 'TasksStatus'))) { $p->setClosedDate(null); } $p->save(); if (strlen($p->getAssignedTo()) > 0) { Tasks::sendNotification($this, $p, array('status' => explode(',', $p->getAssignedTo())), $this->getUser()); } $c = new TasksComments(); $c->setTasksStatusId($value); $c->setTasksId($pid); $c->setCreatedAt(date('Y-m-d H:i:s')); $c->setCreatedBy($this->getUser()->getAttribute('id')); $c->save(); } } } } elseif ($key == 'estimated_time') { $action_str = (double) $value; if (in_array(substr($value, 0, 1), array('+', '-', '*', '/'))) { $action_str = 'estimated_time ' . substr($value, 0, 1) . ' ' . (double) substr($value, 1); Doctrine_Query::create()->update('Tasks')->set('estimated_time', 0)->whereIn('id', explode(',', $request->getParameter('selected_items')))->addWhere('estimated_time is null or length(estimated_time)=0')->execute(); } Doctrine_Query::create()->update('Tasks')->set('estimated_time', $action_str)->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute(); } elseif ($key == 'assigned_to') { $tasks_list = Doctrine_Core::getTable('Tasks')->createQuery()->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute(); foreach ($tasks_list as $tasks) { $tasks->setAssignedTo(implode(',', $value)); $tasks->save(); Tasks::sendNotification($this, $tasks, array('new' => $value), $this->getUser()); $c = new TasksComments(); $c->setDescription(t::__('Assigned To') . ': ' . Users::getNameById(implode(',', $value), ', ')); $c->setTasksId($tasks->getId()); $c->setCreatedAt(date('Y-m-d H:i:s')); $c->setCreatedBy($this->getUser()->getAttribute('id')); $c->save(); $tasks->save(); } } else { Doctrine_Query::create()->update('Tasks')->set($key, $value)->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute(); } } $this->redirect_to($request->getParameter('redirect_to'), $request->getParameter('projects_id'), $request->getParameter('tasks_id')); } }
</tr> <?php } ?> <?php if ($sf_request->getParameter('projects_id') > 0) { ?> <tr> <th><?php echo __('Departments'); ?> </th> <td> <?php echo select_tag('departments_id', '', array('choices' => app::getItemsChoicesByTable('Departments', true))); ?> </td> </tr> <?php } ?> <?php } ?> <tr> <th><?php echo $form['description']->renderLabel();
public static function getReportFormFilterByTable($title, $field, $t, $values, $sf_user = false) { if (app::countItemsByTable($t) > 0) { if (!is_string($values)) { $values = ''; } return '<td style="padding-right: 10px;"><b>' . __($title) . '</b><br>' . select_tag($field, explode(',', $values), array('choices' => app::getItemsChoicesByTable($t, false, false, $sf_user), 'expanded' => true, 'multiple' => true)) . '</td>'; } else { return ''; } }