当前位置: 首页>>代码示例>>PHP>>正文


PHP Task::setPriority方法代码示例

本文整理汇总了PHP中Task::setPriority方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::setPriority方法的具体用法?PHP Task::setPriority怎么用?PHP Task::setPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Task的用法示例。


在下文中一共展示了Task::setPriority方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DateTimeValue

 function change_priority_tasks()
 {
     if ($this->request->post('priority') == '0') {
         $query = "update " . TABLE_PREFIX . "project_objects set priority='0', updated_on='" . new DateTimeValue() . "', updated_by_id='" . $this->logged_user->getId() . "' where id='" . $this->active_task->getId() . "'";
         db_execute($query);
     } else {
         $this->active_task->setPriority($this->request->post('priority'));
         $save = $this->active_task->save();
     }
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:10,代码来源:TasksController.class.php

示例2: executeAddTask

 public function executeAddTask()
 {
     $project = ProjectPeer::retrieveByUuid($this->getRequestParameter('slug'));
     // TODO: make sure user is a member of project
     $this->forward404Unless($project, 'Project not found, or user is not member, unable to add task');
     $this->forward404Unless($user = sfGuardUserProfilePeer::retrieveByUuid($this->getRequestParameter('task_user'), 'Unable to retrieve user'));
     // TODO: add validation for task input
     $task = new Task();
     $task->setProjectId($project->getId());
     $task->setOwnerId($this->getUser()->getProfile()->getUserID());
     $task->setName($this->getRequestParameter('name', 'Task Name'));
     $task->setDescription($this->getRequestParameter('description', 'Task Description'));
     if ($this->getRequestParameter('begin')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture());
         $task->setBegin("{$y}-{$m}-{$d}");
     }
     if ($this->getRequestParameter('finish')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture());
         $task->setFinish("{$y}-{$m}-{$d}");
     }
     $task->setStatus(sfConfig::get('app_task_status_open'));
     $task->setPriority($this->getRequestParameter('priority'));
     $task->save();
     //if ($user != null) $task->addUser($user->getUserId());
     $task->addUser($user->getUserId());
     $this->redirect('@show_project_tasks?tab=tasks&project=' . $project->getSlug());
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:27,代码来源:actions.class.php

示例3: complete


//.........这里部分代码省略.........
     } else {
         $this->setCompletedBy($by);
         $this->setCompletedOn(new DateTimeValue());
         $save = $this->save();
         if ($save && !is_error($save)) {
             event_trigger('on_project_object_completed', array(&$this, &$by, $comment));
             $activity_log = new TaskCompletedActivityLog();
             $activity_log->log($this, $by);
             if (instance_of($this, 'Task')) {
                 $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
                 mysql_select_db(DB_NAME);
                 $query = "select * from healingcrystals_project_object_misc where object_id='" . $this->getId() . "'";
                 $result = mysql_query($query, $link);
                 $flag_continue = true;
                 if (mysql_num_rows($result)) {
                     $info = mysql_fetch_assoc($result);
                     if (empty($info['recurring_period'])) {
                         $flag_continue = false;
                     }
                     if ($flag_continue) {
                         $recurring_period = $info['recurring_period'];
                         $recurring_period_type = $info['recurring_period_type'];
                         $recurring_period_condition = $info['recurring_period_condition'];
                         $recurring_end_date = $info['recurring_end_date'];
                         $auto_email_status = $info['auto_email_status'];
                         $email_reminder_period = $info['email_reminder_period'];
                         $email_reminder_unit = $info['email_reminder_unit'];
                         $email_reminder_time = $info['email_reminder_time'];
                         if ($recurring_period_condition == 'after_due_date') {
                             $due_date = new DateTime($this->getDueOn());
                         } else {
                             $due_date = new DateTime();
                         }
                         switch ($recurring_period_type) {
                             case 'D':
                                 $recurring_period_type = 'day' . ($recurring_period == 1 ? '' : 's');
                                 break;
                             case 'W':
                                 $recurring_period_type = 'week' . ($recurring_period == 1 ? '' : 's');
                                 break;
                             case 'M':
                                 $recurring_period_type = 'month' . ($recurring_period == 1 ? '' : 's');
                                 break;
                         }
                         $due_date->modify('+' . $recurring_period . ' ' . $recurring_period_type);
                         if (!empty($recurring_end_date) && $recurring_end_date != '0000-00-00') {
                             if (strtotime($due_date->format('Y-m-d')) - strtotime($recurring_end_date) > 0) {
                                 $flag_continue = false;
                             }
                         }
                     }
                     if ($flag_continue) {
                         $new_task = new Task();
                         $new_task->setSource($this->getSource());
                         $new_task->setType($this->getType());
                         $new_task->setModule('resources');
                         $new_task->setProjectId($this->getProjectId());
                         $new_task->setMilestoneId($this->getMilestoneId());
                         $new_task->setParentId($this->getParentId());
                         $new_task->setParentType($this->getParentType());
                         //$new_task->setName($this->getName());
                         $new_task->setBody($this->getBody());
                         $new_task->setState($this->getState());
                         $new_task->setVisibility($this->getVisibility());
                         $new_task->setPriority($this->getPriority());
                         $new_task->setCreatedOn(date('Y-m-d H:i:s'));
                         $new_task->setCreatedById($this->getCreatedById());
                         $new_task->setCreatedByName($this->getCreatedByName());
                         $new_task->setCreatedByEmail($this->getCreatedByEmail());
                         $new_task->setDueOn($due_date->format('Y-m-d'));
                         $query02 = "insert into healingcrystals_project_objects (source, type, module, project_id, milestone_id, parent_id, parent_type, body, state, visibility, priority, created_on, created_by_id, created_by_name, created_by_email, due_on) values ('{$new_task->getSource()}' , '{$new_task->getType()}', '{$new_task->getModule()}', '{$new_task->getProjectId()}', '{$new_task->getMilestoneId()}', '{$new_task->getParentId()}', '{$new_task->getParentType()}', '" . mysql_real_escape_string($new_task->getBody()) . "', '{$new_task->getState()}', '{$new_task->getVisibility()}', '{$new_task->getPriority()}', '{$new_task->getCreatedOn()}', '{$new_task->getCreatedById()}', '{$new_task->getCreatedByName()}', '{$new_task->getCreatedByEmail()}',  '{$new_task->getDueOn()}')";
                         mysql_query($query02);
                         $new_task_id = mysql_insert_id($link);
                         if ($new_task_id) {
                             $_SESSION['new_recurring_task_id'] = $new_task_id;
                             $query02 = "select * from healingcrystals_assignments where object_id='" . $this->getId() . "'";
                             $result02 = mysql_query($query02, $link);
                             if (mysql_num_rows($result02)) {
                                 $query03 = "insert into healingcrystals_assignments \n\t\t\t\t\t\t\t\t\t\t\tselect user_id, '{$new_task_id}', is_owner from healingcrystals_assignments where object_id='" . $this->getId() . "'";
                                 mysql_query($query03);
                             }
                             $query02 = "insert into healingcrystals_project_object_misc \n\t\t\t\t\t\t\t\t\t\tselect '{$new_task_id}', reminder_date, recurring_period, recurring_period_type, recurring_period_condition, recurring_end_date, now(), null, auto_email_status, email_reminder_period, email_reminder_unit, email_reminder_time, null from healingcrystals_project_object_misc where object_id='" . $this->getId() . "'";
                             mysql_query($query02);
                         }
                     }
                 }
                 $query = "select comment_id, user_id from actionrequests_to_tasklist where object_id='" . $this->getId() . "'";
                 $result = mysql_query($query);
                 if (mysql_num_rows($result)) {
                     $info = mysql_fetch_assoc($result);
                     $query = "update healingcrystals_assignments_action_request set is_action_request='-1', last_modified=now() where is_action_request='1' and user_id='" . $info['user_id'] . "' and comment_id='" . $info['comment_id'] . "'";
                     mysql_query($query);
                 }
                 //mysql_close();
             }
         }
         // if
         return $save;
     }
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:ProjectObject.class.php

示例4: lang

 /**
  * Quick add checklist
  *
  * @param void
  * @return null
  */
 function quick_add()
 {
     if (!Checklist::canAdd($this->logged_user, $this->active_project)) {
         $this->httpError(HTTP_ERR_FORBIDDEN, lang("You don't have permission for this action"), true, true);
     }
     // if
     $this->skip_layout = true;
     $checklist_data = $this->request->post('checklist');
     if (!is_array($checklist_data)) {
         $checklist_data = array('visibility' => $this->active_project->getDefaultVisibility());
     }
     //if
     $this->smarty->assign(array('checklist_data' => $checklist_data, 'quick_add_url' => assemble_url('project_checklists_quick_add', array('project_id' => $this->active_project->getId()))));
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $this->active_checklist = new Checklist();
         $this->active_checklist->setAttributes($checklist_data);
         $this->active_checklist->setProjectId($this->active_project->getId());
         $this->active_checklist->setCreatedBy($this->logged_user);
         $this->active_checklist->setState(STATE_VISIBLE);
         $subscribers = array($this->logged_user->getId());
         if (is_foreachable(array_var($checklist_data['assignees'], 0))) {
             $subscribers = array_merge($subscribers, array_var($checklist_data['assignees'], 0));
         } else {
             $subscribers[] = $this->active_project->getLeaderId();
         }
         // if
         Subscriptions::subscribeUsers($subscribers, $this->active_checklist);
         $this->active_checklist->ready();
         // ready
         $save = $this->active_checklist->save();
         if ($save && !is_error($save)) {
             if (isset($checklist_data['tasks']) && is_foreachable($checklist_data['tasks'])) {
                 foreach ($checklist_data['tasks'] as $task_text) {
                     $task_text = trim($task_text);
                     if ($task_text != '') {
                         $task = new Task();
                         $task->setBody($task_text);
                         $task->setPriority(PRIORITY_NORMAL);
                         $task->setProjectId($this->active_project->getId());
                         $task->setParent($this->active_checklist);
                         $task->setCreatedBy($this->logged_user);
                         $task->setState(STATE_VISIBLE);
                         $task->setVisibility(VISIBILITY_NORMAL);
                         $task->new_assignees = $checklist_data['assignees'];
                         $task->save();
                         Subscriptions::subscribeUsers($subscribers, $task);
                         $task->ready();
                     }
                     // if
                 }
                 // if
             }
             // if
             db_commit();
             $this->smarty->assign(array('active_checklist' => $this->active_checklist, 'checklist_data' => array('visibility' => $this->active_project->getDefaultVisibility()), 'project_id' => $this->active_project->getId()));
         } else {
             db_rollback();
             $this->httpError(HTTP_ERR_OPERATION_FAILED, $save->getErrorsAsString(), true, true);
         }
         // if
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:70,代码来源:ChecklistsController.class.php

示例5: importPendingEmailToTaskList


//.........这里部分代码省略.........
                     //EOF:mod 20121107
                 //BOF:mod 20121107
                 /*
                 //EOF:mod 20121107
                 case 'PRIORITY_ONGOING':
                 	$priority_val = '-3';
                 	$priority_val_set = true;
                 	break;
                 //BOF:mod 20121107
                 */
                 //EOF:mod 20121107
                 case 'PRIORITY_LOWEST':
                     $priority_val = '-2';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_LOW':
                     $priority_val = '-1';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_NORMAL':
                     $priority_val = '0';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_HIGH':
                     $priority_val = '1';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_HIGHEST':
                     $priority_val = '2';
                     $priority_val_set = true;
                     break;
                     //BOF:mod 20121107
                 //BOF:mod 20121107
                 case 'PRIORITY_URGENT':
                     $priority_val = '3';
                     $priority_val_set = true;
                     break;
                     //EOF:mod 20121107
             }
             if ($priority_val_set) {
                 $task->setPriority($priority_val);
             }
         }
     }
     $task->setName($incoming_mail->getSubject());
     $amended_body = '';
     //BOF:mod 20120820
     if (empty($comment)) {
         if (strpos($incoming_mail->getSubject(), '{') !== false) {
             $amended_body .= substr($incoming_mail->getSubject(), 0, strrpos($incoming_mail->getSubject(), '{'));
         } else {
             $amended_body .= $incoming_mail->getBody();
         }
     } else {
         if (strpos($incoming_mail->getSubject(), '{') !== false) {
             $parent = $comment->getParent();
             $url = $parent->getViewUrl() . '#comment' . $comment->getId();
             $amended_body .= substr($incoming_mail->getSubject(), 0, strrpos($incoming_mail->getSubject(), '{')) . '<br/><a href="' . $url . '">View Task in Full</a>';
         } else {
             $temp_body = strip_tags($incoming_mail->getBody());
             $chars_len = strlen($temp_body);
             //if ($chars_len > 150){
             if ($chars_len > 525) {
                 //mysql_query("insert into testing (date_added, content) values (now(), 'greater than 150 block')");
                 //$url = $comment->getRealViewUrl();
                 $parent = $comment->getParent();
                 $url = $parent->getViewUrl() . '#comment' . $comment->getId();
                 //mysql_query("insert into testing (date_added, content) values (now(), '" . mysql_real_escape_string($url) . "')");
                 //$amended_body .= substr($temp_body, 0, 150) . '.. <br/><a href="' . $url . '">View Task in Full</a>';
                 $amended_body .= substr($temp_body, 0, 525) . '.. <br/><a href="' . $url . '">View Task in Full</a>';
             } else {
                 $amended_body .= $incoming_mail->getBody();
             }
         }
         //mysql_query("insert into testing (date_added, content) values (now(), '" . mysql_real_escape_string($amended_body) . "')");
         $attachments = $comment->getAttachments();
         if (is_foreachable($attachments)) {
             $amended_body .= '<br/>Attachments:<br/>';
             foreach ($attachments as $attachment) {
                 $amended_body .= '<a href="' . $attachment->getViewUrl() . '">' . $attachment->getName() . '</a><br/>';
             }
         }
     }
     $task->setBody($amended_body);
     //IncomingMailImporter::attachFilesToProjectObject($incoming_mail, $task);
     $save = $task->save();
     if ($save && !is_error($save)) {
         //$subscibed_users = array($project->getLeaderId());
         //if (instance_of($user, 'User')) {
         // $subscibed_users[] = $user->getId();
         //} // if
         //Subscriptions::subscribeUsers($subscibed_users, $ticket);
         $task->ready();
         //mysql_query("insert into testing (date_added, content) values (now(), 'in task list adde func end: " . $task->getId() . "')");
         return $task;
     }
     // if
     return $save;
     //mysql_close($link);
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:IncomingMailImporter.class.php


注:本文中的Task::setPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。