function show_taskCommentsPrinter() { global $taskID; global $TPL; $TPL["commentsR"] = comment::util_get_comments("task", $taskID, $options); include_template("../comment/templates/commentP.tpl"); }
function show_comments() { global $clientID; global $TPL; global $client; $TPL["commentsR"] = comment::util_get_comments("client", $clientID); $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden"; $interestedPartyOptions = $client->get_all_parties(); $interestedPartyOptions = interestedParty::get_interested_parties("client", $client->get_id(), $interestedPartyOptions); $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array(); $TPL["entity"] = "client"; $TPL["entityID"] = $client->get_id(); $TPL["clientID"] = $client->get_id(); $commentTemplate = new commentTemplate(); $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "client")); $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops); include_template("../comment/templates/commentM.tpl"); }
public static function get_list($_FORM) { $current_user =& singleton("current_user"); /* * This is the definitive method of getting a list of tasks that need a sophisticated level of filtering * */ list($filter, $having) = task::get_list_filter($_FORM); $debug = $_FORM["debug"]; $debug and print "\n<pre>_FORM: " . print_r($_FORM, 1) . "</pre>"; $debug and print "\n<pre>filter: " . print_r($filter, 1) . "</pre>"; $_FORM["taskView"] or $_FORM["taskView"] = 'prioritised'; // Zero is a valid limit if ($_FORM["limit"] || $_FORM["limit"] === 0 || $_FORM["limit"] === "0") { $limit = prepare("limit %d", $_FORM["limit"]); } $_FORM["return"] or $_FORM["return"] = "html"; $_FORM["people_cache"] =& get_cached_table("person"); $_FORM["timeUnit_cache"] =& get_cached_table("timeUnit"); $_FORM["taskType_cache"] =& get_cached_table("taskType"); if ($_FORM["taskView"] == "prioritised") { unset($filter["parentTaskID"]); $order_limit = " " . $limit; } else { $order_limit = " ORDER BY projectName,taskName " . $limit; } // Get a hierarchical list of tasks if (is_array($filter) && count($filter)) { $f = " WHERE " . implode(" AND ", $filter); } $uid = sprintf("%d", $current_user->get_id()); $spread = sprintf("%d", config::get_config_item("taskPrioritySpread")); $scale = sprintf("%d", config::get_config_item("taskPriorityScale")); $scale_halved = sprintf("%d", config::get_config_item("taskPriorityScale") / 2); $q = "SELECT task.*\n ,projectName\n ,projectShortName\n ,clientID\n ,projectPriority\n ,project.currencyTypeID as currency\n ,rate\n ,rateUnitID\n ,GROUP_CONCAT(pendingTask.pendingTaskID) as pendingTaskIDs\n ,GROUP_CONCAT(DISTINCT alltag.name SEPARATOR ', ') as tags\n FROM task\n LEFT JOIN project ON project.projectID = task.projectID\n LEFT JOIN projectPerson ON project.projectID = projectPerson.projectID AND projectPerson.personID = '" . $uid . "'\n LEFT JOIN pendingTask ON pendingTask.taskID = task.taskID\n LEFT JOIN tag alltag ON alltag.taskID = task.taskID\n LEFT JOIN tag seltag ON seltag.taskID = task.taskID\n " . $f . "\n GROUP BY task.taskID\n " . $having . "\n " . $order_limit; $debug and print "\n<br>QUERY: " . $q; $_FORM["debug"] and print "\n<br>QUERY: " . $q; $db = new db_alloc(); $db->query($q); while ($row = $db->next_record()) { $task = new task(); $task->read_db_record($db); $row["taskURL"] = $task->get_url(); $row["taskName"] = $task->get_name($_FORM); $row["taskLink"] = $task->get_task_link($_FORM); $row["project_name"] = $row["projectShortName"] or $row["project_name"] = $row["projectName"]; $row["projectPriority"] = $db->f("projectPriority"); has("project") and $row["projectPriorityLabel"] = project::get_priority_label($db->f("projectPriority")); has("project") and list($row["priorityFactor"], $row["daysUntilDue"]) = $task->get_overall_priority($row["projectPriority"], $row["priority"], $row["dateTargetCompletion"]); $row["taskTypeImage"] = $task->get_task_image(); $row["taskTypeSeq"] = $_FORM["taskType_cache"][$row["taskTypeID"]]["taskTypeSeq"]; $row["taskStatusLabel"] = $task->get_task_status("label"); $row["taskStatusColour"] = $task->get_task_status("colour"); $row["creator_name"] = $_FORM["people_cache"][$row["creatorID"]]["name"]; $row["manager_name"] = $_FORM["people_cache"][$row["managerID"]]["name"]; $row["assignee_name"] = $_FORM["people_cache"][$row["personID"]]["name"]; $row["closer_name"] = $_FORM["people_cache"][$row["closerID"]]["name"]; $row["estimator_name"] = $_FORM["people_cache"][$row["estimatorID"]]["name"]; $row["creator_username"] = $_FORM["people_cache"][$row["creatorID"]]["username"]; $row["manager_username"] = $_FORM["people_cache"][$row["managerID"]]["username"]; $row["assignee_username"] = $_FORM["people_cache"][$row["personID"]]["username"]; $row["closer_username"] = $_FORM["people_cache"][$row["closerID"]]["username"]; $row["estimator_username"] = $_FORM["people_cache"][$row["estimatorID"]]["username"]; $row["newSubTask"] = $task->get_new_subtask_link(); $_FORM["showPercent"] and $row["percentComplete"] = $task->get_percentComplete(); $_FORM["showTimes"] and $row["timeActual"] = $task->get_time_billed() / 60 / 60; $row["rate"] = page::money($row["currency"], $row["rate"], "%mo"); $row["rateUnit"] = $_FORM["timeUnit_cache"][$row["rateUnitID"]]["timeUnitName"]; $row["priorityLabel"] = $task->get_priority_label(); if (!$_FORM["skipObject"]) { $_FORM["return"] == "array" and $row["object"] = $task; } $row["padding"] = $_FORM["padding"]; $row["taskID"] = $task->get_id(); $row["parentTaskID"] = $task->get_value("parentTaskID"); $row["parentTaskID_link"] = "<a href='" . $task->get_url(false, $task->get_value("parentTaskID")) . "'>" . $task->get_value("parentTaskID") . "</a>"; $row["timeLimitLabel"] = $row["timeBestLabel"] = $row["timeWorstLabel"] = $row["timeExpectedLabel"] = $row["timeActualLabel"] = ""; $row["timeLimit"] !== NULL and $row["timeLimitLabel"] = seconds_to_display_format($row["timeLimit"] * 60 * 60); $row["timeBest"] !== NULL and $row["timeBestLabel"] = seconds_to_display_format($row["timeBest"] * 60 * 60); $row["timeWorst"] !== NULL and $row["timeWorstLabel"] = seconds_to_display_format($row["timeWorst"] * 60 * 60); $row["timeExpected"] !== NULL and $row["timeExpectedLabel"] = seconds_to_display_format($row["timeExpected"] * 60 * 60); $row["timeActual"] !== NULL and $row["timeActualLabel"] = seconds_to_display_format($row["timeActual"] * 60 * 60); if ($_FORM["showComments"] && ($comments = comment::util_get_comments("task", $row["taskID"]))) { $row["comments"] = $comments; } if ($_FORM["taskView"] == "byProject") { $rows[$task->get_id()] = array("parentTaskID" => $row["parentTaskID"], "row" => $row); } else { if ($_FORM["taskView"] == "prioritised") { $rows[$row["taskID"]] = $row; if (is_array($rows) && count($rows)) { uasort($rows, array("task", "priority_compare")); } } } } if ($_FORM["taskView"] == "byProject") { $parentTaskID = $_FORM["parentTaskID"] or $parentTaskID = 0; $t = task::get_recursive_child_tasks($parentTaskID, (array) $rows); list($tasks, $done) = task::build_recursive_task_list($t, $_FORM); // This bit appends the orphan tasks onto the end.. foreach ((array) $rows as $taskID => $r) { $row = $r["row"]; $row["padding"] = 0; if (!$done[$taskID]) { $tasks += array($taskID => $row); } } } else { if ($_FORM["taskView"] == "prioritised") { $tasks =& $rows; } } return (array) $tasks; }
function show_comments() { global $timeSheetID; global $TPL; global $timeSheet; if ($timeSheetID) { $TPL["commentsR"] = comment::util_get_comments("timeSheet", $timeSheetID); $TPL["class_new_comment"] = "hidden"; $TPL["allParties"] = $timeSheet->get_all_parties($timeSheet->get_value("projectID")) or $TPL["allParties"] = array(); $TPL["entity"] = "timeSheet"; $TPL["entityID"] = $timeSheet->get_id(); $p = $timeSheet->get_foreign_object('project'); $TPL["clientID"] = $p->get_value("clientID"); $commentTemplate = new commentTemplate(); $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "timeSheet")); $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops); $timeSheetPrintOptions = config::get_config_item("timeSheetPrintOptions"); $timeSheetPrint = config::get_config_item("timeSheetPrint"); $ops = array("" => "Format as..."); foreach ($timeSheetPrint as $value) { $ops[$value] = $timeSheetPrintOptions[$value]; } $TPL["attach_extra_files"] = " "; $TPL["attach_extra_files"] .= "Attach Time Sheet "; $TPL["attach_extra_files"] .= '<select name="attach_timeSheet">' . page::select_options($ops) . '</select><br>'; include_template("../comment/templates/commentM.tpl"); } }
function show_comments() { global $projectID; global $TPL; global $project; $TPL["commentsR"] = comment::util_get_comments("project", $projectID); $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden"; $interestedPartyOptions = $project->get_all_parties(); $interestedPartyOptions = interestedParty::get_interested_parties("project", $project->get_id(), $interestedPartyOptions); $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array(); $TPL["entity"] = "project"; $TPL["entityID"] = $project->get_id(); $TPL["clientID"] = $project->get_value("clientID"); $commentTemplate = new commentTemplate(); $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "project")); $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops); $ops = array("" => "Format as...", "pdf" => "PDF", "pdf_plus" => "PDF+", "html" => "HTML", "html_plus" => "HTML+"); $TPL["attach_extra_files"] = " "; $TPL["attach_extra_files"] .= "Attach Task Report "; $TPL["attach_extra_files"] .= '<select name="attach_tasks">' . page::select_options($ops) . '</select><br>'; include_template("../comment/templates/commentM.tpl"); }
function show_comments() { global $invoiceID; global $TPL; global $invoice; if ($invoiceID) { $TPL["commentsR"] = comment::util_get_comments("invoice", $invoiceID); $TPL["class_new_comment"] = "hidden"; if ($invoice->get_value("projectID")) { $project = $invoice->get_foreign_object("project"); $interestedPartyOptions = $project->get_all_parties($invoice->get_value("projectID")); $client = $project->get_foreign_object("client"); $clientID = $client->get_id(); } else { if ($invoice->get_value("clientID")) { $client = $invoice->get_foreign_object("client"); $interestedPartyOptions = $client->get_all_parties($invoice->get_value("clientID")); $clientID = $client->get_id(); } } $interestedPartyOptions = interestedParty::get_interested_parties("invoice", $invoice->get_id(), $interestedPartyOptions); $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array(); $TPL["entity"] = "invoice"; $TPL["entityID"] = $invoice->get_id(); $TPL["clientID"] = $clientID; $commentTemplate = new commentTemplate(); $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "invoice")); $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops); $ops = array("" => "Format as...", "generate_pdf" => "PDF Invoice", "generate_pdf_verbose" => "PDF Invoice - verbose"); $TPL["attach_extra_files"] = " "; $TPL["attach_extra_files"] .= "Attach Invoice "; $TPL["attach_extra_files"] .= '<select name="attach_invoice">' . page::select_options($ops) . '</select><br>'; include_template("../comment/templates/commentM.tpl"); } }
function show_comments() { global $productSaleID; global $TPL; global $productSale; if ($productSaleID) { $TPL["commentsR"] = comment::util_get_comments("productSale", $productSaleID); $TPL["class_new_comment"] = "hidden"; $TPL["entity"] = "productSale"; $TPL["entityID"] = $productSale->get_id(); $project = $productSale->get_foreign_object('project'); $TPL["clientID"] = $project->get_value("clientID"); $TPL["allParties"] = $productSale->get_all_parties($productSale->get_value("projectID")) or $TPL["allParties"] = array(); $commentTemplate = new commentTemplate(); $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "productSale")); $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops); include_template("../comment/templates/commentM.tpl"); } }