function get_changes_list() { // This function returns HTML rows for the changes that have been made to this task $rows = array(); $people_cache =& get_cached_table("person"); $options = array("taskID" => $this->get_id()); $changes = audit::get_list($options); foreach ($changes as $audit) { $changeDescription = ""; $newValue = $audit['value']; switch ($audit['field']) { case 'created': $changeDescription = $newValue; break; case 'dip': $changeDescription = "Default parties set to " . interestedParty::abbreviate($newValue); break; case 'taskName': $changeDescription = "Task name set to '{$newValue}'."; break; case 'taskDescription': $changeDescription = "Task description set to <a class=\"magic\" href=\"#x\" onclick=\"\$('#audit" . $audit["auditID"] . "').slideToggle('fast');\">Show</a> <div class=\"hidden\" id=\"audit" . $audit["auditID"] . "\"><div>" . $newValue . "</div></div>"; break; case 'priority': $priorities = config::get_config_item("taskPriorities"); $changeDescription = sprintf('Task priority set to <span style="color: %s;">%s</span>.', $priorities[$newValue]["colour"], $priorities[$newValue]["label"]); break; case 'projectID': task::load_entity("project", $newValue, $newProject); is_object($newProject) and $newProjectLink = $newProject->get_project_link(); $newProjectLink or $newProjectLink = "<empty>"; $changeDescription = "Project changed set to " . $newProjectLink . "."; break; case 'parentTaskID': task::load_entity("task", $newValue, $newTask); if ($newValue) { $changeDescription = sprintf("Task set to a child of %d %s.", $newTask->get_id(), $newTask->get_task_link()); } else { $changeDescription = "Task no longer a child task."; } break; case 'duplicateTaskID': task::load_entity("task", $newValue, $newTask); if ($newValue) { $changeDescription = "Task set to a duplicate of " . $newTask->get_task_link(); } else { $changeDescription = "Task is no longer a duplicate."; } break; case 'personID': $changeDescription = "Task assigned to " . $people_cache[$newValue]["name"] . "."; break; case 'managerID': $changeDescription = "Task manager set to " . $people_cache[$newValue]["name"] . "."; break; case 'estimatorID': $changeDescription = "Task estimator set to " . $people_cache[$newValue]["name"] . "."; break; case 'taskTypeID': $changeDescription = "Task type set to " . $newValue . "."; break; case 'taskStatus': $changeDescription = sprintf('Task status set to <span style="background-color:%s">%s</span>.', task::get_task_status_thing("colour", $newValue), task::get_task_status_thing("label", $newValue)); break; case 'dateActualCompletion': case 'dateActualStart': case 'dateTargetStart': case 'dateTargetCompletion': case 'timeLimit': case 'timeBest': case 'timeWorst': case 'timeExpected': // these cases are more or less identical switch ($audit['field']) { case 'dateActualCompletion': $fieldDesc = "actual completion date"; break; case 'dateActualStart': $fieldDesc = "actual start date"; break; case 'dateTargetStart': $fieldDesc = "estimate/target start date"; break; case 'dateTargetCompletion': $fieldDesc = "estimate/target completion date"; break; case 'timeLimit': $fieldDesc = "hours worked limit"; break; case 'timeBest': $fieldDesc = "best estimate"; break; case 'timeWorst': $fieldDesc = "worst estimate"; break; case 'timeExpected': $fieldDesc = "expected estimate"; } if ($newValue) { $changeDescription = "The {$fieldDesc} was set to {$newValue}."; } else { $changeDescription = "The {$fieldDesc} was removed."; } break; } $rows[] = "<tr><td class=\"nobr\">" . $audit["dateChanged"] . "</td><td>{$changeDescription}</td><td>" . page::htmlentities($people_cache[$audit["personID"]]["name"]) . "</td></tr>"; } return implode("\n", $rows); }
function get_changes_list() { // This function returns HTML rows for the changes that have been made to this project $rows = array(); $people_cache =& get_cached_table("person"); $timeUnit = new timeUnit(); $timeUnits = array_reverse($timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelA"), true); $options = array("projectID" => $this->get_id()); $changes = audit::get_list($options); foreach ((array) $changes as $audit) { $changeDescription = ""; $newValue = $audit['value']; switch ($audit['field']) { case 'created': $changeDescription = $newValue; break; case 'dip': $changeDescription = "Default parties set to " . interestedParty::abbreviate($newValue); break; case 'projectShortName': $changeDescription = "Project nickname set to '{$newValue}'."; break; case 'projectComments': $changeDescription = "Project description set to <a class=\"magic\" href=\"#x\" onclick=\"\$('#audit" . $audit["auditID"] . "').slideToggle('fast');\">Show</a> <div class=\"hidden\" id=\"audit" . $audit["auditID"] . "\"><div>" . $newValue . "</div></div>"; break; case 'clientID': $newClient = new client($newValue); is_object($newClient) and $newClientLink = $newClient->get_link(); $newClientLink or $newClientLink = "<empty>"; $changeDescription = "Client set to " . $newClientLink . "."; break; case 'clientContactID': $newClientContact = new clientContact($newValue); is_object($newClientContact) and $newClientContactLink = $newClientContact->get_link(); $newClientContactLink or $newClientContactLink = "<empty>"; $changeDescription = "Client contact set to " . $newClientContactLink . "."; break; case 'projectType': $changeDescription = "Project type set to " . $newValue . "."; break; case 'projectBudget': $changeDescription = "Project budget set to " . page::money($this->get_value("currencyTypeID"), $newValue) . "."; break; case 'currencyTypeID': $changeDescription = "Project currency set to " . $newValue . "."; break; case 'projectStatus': $changeDescription = "Project status set to " . $newValue . "."; break; case 'projectName': $changeDescription = "Project name set to '{$newValue}'."; break; case 'cost_centre_tfID': $newCostCentre = new tf($newValue); is_object($newCostCentre) and $newCostCentreLink = $newCostCentre->get_link(); $newCostCentreLink or $newCostCentreLink = "<empty>"; $changeDescription = "Cost centre TF set to " . $newCostCentreLink . "."; break; case 'customerBilledDollars': $changeDescription = "Client billing set to " . page::money($this->get_value("currencyTypeID"), $newValue) . "."; break; case 'defaultTaskLimit': $changeDescription = "Default task limit set to " . $newValue . "."; break; case 'defaultTimeSheetRate': $changeDescription = "Default time sheet rate set to " . page::money($this->get_value("currencyTypeID"), $newValue) . "."; break; case 'defaultTimeSheetRateUnitID': $changeDescription = "Default time sheet rate unit set to '" . $timeUnits[$newValue] . "'."; break; case 'projectPriority': $priorities = config::get_config_item("projectPriorities"); $changeDescription = sprintf('Project priority set to <span style="color: %s;">%s</span>.', $priorities[$newValue]["colour"], $priorities[$newValue]["label"]); break; case 'dateActualCompletion': case 'dateActualStart': case 'dateTargetStart': case 'dateTargetCompletion': // these cases are more or less identical switch ($audit['field']) { case 'dateActualCompletion': $fieldDesc = "actual completion date"; break; case 'dateActualStart': $fieldDesc = "actual start date"; break; case 'dateTargetStart': $fieldDesc = "estimate/target start date"; break; case 'dateTargetCompletion': $fieldDesc = "estimate/target completion date"; break; } if (!$newValue) { $changeDescription = "The {$fieldDesc} was removed."; } else { $changeDescription = "The {$fieldDesc} set to {$newValue}."; } break; } $rows[] = "<tr><td class=\"nobr\">" . $audit["dateChanged"] . "</td><td>{$changeDescription}</td><td>" . page::htmlentities($people_cache[$audit["personID"]]["name"]) . "</td></tr>"; } return implode("\n", $rows); }