本文整理汇总了PHP中project::get_value方法的典型用法代码示例。如果您正苦于以下问题:PHP project::get_value方法的具体用法?PHP project::get_value怎么用?PHP project::get_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类project
的用法示例。
在下文中一共展示了project::get_value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: project
function get_rate($projectID, $personID)
{
// Try to get the person's rate from the following sources:
// project.defaultTimeSheetRate
// person.defaultTimeSheetRate
// config.name == defaultTimeSheetRate
// First check the project for a rate
$project = new project($projectID);
$row = array('rate' => $project->get_value("defaultTimeSheetRate"), 'unit' => $project->get_value("defaultTimeSheetRateUnitID"));
if (imp($row['rate']) && $row['unit']) {
return $row;
}
// Next check person, which is in global currency rather than project currency - conversion required
$db = new db_alloc();
$q = prepare("SELECT defaultTimeSheetRate as rate, defaultTimeSheetRateUnitID as unit FROM person WHERE personID = %d", $personID);
$db->query($q);
$row = $db->row();
if (imp($row['rate']) && $row['unit']) {
if ($project->get_value("currencyTypeID") != config::get_config_item("currency")) {
$row['rate'] = exchangeRate::convert(config::get_config_item("currency"), $row["rate"], $project->get_value("currencyTypeID"));
}
return $row;
}
// Lowest priority: global
$rate = config::get_config_item("defaultTimeSheetRate");
$unit = config::get_config_item("defaultTimeSheetUnit");
if (imp($rate) && $unit) {
if (config::get_config_item("currency") && $project->get_value("currencyTypeID")) {
$rate = exchangeRate::convert(config::get_config_item("currency"), $rate, $project->get_value("currencyTypeID"));
}
return array('rate' => $rate, 'unit' => $unit);
}
}
示例2: show_timeSheetItems
function show_timeSheetItems($template_name)
{
global $date_to_view;
$current_user =& singleton("current_user");
global $TPL;
$query = prepare("SELECT * \n FROM timeSheetItem \n LEFT JOIN timeSheet ON timeSheetItem.timeSheetID = timeSheet.timeSheetID\n LEFT JOIN project ON timeSheet.projectID = project.projectID\n WHERE dateTimeSheetItem='%s'\n AND timeSheet.personID=%d", date("Y-m-d", $date_to_view), $current_user->get_id());
$db = new db_alloc();
$db->query($query);
while ($db->next_record()) {
$timeSheetItem = new timeSheetItem();
$timeSheetItem->read_db_record($db);
$timeSheetItem->set_values();
if ($timeSheetItem->get_value("unit") == "Hour") {
$TPL["daily_hours_total"] += $timeSheetItem->get_value("timeSheetItemDuration");
}
$project = new project();
$project->read_db_record($db);
$project->set_values();
if ($project->get_value("projectShortName")) {
$TPL["item_description"] = $project->get_value("projectShortName");
} else {
$TPL["item_description"] = $project->get_value("projectName");
}
include_template($template_name);
}
}
示例3: date
function project_stats()
{
// date from which a project is counted as being new. if monday then date back to friday, else the previous day
$days = date("w") == 1 ? 3 : 1;
$date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $days, date("Y")));
$query = "SELECT * FROM project";
$db = new db_alloc();
$db_sub = new db_alloc();
$db->query($query);
while ($db->next_record()) {
$project = new project();
$project->read_db_record($db);
$this->projects["total"]["total"]++;
switch ($project->get_value("projectStatus")) {
case "current":
case "overdue":
$this->projects["current"]["total"]++;
break;
case "archived":
$this->projects["archived"]["total"]++;
break;
}
$query = prepare("SELECT * FROM projectPerson WHERE projectID=%d", $project->get_id());
$db_sub->query($query);
while ($db_sub->next_record()) {
$projectPerson = new projectPerson();
$projectPerson->read_db_record($db_sub);
$this->projects["total"][$projectPerson->get_value("personID")]++;
switch ($project->get_value("projectStatus")) {
case "current":
case "overdue":
$this->projects["current"][$projectPerson->get_value("personID")]++;
break;
case "archived":
$this->projects["archived"][$projectPerson->get_value("personID")]++;
break;
}
if ($project->get_value("dateActualStart") != "") {
if (!isset($this->projects["all"][$projectPerson->get_value("personID")])) {
$this->projects["all"][$projectPerson->get_value("personID")] = array();
}
$this->projects["all"][$projectPerson->get_value("personID")][$project->get_value("dateActualStart")]++;
$this->projects["all"][$projectPerson->get_value("personID")]["total"]++;
$this->projects["all"]["total"][$project->get_value("dateActualStart")]++;
if (strcmp($date, $project->get_value("dateActualStart")) <= 0) {
if (!isset($this->projects["new"][$projectPerson->get_value("personID")])) {
$this->projects["new"][$projectPerson->get_value("personID")] = array();
}
$this->projects["new"][$projectPerson->get_value("personID")][$project->get_value("dateActualStart")]++;
$this->projects["new"][$projectPerson->get_value("personID")]["total"]++;
$this->projects["new"]["total"][$project->get_value("dateActualStart")]++;
}
}
}
}
return $this->projects;
}
示例4: show_all_exp
function show_all_exp($template)
{
global $TPL;
global $expenseForm;
global $db;
global $transaction_to_edit;
if ($expenseForm->get_id()) {
if ($_POST["transactionID"] && ($_POST["edit"] || is_object($transaction_to_edit) && $transaction_to_edit->get_id())) {
// if edit is clicked OR if we've rejected changes made to something so are still editing it
$query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d AND transactionID<>%d ORDER BY transactionID DESC", $expenseForm->get_id(), $_POST["transactionID"]);
} else {
$query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d ORDER BY transactionID DESC", $expenseForm->get_id());
}
$db->query($query);
while ($db->next_record()) {
$transaction = new transaction();
$transaction->read_db_record($db);
$transaction->set_values();
$transaction->get_value("quantity") and $TPL["amount"] = $transaction->get_value("amount") / $transaction->get_value("quantity");
$TPL["lineTotal"] = $TPL["amount"] * $transaction->get_value("quantity");
$tf = new tf();
$tf->set_id($transaction->get_value("fromTfID"));
$tf->select();
$TPL["fromTfIDLink"] = $tf->get_link();
$tf = new tf();
$tf->set_id($transaction->get_value("tfID"));
$tf->select();
$TPL["tfIDLink"] = $tf->get_link();
$projectID = $transaction->get_value("projectID");
if ($projectID) {
$project = new project();
$project->set_id($transaction->get_value("projectID"));
$project->select();
$TPL["projectName"] = $project->get_value("projectName");
}
if ($transaction->get_value("fromTfID") == config::get_config_item("expenseFormTfID")) {
$TPL['expense_class'] = "loud";
} else {
$TPL['expense_class'] = "";
}
include_template($template);
}
}
}
示例5: show_projects
function show_projects($template_name)
{
global $TPL;
global $default;
$_FORM = task::load_form_data($defaults);
$arr = task::load_task_filter($_FORM);
is_array($arr) and $TPL = array_merge($TPL, $arr);
if (is_array($_FORM["projectID"])) {
$projectIDs = $_FORM["projectID"];
foreach ($projectIDs as $projectID) {
$project = new project();
$project->set_id($projectID);
$project->select();
$_FORM["projectID"] = array($projectID);
$TPL["graphTitle"] = urlencode($project->get_value("projectName"));
$arr = task::load_task_filter($_FORM);
is_array($arr) and $TPL = array_merge($TPL, $arr);
include_template($template_name);
}
}
}
示例6: project
function translate_meta_tfID($tfID = "")
{
// The special -1 and -2 tfID's represent META TF, i.e. calculated at runtime
// -1 == META: Project TF
if ($tfID == -1) {
if ($this->get_value("projectID")) {
$project = new project();
$project->set_id($this->get_value("projectID"));
$project->select();
$tfID = $project->get_value("cost_centre_tfID");
}
if (!$tfID) {
alloc_error("Unable to use META: Project TF. Please ensure the project has a TF set, or adjust the transactions.");
}
// -2 == META: Salesperson TF
} else {
if ($tfID == -2) {
if ($this->get_value("personID")) {
$person = new person();
$person->set_id($this->get_value("personID"));
$person->select();
$tfID = $person->get_value("preferred_tfID");
if (!$tfID) {
alloc_error("Unable to use META: Salesperson TF. Please ensure the Saleperson has a Preferred Payment TF.");
}
} else {
alloc_error("Unable to use META: Salesperson TF. No product salesperson set.");
}
} else {
if ($tfID == -3) {
$tfID = $this->get_value("tfID");
$tfID or alloc_error("Unable to use META: Sale TF not set.");
}
}
}
return $tfID;
}
示例7: export_gnome_planner
function export_gnome_planner($projectID)
{
$project = new project();
$project->set_id($projectID);
$project->select();
// Note: DOM_Document is a wrapper that wraps DOMDocument for PHP5 and DomDocument for PHP4
$doc = get_xml_document();
$doc->load(ALLOC_MOD_DIR . "shared" . DIRECTORY_SEPARATOR . "export_templates" . DIRECTORY_SEPARATOR . "template.planner");
// General metadata
$rootNode = $doc->getElementsByTagName("project");
$rootNode = $rootNode->item(0);
$rootNode->setAttribute("company", config::get_config_item("companyName"));
// Get the project manager
$projectManager = $project->get_project_manager();
$rootNode->setAttribute("manager", person::get_fullname($projectManager[0]));
$rootNode->setAttribute("name", $project->get_value("projectName"));
if ($project->get_value("dateActualStart")) {
$projectStartDate = export_planner_date(planner_date_timestamp($project->get_value("dateActualStart")));
} else {
$projectStartDate = export_planner_date(planner_date_timestamp($project->get_value("dateTargetStart")));
}
$rootNode->setAttribute("project-start", $projectStartDate);
$resourcesUsed = array();
// Export all tasks in the project
$taskOptions["projectIDs"] = array($project->get_id());
$taskOptions["return"] = "array";
$taskOptions["taskView"] = "byProject";
$tasks = task::get_list($taskOptions);
// We need to sort by taskID (we assume taskIDs were assigned linearly on import) otherwise Planner will get very confused with ordering
foreach ($tasks as $task) {
$taskIDs[] = $task['taskID'];
}
array_multisort($taskIDs, $tasks);
$taskRootNode = $doc->getElementsByTagName("tasks");
$taskRootNode = $taskRootNode->item(0);
foreach ($tasks as $task) {
$taskNode = $doc->createElement("task");
// Use the alloc internal ID rather than pointlessly renumbering things
$taskNode->setAttribute("id", $task["taskID"]);
$taskNode->setAttribute("name", $task["taskName"]);
$taskNode->setAttribute("note", $task["taskDescription"]);
// Ugly date handling
if (!$task["dateActualStart"]) {
if (!$task["dateTargetStart"]) {
// This is a reasonably bad situation
$taskStartDate = time();
} else {
$taskStartDate = planner_date_timestamp($task["dateTargetStart"]);
}
} else {
$taskStartDate = planner_date_timestamp($task["dateActualStart"]);
}
if (!$task["dateActualCompletion"]) {
if (!$task["dateTargetCompletion"]) {
//The task has to last for some amount of time, so end = start (otherwise we get end = 1970)
$taskEndDate = $taskStartDate;
} else {
$taskEndDate = planner_date_timestamp($task["dateTargetCompletion"]);
}
} else {
$taskEndDate = planner_date_timestamp($task["dateActualCompletion"]);
}
// Take a stab at the duration we need to give this task
$taskDuration = $taskEndDate - $taskStartDate;
// That's the total number of seconds, Planner expects the number of 8-hour days worth of seconds
$taskDuration = $taskDuration / 86400 * 28800;
// note: the above doesn't account for weekends so there is a discrepancy between task durations in alloc and those in Planner, the solution is to make people work on the weekends
$taskNode->setAttribute("work", $taskDuration);
$taskNode->setAttribute("start", export_planner_date($taskStartDate));
$taskNode->setAttribute("work-start", export_planner_date($taskStartDate));
$taskNode->setAttribute("end", export_planner_date($taskEndDate));
$taskNode->setAttribute("scheduling", "fixed-work");
$constraintNode = $doc->createElement("constraint");
$constraintNode->setAttribute("type", "start-no-earlier-than");
$constraintNode->setAttribute("time", export_planner_date($taskStartDate));
$taskNode->appendChild($constraintNode);
if ($task["taskTypeID"] == "Milestone") {
$taskNode->setAttribute("type", "milestone");
}
$resourcesUsed[$task["taskID"]] = $task['personID'];
$taskRootNode->appendChild($taskNode);
}
// Now do the resources and their linkage to tasks
$resourcesRootNode = $doc->getElementsByTagName("resources");
$resourcesRootNode = $resourcesRootNode->item(0);
$allocationsRootNode = $doc->getElementsByTagName("allocations");
$allocationsRootNode = $allocationsRootNode->item(0);
$resources = array();
//Store the users that need to be added to <resources>
foreach ($resourcesUsed as $taskID => $resourceID) {
if (isset($resources[$resourceID])) {
$person = $resources[$resourceID];
} else {
$person = new person();
$person->set_id($resourceID);
$person->select();
$resources[$resourceID] = $person;
// Add this person to <resources>
$resourceNode = $doc->createElement("resource");
$resourceNode->setAttribute("id", $person->get_id());
//.........这里部分代码省略.........
示例8: project
if (!$row['personID']) {
$name = "Unassigned";
} else {
$name = $people[$row['personID']]['username'];
}
if ($row['field'] != "taskStatus" || array_search($row['taskStatus'], $status_types) !== FALSE) {
$taskName = escape_xml($row['taskName']);
$project = null;
if ($show_project) {
$project = new project();
$project->set_id($row['projectID']);
$project->select();
}
if ($summary) {
if ($show_project) {
$projectName = $project->get_value('projectShortName');
}
$el['desc'] = sprintf('%s: %d %s "%s" %s', $name, $row['taskID'], $projectName, $taskName, $row['taskStatus']);
} else {
if ($show_project) {
$projectName = "(" . $project->get_value("projectName") . ")";
}
if ($row['field'] == "taskStatus") {
$el['desc'] = sprintf('Task #%d "%s" %s status changed to %s', $row['taskID'], $taskName, $projectName, $row['taskStatus']);
} else {
if ($row['field'] == "personID") {
$el['desc'] = sprintf('Task #%d "%s" %s assigned to %s', $row['taskID'], $taskName, $projectName, $name);
} else {
$el['desc'] = "error!";
}
}
示例9: client
$client = new client();
$client->read_db_record($db);
$parent_names[$client->get_id()] = $client->get_value('clientName');
}
} else {
if ($parentType == "project") {
if ($current_user->have_role("admin")) {
$query = "SELECT * FROM project WHERE projectStatus != 'Archived' ORDER BY projectName";
} else {
$query = prepare("SELECT * \n FROM project \n LEFT JOIN projectPerson ON project.projectID=projectPerson.projectID \n WHERE personID='%d' \n AND projectStatus != 'Archived'\n ORDER BY projectName", $personID);
}
$db->query($query);
while ($db->next_record()) {
$project = new project();
$project->read_db_record($db);
$parent_names[$project->get_id()] = $project->get_value('projectName');
}
} else {
if ($parentType == "task") {
if ($current_user->have_role("admin")) {
$query = "SELECT * FROM task";
} else {
$query = prepare("SELECT * FROM task WHERE personID=%d ORDER BY taskName", $personID);
}
$db->query($query);
while ($db->next_record()) {
$task = new task();
$task->read_db_record($db);
if (substr($task->get_value("taskStatus"), 0, 6) != "closed") {
$parent_names[$task->get_id()] = $task->get_value('taskName');
}
示例10: count
$project->set_id($projectID);
$project->select();
$projectManagers = $project->get_timeSheetRecipients();
if (!$projectManagers) {
$TPL["managers"] = "N/A";
$TPL["timeSheet_dateSubmittedToManager"] = "N/A";
$TPL["timeSheet_approvedByManagerPersonID_username"] = "N/A";
} else {
count($projectManagers) > 1 and $TPL["manager_plural"] = "s";
$people =& get_cached_table("person");
foreach ($projectManagers as $pID) {
$TPL["managers"] .= $commar . $people[$pID]["name"];
$commar = ", ";
}
}
$clientID = $project->get_value("clientID");
$projectID = $project->get_id();
// Get client name
$client = $project->get_foreign_object("client");
$TPL["clientName"] = $client_link;
$TPL["clientID"] = $clientID = $client->get_id();
$TPL["show_client_options"] = $client_link;
}
list($client_select, $client_link, $project_select, $project_link) = client::get_client_and_project_dropdowns_and_links($clientID, $projectID, true);
$TPL["invoice_link"] = $timeSheet->get_invoice_link();
list($amount_used, $amount_allocated) = $timeSheet->get_amount_allocated();
if ($amount_allocated) {
$TPL["amount_allocated_label"] = "Amount Used / Allocated:";
$TPL["amount_allocated"] = $amount_allocated;
$TPL["amount_used"] = $amount_used . " / ";
}
示例11: project
$p->set_id($_POST["copy_projectID"]);
if ($p->select()) {
$p2 = new project();
$p2->read_row_record($p->row());
$p2->set_id("");
$p2->set_value("projectName", $_POST["copy_project_name"]);
$p2->set_value("projectShortName", "");
$p2->save();
$TPL["message_good"][] = "Project details copied successfully.";
// Copy project people
$q = prepare("SELECT * FROM projectPerson WHERE projectID = %d", $p->get_id());
$db = new db_alloc();
$db->query($q);
while ($row = $db->row()) {
$projectPerson = new projectPerson();
$projectPerson->currency = $p->get_value("currencyTypeID");
$projectPerson->read_row_record($row);
$projectPerson->set_id("");
$projectPerson->set_value("projectID", $p2->get_id());
$projectPerson->save();
$TPL["message_good"]["projectPeople"] = "Project people copied successfully.";
}
// Copy commissions
$q = prepare("SELECT * FROM projectCommissionPerson WHERE projectID = %d", $p->get_id());
$db = new db_alloc();
$db->query($q);
while ($row = $db->row()) {
$projectCommissionPerson = new projectCommissionPerson();
$projectCommissionPerson->read_row_record($row);
$projectCommissionPerson->set_id("");
$projectCommissionPerson->set_value("projectID", $p2->get_id());
示例12: singleton
function add_timeSheetItem($stuff)
{
$current_user =& singleton("current_user");
$errstr = "Failed to record new time sheet item. ";
$taskID = $stuff["taskID"];
$projectID = $stuff["projectID"];
$duration = $stuff["duration"];
$comment = $stuff["comment"];
$emailUID = $stuff["msg_uid"];
$emailMessageID = $stuff["msg_id"];
$date = $stuff["date"];
$unit = $stuff["unit"];
$multiplier = $stuff["multiplier"];
if ($taskID) {
$task = new task();
$task->set_id($taskID);
$task->select();
$projectID = $task->get_value("projectID");
$extra = " for task " . $taskID;
}
$projectID or alloc_error(sprintf($errstr . "No project found%s.", $extra));
$row_projectPerson = projectPerson::get_projectPerson_row($projectID, $current_user->get_id());
$row_projectPerson or alloc_error($errstr . "The person(" . $current_user->get_id() . ") has not been added to the project(" . $projectID . ").");
if ($row_projectPerson && $projectID) {
if ($stuff["timeSheetID"]) {
$q = prepare("SELECT *\n FROM timeSheet\n WHERE status = 'edit'\n AND personID = %d\n AND timeSheetID = %d\n ORDER BY dateFrom\n LIMIT 1\n ", $current_user->get_id(), $stuff["timeSheetID"]);
$db = new db_alloc();
$db->query($q);
$row = $db->row();
$row or alloc_error("Couldn't find an editable time sheet with that ID.");
} else {
$q = prepare("SELECT *\n FROM timeSheet\n WHERE status = 'edit'\n AND projectID = %d\n AND personID = %d\n ORDER BY dateFrom\n LIMIT 1\n ", $projectID, $current_user->get_id());
$db = new db_alloc();
$db->query($q);
$row = $db->row();
}
// If no timeSheets add a new one
if (!$row) {
$project = new project();
$project->set_id($projectID);
$project->select();
$timeSheet = new timeSheet();
$timeSheet->set_value("projectID", $projectID);
$timeSheet->set_value("status", "edit");
$timeSheet->set_value("personID", $current_user->get_id());
$timeSheet->set_value("recipient_tfID", $current_user->get_value("preferred_tfID"));
$timeSheet->set_value("customerBilledDollars", page::money($project->get_value("currencyTypeID"), $project->get_value("customerBilledDollars"), "%mo"));
$timeSheet->set_value("currencyTypeID", $project->get_value("currencyTypeID"));
$timeSheet->save();
$timeSheetID = $timeSheet->get_id();
// Else use the first timesheet we found
} else {
$timeSheetID = $row["timeSheetID"];
}
$timeSheetID or alloc_error($errstr . "Couldn't locate an existing, or create a new Time Sheet.");
// Add new time sheet item
if ($timeSheetID) {
$timeSheet = new timeSheet();
$timeSheet->set_id($timeSheetID);
$timeSheet->select();
$tsi = new timeSheetItem();
$tsi->currency = $timeSheet->get_value("currencyTypeID");
$tsi->set_value("timeSheetID", $timeSheetID);
$d = $date or $d = date("Y-m-d");
$tsi->set_value("dateTimeSheetItem", $d);
$tsi->set_value("timeSheetItemDuration", $duration);
$tsi->set_value("timeSheetItemDurationUnitID", $unit);
if (is_object($task)) {
$tsi->set_value("description", $task->get_name());
$tsi->set_value("taskID", sprintf("%d", $taskID));
$_POST["timeSheetItem_taskID"] = sprintf("%d", $taskID);
// this gets used in timeSheetItem->save();
}
$tsi->set_value("personID", $current_user->get_id());
$tsi->set_value("rate", page::money($timeSheet->get_value("currencyTypeID"), $row_projectPerson["rate"], "%mo"));
$tsi->set_value("multiplier", $multiplier);
$tsi->set_value("comment", $comment);
$tsi->set_value("emailUID", $emailUID);
$tsi->set_value("emailMessageID", $emailMessageID);
$tsi->save();
$id = $tsi->get_id();
$tsi = new timeSheetItem();
$tsi->set_id($id);
$tsi->select();
$ID = $tsi->get_value("timeSheetID");
}
}
if ($ID) {
return array("status" => "yay", "message" => $ID);
} else {
alloc_error($errstr . "Time not added.");
}
}
示例13: project
function get_client_and_project_dropdowns_and_links($clientID = false, $projectID = false, $onlymine = false)
{
// This function returns dropdown lists and links for both client and
// project. The two dropdown lists are linked, in that if you change the
// client, then the project dropdown dynamically updates
global $TPL;
$project = new project();
$project->set_id($projectID);
$project->select();
if (!$clientID) {
$clientID = $project->get_value("clientID");
}
$client = new client();
$client->set_id($clientID);
$client->select();
$options["clientStatus"] = "Current";
$ops = client::get_list($options);
$ops = array_kv($ops, "clientID", "clientName");
$client->get_id() and $ops[$client->get_id()] = $client->get_value("clientName");
$client_select = "<select id=\"clientID\" name=\"clientID\" onChange=\"makeAjaxRequest('" . $TPL["url_alloc_updateProjectListByClient"] . "clientID='+\$('#clientID').attr('value')+'&onlymine=" . sprintf("%d", $onlymine) . "','projectDropdown')\"><option></option>";
$client_select .= page::select_options($ops, $clientID, 100) . "</select>";
$client_link = $client->get_link();
$project_select = '<div id="projectDropdown" style="display:inline">' . $project->get_dropdown_by_client($clientID, $onlymine) . '</div>';
$project_link = $project->get_link();
return array($client_select, $client_link, $project_select, $project_link);
}
示例14: singleton
function populate_string($str, $entity, $entityID = false)
{
// Actually do the text substitution
$current_user =& singleton("current_user");
is_object($current_user) and $swap["cu"] = person::get_fullname($current_user->get_id());
if ($entity == "timeSheet" && $entityID) {
$timeSheet = new timeSheet();
$timeSheet->set_id($entityID);
$timeSheet->select();
$timeSheet->load_pay_info();
foreach ($timeSheet->pay_info as $k => $v) {
$swap[$k] = $v;
}
if ($timeSheet->get_value("approvedByManagerPersonID")) {
$swap["tm"] = person::get_fullname($timeSheet->get_value("approvedByManagerPersonID"));
} else {
$project = $timeSheet->get_foreign_object("project");
$projectManagers = $project->get_timeSheetRecipients();
if (is_array($projectManagers) && count($projectManagers)) {
$people =& get_cached_table("person");
foreach ($projectManagers as $pID) {
$swap["tm"] .= $commar . $people[$pID]["name"];
$commar = ", ";
}
}
}
if ($timeSheet->get_value("approvedByAdminPersonID")) {
$swap["tc"] = person::get_fullname($timeSheet->get_value("approvedByAdminPersonID"));
} else {
$people =& get_cached_table("person");
$timeSheetAdministrators = config::get_config_item('defaultTimeSheetAdminList');
if (count($timeSheetAdministrators)) {
$swap["tc"] = "";
$comma = "";
foreach ($timeSheetAdministrators as $adminID) {
$swap["tc"] .= $comma . $people[$adminID]["name"];
$comma = ", ";
}
} else {
$swap["tc"] = 'no-one';
}
}
$swap["ti"] = $timeSheet->get_id();
$swap["to"] = person::get_fullname($timeSheet->get_value("personID"));
$swap["ta"] = person::get_fullname($timeSheet->get_value("personID"));
$swap["tf"] = $timeSheet->get_value("dateFrom");
$swap["tt"] = $timeSheet->get_value("dateTo");
$swap["ts"] = $timeSheet->get_timeSheet_status();
$swap["tu"] = config::get_config_item("allocURL") . "time/timeSheet.php?timeSheetID=" . $timeSheet->get_id();
$projectID = $timeSheet->get_value("projectID");
}
if ($entity == "task" && $entityID) {
$task = new task();
$task->set_id($entityID);
$task->select();
$swap["ti"] = $task->get_id();
$swap["to"] = person::get_fullname($task->get_value("creatorID"));
$swap["ta"] = person::get_fullname($task->get_value("personID"));
$swap["tm"] = person::get_fullname($task->get_value("managerID"));
$swap["tc"] = person::get_fullname($task->get_value("closerID"));
$swap["tn"] = $task->get_value("taskName");
$swap["td"] = $task->get_value("taskDescription");
$swap["tu"] = config::get_config_item("allocURL") . "task/task.php?taskID=" . $task->get_id();
$swap["tp"] = $task->get_priority_label();
$swap["ts"] = $task->get_task_status("label");
$swap["teb"] = $task->get_value("timeBest");
$swap["tem"] = $task->get_value("timeExpected");
$swap["tew"] = $task->get_value("timeWorst");
$swap["tep"] = person::get_fullname($task->get_value("estimatorID"));
//time estimate person, when it's implemented
$projectID = $task->get_value("projectID");
}
if ($entity == "project" && $entityID || $projectID) {
$project = new project();
if ($projectID) {
$project->set_id($projectID);
} else {
$project->set_id($entityID);
}
$project->select();
$swap["pn"] = $project->get_value("projectName");
$swap["pi"] = $project->get_id();
$clientID = $project->get_value("clientID");
}
if ($entity == "client" && $entityID || $clientID) {
$client = new client();
if ($clientID) {
$client->set_id($clientID);
} else {
$client->set_id($entityID);
}
$client->select();
$swap["li"] = $client->get_id();
$swap["cc"] = $client->get_value("clientName");
}
$swap["cd"] = config::get_config_item("companyContactAddress");
$swap["cd"] .= " " . config::get_config_item("companyContactAddress2");
$swap["cd"] .= " " . config::get_config_item("companyContactAddress3");
$swap["cd"] .= "\nP: " . config::get_config_item("companyContactPhone");
$swap["cd"] .= "\nF: " . config::get_config_item("companyContactFax");
//.........这里部分代码省略.........
示例15: project
function is_alive()
{
$type = $this->get_value('reminderType');
if ($type == "project") {
$project = new project();
$project->set_id($this->get_value('reminderLinkID'));
if ($project->select() == false || $project->get_value('projectStatus') == "Archived") {
return false;
}
} else {
if ($type == "task") {
$task = new task();
$task->set_id($this->get_value('reminderLinkID'));
if ($task->select() == false || substr($task->get_value("taskStatus"), 0, 6) == 'closed') {
return false;
}
} else {
if ($type == "client") {
$client = new client();
$client->set_id($this->get_value('reminderLinkID'));
if ($client->select() == false || $client->get_value('clientStatus') == "Archived") {
return false;
}
}
}
}
return true;
}