本文整理汇总了PHP中CTask::store方法的典型用法代码示例。如果您正苦于以下问题:PHP CTask::store方法的具体用法?PHP CTask::store怎么用?PHP CTask::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTask
的用法示例。
在下文中一共展示了CTask::store方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _preCalcData
protected function _preCalcData()
{
$taskList = $this->obj->getAllowedTaskList(null, 1);
foreach ($taskList as $item) {
$tmpTask = new CTask();
$tmpTask->load($item['task_id']);
if ($tmpTask->task_dynamic == 1) {
$tmpTask->updateDynamics(true);
$tmpTask->store();
}
}
}
示例2: updateTaskSummary
/**
* Updates the variable information on the task.
*
* @param int $task_log_task that task id of task this task log is for
*
* @return void
*
* @access private
*/
private function updateTaskSummary(CAppUI $AppUI, $task_id)
{
$perms = $AppUI->acl();
$q = $this->_query;
if ($perms->checkModuleItem('tasks', 'edit', $task_id)) {
if ($this->task_log_percent_complete < 100) {
$q->addQuery('task_log_percent_complete, task_log_date, task_log_task_end_date');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$q->addOrder('task_log_date DESC, task_log_id DESC');
$q->setLimit(1);
$results = $q->loadHash();
$q->clear();
$percentComplete = $results['task_log_percent_complete'];
/*
* TODO: In theory, we shouldn't just use the task_log_task_end_date,
* because if we're after that date and someone is still adding
* logs to a task, obviously the task isn't complete. We may want
* to check to see if task_log_date > task_log_task_end_date and
* use the later one as the end date.. not sure yet.
*/
$taskEndDate = $results['task_log_task_end_date'];
} else {
$percentComplete = 100;
$taskEndDate = $this->task_log_date;
}
$task = new CTask();
$task->load($task_id);
$task->task_percent_complete = $percentComplete;
$task->task_end_date = $taskEndDate;
$msg = $task->store($AppUI);
if (is_array($msg)) {
$AppUI->setMsg($msg, UI_MSG_ERROR, true);
}
$task->pushDependencies($task_id, $task->task_end_date);
}
$q->addQuery('SUM(task_log_hours)');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_log_task);
$totalHours = $q->loadResult();
CTask::updateHoursWorked($task_id, $totalHours);
}
示例3: storeTokenTask
/**
*
* @param CAppUI $AppUI
* @param CProject $projectId
*
* The point of this function is to create/update a task to represent a
* subproject.
*
*/
public static function storeTokenTask(CAppUI $AppUI, $project_id)
{
$subProject = new CProject();
$subProject->load($project_id);
if ($subProject->project_id != $subProject->project_parent) {
$q = new w2p_Database_Query();
$q->addTable('tasks');
$q->addQuery('MIN(task_start_date) AS min_task_start_date');
$q->addQuery('MAX(task_end_date) AS max_task_end_date');
$q->addWhere('task_project = ' . $subProject->project_id);
$projectDates = $q->loadList();
$q->clear();
$q->addTable('tasks');
$q->addQuery('task_id');
$q->addWhere('task_represents_project = ' . $subProject->project_id);
$task_id = $q->loadResult();
$task = new CTask();
if ($task_id) {
$task->load($task_id);
} else {
$task->task_description = $task->task_name;
$task->task_priority = $subProject->project_priority;
$task->task_project = $subProject->project_parent;
$task->task_represents_project = $subProject->project_id;
$task->task_owner = $AppUI->user_id;
}
$task->task_name = $AppUI->_('Subproject') . ': ' . $subProject->project_name;
$task->task_duration_type = 1;
$task->task_duration = $subProject->getTotalProjectHours();
$task->task_start_date = $projectDates[0]['min_task_start_date'];
$task->task_end_date = $projectDates[0]['max_task_end_date'];
$task->task_percent_complete = $subProject->project_percent_complete;
$result = $task->store($AppUI);
//TODO: we should do something with this store result?
}
}
示例4: CTask
}
//Action: Unassign User
if (isset($_POST['bulk_task_unassign']) && $bulk_task_unassign != '') {
$upd_task = new CTask();
$upd_task->load($key);
if ($upd_task->task_id) {
$upd_task->removeAssigned($bulk_task_unassign);
}
}
// Action: Allow user to add task logs for others
if (isset($_POST['bulk_task_allow_other_user_tasklogs']) && $bulk_task_allow_other_user_tasklogs != '') {
$upd_task = new CTask();
$upd_task->load($key);
if ($upd_task->task_id) {
$upd_task->task_allow_other_user_tasklogs = $bulk_task_allow_other_user_tasklogs;
$result = $upd_task->store($AppUI);
if (is_array($result)) {
break;
}
}
}
//Action: Other Actions
if (isset($_POST['bulk_task_other']) && $bulk_task_other != '') {
if ($upd_task->task_id) {
//Option 1 - Mark as finished
if ($bulk_task_other == '1') {
$upd_task->task_percent_complete = 100;
if (!$upd_task->task_end_date || $upd_task->task_end_date == '0000-00-00 00:00:00') {
$end_date = null;
$end_date = new w2p_Utilities_Date();
$upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
示例5: updateDynamics
public function updateDynamics($fromChildren = false)
{
global $AppUI;
//Has a parent or children, we will check if it is dynamic so that it's info is updated also
$q = new DBQuery();
$modified_task = new CTask();
if ($fromChildren) {
$modified_task =& $this;
} else {
$modified_task->load($this->task_parent);
$modified_task->htmlDecode();
}
if ($modified_task->task_dynamic == '1') {
//Update allocated hours based on children with duration type of 'hours'
$q->addTable('tasks');
$q->addQuery('SUM(task_duration * task_duration_type)');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND task_duration_type = 1 ');
$q->addGroup('task_parent');
$children_allocated_hours1 = (double) $q->loadResult();
$q->clear();
/*
* Update allocated hours based on children with duration type of 'days'
* use the daily working hours instead of the full 24 hours to calculate
* dynamic task duration!
*/
$q->addTable('tasks');
$q->addQuery(' SUM(task_duration * ' . w2PgetConfig('daily_working_hours') . ')');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND task_duration_type <> 1 ');
$q->addGroup('task_parent');
$children_allocated_hours2 = (double) $q->loadResult();
$q->clear();
// sum up the two distinct duration values for the children with duration type 'hrs'
// and for those with the duration type 'day'
$children_allocated_hours = $children_allocated_hours1 + $children_allocated_hours2;
if ($modified_task->task_duration_type == 1) {
$modified_task->task_duration = round($children_allocated_hours, 2);
} else {
$modified_task->task_duration = round($children_allocated_hours / w2PgetConfig('daily_working_hours'), 2);
}
//Update worked hours based on children
$q->addTable('tasks', 't');
$q->innerJoin('task_log', 'tl', 't.task_id = tl.task_log_task');
$q->addQuery('SUM(task_log_hours)');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND task_dynamic <> 1 ');
$children_hours_worked = (double) $q->loadResult();
$q->clear();
//Update worked hours based on dynamic children tasks
$q->addTable('tasks');
$q->addQuery('SUM(task_hours_worked)');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND task_dynamic = 1 ');
$children_hours_worked += (double) $q->loadResult();
$q->clear();
$modified_task->task_hours_worked = $children_hours_worked;
//Update percent complete
//hours
$q->addTable('tasks');
$q->addQuery('SUM(task_percent_complete * task_duration * task_duration_type)');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND task_duration_type = 1 ');
$real_children_hours_worked = (double) $q->loadResult();
$q->clear();
//days
$q->addTable('tasks');
$q->addQuery('SUM(task_percent_complete * task_duration * ' . w2PgetConfig('daily_working_hours') . ')');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND task_duration_type <> 1 ');
$real_children_hours_worked += (double) $q->loadResult();
$q->clear();
$total_hours_allocated = (double) ($modified_task->task_duration * ($modified_task->task_duration_type > 1 ? w2PgetConfig('daily_working_hours') : 1));
if ($total_hours_allocated > 0) {
$modified_task->task_percent_complete = ceil($real_children_hours_worked / $total_hours_allocated);
} else {
$q->addTable('tasks');
$q->addQuery('AVG(task_percent_complete)');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id);
$modified_task->task_percent_complete = $q->loadResult();
$q->clear();
}
//Update start date
$q->addTable('tasks');
$q->addQuery('MIN(task_start_date)');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND NOT ISNULL(task_start_date)' . ' AND task_start_date <> \'0000-00-00 00:00:00\'');
$d = $q->loadResult();
$q->clear();
if ($d) {
$modified_task->task_start_date = $d;
} else {
$modified_task->task_start_date = '0000-00-00 00:00:00';
}
//Update end date
$q->addTable('tasks');
$q->addQuery('MAX(task_end_date)');
$q->addWhere('task_parent = ' . (int) $modified_task->task_id . ' AND task_id <> ' . $modified_task->task_id . ' AND NOT ISNULL(task_end_date)');
$modified_task->task_end_date = $q->loadResult();
$q->clear();
//If we are updating a dynamic task from its children we don't want to store() it
//when the method exists the next line in the store calling function will do that
if ($fromChildren == false) {
$modified_task->store($AppUI);
}
}
}
示例6: executePost
/**
* Post Request Handler
*
* This method is called when a request is a POST
*
* @return array
*/
public function executePost()
{
/**
* @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');
$project_id = $this->getParam('project_id', self::TYPE_INT);
$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');
$task = new CTask();
// 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' => $this->getParam('task_id'), '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) {
//.........这里部分代码省略.........
示例7: updateTaskSummary
/**
* Updates the variable information on the task.
*
* @param int $task_log_task that task id of task this task log is for
*
* @return void
*
* @access private
*/
protected function updateTaskSummary($AppUI = null, $task_id)
{
$q = $this->_getQuery();
if ($this->_perms->checkModuleItem('tasks', 'edit', $task_id)) {
if ($this->task_log_percent_complete < 100) {
$q->addQuery('task_log_percent_complete, task_log_date');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$q->addOrder('task_log_date DESC, task_log_id DESC');
$q->setLimit(1);
$results = $q->loadHash();
$percentComplete = $results['task_log_percent_complete'];
} else {
$percentComplete = 100;
}
$task = new CTask();
$task->overrideDatabase($this->_query);
$task->load($task_id);
$task->task_percent_complete = $percentComplete;
$diff = strtotime($this->task_log_task_end_date) - strtotime($task->task_end_date);
$task->task_end_date = 0 == $diff ? $task->task_end_date : $this->task_log_task_end_date;
$success = $task->store();
if (!$success) {
$this->_AppUI->setMsg($task->getError(), UI_MSG_ERROR, true);
}
$task->pushDependencies($task_id, $task->task_end_date);
}
$q->addQuery('SUM(task_log_hours)');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$totalHours = $q->loadResult();
CTask::updateHoursWorked($task_id, $totalHours);
}
示例8: CDate
if ($upd_task->task_id) {
$upd_task->removeAssigned($bulk_task_unassign);
}
}
//Action: Other Actions
if (isset($_POST['bulk_task_other']) && $bulk_task_other != '') {
if ($upd_task->task_id) {
//Option 1 - Mark as finished
if ($bulk_task_other == '1') {
$upd_task->task_percent_complete = 100;
if (!$upd_task->task_end_date || $upd_task->task_end_date == '0000-00-00 00:00:00') {
$end_date = null;
$end_date = new CDate();
$upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
$upd_task->store($AppUI);
//Option 2 - Mark as milestone
} elseif ($bulk_task_other == '2') {
$upd_task->task_milestone = 1;
$upd_task->store($AppUI);
//Option 3 - Mark as non milestone
} elseif ($bulk_task_other == '3') {
$upd_task->task_milestone = 0;
$upd_task->store($AppUI);
//Option 4 - Mark as dynamic
} elseif ($bulk_task_other == '4') {
$upd_task->task_dynamic = 1;
$upd_task->store($AppUI);
//Option 5 - Mark as non dynamic
} elseif ($bulk_task_other == '5') {
$upd_task->task_dynamic = 0;
示例9:
$task->load($obj->task_log_task);
$canEditTask = $perms->checkModuleItem('tasks', 'edit', $task_id);
if ($canEditTask) {
$task->htmlDecode();
$task->check();
$task_end_date = new w2p_Utilities_Date($task->task_end_date);
$task->task_percent_complete = w2PgetParam($_POST, 'task_percent_complete', null);
if (w2PgetParam($_POST, 'task_end_date', '') != '') {
$new_date = new w2p_Utilities_Date($_POST['task_end_date']);
$new_date->setTime($task_end_date->hour, $task_end_date->minute, $task_end_date->second);
$task->task_end_date = $new_date->format(FMT_DATETIME_MYSQL);
}
if ($task->task_percent_complete >= 100 && (!$task->task_end_date || $task->task_end_date == '0000-00-00 00:00:00')) {
$task->task_end_date = $obj->task_log_date;
}
$msg = $task->store($AppUI);
if (is_array($msg)) {
$AppUI->setMsg($msg, UI_MSG_ERROR, true);
}
$new_task_end = new w2p_Utilities_Date($task->task_end_date);
if ($new_task_end->dateDiff($task_end_date)) {
$task->addReminder();
}
$task->pushDependencies($task->task_id, $task->task_end_date);
}
if ('on' == $notify_owner) {
if ($msg = $task->notifyOwner()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
}
}
// Check if we need to email the task log to anyone.
示例10: 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);
$dateOffset = $destDate->dateDiff($origDate);
// 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.
foreach ($tasks as $task_id) {
$newTask = new CTask();
$newTask->load($task_id);
if (in_array($task_id, $taskXref)) {
// Fix task start date from project start date offset
$origDate->setDate($newTask->task_start_date);
$destDate->setDate($newTask->task_start_date);
$destDate->addDays($dateOffset);
$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($newTask->task_end_date);
$destDate->addDays($dateOffset);
$destDate = $destDate->next_working_day();
$newTask->task_end_date = $destDate->format(FMT_DATETIME_MYSQL);
}
$newTask->task_parent = $taskXref[$nid2op[$newTask->task_id]];
$newTask->store();
$newTask->updateDependencies($newDeps[$task_id]);
}
// end check if imported task
$newTask->store();
}
// end Fix record integrity
}
示例11: CTask
// Re-add (keep) task time span for end date.
// This is independent from $obj->task_duration.
// The value returned by Date::Duration() is always in hours ('1')
$ned->addDuration($d, '1');
}
// prefer tue 16:00 over wed 8:00 as an end date
$ned = $ned->prev_working_day();
$obj->task_start_date = $nsd->format(FMT_DATETIME_MYSQL);
$obj->task_end_date = $ned->format(FMT_DATETIME_MYSQL);
$obj->task_start_date = $AppUI->convertToSystemTZ($obj->task_start_date);
$obj->task_end_date = $AppUI->convertToSystemTZ($obj->task_end_date);
$updateTask = new CTask();
$updateTask->load((int) $obj->task_id);
$updateTask->task_start_date = $obj->task_start_date;
$updateTask->task_end_date = $obj->task_end_date;
$updateTask->store($AppUI);
}
$obj->pushDependencies($obj->task_id, $obj->task_end_date);
}
// If there is a set of post_save functions, then we process them
if (isset($post_save)) {
foreach ($post_save as $post_save_function) {
$post_save_function();
}
}
if ($notify) {
if ($msg = $obj->notify($comment)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
}
}
$AppUI->redirect('m=projects&a=view&project_id=' . $obj->task_project);
示例12: CDate
if ($obj->task_log_date) {
$date = new CDate($obj->task_log_date);
$obj->task_log_date = $date->format(FMT_DATETIME_MYSQL);
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Task Log');
if ($del) {
if ($msg = $obj->delete()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$AppUI->setMsg("deleted", UI_MSG_ALERT);
}
$AppUI->redirect("m=timecard&tab=0");
} else {
$obj->task_log_costcode = cleanText($obj->task_log_costcode);
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
// update task percent complete
$task = new CTask();
if ($task_id) {
$task->load($task_id);
$task->task_percent_complete = $task_percent_complete;
$task->store();
}
$AppUI->setMsg(@$_POST['task_log_id'] ? 'updated' : 'inserted', UI_MSG_OK, true);
$AppUI->redirect("m=timecard&tab=0");
}
}
$AppUI->redirect();
示例13:
}
if ($column == "task_description") {
$task_obj->task_description = $value;
}
if ($column == "task_percent_complete") {
$task_obj->task_percent_complete = (int) $value;
}
if ($column == "task_start_date") {
$userTZ = $AppUI->getPref('TIMEZONE');
$start_date_userTZ = $start_date = new w2p_Utilities_Date($value, $userTZ);
$start_date->convertTZ('UTC');
$ts = $start_date->format(FMT_DATETIME_MYSQL);
$task_obj->task_start_date = $ts;
}
if ($column == "task_end_date") {
$userTZ = $AppUI->getPref('TIMEZONE');
$start_date_userTZ = $start_date = new w2p_Utilities_Date($value, $userTZ);
$start_date->convertTZ('UTC');
$ts = $start_date->format(FMT_DATETIME_MYSQL);
$task_obj->task_end_date = $ts;
}
// if (column=="task_start_date") $task_obj->task_name=$value;
// if (column=="task_end_date") $task_obj->task_name=$value;
/* Update a record using information about id, columnName (property
of the object or column in the table) and value that should be
set */
if ($id > 0 && $task_obj->store()) {
echo $value;
} else {
echo "cannot store/edit task name";
}
示例14: _processTask
protected function _processTask(CAppUI $AppUI, $project_id, $task)
{
$myTask = new CTask();
$myTask->task_name = w2PgetCleanParam($task, 'task_name', null);
$myTask->task_project = $project_id;
$myTask->task_description = w2PgetCleanParam($task, 'task_description', '');
$myTask->task_start_date = $task['task_start_date'];
$myTask->task_end_date = $task['task_end_date'];
$myTask->task_duration = $task['task_duration'];
$myTask->task_milestone = (int) $task['task_milestone'];
$myTask->task_owner = (int) $task['task_owner'];
$myTask->task_dynamic = (int) $task['task_dynamic'];
$myTask->task_priority = (int) $task['task_priority'];
$myTask->task_percent_complete = $task['task_percent_complete'];
$myTask->task_duration_type = 1;
$result = $myTask->store($AppUI);
return is_array($result) ? $result : $myTask->task_id;
}
示例15: CDate
}
$end_date = new CDate($obj->task_end_date);
$obj->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
// prepare (and translate) the module name ready for the suffix
if ($del) {
$result = $obj->delete();
if (is_array($result)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg('Task deleted');
$AppUI->redirect('', -1);
}
}
$result = $obj->store($AppUI);
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();