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


PHP ProjectTasks::maxOrder方法代码示例

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


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

示例1: add_task

 /**
  * Add new task
  *
  * @access public
  * @param void
  * @return null
  */
 function add_task()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $notAllowedMember = '';
     if (!ProjectTask::canAdd(logged_user(), active_context(), $notAllowedMember)) {
         if (str_starts_with($notAllowedMember, '-- req dim --')) {
             flash_error(lang('must choose at least one member of', str_replace_first('-- req dim --', '', $notAllowedMember, $in)));
         } else {
             flash_error(lang('no context permissions to add', lang("tasks"), $notAllowedMember));
         }
         ajx_current("empty");
         return;
     }
     // if
     $task = new ProjectTask();
     $task_data = array_var($_POST, 'task');
     if (!is_array($task_data)) {
         $dd = getDateValue(array_var($_POST, 'task_due_date', ''));
         if ($dd instanceof DateTimeValue) {
             $duetime = getTimeValue(array_var($_POST, 'task_due_time'));
             if (is_array($duetime)) {
                 $dd->setHour(array_var($duetime, 'hours'));
                 $dd->setMinute(array_var($duetime, 'mins'));
             }
             $task->setUseDueTime(is_array($duetime));
         }
         $sd = getDateValue(array_var($_POST, 'task_start_date', ''));
         if ($sd instanceof DateTimeValue) {
             $starttime = getTimeValue(array_var($_POST, 'task_start_time'));
             if (is_array($starttime)) {
                 $sd->setHour(array_var($starttime, 'hours'));
                 $sd->setMinute(array_var($starttime, 'mins'));
             }
             $task->setUseStartTime(is_array($starttime));
         }
         $time_estimate = array_var($_POST, 'hours', 0) * 60 + array_var($_POST, 'minutes', 0);
         $task_data = array('milestone_id' => array_var($_POST, 'milestone_id', 0), 'project_id' => 1, 'name' => array_var($_POST, 'name', ''), 'assigned_to_contact_id' => array_var($_POST, 'assigned_to_contact_id', '0'), 'parent_id' => array_var($_POST, 'parent_id', 0), 'priority' => array_var($_POST, 'priority', ProjectTasks::PRIORITY_NORMAL), 'text' => array_var($_POST, 'text', ''), 'start_date' => $sd, 'due_date' => $dd, 'time_estimate' => $time_estimate, 'is_template' => array_var($_POST, "is_template", array_var($_GET, "is_template", false)), 'percent_completed' => array_var($_POST, "percent_completed", ''), 'object_subtype' => array_var($_POST, "object_subtype", config_option('default task co type')), 'send_notification' => array_var($_POST, 'notify') && array_var($_POST, 'notify') == 'true');
         // array
         if (Plugins::instance()->isActivePlugin('mail')) {
             $from_email = array_var($_GET, 'from_email');
             $email = MailContents::findById($from_email);
             if ($email instanceof MailContent) {
                 $task_data['name'] = $email->getSubject();
                 $task_data['text'] = lang('create task from email description', $email->getSubject(), $email->getFrom(), $email->getTextBody());
                 tpl_assign('from_email', $email);
             }
         }
     }
     // if
     if (array_var($_GET, 'replace')) {
         ajx_replace(true);
     }
     tpl_assign('task_data', $task_data);
     tpl_assign('task', $task);
     tpl_assign('pending_task_id', 0);
     $subtasks = array();
     if (array_var($_POST, 'multi_assignment')) {
         $json_subtasks = json_decode(array_var($_POST, 'multi_assignment'));
         $line = 0;
         if (count($json_subtasks) > 0) {
             foreach ($json_subtasks as $json_subtask) {
                 $subtasks[$line]['assigned_to_contact_id'] = $json_subtask->assigned_to_contact_id;
                 $subtasks[$line]['name'] = $json_subtask->name;
                 $subtasks[$line]['time_estimate_hours'] = $json_subtask->time_estimate_hours;
                 $subtasks[$line]['time_estimate_minutes'] = $json_subtask->time_estimate_minutes;
                 $line++;
             }
         }
     }
     tpl_assign('multi_assignment', $subtasks);
     if (is_array(array_var($_POST, 'task'))) {
         // order
         $task->setOrder(ProjectTasks::maxOrder(array_var($task_data, "parent_id", 0), array_var($task_data, "milestone_id", 0)));
         $task_data['due_date'] = getDateValue(array_var($_POST, 'task_due_date'));
         $task_data['start_date'] = getDateValue(array_var($_POST, 'task_start_date'));
         if ($task_data['due_date'] instanceof DateTimeValue) {
             $duetime = getTimeValue(array_var($_POST, 'task_due_time'));
             if (is_array($duetime)) {
                 $task_data['due_date']->setHour(array_var($duetime, 'hours'));
                 $task_data['due_date']->setMinute(array_var($duetime, 'mins'));
             }
             $task_data['due_date']->advance(logged_user()->getTimezone() * -3600);
             $task_data['use_due_time'] = is_array($duetime);
         }
         if ($task_data['start_date'] instanceof DateTimeValue) {
             $starttime = getTimeValue(array_var($_POST, 'task_start_time'));
             if (is_array($starttime)) {
                 $task_data['start_date']->setHour(array_var($starttime, 'hours'));
                 $task_data['start_date']->setMinute(array_var($starttime, 'mins'));
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例2: copySubTasks

	/**
	 * Copies subtasks from taskFrom to taskTo.
	 *
	 * @param ProjectTask $taskFrom
	 * @param ProjectTask $taskTo
	 */
	function copySubTasks(ProjectTask $taskFrom, ProjectTask $taskTo, $as_template = false) {
		foreach ( $taskFrom->getSubTasks () as $sub ) {
			if ($sub->getId() == $taskTo->getId()) continue;
			$new = ProjectTasks::createTaskCopy ( $sub );
			$new->setIsTemplate ( $as_template );
			$new->setParentId ( $taskTo->getId () );
			$new->setMilestoneId ( $taskTo->getMilestoneId () );
			$new->setOrder ( ProjectTasks::maxOrder ( $new->getParentId (), $new->getMilestoneId () ) );
			if ($sub->getIsTemplate ()) {
				$new->setFromTemplateId ( $sub->getId () );
			}
			$new->save ();
			
			$object_controller = new ObjectController();
			if (count($taskFrom->getMemberIds())) {
				$object_controller->add_to_members($new, $taskFrom->getMemberIds());
			}
			$new->copyCustomPropertiesFrom ( $sub );
			$new->copyLinkedObjectsFrom ( $sub );
			ProjectTasks::copySubTasks ( $sub, $new, $as_template );
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:28,代码来源:ProjectTasks.class.php

示例3: add_task


//.........这里部分代码省略.........
             $text_post = preg_replace("/[\n|\r|\n\r]/", '', array_var($_POST, 'text', ''));
         } else {
             $text_post = array_var($_POST, 'text', '');
         }
         $task_data = array('milestone_id' => array_var($_REQUEST, 'milestone_id', 0), 'project_id' => 1, 'name' => array_var($_REQUEST, 'name', ''), 'assigned_to_contact_id' => array_var($_REQUEST, 'assigned_to_contact_id', '0'), 'selected_members_ids' => json_decode(array_var($_POST, 'members', null)), 'parent_id' => array_var($_REQUEST, 'parent_id', 0), 'priority' => array_var($_POST, 'priority', ProjectTasks::PRIORITY_NORMAL), 'text' => $text_post, 'start_date' => $sd, 'due_date' => $dd, 'time_estimate' => $time_estimate, 'is_template' => array_var($_POST, "is_template", array_var($_GET, "is_template", false)), 'percent_completed' => array_var($_POST, "percent_completed", ''), 'object_subtype' => array_var($_POST, "object_subtype", config_option('default task co type')), 'send_notification_subscribers' => user_config_option("can notify subscribers"));
         // array
         if (Plugins::instance()->isActivePlugin('mail')) {
             $from_email = array_var($_GET, 'from_email');
             $email = MailContents::findById($from_email);
             if ($email instanceof MailContent) {
                 $task_data['name'] = $email->getSubject();
                 $task_data['text'] = lang('create task from email description', $email->getSubject(), $email->getFrom(), $email->getTextBody());
                 $task_data['selected_members_ids'] = $email->getMemberIds();
                 tpl_assign('from_email', $email);
             }
         }
         tpl_assign('additional_onsubmit', array_var($_REQUEST, 'additional_onsubmit'));
     }
     // if
     if (array_var($_GET, 'replace')) {
         ajx_replace(true);
     }
     tpl_assign('task_data', $task_data);
     tpl_assign('task', $task);
     tpl_assign('pending_task_id', 0);
     $subtasks = array();
     if (array_var($_POST, 'multi_assignment')) {
         $subtasks = json_decode(array_var($_POST, 'multi_assignment'), true);
     }
     tpl_assign('multi_assignment', $subtasks);
     if (is_array(array_var($_POST, 'task'))) {
         try {
             // order
             $task->setOrder(ProjectTasks::maxOrder(array_var($task_data, "parent_id", 0), array_var($task_data, "milestone_id", 0)));
             try {
                 $task_data['due_date'] = getDateValue(array_var($_POST, 'task_due_date'));
                 $task_data['start_date'] = getDateValue(array_var($_POST, 'task_start_date'));
             } catch (Exception $e) {
                 throw new Exception(lang('date format error', date_format_tip(user_config_option('date_format'))));
             }
             if ($task_data['due_date'] instanceof DateTimeValue) {
                 $duetime = getTimeValue(array_var($_POST, 'task_due_time'));
                 if (is_array($duetime)) {
                     $task_data['due_date']->setHour(array_var($duetime, 'hours'));
                     $task_data['due_date']->setMinute(array_var($duetime, 'mins'));
                     $task_data['due_date']->advance(logged_user()->getTimezone() * -3600);
                 }
                 $task_data['use_due_time'] = is_array($duetime);
             }
             if ($task_data['start_date'] instanceof DateTimeValue) {
                 $starttime = getTimeValue(array_var($_POST, 'task_start_time'));
                 if (is_array($starttime)) {
                     $task_data['start_date']->setHour(array_var($starttime, 'hours'));
                     $task_data['start_date']->setMinute(array_var($starttime, 'mins'));
                     $task_data['start_date']->advance(logged_user()->getTimezone() * -3600);
                 }
                 $task_data['use_start_time'] = is_array($starttime);
             }
             $err_msg = $this->setRepeatOptions($task_data);
             if ($err_msg) {
                 throw new Exception($err_msg);
             }
             if (config_option("wysiwyg_tasks")) {
                 $task_data['type_content'] = "html";
                 $task_data['text'] = str_replace(array("\r", "\n", "\r\n"), array('', '', ''), array_var($task_data, 'text'));
             } else {
开发者ID:abhinay100,项目名称:feng_app,代码行数:67,代码来源:TaskController.class.php

示例4: add_task

 /**
  * Add new task
  *
  * @access public
  * @param void
  * @return null
  */
 function add_task()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $project = active_or_personal_project();
     if (!ProjectTask::canAdd(logged_user(), $project)) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $task = new ProjectTask();
     $task_data = array_var($_POST, 'task');
     if (!is_array($task_data)) {
         $task_data = array('milestone_id' => array_var($_POST, 'milestone_id', 0), 'project_id' => array_var($_POST, 'project_id', active_or_personal_project()->getId()), 'title' => array_var($_POST, 'title', ''), 'assigned_to' => array_var($_POST, 'assigned_to', '0:0'), 'parent_id' => array_var($_POST, 'parent_id', 0), 'priority' => array_var($_POST, 'priority', ProjectTasks::PRIORITY_NORMAL), 'text' => array_var($_POST, 'text', ''), 'start_date' => getDateValue(array_var($_POST, 'task_start_date', '')), 'due_date' => getDateValue(array_var($_POST, 'task_due_date', '')), 'is_template' => array_var($_POST, "is_template", array_var($_GET, "is_template", false)), 'tags' => array_var($_POST, "tags", ''), 'object_subtype' => array_var($_POST, "object_subtype", config_option('default task co type')), 'send_notification' => array_var($_POST, 'notify') && array_var($_POST, 'notify') == 'true');
         // array
         $from_email = array_var($_GET, 'from_email');
         $email = MailContents::findById($from_email);
         if ($email instanceof MailContent) {
             $task_data['title'] = $email->getSubject();
             $task_data['text'] = lang('create task from email description', $email->getSubject(), $email->getFrom(), $email->getTextBody());
             $task_data['tags'] = implode(", ", $email->getTagNames());
             tpl_assign('from_email', $email);
         }
     }
     // if
     if (array_var($_GET, 'replace')) {
         ajx_replace(true);
     }
     tpl_assign('task_data', $task_data);
     tpl_assign('task', $task);
     if (is_array(array_var($_POST, 'task'))) {
         $proj = Projects::findById(array_var($task_data, 'project_id'));
         if ($proj instanceof Project) {
             $project = $proj;
         }
         // order
         $task->setOrder(ProjectTasks::maxOrder(array_var($task_data, "parent_id", 0), array_var($task_data, "milestone_id", 0)));
         $task_data['due_date'] = getDateValue(array_var($_POST, 'task_due_date'));
         $task_data['start_date'] = getDateValue(array_var($_POST, 'task_start_date'));
         try {
             $err_msg = $this->setRepeatOptions($task_data);
             if ($err_msg) {
                 flash_error($err_msg);
                 ajx_current("empty");
                 return;
             }
             $task->setFromAttributes($task_data);
             $totalMinutes = array_var($task_data, 'time_estimate_hours', 0) * 60 + array_var($task_data, 'time_estimate_minutes', 0);
             $task->setTimeEstimate($totalMinutes);
             $task->setIsPrivate(false);
             // Not used, but defined as not null.
             // Set assigned to
             $assigned_to = explode(':', array_var($task_data, 'assigned_to', ''));
             $company_id = array_var($assigned_to, 0, 0);
             $user_id = array_var($assigned_to, 1, 0);
             $can_assign = can_assign_task_to_company_user(logged_user(), $task, $company_id, $user_id);
             if ($can_assign !== true) {
                 flash_error($can_assign);
                 ajx_current("empty");
                 return;
             }
             $task->setAssignedToCompanyId($company_id);
             $task->setAssignedToUserId($user_id);
             $id = array_var($_GET, 'id', 0);
             $parent = ProjectTasks::findById($id);
             if ($parent instanceof ProjectTask) {
                 $task->setParentId($id);
                 if ($parent->getIsTemplate()) {
                     $task->setIsTemplate(true);
                 }
             }
             if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
                 flash_error(lang('task child of child error'));
                 ajx_current("empty");
                 return;
             }
             //Add handins
             $handins = array();
             for ($i = 0; $i < 4; $i++) {
                 if (isset($task_data["handin{$i}"]) && is_array($task_data["handin{$i}"]) && trim(array_var($task_data["handin{$i}"], 'title')) != '') {
                     $assigned_to = explode(':', array_var($task_data["handin{$i}"], 'assigned_to', ''));
                     $handins[] = array('title' => array_var($task_data["handin{$i}"], 'title'), 'responsible_company_id' => array_var($assigned_to, 0, 0), 'responsible_user_id' => array_var($assigned_to, 1, 0));
                     // array
                 }
                 // if
             }
             // for
             DB::beginWork();
             $task->save();
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例5: copySubTasks

 /**
  * Copies subtasks from taskFrom to taskTo.
  *
  * @param ProjectTask $taskFrom
  * @param ProjectTask $taskTo
  */
 function copySubTasks(ProjectTask $taskFrom, ProjectTask $taskTo, $as_template = false)
 {
     foreach ($taskFrom->getSubTasks() as $sub) {
         $new = ProjectTasks::createTaskCopy($sub);
         $new->setIsTemplate($as_template);
         $new->setParentId($taskTo->getId());
         $new->setMilestoneId($taskTo->getMilestoneId());
         $new->setOrder(ProjectTasks::maxOrder($new->getParentId(), $new->getMilestoneId()));
         if ($sub->getIsTemplate()) {
             $new->setFromTemplateId($sub->getId());
         }
         $new->save();
         foreach ($taskTo->getWorkspaces() as $workspace) {
             if (ProjectTask::canAdd(logged_user(), $workspace)) {
                 $new->addToWorkspace($workspace);
             }
         }
         $new->copyCustomPropertiesFrom($sub);
         $new->copyLinkedObjectsFrom($sub);
         $new->setTagsFromCSV(implode(",", $sub->getTagNames()));
         ProjectTasks::copySubTasks($sub, $new, $as_template);
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:29,代码来源:ProjectTasks.class.php


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