public function buildRow($rowData, $customLookups = array()) { if (!$this->showRow($rowData)) { return ''; } $this->stageRowData($rowData); $class = w2pFindTaskComplete($rowData['task_start_date'], $rowData['task_end_date'], $rowData['task_percent_complete']); $row = '<tr class="' . $class . '">'; $row .= $this->_buildCells(array('edit' => 'task_id', 'pin' => 'task_id', 'log' => 'task_id')); foreach ($this->_fieldKeys as $column) { if ('task_name' == $column) { $prefix = $suffix = ''; if ($rowData['depth'] > 1) { $prefix .= str_repeat(' ', ($rowData['depth'] - 1) * 4) . '<img src="' . w2PfindImage('corner-dots.gif') . '" />'; } if ($rowData['children'] > 0) { $prefix .= '<img src="' . w2PfindImage('icons/collapse.gif') . '" /> '; } if ('' != $rowData['task_description']) { $prefix .= w2PtoolTip($this->_AppUI->_('Task Description'), $rowData['task_description']); $suffix .= w2PendTip(); } if ($rowData['task_milestone']) { $suffix .= ' ' . '<img src="' . w2PfindImage('icons/milestone.gif') . '" />'; } if (1 == $rowData['task_dynamic'] || $rowData['task_milestone']) { $rowData[$column] = '<b>' . $rowData[$column] . '</b>'; } $rowData[$column] = $prefix . $rowData[$column] . $suffix; } if ('task_assignees' == $column) { $parsed = array(); $assignees = $this->task->assignees($rowData['task_id']); foreach ($assignees as $assignee) { $parsed[] = '<a href="?m=users&a=view&user_id=' . $assignee['user_id'] . '">' . $assignee['contact_name'] . '</a>'; } $rowData[$column] = implode(', ', $parsed); } $row .= $this->createCell($column, $rowData[$column], $customLookups); } if ('projectdesigner' == $this->module) { $row .= '<td class="data"><input type="checkbox" name="selected_task[]" value="' . $rowData['task_id'] . '"/></td>'; } $row .= '</tr>'; return $row; }
width: 900px; margin: 0 auto; } </style>"; */ $html .= "<style type='text/css'>\n\n\tbody {\n\t\tmargin-top: 40px;\n\t\ttext-align: center;\n\t\tfont-size: 14px;\n\t\t}\n\t\t\n\t#wrap {\n\t\twidth: 1100px;\n\t\tmargin: 0 auto;\n\t\t}\n\t\t\n\t#external-events {\n\t\tfloat: left;\n\t\twidth: 150px;\n height: 700px;\n overflow: scroll;\n\t\tpadding: 0 10px;\n\t\tborder: 1px solid #ccc;\n\t\tbackground: #eee;\n\t\ttext-align: left;\n\t\t}\n\t\t\n\t#external-events h4 {\n\t\tfont-size: 16px;\n\t\tmargin-top: 0;\n\t\tpadding-top: 1em;\n\t\t}\n\t\t\n\t.external-event { /* try to mimick the look of a real event */\n\t\tmargin: 10px 0;\n\t\tborder: 1px solid #000000;\n\t\tpadding: 2px 4px;\n\t\tbackground: #3366CC;\n\t\tcolor: #000000;//#fff;\n\t\tfont-size: .95em;\n\t\tcursor: pointer;\n word-wrap: break-word; /* Firefox & IE */\n// word-break: break-all; /* Chrome */ }\n}\n\n\n\n\t.external-eventoverdue { /* try to mimick the look of a real event */\n\t\tmargin: 10px 0;\n\t\tborder: 1px solid #000000;\n\t\tpadding: 2px 4px;\n\t\tbackground: #CC6666;\n\t\tcolor: #fff;\n\t\tfont-size: .85em;\n\t\tcursor: pointer;\n word-wrap: break-word; /* Firefox & IE */\n// word-break: break-all; /* Chrome */ }\n}\n\n\n\t.external-event-notstarted { /* try to mimick the look of a real event */\n\t\tmargin: 10px 0;\n\t\tborder: 1px solid #000000;\n\t\tpadding: 2px 4px;\n\t\tbackground: #ffeebb;\n\t\tcolor: #fff;\n\t\tfont-size: .85em;\n\t\tcursor: pointer;\n word-wrap: break-word; /* Firefox & IE */\n// word-break: break-all; /* Chrome */ }\n}\n\n\n\n\n\t.external-event-ontime { /* try to mimick the look of a real event */\n\t\tmargin: 10px 0;\n\t\tborder: 1px solid #000000;\n\t\tpadding: 2px 4px;\n\t\tbackground: #e6eedd;\n\t\tcolor: #fff;\n\t\tfont-size: .85em;\n\t\tcursor: pointer;\n word-wrap: break-word; /* Firefox & IE */\n// word-break: break-all; /* Chrome */ }\n}\n\n\n\t\t\n\t#external-events p {\n\t\tmargin: 1.5em 0;\n\t\tfont-size: 11px;\n\t\tcolor: #666;\n\t\t}\n\t\t\n\t#external-events p input {\n\t\tmargin: 0;\n\t\tvertical-align: middle;\n\t\t}\n\n\t#calendar {\n\t\tfloat: right;\n\t\twidth: 900px;\n\t\t}\n\n</style>"; //$html.="<div id='calendar'></div>"; $event1 = "Event1"; /*<div class='external-event'>My Event 1</div> <div class='external-event'>$event1</div> */ $html .= "<div id='wrap'>\n\n<div id='external-events'>\n<h3>Drag Tasks into Calendar</h3>\n<p>doubleclick task to set task progress<p>\n<!---\n<div class='external-event'>My Event 3</div>\n-->\n"; //id='".$task['task_id']." foreach ($tasks as $task) { $taskclass = w2pFindTaskComplete($task['task_start_date'], $task['task_end_date'], $task['task_percent_complete']); $tname = $task[task_name] . "..." . $task[project_name]; $task_descr = $task['task_description']; $href = '?m=tasks&a=view&task_id=' . $task['task_id']; $href_edit = '?m=tasks&a=addedit&task_id=' . $task['task_id']; $href_task_log = '?m=tasks&a=view&tab=1&task_id=' . $task['task_id']; $descript = "Links: "; $descript .= $href ? '<a href="' . $href . '" class="event">' : ''; $descript .= "<b>View</b>"; //$row['event_name']; $descript .= $href ? '</a>' : ''; $descript .= $href_edit ? '<a href="' . $href_edit . '" class="event">' : ''; $descript .= "<b> Edit </b>"; //$row['event_name']; $descript .= $href_edit ? '</a>' : ''; $href_proj = '?m=projects&a=view&project_id=' . $task['task_project'];
/** * This was used to designate if a task was on not started, late, on time, or * some other combination thereof. * TODO: Remove for v4.0 - caseydk 04 Mar 2012 * * @deprecated */ function taskstyle_pd($task) { trigger_error("The taskstyle_pd function has been deprecated and will be removed in v4.0. Use w2pFindTaskComplete() instead.", E_USER_NOTICE); $style = w2pFindTaskComplete($task['task_start_date'], $task['task_end_date'], $task['task_percent_complete']); switch ($style) { case 'done': case 'late': case 'notstarted': $style = 'task_' . $style; break; case 'active': $style = 'task_started'; break; default: $style = 'task_future'; break; } }
public function test_w2pFindTaskComplete() { $empty = null; //we don't care what this value is $past = date('Y-m-d', strtotime('-1 week')); $future = date('Y-m-d', strtotime('+1 week')); $this->assertEquals('done', w2pFindTaskComplete($empty, $empty, 100)); $this->assertEquals('', w2pFindTaskComplete($future, $empty, 0)); $this->assertEquals('active', w2pFindTaskComplete($past, $future, 50)); $this->assertEquals('notstarted', w2pFindTaskComplete($past, $future, 0)); $this->assertEquals('late', w2pFindTaskComplete($past, $empty, 0)); }
function showtask_pd_ed(&$arr, $level = 0, $today_view = false) { global $AppUI, $w2Pconfig, $done, $userAlloc, $showEditCheckbox; global $task_access, $PROJDESIGN_CONFIG, $m, $expanded; $durnTypes = w2PgetSysVal('TaskDurationType'); //Check for Tasks Access $tmpTask = new CTask(); $tmpTask->load($arr['task_id']); $canAccess = $tmpTask->canAccess(); if (!$canAccess) { return false; } $htmlHelper = new w2p_Output_HTMLHelper($AppUI); $htmlHelper->df .= ' ' . $AppUI->getPref('TIMEFORMAT'); $htmlHelper->stageRowData($arr); $types = w2Pgetsysval('TaskType'); $show_all_assignees = $w2Pconfig['show_all_task_assignees'] ? true : false; $done[] = $arr['task_id']; // prepare coloured highlight of task time information $class = w2pFindTaskComplete($arr['task_start_date'], $arr['task_end_date'], $arr['task_percent_complete']); $jsTaskId = 'task_proj_' . $arr['task_project'] . '_level-' . $level . '-task_' . $arr['task_id'] . '_'; if ($expanded) { $s = '<tr id="' . $jsTaskId . '" class="' . $class . '" onclick="select_row(\'selected_task\', \'' . $arr['task_id'] . '\', \'frm_tasks\')">'; // edit icon } else { $s = '<tr id="' . $jsTaskId . '" class="' . $class . '" onclick="select_row(\'selected_task\', \'' . $arr['task_id'] . '\', \'frm_tasks\')" ' . ($level ? 'style="display:none"' : '') . '>'; // edit icon } $s .= '<td class="data _edit">'; $canEdit = $arr['task_represents_project'] ? false : true; if ($canEdit) { $s .= '<a href="?m=tasks&a=addedit&task_id=' . $arr['task_id'] . '">' . w2PshowImage('icons/pencil.gif', 12, 12) . '</a>'; } $s .= '</td>'; $s .= $htmlHelper->createCell('task_percent_complete', $arr['task_percent_complete']); $s .= $htmlHelper->createCell('task_priority', $arr['task_priority']); $s .= $htmlHelper->createCell('user_task_priority', $arr['user_task_priority']); $s .= $htmlHelper->createCell('other', mb_substr($task_access[$arr['task_access']], 0, 3)); $s .= $htmlHelper->createCell('other', mb_substr($types[$arr['task_type']], 0, 3)); // reminders set $s .= $htmlHelper->createCell('other', $arr['queue_id'] ? 'Yes' : ''); $s .= $htmlHelper->createCell('other', $arr['task_status'] == -1 ? 'Yes' : ''); // add log $s .= '<td align="center" nowrap="nowrap">'; if ($arr['task_dynamic'] != 1 && 0 == $arr['task_represents_project']) { $s .= '<a href="?m=tasks&a=view&tab=1&project_id=' . $arr['task_project'] . '&task_id=' . $arr['task_id'] . '">' . w2PtoolTip('tasks', 'add work log to this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>'; } $s .= '</td>'; // dots $s .= '<td style="width: ' . ($today_view ? '20%' : '50%') . '" class="data _name">'; for ($y = 0; $y < $level; $y++) { if ($y + 1 == $level) { $image = w2PfindImage('corner-dots.gif', $m); } else { $image = w2PfindImage('shim.gif', $m); } $s .= '<img src="' . $image . '" width="16" height="12" border="0" alt="" />'; } // name link if ($arr['task_description']) { $s .= w2PtoolTip('Task Description', $arr['task_description'], true); } $jsTaskId = 'task_proj_' . $arr['task_project'] . '_level-' . $level . '-task_' . $arr['task_id'] . '_'; $open_link = '<a href="javascript: void(0);" onclick="selected_task_' . $arr['task_id'] . '.checked=true"><img onclick="expand_collapse(\'' . $jsTaskId . '\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="' . $jsTaskId . '_collapse" src="' . w2PfindImage('icons/collapse.gif', $m) . '" border="0" align="center" ' . (!$expanded ? 'style="display:none"' : '') . ' alt="" /><img onclick="expand_collapse(\'' . $jsTaskId . '\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="' . $jsTaskId . '_expand" src="' . w2PfindImage('icons/expand.gif', $m) . '" border="0" align="center" ' . ($expanded ? 'style="display:none"' : '') . ' alt="" /></a>'; $taskObj = new CTask(); $taskObj->load($arr['task_id']); if (count($taskObj->getChildren())) { $is_parent = true; } else { $is_parent = false; } if ($arr['task_milestone'] > 0) { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" ><b>' . $arr['task_name'] . '</b></a> <img src="' . w2PfindImage('icons/milestone.gif', $m) . '" border="0" alt="" /></td>'; } elseif ($arr['task_dynamic'] == '1' || $is_parent) { $s .= $open_link; if ($arr['task_dynamic'] == '1') { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" ><b><i>' . $arr['task_name'] . '</i></b></a></td>'; } else { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" >' . $arr['task_name'] . '</a></td>'; } } else { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" >' . $arr['task_name'] . '</a></td>'; } if ($arr['task_description']) { $s .= w2PendTip(); } // task description if ($PROJDESIGN_CONFIG['show_task_descriptions']) { $s .= '<td align="justified">' . $arr['task_description'] . '</td>'; } // task owner $s .= $htmlHelper->createCell('task_owner', $arr['contact_name']); $s .= $htmlHelper->createCell('task_start_datetime', $arr['task_start_date']); // duration or milestone $s .= $htmlHelper->createCell('task_duration', $arr['task_duration'] . ' ' . mb_substr($AppUI->_($durnTypes[$arr['task_duration_type']]), 0, 1)); $s .= $htmlHelper->createCell('task_end_datetime', $arr['task_end_date']); if (isset($arr['task_assigned_users']) && ($assigned_users = $arr['task_assigned_users'])) { $a_u_tmp_array = array(); if ($show_all_assignees) { $s .= '<td align="left">'; foreach ($assigned_users as $val) { $aInfo = '<a href="?m=users&a=view&user_id=' . $val['user_id'] . '"'; $aInfo .= 'title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$val['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$val['user_id']]['freeCapacity'] . '%' : '') . '">'; $aInfo .= $val['contact_name'] . ' (' . $val['perc_assignment'] . '%)</a>'; $a_u_tmp_array[] = $aInfo; } $s .= join(', ', $a_u_tmp_array); $s .= '</td>'; } else { $s .= '<td align="left" nowrap="nowrap">'; $s .= '<a href="?m=users&a=view&user_id=' . $assigned_users[0]['user_id'] . '"'; $s .= 'title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[0]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[0]['user_id']]['freeCapacity'] . '%' : '') . '">'; $s .= $assigned_users[0]['contact_name'] . ' (' . $assigned_users[0]['perc_assignment'] . '%)</a>'; if ($arr['assignee_count'] > 1) { $id = $arr['task_id']; $s .= '<a href="javascript: void(0);" onclick="toggle_users(\'users_' . $id . '\');" title="' . join(', ', $a_u_tmp_array) . '">(+' . ($arr['assignee_count'] - 1) . ')</a>'; $s .= '<span style="display: none" id="users_' . $id . '">'; $a_u_tmp_array[] = $assigned_users[0]['user_username']; for ($i = 1, $i_cmp = count($assigned_users); $i < $i_cmp; $i++) { $a_u_tmp_array[] = $assigned_users[$i]['user_username']; $s .= '<br /><a href="?m=users&a=view&user_id='; $s .= $assigned_users[$i]['user_id'] . '" title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['freeCapacity'] . '%' : '') . '">'; $s .= $assigned_users[$i]['contact_name'] . ' (' . $assigned_users[$i]['perc_assignment'] . '%)</a>'; } $s .= '</span>'; } $s .= '</td>'; } } else { // No users asigned to task $s .= '<td class="data">-</td>'; } // Assignment checkbox if ($showEditCheckbox && 0 == $arr['task_represents_project']) { $s .= '<td class="data"><input type="checkbox" onclick="select_box(\'multi_check\', ' . $arr['task_id'] . ',\'project_' . $arr['task_project'] . '_level-' . $level . '-task_' . $arr['task_id'] . '_\',\'frm_tasks\')" onfocus="is_check=true;" onblur="is_check=false;" id="selected_task_' . $arr['task_id'] . '" name="selected_task" value="' . $arr['task_id'] . '"/></td>'; } $s .= '</tr>'; return $s; }
public function getTaskColor($start_date, $end_date, $percent) { return 'ff00ff'; $class = w2pFindTaskComplete($start_date, $end_date, $percent); /* late #CC6666 not started #ffeebb ontime #e6eedd // if ($class = 'done') { return 'done'; } if ($class = '') { return 'e6eedd'; } if ($class = 'late') { return 'CC6666'; } // if ($class = 'active' ) { return 'active'; } if ($class = 'notstarted') { return 'ffeebb'; } */ return 'e6eedd'; }