function set_option_tpl_values() { // Set template values to provide options for edit selects global $TPL; $current_user =& singleton("current_user"); global $isMessage; $db = new db_alloc(); $projectID = $_GET["projectID"] or $projectID = $this->get_value("projectID"); $TPL["personOptions"] = "<select name=\"personID\"><option value=\"\">" . $this->get_personList_dropdown($projectID, "personID") . "</select>"; $TPL["managerPersonOptions"] = "<select name=\"managerID\"><option value=\"\">" . $this->get_personList_dropdown($projectID, "managerID") . "</select>"; $TPL["estimatorPersonOptions"] = "<select name=\"estimatorID\"><option value=\"\">" . $this->get_personList_dropdown($projectID, "estimatorID") . "</select>"; // TaskType Options $taskType = new meta("taskType"); $taskType_array = $taskType->get_assoc_array("taskTypeID", "taskTypeID"); $TPL["taskTypeOptions"] = page::select_options($taskType_array, $this->get_value("taskTypeID")); // Project dropdown $TPL["projectOptions"] = task::get_project_options($projectID); // We're building these two with the <select> tags because they will be // replaced by an AJAX created dropdown when the projectID changes. $TPL["parentTaskOptions"] = $this->get_parent_task_select(); $TPL["interestedPartyOptions"] = $this->get_task_cc_list_select(); $db->query(prepare("SELECT fullName, emailAddress, clientContactPhone, clientContactMobile\n FROM interestedParty\n LEFT JOIN clientContact ON interestedParty.clientContactID = clientContact.clientContactID\n WHERE entity='task' \n AND entityID = %d\n AND interestedPartyActive = 1\n ORDER BY fullName", $this->get_id())); while ($db->next_record()) { $value = interestedParty::get_encoded_interested_party_identifier($db->f("fullName"), $db->f("emailAddress")); $phone = array("p" => $db->f('clientContactPhone'), "m" => $db->f('clientContactMobile')); $TPL["interestedParties"][] = array('key' => $value, 'name' => $db->f("fullName"), 'email' => $db->f("emailAddress"), 'phone' => $phone); } $TPL["task_taskStatusLabel"] = $this->get_task_status("label"); $TPL["task_taskStatusColour"] = $this->get_task_status("colour"); $TPL["task_taskStatusValue"] = $this->get_value("taskStatus"); $TPL["task_taskStatusOptions"] = page::select_options(task::get_task_statii_array(true), $this->get_value("taskStatus")); // Project label if (has("project")) { $p = new project(); $p->set_id($this->get_value("projectID")); $p->select(); $TPL["projectName"] = $p->get_display_value(); } $taskPriorities = config::get_config_item("taskPriorities") or $taskPriorities = array(); $projectPriorities = config::get_config_item("projectPriorities") or $projectPriorities = array(); $priority = $this->get_value("priority") or $priority = 3; $TPL["priorityOptions"] = page::select_options(array_kv($taskPriorities, null, "label"), $priority); $TPL["priorityLabel"] = " <div style=\"display:inline; color:" . $taskPriorities[$priority]["colour"] . "\">["; if (is_object($p)) { list($priorityFactor, $daysUntilDue) = $this->get_overall_priority($p->get_value("projectPriority"), $this->get_value("priority"), $this->get_value("dateTargetCompletion")); $str = "Task priority: " . $taskPriorities[$this->get_value("priority")]["label"] . "<br>"; $str .= "Project priority: " . $projectPriorities[$p->get_value("projectPriority")]["label"] . "<br>"; $str .= "Days until due: " . $daysUntilDue . "<br>"; $str .= "Calculated priority: " . $priorityFactor; $TPL["priorityLabel"] .= page::help($str, $this->get_priority_label()); } else { $TPL["priorityLabel"] .= $this->get_priority_label(); } $TPL["priorityLabel"] .= "]</div>"; // If we're viewing the printer friendly view if ($_GET["media"] == "print") { // Parent Task label $t = new task(); $t->set_id($this->get_value("parentTaskID")); $t->select(); $TPL["parentTask"] = $t->get_display_value(); // Task Type label $TPL["taskType"] = $this->get_value("taskTypeID"); // Priority $TPL["priority"] = $this->get_value("priority"); // Assignee label $p = new person(); $p->set_id($this->get_value("personID")); $p->select(); $TPL["person"] = $p->get_display_value(); } }
public static function get_interested_parties($entity, $entityID = false, $ops = array(), $dont_select = false) { $rtn = array(); if ($entityID) { $db = new db_alloc(); $q = prepare("SELECT *\n FROM interestedParty\n WHERE entity='%s'\n AND entityID = %d\n ", $entity, $entityID); $db->query($q); while ($db->row()) { $ops[$db->f("emailAddress")]["name"] = $db->f("fullName"); $ops[$db->f("emailAddress")]["role"] = "interested"; $ops[$db->f("emailAddress")]["selected"] = $db->f("interestedPartyActive") && !$dont_select ? true : false; $ops[$db->f("emailAddress")]["personID"] = $db->f("personID"); $ops[$db->f("emailAddress")]["clientContactID"] = $db->f("clientContactID"); $ops[$db->f("emailAddress")]["external"] = $db->f("external"); } } if (is_array($ops)) { foreach ($ops as $email => $info) { // if there is an @ symbol in email address if (stristr($email, "@")) { $info["email"] = $email; $info["identifier"] = interestedParty::get_encoded_interested_party_identifier($info); $rtn[$email] = $info; } } uasort($rtn, array("interestedParty", "sort_interested_parties")); } return $rtn; }
$TPL["clientDetails"] .= "</tr>"; $TPL["clientDetails"] .= "<tr>"; $one and $TPL["clientDetails"] .= "<td class=\"nobr\"><u>Postal Address</u></td>"; $two and $TPL["clientDetails"] .= "<td class=\"nobr\"><u>Street Address</u></td>"; $thr and $TPL["clientDetails"] .= "<td><u>Contact</u></td>"; $TPL["clientDetails"] .= "</tr>"; $TPL["clientDetails"] .= "<tr>"; $one and $TPL["clientDetails"] .= "<td valign=\"top\">" . $one . "</td>"; $two and $TPL["clientDetails"] .= "<td valign=\"top\">" . $two . "</td>"; $thr and $TPL["clientDetails"] .= "<td valign=\"top\">" . $thr . "</td>"; $TPL["clientDetails"] .= "</tr>"; $TPL["clientDetails"] .= "</table>"; } $db->query(prepare("SELECT fullName, emailAddress, clientContactPhone, clientContactMobile, interestedPartyActive\n FROM interestedParty\n LEFT JOIN clientContact ON interestedParty.clientContactID = clientContact.clientContactID\n WHERE entity='project' \n AND entityID = %d\n AND interestedPartyActive = 1\n ORDER BY fullName", $project->get_id())); while ($db->next_record()) { $value = interestedParty::get_encoded_interested_party_identifier($db->f("fullName"), $db->f("emailAddress")); $phone = array("p" => $db->f('clientContactPhone'), "m" => $db->f('clientContactMobile')); $TPL["interestedParties"][] = array('key' => $value, 'name' => $db->f("fullName"), 'email' => $db->f("emailAddress"), 'phone' => $phone); } $TPL["interestedPartyOptions"] = $project->get_cc_list_select(); $TPL["clientContactDropdown"] = "<input type=\"hidden\" name=\"clientContactID\" value=\"" . $project->get_value("clientContactID") . "\">"; $TPL["clientHidden"] = "<input type=\"hidden\" id=\"clientID\" name=\"clientID\" value=\"" . $clientID . "\">"; $TPL["clientHidden"] .= "<input type=\"hidden\" id=\"clientContactID\" name=\"clientContactID\" value=\"" . $project->get_value("clientContactID") . "\">"; // Gets $ per hour, even if user uses metric like $200 Daily function get_projectPerson_hourly_rate($personID, $projectID) { $db = new db_alloc(); $q = prepare("SELECT rate,rateUnitID FROM projectPerson WHERE personID = %d AND projectID = %d", $personID, $projectID); $db->query($q); $db->next_record(); $rate = $db->f("rate");