public function __construct() { parent::__construct(); trigger_error("CTaskLog has been deprecated in v3.0 and will be removed by v4.0. Please use CTask_Log instead.", E_USER_NOTICE); }
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } // @todo refactor to use a core controller $del = (int) w2PgetParam($_POST, 'del', 0); $notify_owner = w2PgetParam($_POST, 'task_log_notify_owner', 'off'); // TODO: This is a dirty hack. $_POST['task_log_task_end_date'] = $_POST['task_end_date']; $_POST['task_log_percent_complete'] = $_POST['task_percent_complete']; $obj = new CTask_Log(); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect('m=tasks&a=view&task_id=' . $obj->task_log_task); } $action = $del ? 'deleted' : 'stored'; $result = $del ? $obj->delete() : $obj->store(); if (count($obj->getError())) { $AppUI->setMsg($result, UI_MSG_ERROR, true); $AppUI->holdObject($obj); $AppUI->redirect('m=tasks&a=view&task_id=' . $obj->task_log_task); } if ($result) { $AppUI->setMsg('Task Log ' . $action, UI_MSG_OK, true); $task = new CTask(); $task->load($obj->task_log_task); if ('on' == $notify_owner) { if ($msg = $task->notifyOwner()) { $AppUI->setMsg($msg, UI_MSG_ERROR); }
/* $Id$ $URL$ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } global $AppUI, $obj, $percent, $can_edit_time_information, $cal_sdf; $task = $obj; $task_log_id = (int) w2PgetParam($_GET, 'task_log_id', 0); $AppUI->loadCalendarJS(); // check permissions $perms =& $AppUI->acl(); $canEditTask = $perms->checkModuleItem('tasks', 'edit', $obj->task_id); $canViewTask = $perms->checkModuleItem('tasks', 'view', $obj->task_id); $canEdit = canEdit('task_log'); $canAdd = canAdd('task_log'); $log = new CTask_Log(); if ($task_log_id) { if (!$canEdit || !$canViewTask) { $AppUI->redirect('m=public&a=access_denied'); } $log->load($task_log_id); } else { if (!$canAdd || !$canViewTask) { $AppUI->redirect('m=public&a=access_denied'); } $log->task_log_task = $obj->task_id; $log->task_log_name = $obj->task_name; } $project = new CProject(); $project->load($obj->task_project); $bcode = new CSystem_Bcode();
/** * Test deleting a tasklog * */ public function testDelete() { $this->obj->bind($this->post_data); $result = $this->obj->store(); $this->assertTrue($result); $original_id = $this->obj->task_log_id; $result = $this->obj->delete(); $item = new CTask_Log(); $item->overrideDatabase($this->mockDB); $this->mockDB->stageHash(array('task_log_name' => '', 'task_log_description' => '')); $item->load($original_id); $this->assertTrue(is_a($item, 'CTask_Log')); $this->assertEquals('', $item->task_log_name); $this->assertEquals('', $item->task_log_description); //TODO: figure out a way to test the CTask cascading totals //TODO: figure out a way to test the CProject cascading totals }
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } // @todo convert to template // @todo remove database query global $AppUI, $obj, $can_edit_time_information, $cal_sdf, $m; $percent = array(0 => '0', 5 => '5', 10 => '10', 15 => '15', 20 => '20', 25 => '25', 30 => '30', 35 => '35', 40 => '40', 45 => '45', 50 => '50', 55 => '55', 60 => '60', 65 => '65', 70 => '70', 75 => '75', 80 => '80', 85 => '85', 90 => '90', 95 => '95', 100 => '100'); $task = $obj; $task_id = $task->task_id; $task_log_id = (int) w2PgetParam($_GET, 'task_log_id', 0); $log = new CTask_Log(); $log->load($task_log_id); $canAuthor = $log->canCreate(); if (!$canAuthor && !$task_log_id) { $AppUI->redirect(ACCESS_DENIED); } $canEdit = $log->canEdit(); if ($task_log_id && !$canEdit) { $AppUI->redirect(ACCESS_DENIED); } $AppUI->getTheme()->loadCalendarJS(); // check permissions $perms =& $AppUI->acl(); $canEditTask = $perms->checkModuleItem('tasks', 'edit', $obj->task_id); $canViewTask = $perms->checkModuleItem('tasks', 'view', $obj->task_id); if ($task_log_id) { if (!$canEdit || !$canViewTask) { $AppUI->redirect(ACCESS_DENIED); }