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


PHP Task::setProjectId方法代码示例

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


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

示例1: executeUpdate

 public function executeUpdate()
 {
     $jira = new sfJiraPlugin($this->getUser()->getProfile()->getJiraLogin(), $this->getUser()->getProfile()->getJiraPassword());
     $aProjects = $jira->getProjects();
     foreach ($aProjects as $project) {
         #var_dump( $project );
         $c = new Criteria();
         $c->add(ProjectPeer::USER_ID, $this->getUser()->getProfile()->getId());
         $c->add(ProjectPeer::KEY, $project->key);
         $p = ProjectPeer::doSelectOne($c);
         $c = new Criteria();
         $c->add(UserPeer::JIRA_LOGIN, $project->lead);
         $u = UserPeer::doSelectOne($c);
         if (empty($p)) {
             $p = new Project();
             $p->setKey($project->key);
             $p->setLeadId(!empty($u) ? $u->getId() : null);
             $p->setUserId($this->getUser()->getProfile()->getId());
             $p->setName($project->name);
             $p->setUpdated(date('r'));
             $p->save();
         }
         $issues = $jira->getIssuesForProject($p->getKey());
         foreach ($issues as $issue) {
             #die($p->getKey());
             if ($issue->assignee == $this->getUser()->getProfile()->getJiraLogin()) {
                 $c = new Criteria();
                 $c->add(TaskPeer::KEY, $issue->key);
                 $t = TaskPeer::doSelectOne($c);
                 if (empty($t)) {
                     $c = new Criteria();
                     $c->add(UserPeer::JIRA_LOGIN, $issue->reporter);
                     $u = UserPeer::doSelectOne($c);
                     $t = new Task();
                     $t->setProjectId($p->getId());
                     $t->setTitle($issue->summary);
                     $t->setDescription($issue->description);
                     $t->setKey($issue->key);
                     $t->setUpdated(date('r'));
                     $t->setStatusId($issue->status);
                     $t->setPriorityId($issue->priority);
                     $t->setLeadId(!empty($u) ? $u->getId() : null);
                     $t->save();
                 }
             }
         }
     }
     $this->redirect('@homepage');
     return sfView::NONE;
 }
开发者ID:snoopckuu,项目名称:prmanagment,代码行数:50,代码来源:actions.class.php

示例2: edit


//.........这里部分代码省略.........
                         }
                     } else {
                         $query = "insert into healingcrystals_assignments_action_request (user_id, is_action_request, is_fyi, selected_by_user_id, comment_id, date_added) values ('" . $id . "', '1', '0', '" . $this->logged_user->getId() . "', '" . $this->active_comment->getId() . "', now())";
                         mysql_query($query);
                         $new_ar_users[] = $id;
                     }
                 }
                 $query = "update healingcrystals_assignments_action_request set is_action_request='0' where comment_id='" . $this->active_comment->getId() . "' and user_id not in (" . implode(', ', $action_request_user_id) . ")";
                 mysql_query($query);
             } else {
                 $query = "update healingcrystals_assignments_action_request set is_action_request='0' where comment_id='" . $this->active_comment->getId() . "'";
                 mysql_query($query);
             }
             mysql_query("delete from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and is_action_request='0' and is_fyi='0' and marked_for_email='0'");
             //EOF:task_1260
             foreach ($action_request_users as $id) {
                 if (!in_array($id, $existing_ar_users)) {
                     //unassign
                     $query = "select object_id from actionrequests_to_tasklist where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "' and type='Task'";
                     $result = mysql_query($query);
                     if (mysql_num_rows($result)) {
                         $info = mysql_fetch_assoc($result);
                         $task = new Task($info['object_id']);
                         $task->delete();
                         mysql_query("delete from actionrequests_to_tasklist where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "' and type='Task'");
                     }
                 }
             }
             foreach ($new_ar_users as $id) {
                 //assign
                 //BOF:mod 20130429
                 /*
                 //EOF:mod 20130429
                 			$priority = '0';
                       $query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
                 			$result = mysql_query($query, $link);
                       if (mysql_num_rows($result)){
                 				$query1 = "update healingcrystals_assignments_action_request set is_action_request='1', priority_actionrequest='" . $priority . "' where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
                 				mysql_query($query1, $link);
                 			} else {
                 				$query1 = "insert into healingcrystals_assignments_action_request (user_id, is_action_request, is_fyi, selected_by_user_id, comment_id, date_added, priority_actionrequest) values ('" . $id . "', '1', '0', '" . $this->logged_user->getId() . "', '" . $this->active_comment->getId() . "', now(), '" . $priority . "')";
                 				mysql_query($query1, $link);
                 			}
                 //BOF:mod 20130429
                 */
                 //EOF:mod 20130429
                 $task = new Task();
                 $task->setProjectId(TASK_LIST_PROJECT_ID);
                 $task->setParentId(Page::getTaskPageIdForUser($id));
                 $task->setParentType('Page');
                 $task->setCreatedBy($this->logged_user);
                 $task->setVisibility(VISIBILITY_NORMAL);
                 $task->setState(STATE_VISIBLE);
                 $task_body = '';
                 $parent = $this->active_comment->getParent();
                 $url = $parent->getViewUrl() . '#comment' . $this->active_comment->getId();
                 $comment_body = $this->active_comment->getBody();
                 $comment_body = strip_tags($comment_body);
                 if (strlen($comment_body) > 525) {
                     $task_body .= substr($comment_body, 0, 525) . '..';
                 } else {
                     $task_body .= $comment_body;
                 }
                 $task_body .= '<br/><a href="' . $url . '">View Task in Full</a>';
                 $attachments = $this->active_comment->getAttachments();
                 if (is_foreachable($attachments)) {
                     $task_body .= '<br/>Attachments:<br/>';
                     foreach ($attachments as $attachment) {
                         $task_body .= '<a href="' . $attachment->getViewUrl() . '">' . $attachment->getName() . '</a><br/>';
                     }
                 }
                 $task->setBody($task_body);
                 $savetask = $task->save();
                 if ($savetask && !is_error($savetask)) {
                     $task->ready();
                     mysql_query("insert into actionrequests_to_tasklist (comment_id, user_id, type, object_id) values ('" . $this->active_comment->getId() . "', '" . $id . "', 'Task', '" . $task->getId() . "')");
                 }
             }
             if ($this->request->getFormat() == FORMAT_HTML) {
                 flash_success('Comment has been updated');
                 $this->redirectToUrl($this->active_comment->getRealViewUrl());
             } else {
                 $this->serveData($this->active_comment, 'comment');
             }
             // if
         } else {
             if ($this->request->getFormat() == FORMAT_HTML) {
                 $this->smarty->assign('errors', $save);
             } else {
                 $this->serveData($save);
             }
             // if
         }
         // if
     }
     // if
     //BOF:task_1260
     //mysql_close($link);
     //EOF:task_1260
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:CommentsController.class.php

示例3: 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

示例4: add

 /**
  * Show and process add task form
  *
  * @param void
  * @return null
  */
 function add()
 {
     $this->wireframe->print_button = false;
     if (!instance_of($this->active_task_parent, 'ProjectObject')) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_task_parent->canSubtask($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $task_data = $this->request->post('task');
     $this->smarty->assign(array('task_data' => $task_data, 'page_tab' => $this->active_task_parent->getProjectTab()));
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $this->active_task = new Task();
         // just in case...
         $this->active_task->log_activities = false;
         $this->active_task->setAttributes($task_data);
         $this->active_task->setParent($this->active_task_parent);
         $this->active_task->setProjectId($this->active_project->getId());
         if (trim($this->active_task->getCreatedByName()) == '' || trim($this->active_task->getCreatedByEmail()) == '') {
             $this->active_task->setCreatedBy($this->logged_user);
         }
         // if
         $this->active_task->setState(STATE_VISIBLE);
         $this->active_task->setVisibility($this->active_task_parent->getVisibility());
         $save = $this->active_task->save();
         if ($save && !is_error($save)) {
             $subscribers = array($this->logged_user->getId());
             if (is_foreachable(array_var($task_data['assignees'], 0))) {
                 $subscribers = array_merge($subscribers, array_var($task_data['assignees'], 0));
             } else {
                 $subscribers[] = $this->active_project->getLeaderId();
             }
             // if
             if (!in_array($this->active_project->getLeaderId(), $subscribers)) {
                 $subscribers[] = $this->active_project->getLeaderId();
             }
             // if
             Subscriptions::subscribeUsers($subscribers, $this->active_task);
             $activity = new NewTaskActivityLog();
             $activity->log($this->active_task, $this->logged_user);
             db_commit();
             $this->active_task->ready();
             //BOF:mod
             $recurring_flag = $task_data['recurring_flag'];
             $recurring_period = $task_data['recurring_period'];
             $recurring_period_type = $task_data['recurring_period_type'];
             $recurring_period_condition = $task_data['recurring_period_condition'];
             //$recurring_end_date         = str_replace('/', '-', $task_data['recurring_end_date']);
             ///    $reminder                   = str_replace('/', '-', $task_data['reminder']);
             $recurring_end_date = dateval($task_data['recurring_end_date']);
             /*$reminder                   = dateval($task_data['reminder']);
                          $reminderhours              = (int)$task_data['reminderhours'];
                          $reminderminutes            = (int)$task_data['reminderminutes'];
                          $remindermeridian           = $task_data['remindermeridian'];
                          if (!empty($reminder)){
                              if (!empty($remindermeridian) && $remindermeridian=='PM' && $reminderhours<12){
                                  $reminderhours += 12;
                              } elseif (!empty($remindermeridian) && $remindermeridian=='AM' && $reminderhours==12){
             			$reminderhours = 0;
             		}
                              $reminder               = $reminder . ' ' . $reminderhours . ':' . $reminderminutes;
                          }*/
             $email_flag = empty($task_data['email_flag']) ? '0' : '1';
             if ($email_flag == '1') {
                 $email_reminder_period = (int) $task_data['figure_before_due_date'];
                 $email_reminder_unit = empty($task_data['unit_before_due_date']) ? 'D' : $task_data['unit_before_due_date'];
                 $email_reminder_hours = empty($task_data['reminderhours']) ? '6' : $task_data['reminderhours'];
                 $email_reminder_minutes = (int) $task_data['reminderminutes'];
                 $email_reminder_meridian = empty($task_data['remindermeridian']) ? 'AM' : $task_data['remindermeridian'];
                 $email_reminder_time = '';
                 if ($email_reminder_meridian == 'PM' && $email_reminder_hours < 12) {
                     $email_reminder_time = $email_reminder_hours + 12 . ':';
                 } elseif ($email_reminder_meridian == 'AM' && $email_reminder_hours == 12) {
                     $email_reminder_time = '00:';
                 } else {
                     $email_reminder_time = str_pad($email_reminder_hours, 2, '0', STR_PAD_LEFT) . ':';
                 }
                 $email_reminder_time .= $email_reminder_minutes;
             }
             $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
             mysql_select_db(DB_NAME);
             //if (empty($recurring_flag) && empty($reminder) && empty($email_flag)){
             if (empty($recurring_flag) && empty($email_flag)) {
                 $query = "delete from healingcrystals_project_object_misc where object_id='" . $this->active_task->getId() . "'";
                 mysql_query($query, $link);
             } else {
                 if (empty($recurring_flag)) {
                     $recurring_period = '';
                     $recurring_period_type = '';
                     $recurring_period_condition = '';
                     $recurring_end_date = '';
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:TasksController.class.php

示例5: 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

示例6: 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

示例7: importPendingEmailToTaskList

 function importPendingEmailToTaskList(&$incoming_mail, &$project, &$user, $page_id, $comment)
 {
     //$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
     //mysql_select_db(DB_NAME, $link);
     //mysql_query("insert into testing (date_added, content) values (now(), 'in task list adde func:Page " . $page_id . " / comment: " . $comment->getId() . "')");
     //mysql_query("insert into testing (date_added, content) values (now(), '" . mysql_real_escape_string($incoming_mail->getSubject()) . "')");
     //EOF:mod 20120820
     list($user_name, $priority) = explode('-', $incoming_mail->getSubject());
     $user_name = trim($user_name);
     $priority = trim($priority);
     $name_parts = explode(' ', $user_name);
     list($first_name, $last_name) = $name_parts;
     //mysql_query("insert into testing (date_added, content) values (now(), '" . mysql_real_escape_string($priority) . "')");
     //BOF:mod 20120820
     /*
     //EOF:mod 20120820
     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
     mysql_select_db(DB_NAME, $link);
     $query = "select id from healingcrystals_users where first_name='" . mysql_real_escape_string($first_name) . "' " . (!empty($last_name) ? " and last_name='" . mysql_real_escape_string($last_name) . "' " : "");
     $result = mysql_query($query, $link);
     if (mysql_num_rows($result)){
     		$info = mysql_fetch_assoc($result);
     		$user_id = $info['id'];
     		$task_meant_for_user = Users::findById($user_id);
     		$page_title = $task_meant_for_user->getName() . ' - Task List';
     		//echo $page_title . '<br/>';
     		$query2 = "select id from healingcrystals_project_objects where type='Page' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='" . mysql_real_escape_string($page_title) . "'";
     		//echo $query2 . '<br/>';
     		$result2 = mysql_query($query2,$link);
     		if (mysql_num_rows($result2)){
     			$info2 = mysql_fetch_assoc($result2);
     			$page_id = $info2['id'];
     		} else {
     			$query3 = "select id from healingcrystals_project_objects where type='Category' and module='pages' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='General'";
     			//echo $query3 . '<br/>';
     			$page_category = mysql_query($query3, $link);
     			$page_category_info = mysql_fetch_assoc($page_category);
     			$category_id = $page_category_info['id'];
     			//echo $category_id . '<br/>';
     
     			$page_data = array(
     				'type' => 'Page',
     				'module' => 'pages',
     				'visibility' => VISIBILITY_NORMAL,
     				'name' => $page_title,
     				'body' => 'Auto-generated Task List Page',
     				'integer_field_1' => '1',
     			);
     			//print_r($page_data);
     			//db_begin_work();
     			$page = new Page();
     			$page->setAttributes($page_data);
     			$page->setProjectId(TASK_LIST_PROJECT_ID);
     			$page->setCreatedBy($user);
     			$page->setState(STATE_VISIBLE);
     			$page->setParentId($category_id);
     			$page->save();
     			$page->ready();
     			$page_id = $page->getId();
     		}
     }
     mysql_close($link);
     //BOF:mod 20120820
     */
     //EOF:mod 20120820
     $task = new Task();
     $task->setProjectId($project->getId());
     $task->setParentId($page_id);
     $task->setParentType('Page');
     $task->setCreatedBy($user);
     $task->setCreatedOn($incoming_mail->getCreatedOn());
     $task->setVisibility(VISIBILITY_NORMAL);
     $task->setState(STATE_VISIBLE);
     $task->setSource(OBJECT_SOURCE_EMAIL);
     if (!empty($priority)) {
         $constant_name = 'PRIORITY_' . strtoupper(str_replace(' ', '', $priority));
         $priority_val = '';
         $priority_val_set = false;
         if (defined($constant_name)) {
             switch ($constant_name) {
                 case 'PRIORITY_HOLD':
                     $priority_val = '-4';
                     $priority_val_set = true;
                     break;
                     //BOF:mod 20121107
                     /*
                     //EOF:mod 20121107
                     case 'PRIORITY_ONGOING':
                     	$priority_val = '-3';
                     	$priority_val_set = true;
                     	break;
                     //BOF:mod 20121107
                     */
                     //EOF:mod 20121107
                 //BOF:mod 20121107
                 /*
                 //EOF:mod 20121107
                 case 'PRIORITY_ONGOING':
                 	$priority_val = '-3';
                 	$priority_val_set = true;
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:IncomingMailImporter.class.php


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