本文整理汇总了PHP中app::getStatusByGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP app::getStatusByGroup方法的具体用法?PHP app::getStatusByGroup怎么用?PHP app::getStatusByGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::getStatusByGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeMultipleEdit
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();
//.........这里部分代码省略.........
示例2: processForm
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'));
}
}
示例3: getDefaultFilter
public static function getDefaultFilter($request, $sf_user, $filter_type = 'filter')
{
$f = array();
if (strstr($filter_type, 'timeReport')) {
if (count($s = app::getStatusByGroup('closed', 'TasksStatus')) > 0) {
$f['TasksStatus'] = implode(',', $s);
}
} else {
if (count($s = app::getStatusByGroup('open', 'TasksStatus')) > 0) {
$f['TasksStatus'] = implode(',', $s);
}
}
return $f;
}