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


PHP CTask::load方法代码示例

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


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

示例1: taskstyle_pd

function taskstyle_pd($task)
{
    $now = new CDate();
    $start_date = intval($task["task_start_date"]) ? new CDate($task["task_start_date"]) : null;
    $end_date = intval($task["task_end_date"]) ? new CDate($task["task_end_date"]) : null;
    if ($start_date && !$end_date) {
        $end_date = $start_date;
        $end_date->addSeconds(@$task["task_duration"] * $task["task_duration_type"] * SEC_HOUR);
    } else {
        if (!$start_date) {
            return '';
        }
    }
    $style = 'class=';
    if ($task['task_percent_complete'] == 0) {
        $style .= $now->before($start_date) ? '"task_future"' : '"task_notstarted"';
    } else {
        if ($task['task_percent_complete'] == 100) {
            $t = new CTask();
            $t->load($task['task_id']);
            $actual_end_date = new CDate(get_actual_end_date_pd($t->task_id, $t));
            $style .= $actual_end_date->after($end_date) ? '"task_late"' : '"task_done"';
        } else {
            $style .= $now->after($end_date) ? '"task_overdue"' : '"task_started"';
        }
    }
    return $style;
}
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:28,代码来源:projectdesigner.class.php

示例2: setComplete

function setComplete($id)
{
    global $AppUI;
    $task = new CTask();
    if ($task->load($id)) {
        $q = new DBQuery();
        $q->addTable('user_tasks');
        $q->addQuery('user_id');
        $q->addWhere('task_id = ' . $id);
        $q->addWhere('user_id = ' . $AppUI->user_id);
        $r = $q->loadResult();
        if ($r != $AppUI->user_id) {
            $p = new CProject($task->task_project);
            if (!$p->project_id || $p->getManager() != $AppUI->user_id) {
                return 'Error';
            }
        }
        $q->addTable('tasks');
        $q->addUpdate('task_percent_complete', '100');
        $q->addWhere('task_id = ' . $id);
        $q->exec();
        return 'OK';
    }
    return 'Error';
}
开发者ID:n2i,项目名称:xvnkb,代码行数:25,代码来源:complete.php

示例3: __extract_from_tasks_pinning

/**
 * @param $AppUI
 * @param $task_id
 */
function __extract_from_tasks_pinning($AppUI, $task_id)
{
    if (isset($_GET['pin'])) {
        $pin = (int) w2PgetParam($_GET, 'pin', 0);
        $task = new CTask();
        // load the record data
        if (1 == $pin) {
            $result = $task->pinTask($AppUI->user_id, $task_id);
        }
        if (-1 == $pin) {
            $result = $task->unpinTask($AppUI->user_id, $task_id);
        }
        if (!$result) {
            $AppUI->setMsg('Pinning ', UI_MSG_ERROR, true);
        }
        $task->load($task_id);
        $AppUI->redirect('m=projects&a=view&project_id=' . $task->task_project, -1);
    }
}
开发者ID:illuminate3,项目名称:web2project,代码行数:23,代码来源:cleanup_functions.php

示例4: date

     // patch 2.12.04 tasks finished in the last 7 days
     //$q->addTable('user_tasks');
     $q->addTable('user_tasks');
     $q->addWhere('user_tasks.user_id = ' . (int) $user_id);
     $q->addWhere('user_tasks.task_id = tasks.task_id');
     $q->addWhere('task_percent_complete = 100');
     //TODO: use date class to construct date.
     $q->addWhere('task_end_date >= \'' . date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d') - 7, date('Y'))) . '\'');
     break;
 case 'children':
     $q->addWhere('task_parent = ' . (int) $task_id);
     $q->addWhere('tasks.task_id <> ' . $task_id);
     break;
 case 'deepchildren':
     $taskobj = new CTask();
     $taskobj->load((int) $task_id);
     $deepchildren = $taskobj->getDeepChildren();
     $q->addWhere('tasks.task_id IN (' . implode(',', $deepchildren) . ')');
     $q->addWhere('tasks.task_id <> ' . $task_id);
     break;
 case 'myproj':
     $q->addWhere('project_owner = ' . (int) $user_id);
     break;
 case 'mycomp':
     if (!$AppUI->user_company) {
         $AppUI->user_company = 0;
     }
     $q->addWhere('project_company = ' . (int) $AppUI->user_company);
     break;
 case 'myunfinished':
     $q->addTable('user_tasks');
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:tasks.php

示例5: getDeepChildren

 public function getDeepChildren()
 {
     $children = $this->getChildren();
     if ($children) {
         $deep_children = array();
         $tempTask = new CTask();
         foreach ($children as $child) {
             $tempTask->load($child);
             $deep_children = array_merge($deep_children, $tempTask->getDeepChildren());
         }
         return array_merge($children, $deep_children);
     }
     return array();
 }
开发者ID:eureka2,项目名称:web2project,代码行数:14,代码来源:tasks.class.php

示例6: canTaskAccess

/**
 * Used to check if a user has task_access to see the task in task list context
 * (This function was optimized to try to use the DB the least possible)
 * TODO:  Remove for v4.0 - caseydk 20 September 2012
 *
 * @param mixed $task_id
 * @param mixed $task_access
 * @param mixed $task_owner
 * @return true if user has task access to it, or false if he doesn't
 *
 * @deprecated
 */
function canTaskAccess($task_id)
{
    trigger_error("canTaskAccess has been deprecated in v3.0 and will be removed by v4.0. Please use CTask->canAccess() instead.", E_USER_NOTICE);
    global $AppUI;
    $task = new CTask();
    $task->load($task_id);
    return $task->canAccess($AppUI->user_id);
}
开发者ID:illuminate3,项目名称:web2project,代码行数:20,代码来源:deprecated_functions.php

示例7: importTasks

 /**	Import tasks from another project
  *
  *	@param	int		Project ID of the tasks come from.
  *	@return	bool
  **/
 public function importTasks($from_project_id)
 {
     global $AppUI;
     $errors = array();
     // Load the original
     $origProject = new CProject();
     $origProject->load($from_project_id);
     $q = $this->_query;
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project =' . (int) $from_project_id);
     $tasks = array_flip($q->loadColumn());
     $q->clear();
     $origDate = new w2p_Utilities_Date($origProject->project_start_date);
     $destDate = new w2p_Utilities_Date($this->project_start_date);
     $timeOffset = $origDate->dateDiff($destDate);
     if ($origDate->compare($origDate, $destDate) > 0) {
         $timeOffset = -1 * $timeOffset;
     }
     // Dependencies array
     $deps = array();
     // Copy each task into this project and get their deps
     foreach ($tasks as $orig => $void) {
         $objTask = new CTask();
         $objTask->load($orig);
         $destTask = $objTask->copy($this->project_id);
         $tasks[$orig] = $destTask;
         $deps[$orig] = $objTask->getDependencies();
     }
     // Fix record integrity
     foreach ($tasks as $old_id => $newTask) {
         // Fix parent Task
         // This task had a parent task, adjust it to new parent task_id
         if ($newTask->task_id != $newTask->task_parent) {
             $newTask->task_parent = $tasks[$newTask->task_parent]->task_id;
         }
         // Fix task start date from project start date offset
         $origDate->setDate($newTask->task_start_date);
         $origDate->addDays($timeOffset);
         $destDate = $origDate;
         $newTask->task_start_date = $destDate->format(FMT_DATETIME_MYSQL);
         // Fix task end date from start date + work duration
         if (!empty($newTask->task_end_date) && $newTask->task_end_date != '0000-00-00 00:00:00') {
             $origDate->setDate($newTask->task_end_date);
             $origDate->addDays($timeOffset);
             $destDate = $origDate;
             $newTask->task_end_date = $destDate->format(FMT_DATETIME_MYSQL);
         }
         // Dependencies
         if (!empty($deps[$old_id])) {
             $oldDeps = explode(',', $deps[$old_id]);
             // New dependencies array
             $newDeps = array();
             foreach ($oldDeps as $dep) {
                 $newDeps[] = $tasks[$dep]->task_id;
             }
             // Update the new task dependencies
             $csList = implode(',', $newDeps);
             $newTask->updateDependencies($csList);
         }
         // end of update dependencies
         $result = $newTask->store($AppUI);
         $newTask->addReminder();
         $importedTasks[] = $newTask->task_id;
         if (is_array($result) && count($result)) {
             foreach ($result as $key => $error_msg) {
                 $errors[] = $newTask->task_name . ': ' . $error_msg;
             }
         }
     }
     // end Fix record integrity
     // We have errors, so rollback everything we've done so far
     if (count($errors)) {
         foreach ($importedTasks as $badTask) {
             $delTask = new CTask();
             $delTask->task_id = $badTask;
             $delTask->delete($AppUI);
         }
     }
     return $errors;
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:86,代码来源:projects.class.php

示例8: importTasks

 /**	Import tasks from another project
  *
  *	@param	int		Project ID of the tasks come from.
  *	@return	bool
  **/
 function importTasks($from_project_id, $scale_project = false)
 {
     // Load the original
     $origProject = new CProject();
     $origProject->load($from_project_id);
     $q = new DBQuery();
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project =' . $from_project_id);
     $sql = $q->prepare();
     $q->clear();
     $tasks = array_flip(db_loadColumn($sql));
     //Pristine Start and End Dates of Source and Destination Projects
     $origStartDate = new CDate($origProject->project_start_date);
     $origEndDate = new CDate($origProject->project_end_date);
     $destStartDate = new CDate($this->project_start_date);
     $destEndDate = new CDate($this->project_end_date);
     $dateOffset = $destStartDate->dateDiff($origStartDate);
     //Check that we have enough information to scale properly
     //(i.e. no information is missing or "zero")
     if (empty($origProject->project_start_date) || empty($origProject->project_end_date) || empty($this->project_start_date) || empty($this->project_end_date) || $origProject->project_start_date == '0000-00-00 00:00:00' || $origProject->project_end_date == '0000-00-00 00:00:00' || $this->project_start_date == '0000-00-00 00:00:00' || $this->project_end_date == '0000-00-00 00:00:00') {
         $scale_project = false;
     }
     if ($scale_project) {
         //get ratio for scaling, protect from division by 0
         $ratio = (abs($destEndDate->dateDiff($destStartDate)) + 1) / (abs($origEndDate->dateDiff($origStartDate)) + 1);
     }
     // Old dependencies array from imported tasks
     $deps = array();
     // New dependencies array for new copies of imported tasks
     $newDeps = array();
     // Old2New task ID array
     $taskXref = array();
     // New task ID to old parent array
     $nid2op = array();
     // Copy each task into this project and get their deps
     foreach ($tasks as $orig => $void) {
         $objTask = new CTask();
         $objTask->load($orig);
         // Grab the old parent id
         $oldParent = (int) $objTask->task_parent;
         $deps[$orig] = $objTask->getDependencies();
         $destTask = $objTask->copy($this->project_id, 0);
         $nid2op[$destTask->task_id] = $oldParent;
         $tasks[$orig] = $destTask;
         $taskXref[$orig] = (int) $destTask->task_id;
     }
     // Build new dependencies array
     foreach ($deps as $odkey => $od) {
         $ndt = '';
         $ndkey = $taskXref[$odkey];
         $odep = explode(',', $od);
         foreach ($odep as $odt) {
             $ndt = $ndt . $taskXref[$odt] . ',';
         }
         $ndt = rtrim($ndt, ',');
         $newDeps[$ndkey] = $ndt;
     }
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project =' . $this->project_id);
     $tasks = $q->loadColumn();
     // Update dates based on new project's start date.
     $origDate = new CDate($origProject->project_start_date);
     $origStartHour = new CDate($this->project_start_date);
     $destDate = new CDate($this->project_start_date);
     foreach ($tasks as $task_id) {
         $newTask = new CTask();
         $newTask->load($task_id);
         if (in_array($task_id, $taskXref)) {
             $task_date_vars = array('task_start_date', 'task_end_date');
             //Adjust task dates based on calculated offsets
             foreach ($task_date_vars as $my_date) {
                 if (!empty($newTask->{$my_date}) && $newTask->{$my_date} != '0000-00-00 00:00:00') {
                     $origDate->setDate($newTask->{$my_date});
                     $origStartHour->setDate($newTask->{$my_date});
                     $origStartHour->setTime(intval(dPgetConfig('cal_day_start')));
                     $destDate->setDate($newTask->{$my_date});
                     $destDate->addDays($dateOffset);
                     if ($scale_project) {
                         $offsetAdd = round($origDate->dateDiff($origStartDate) * $ratio) - $origDate->dateDiff($origStartDate);
                         $destDate->addDays($offsetAdd);
                         $hours_in = $origStartHour->calcDuration($origDate);
                         $offsetAddHours = round($hours_in * $ratio) - $hours_in;
                         if ($offsetAddHours % dPgetConfig('daily_working_hours')) {
                             $destDate->addDuration($offsetAddHours);
                         }
                     }
                     $destDate = $destDate->next_working_day();
                     $newTask->{$my_date} = $destDate->format(FMT_DATETIME_MYSQL);
                 }
             }
             //Adjust durration to scale
             if ($scale_project) {
                 $newTask->task_duration = round($newTask->task_duration * $ratio, 2);
//.........这里部分代码省略.........
开发者ID:srinivasulurao,项目名称:jonel,代码行数:101,代码来源:projects.class.php

示例9: executeDelete

 /**
  * Delete Request Handler
  *
  * This method is called when a request is a DELETE
  *
  * @return array
  */
 public function executeDelete()
 {
     $valid = $this->hasRequiredParameters($this->requiredParams);
     if ($valid instanceof Frapi_Error) {
         return $valid;
     }
     $username = $this->getParam('username');
     $password = $this->getParam('password');
     $task_id = $this->getParam('task_id', self::TYPE_INT);
     // Attempt to login as user, a little bit of a hack as we currently
     // require the $_POST['login'] var to be set as well as a global AppUI
     $AppUI = new CAppUI();
     $GLOBALS['AppUI'] = $AppUI;
     $_POST['login'] = 'login';
     if (!$AppUI->login($username, $password)) {
         throw new Frapi_Error('INVALID_LOGIN');
     }
     $task = new CTask();
     $task->load($task_id);
     if (!$task->delete($AppUI)) {
         throw new Frapi_Error('PERMISSION_ERROR');
     }
     $this->data['success'] = true;
     return $this->toArray();
 }
开发者ID:robertbasic,项目名称:web2project-api,代码行数:32,代码来源:Task.php

示例10: executePut

 /**
  * Put Request Handler
  *
  * This method is called when a request is a PUT
  *
  * @return array
  */
 public function executePut()
 {
     /**
      * @todo Remove this once we figure out how to reference vars in file
      * that is autoloaded
      */
     global $tracking_dynamics;
     $valid = $this->hasRequiredParameters($this->requiredParams);
     if ($valid instanceof Frapi_Error) {
         return $valid;
     }
     $username = $this->getParam('username');
     $password = $this->getParam('password');
     $hassign = $this->getParam('hassign');
     $hdependencies = $this->getParam('hdependencies');
     $notify = $this->getParam('task_notify');
     $comment = $this->getParam('email_comment');
     $task_id = $this->getParam('task_id');
     $adjustStartDate = $this->getParam('set_task_start_date');
     // Attempt to login as user, a little bit of a hack as we currently
     // require the $_POST['login'] var to be set as well as a global AppUI
     $AppUI = new CAppUI();
     $GLOBALS['AppUI'] = $AppUI;
     $_POST['login'] = 'login';
     if (!$AppUI->login($username, $password)) {
         throw new Frapi_Error('INVALID_LOGIN');
     }
     $post_data = array('task_id' => 0, 'task_name' => $this->getParam('task_name'), 'task_status' => $this->getParam('task_status'), 'task_percent_complete' => $this->getParam('task_percent_complete'), 'task_milestone' => $this->getParam('task_milestone'), 'task_owner' => $this->getParam('task_owner'), 'task_access' => $this->getParam('task_access'), 'task_related_url' => $this->getParam('task_related_url'), 'task_parent' => $this->getParam('task_parent'), 'task_type' => $this->getParam('task_type'), 'task_target_budget' => $this->getParam('task_target_budget'), 'task_description' => $this->getParam('task_description'), 'task_start_date' => $this->getParam('task_start_date'), 'task_end_date' => $this->getParam('task_end_date'), 'task_duration' => $this->getParam('task_duration'), 'task_duration_type' => $this->getParam('task_duration_type'), 'task_dynamic' => $this->getParam('task_dynamic'), 'task_allow_other_user_tasklogs' => $this->getParam('task_allow_other_user_tasklogs'), 'task_project' => $this->getParam('task_project'), 'task_priority' => $this->getParam('task_priority'));
     // Include any files for handling module-specific requirements
     foreach (findTabModules('tasks', 'addedit') as $mod) {
         $fname = W2P_BASE_DIR . '/modules/' . $mod . '/tasks_dosql.addedit.php';
         if (file_exists($fname)) {
             require_once $fname;
         }
     }
     // Find the task if we are set
     $task_end_date = null;
     if ($task_id) {
         $task->load($task_id);
         $task_end_date = new w2p_Utilities_Date($task->task_end_date);
     }
     $task = new CTask();
     if (!$task->bind($post_data)) {
         throw new Frapi_Error('SAVE_ERROR', $task->getError());
     }
     if ($task->task_dynamic != 1) {
         $task_dynamic_delay = $this->getParam('task_dynamic_nodelay') ? $this->getParam('task_dynamic_nodelay') : '0';
         if (in_array($task->task_dynamic, $tracking_dynamics)) {
             $task->task_dynamic = $task_dynamic_delay ? 21 : 31;
         } else {
             $task->task_dynamic = $task_dynamic_delay ? 11 : 0;
         }
     }
     // Let's check if task_dynamic is unchecked
     if (!$this->getParam('task_dynamic')) {
         $task->task_dynamic = false;
     }
     // Make sure task milestone is set or reset as appropriate
     if ($this->getParam('task_milestone')) {
         $task->task_milestone = false;
     }
     //format hperc_assign user_id=percentage_assignment;user_id=percentage_assignment;user_id=percentage_assignment;
     $tmp_ar = explode(';', $this->getParam('hperc_assign'));
     $i_cmp = sizeof($tmp_ar);
     $hperc_assign_ar = array();
     for ($i = 0; $i < $i_cmp; $i++) {
         $tmp = explode('=', $tmp_ar[$i]);
         if (count($tmp) > 1) {
             $hperc_assign_ar[$tmp[0]] = $tmp[1];
         } elseif ($tmp[0] != '') {
             $hperc_assign_ar[$tmp[0]] = 100;
         }
     }
     // let's check if there are some assigned departments to task
     $task->task_departments = implode(',', $this->getParam('dept_ids', self::TYPE_ARRAY));
     // convert dates to SQL format first
     if ($task->task_start_date) {
         $date = new w2p_Utilities_Date($task->task_start_date);
         $task->task_start_date = $date->format(FMT_DATETIME_MYSQL);
     }
     $end_date = null;
     if ($task->task_end_date) {
         if (strpos($task->task_end_date, '2400') !== false) {
             $task->task_end_date = str_replace('2400', '2359', $task->task_end_date);
         }
         $end_date = new w2p_Utilities_Date($task->task_end_date);
         $task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
     }
     $error_array = $task->store($AppUI);
     // Return all the validation messages
     if ($error_array !== true) {
         $error_message = '';
         foreach ($error_array as $error) {
//.........这里部分代码省略.........
开发者ID:robertbasic,项目名称:web2project-api,代码行数:101,代码来源:Tasks.php

示例11: submitIt

}
$titleBlock->show();
//Clear the file id if checking out so a new version is created.
if ($ci) {
    $file_id = 0;
}
if ($file->file_project) {
    $file_project = $file->file_project;
}
if ($file->file_task) {
    $file_task = $file->file_task;
    $task_name = $file->getTaskName();
} else {
    if ($file_task) {
        $task = new CTask();
        $task->load($file_task);
        $task_name = $task->task_name;
    } else {
        $task_name = '';
    }
}
if (isset($file->file_helpdesk_item)) {
    $file_helpdesk_item = $file->file_helpdesk_item;
}
$folders = getFolderSelectList();
?>
<script language="javascript">
function submitIt() {
	var f = document.uploadFrm;
	f.submit();
}
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:addedit.php

示例12: importTasks

 /**	Import tasks from another project
  *
  *	@param	int		Project ID of the tasks come from.
  *	@return	bool	
  **/
 function importTasks($from_project_id)
 {
     // Load the original
     $origProject = new CProject();
     $origProject->load($from_project_id);
     $q = new DBQuery();
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project =' . $from_project_id);
     $sql = $q->prepare();
     $q->clear();
     $tasks = array_flip(db_loadColumn($sql));
     $origDate = new CDate($origProject->project_start_date);
     $destDate = new CDate($this->project_start_date);
     $timeOffset = $destDate->getTime() - $origDate->getTime();
     // Dependencies array
     $deps = array();
     // Copy each task into this project and get their deps
     foreach ($tasks as $orig => $void) {
         $objTask = new CTask();
         $objTask->load($orig);
         $destTask = $objTask->copy($this->project_id);
         $tasks[$orig] = $destTask;
         $deps[$orig] = $objTask->getDependencies();
     }
     // Fix record integrity
     foreach ($tasks as $old_id => $newTask) {
         // Fix parent Task
         // This task had a parent task, adjust it to new parent task_id
         if ($newTask->task_id != $newTask->task_parent) {
             $newTask->task_parent = $tasks[$newTask->task_parent]->task_id;
         }
         // Fix task start date from project start date offset
         $origDate->setDate($newTask->task_start_date);
         $destDate->setDate($origDate->getTime() + $timeOffset, DATE_FORMAT_UNIXTIME);
         $destDate = $destDate->next_working_day();
         $newTask->task_start_date = $destDate->format(FMT_DATETIME_MYSQL);
         // Fix task end date from start date + work duration
         //$newTask->calc_task_end_date();
         if (!empty($newTask->task_end_date) && $newTask->task_end_date != '0000-00-00 00:00:00') {
             $origDate->setDate($newTask->task_end_date);
             $destDate->setDate($origDate->getTime() + $timeOffset, DATE_FORMAT_UNIXTIME);
             $destDate = $destDate->next_working_day();
             $newTask->task_end_date = $destDate->format(FMT_DATETIME_MYSQL);
         }
         // Dependencies
         if (!empty($deps[$old_id])) {
             $oldDeps = explode(',', $deps[$old_id]);
             // New dependencies array
             $newDeps = array();
             foreach ($oldDeps as $dep) {
                 $newDeps[] = $tasks[$dep]->task_id;
             }
             // Update the new task dependencies
             $csList = implode(',', $newDeps);
             $newTask->updateDependencies($csList);
         }
         // end of update dependencies
         $newTask->store();
     }
     // end Fix record integrity
 }
开发者ID:seatecnologia,项目名称:dotproject_timesheet,代码行数:67,代码来源:projects.class.php

示例13: importTasks

 /**	Import tasks from another project
  *
  *	@param	int		Project ID of the tasks come from.
  *	@return	bool	
  **/
 function importTasks($from_project_id)
 {
     // Load the original
     $origProject = new CProject();
     $origProject->load($from_project_id);
     $q = new DBQuery();
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_project =' . $from_project_id);
     $sql = $q->prepare();
     $q->clear();
     $tasks = array_flip(db_loadColumn($sql));
     $origDate = new CDate($origProject->project_start_date);
     $destDate = new CDate($this->project_start_date);
     $timeOffset = $destDate->getTime() - $origDate->getTime();
     $objTask = new CTask();
     // Dependencies array
     $deps = array();
     // Copy each task into this project and get their deps, y tambien copia los usuarios asignados
     foreach ($tasks as $orig => $void) {
         $objTask->load($orig);
         $destTask = $objTask->copy($this->project_id);
         $tasks[$orig] = $destTask;
         if ($this->project_company == $origProject->project_company) {
             // guarda en user_tasks todos los usuarios asignados a la tarea original, solo si this y
             //  origProy pertenecen a la misma compañía.
             $sql = "select * from user_tasks where task_id = {$orig}";
             $rows = db_LoadList($sql);
             foreach ($rows as $row) {
                 $sql2 = "INSERT INTO user_tasks (user_id, user_type, task_id, perc_assignment, user_task_priority) \n\t\t\t\t\t\t\t\tVALUES (" . $row['user_id'] . "," . $row['user_type'] . "," . $destTask->task_id . "," . $row['perc_assignment'] . "," . $row['user_task_priority'] . ")";
                 db_exec($sql2);
             }
         }
         $deps[$orig] = $objTask->getDependencies();
     }
     // Fix record integrity
     foreach ($tasks as $old_id => $newTask) {
         // Fix parent Task
         // This task had a parent task, adjust it to new parent task_id
         if ($newTask->task_id != $newTask->task_parent) {
             $newTask->task_parent = $tasks[$newTask->task_parent]->task_id;
         }
         // Fix task start date from project start date offset
         $origDate->setDate($newTask->task_start_date);
         $destDate->setDate($origDate->getTime() + $timeOffset, DATE_FORMAT_UNIXTIME);
         $destDate = $newTask->next_working_day($destDate);
         $newTask->task_start_date = $destDate->format(FMT_DATETIME_MYSQL);
         // Fix task end date from start date + work duration
         $newTask->calc_task_end_date();
         // Dependencies
         if (!empty($deps[$old_id])) {
             $oldDeps = explode(',', $deps[$old_id]);
             // New dependencies array
             $newDeps = array();
             foreach ($oldDeps as $dep) {
                 $newDeps[] = $tasks[$dep]->task_id;
             }
             // Update the new task dependencies
             $csList = implode(',', $newDeps);
             $newTask->updateDependencies($csList);
         }
         // end of update dependencies
         //Asignados
         $newTask->store();
     }
     // end Fix record integrity
 }
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:72,代码来源:projects.class.php

示例14: CTask

 if ($taskRecount) {
     $myTask = new CTask();
     CProject::updateTaskCount($taskRecount, $myTask->getTaskCount($taskRecount));
 }
 //$obj->task_project
 if (is_array($result)) {
     $AppUI->setMsg($result, UI_MSG_ERROR, true);
     $AppUI->holdObject($obj);
     $AppUI->redirect('m=tasks&a=addedit');
 }
 if ($result) {
     $task_parent = (int) w2PgetParam($_POST, 'task_parent', 0);
     $old_task_parent = (int) w2PgetParam($_POST, 'old_task_parent', 0);
     if ($task_parent != $old_task_parent) {
         $oldTask = new CTask();
         $oldTask->load($old_task_parent);
         $oldTask->updateDynamics(false);
     }
     $custom_fields = new CustomFields($m, 'addedit', $obj->task_id, 'edit');
     $custom_fields->bind($_POST);
     $sql = $custom_fields->store($obj->task_id);
     // Store Custom Fields
     // Now add any task reminders
     // If there wasn't a task, but there is one now, and
     // that task date is set, we need to set a reminder.
     if (empty($task_end_date) || !empty($end_date) && $task_end_date->dateDiff($end_date)) {
         $obj->addReminder();
     }
     $AppUI->setMsg($task_id ? 'Task updated' : 'Task added', UI_MSG_OK);
     if (isset($hassign)) {
         $obj->updateAssigned($hassign, $hperc_assign_ar);
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:do_task_aed.php

示例15: getTaskName

 /** @deprecated */
 public function getTaskName()
 {
     trigger_error("The CFile->getTaskName method has been deprecated in v3.0 and will be removed in v4.0. Please use just load a CTask object instead", E_USER_NOTICE);
     $task = new CTask();
     $task->load((int) $this->file_task);
     return $task->task_name;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:8,代码来源:files.class.php


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