![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: do_task_bulk_aed.php 58 2008-02-21 11:12:21Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projectdesigner/do_task_bulk_aed.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 global $AppUI; 6 $project_id = w2PgetParam($_POST, 'project_id', 0); 7 $selected = w2PgetParam($_POST, 'bulk_selected_task', 0); 8 $bulk_task_project = w2PgetParam($_POST, 'bulk_task_project', ''); 9 $bulk_task_parent = w2PgetParam($_POST, 'bulk_task_parent', ''); 10 $bulk_task_dependency = w2PgetParam($_POST, 'bulk_task_dependency', ''); 11 $bulk_task_priority = w2PgetParam($_POST, 'bulk_task_priority', ''); 12 $bulk_task_access = w2PgetParam($_POST, 'bulk_task_access', ''); 13 $bulk_task_assign = w2PgetParam($_POST, 'bulk_task_assign', ''); 14 $bulk_task_hperc_assign = w2PgetParam($_POST, 'bulk_task_hperc_assign', ''); 15 //$bulk_task_assign_perc = w2PgetParam( $_POST, 'bulk_task_assign_perc', '' ); 16 $bulk_task_unassign = w2PgetParam($_POST, 'bulk_task_unassign', ''); 17 $bulk_task_other = w2PgetParam($_POST, 'bulk_task_other', ''); 18 $bulk_task_owner = w2PgetParam($_POST, 'bulk_task_owner', ''); 19 $bulk_task_type = w2PgetParam($_POST, 'bulk_task_type', ''); 20 $bulk_task_duration = w2PgetParam($_POST, 'bulk_task_duration', ''); 21 $bulk_task_durntype = w2PgetParam($_POST, 'bulk_task_durntype', ''); 22 $bulk_task_start_date = w2PgetParam($_POST, 'add_task_bulk_start_date', ''); 23 if ($bulk_task_start_date) { 24 $start_date = new CDate($bulk_task_start_date); 25 $bulk_start_date = $start_date->format(FMT_DATETIME_MYSQL); 26 } 27 $bulk_task_end_date = w2PgetParam($_POST, 'add_task_bulk_end_date', ''); 28 if ($bulk_task_end_date) { 29 $end_date = new CDate($bulk_task_end_date); 30 $bulk_end_date = $end_date->format(FMT_DATETIME_MYSQL); 31 } 32 $bulk_move_date = intval(w2PgetParam($_POST, 'bulk_move_date', '')); 33 $bulk_task_percent_complete = w2PgetParam($_POST, 'bulk_task_percent_complete', ''); 34 35 $perms = &$AppUI->acl(); 36 if (!$perms->checkModule('tasks', 'edit')) { 37 $AppUI->redirect('m=public&a=access_denied'); 38 } 39 40 //Lets store the panels view options of the user: 41 $pdo = new CProjectDesignerOptions(); 42 $pdo->pd_option_user = $AppUI->user_id; 43 $pdo->pd_option_view_project = w2PgetParam($_POST, 'opt_view_project', 0); 44 $pdo->pd_option_view_gantt = w2PgetParam($_POST, 'opt_view_gantt', 0); 45 $pdo->pd_option_view_tasks = w2PgetParam($_POST, 'opt_view_tasks', 0); 46 $pdo->pd_option_view_actions = w2PgetParam($_POST, 'opt_view_actions', 0); 47 $pdo->pd_option_view_addtasks = w2PgetParam($_POST, 'opt_view_addtsks', 0); 48 $pdo->pd_option_view_files = w2PgetParam($_POST, 'opt_view_files', 0); 49 $pdo->store(); 50 51 if (is_array($selected) && count($selected)) { 52 $upd_task = new CTask(); 53 foreach ($selected as $key => $val) { 54 if ($key) { 55 $upd_task->load($key); 56 } 57 58 //Action: Modify Percent Complete 59 if (isset($_POST['bulk_task_percent_complete']) && $bulk_task_percent_complete != '' && $bulk_task_percent_complete) { 60 if ($upd_task->task_id) { 61 $upd_task->task_percent_complete = $bulk_task_percent_complete; 62 $upd_task->store(); 63 } 64 } 65 66 //Action: Move Task Date 67 if (isset($_POST['bulk_move_date']) && $bulk_move_date != '' && $bulk_move_date) { 68 if ($upd_task->task_id && (intval($upd_task->task_dynamic) != 1 && !$upd_task->getDependencies($upd_task->task_id))) { 69 $offSet = $bulk_move_date; 70 $start_date = new CDate($upd_task->task_start_date); 71 $start_date->addDays($offSet); 72 $upd_task->task_start_date = $start_date->format(FMT_DATETIME_MYSQL); 73 $end_date = new CDate($upd_task->task_end_date); 74 $end_date->addDays($offSet); 75 $upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL); 76 $upd_task->store(); 77 $upd_task->shiftDependentTasks(); 78 } 79 } 80 81 //Action: Modify Start Date 82 if (isset($_POST['add_task_bulk_start_date']) && $bulk_task_start_date != '' && $bulk_start_date) { 83 if ($upd_task->task_id) { 84 $upd_task->task_start_date = $bulk_start_date; 85 $upd_task->store(); 86 } 87 } 88 89 //Action: Modify End Date 90 if (isset($_POST['add_task_bulk_end_date']) && $bulk_task_end_date != '' && $bulk_end_date) { 91 if ($upd_task->task_id) { 92 $upd_task->task_end_date = $bulk_end_date; 93 $upd_task->store(); 94 } 95 } 96 97 //Action: Modify Duration 98 if (isset($_POST['bulk_task_duration']) && $bulk_task_duration != '' && is_numeric($bulk_task_duration)) { 99 if ($upd_task->task_id) { 100 $upd_task->task_duration = $bulk_task_duration; 101 //set duration type to hours (1) 102 $upd_task->task_duration_type = $bulk_task_durntype ? $bulk_task_durntype : 1; 103 $upd_task->store(); 104 } 105 } 106 107 //Action: Modify Task Owner 108 if (isset($_POST['bulk_task_owner']) && $bulk_task_owner != '' && $bulk_task_owner) { 109 if ($upd_task->task_id) { 110 $upd_task->task_owner = $bulk_task_owner; 111 $upd_task->store(); 112 } 113 } 114 115 //Action: Move to Project 116 if (isset($_POST['bulk_task_project']) && $bulk_task_project != '' && $bulk_task_project) { 117 if ($upd_task->task_id) { 118 $upd_task->task_project = $bulk_task_project; 119 //Set parent to self task 120 $upd_task->task_parent = $key; 121 $upd_task->store(); 122 } 123 } 124 125 //Action: Change parent 126 if (isset($_POST['bulk_task_parent']) && $bulk_task_parent != '') { 127 if ($upd_task->task_id) { 128 //If parent is self task 129 if ($bulk_task_parent == '0') { 130 $upd_task->task_parent = $key; 131 $upd_task->store(); 132 //if not, then the task will be child to the selected parent 133 } else { 134 $upd_task->task_parent = $bulk_task_parent; 135 $upd_task->store(); 136 } 137 } 138 } 139 140 //Action: Change dependency 141 if (isset($_POST['bulk_task_dependency']) && $bulk_task_dependency != '') { 142 if ($upd_task->task_id) { 143 //If parent is self task 144 //print_r($bulk_task_dependency);die; 145 if ($bulk_task_dependency == '0') { 146 $upd_task->task_dynamic = 0; 147 $upd_task->store(); 148 $q = new DBQuery; 149 $q->setDelete('task_dependencies'); 150 $q->addWhere('dependencies_task_id=' . $upd_task->task_id); 151 $q->exec(); 152 } elseif (!($bulk_task_dependency == $upd_task->task_id)) { 153 $upd_task->task_dynamic = 31; 154 $upd_task->store(); 155 $q = new DBQuery; 156 $q->addTable('task_dependencies'); 157 $q->addReplace('dependencies_task_id', $upd_task->task_id); 158 $q->addReplace('dependencies_req_task_id', $bulk_task_dependency); 159 $q->exec(); 160 //Lets recalc the dependency 161 $dep_task = new CTask(); 162 $dep_task->load($bulk_task_dependency); 163 if ($dep_task->task_id) { 164 $dep_task->shiftDependentTasks(); 165 } 166 } 167 } 168 } 169 170 //Action: Modify priority 171 if (isset($_POST['bulk_task_priority']) && $bulk_task_priority != '') { 172 if ($upd_task->task_id) { 173 $upd_task->task_priority = $bulk_task_priority; 174 $upd_task->store(); 175 } 176 } 177 178 //Action: Modify Access 179 if (isset($_POST['bulk_task_access']) && $bulk_task_access != '') { 180 if ($upd_task->task_id) { 181 $upd_task->task_access = $bulk_task_access; 182 $upd_task->store(); 183 } 184 } 185 186 //Action: Modify Type 187 if (isset($_POST['bulk_task_type']) && $bulk_task_type != '') { 188 if ($upd_task->task_id) { 189 $upd_task->task_type = $bulk_task_type; 190 $upd_task->store(); 191 } 192 } 193 194 //Action: Assign User 195 if (isset($_POST['bulk_task_hperc_assign']) && $bulk_task_hperc_assign != '') { 196 //format hperc_assign user_id=percentage_assignment;user_id=percentage_assignment;user_id=percentage_assignment; 197 $bulk_task_assign = ','; 198 $tmp_ar = explode(';', $bulk_task_hperc_assign); 199 $hperc_assign_ar = array(); 200 for ($i = 0, $i_cmp = sizeof($tmp_ar); $i < $i_cmp; $i++) { 201 $tmp = explode('=', $tmp_ar[$i]); 202 if (count($tmp) > 1) { 203 $hperc_assign_ar[$tmp[0]] = $tmp[1]; 204 $bulk_task_assign .= $tmp[0] . ','; 205 } else { 206 $hperc_assign_ar[$tmp[0]] = 100; 207 $bulk_task_assign .= $tmp[0] . ','; 208 } 209 } 210 $upd_task = new CTask(); 211 $upd_task->load($key); 212 if ($upd_task->task_id) { 213 $upd_task->updateAssigned($bulk_task_assign, $hperc_assign_ar, false, false); 214 } 215 //$upd_task->updateAssigned($bulk_task_assign,array($bulk_task_assign=>$bulk_task_assign_perc),false,false); 216 if ($upd_task->task_project && $upd_task->task_id && $upd_task->task_notify) { 217 $upd_task->notify(); 218 } 219 } 220 221 //Action: Unassign User 222 if (isset($_POST['bulk_task_unassign']) && $bulk_task_unassign != '') { 223 $upd_task = new CTask(); 224 $upd_task->load($key); 225 if ($upd_task->task_id) { 226 $upd_task->removeAssigned($bulk_task_unassign); 227 } 228 } 229 230 //Action: Other Actions 231 if (isset($_POST['bulk_task_other']) && $bulk_task_other != '') { 232 233 if ($upd_task->task_id) { 234 //Option 1 - Mark as finished 235 if ($bulk_task_other == '1') { 236 $upd_task->task_percent_complete = 100; 237 if (!$upd_task->task_end_date || $upd_task->task_end_date == '0000-00-00 00:00:00') { 238 $end_date = null; 239 $end_date = new CDate(); 240 $upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL); 241 } 242 $upd_task->store(); 243 //Option 2 - Mark as milestone 244 } elseif ($bulk_task_other == '2') { 245 $upd_task->task_milestone = 1; 246 $upd_task->store(); 247 //Option 3 - Mark as non milestone 248 } elseif ($bulk_task_other == '3') { 249 $upd_task->task_milestone = 0; 250 $upd_task->store(); 251 //Option 4 - Mark as dynamic 252 } elseif ($bulk_task_other == '4') { 253 $upd_task->task_dynamic = 1; 254 $upd_task->store(); 255 //Option 5 - Mark as non dynamic 256 } elseif ($bulk_task_other == '5') { 257 $upd_task->task_dynamic = 0; 258 $upd_task->store(); 259 //Option 6 - Add Task Reminder 260 } elseif ($bulk_task_other == '6') { 261 $upd_task->addReminder(); 262 //Option 7 - Mark as non dynamic 263 } elseif ($bulk_task_other == '7') { 264 $upd_task->clearReminder(true); 265 //Option 8 - Mark as active 266 } elseif ($bulk_task_other == '8') { 267 $upd_task->task_status = '0'; 268 $upd_task->store(); 269 //Option 10 - Empty tasks description 270 } elseif ($bulk_task_other == '10') { 271 $upd_task->task_description = ''; 272 $upd_task->store(); 273 //Option 99 (always at the bottom) - Delete 274 } elseif ($bulk_task_other == '99') { 275 $upd_task->delete(); 276 } 277 } 278 } 279 echo db_error(); 280 } 281 } 282 $AppUI->redirect('m=projectdesigner&project_id=' . $project_id); 283 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |