function load_filter($defaults) { $current_user =& singleton("current_user"); // display the list of project name. $db = new db_alloc(); $page_vars = array_keys(timeSheetGraph::get_list_vars()); $_FORM = get_all_form_data($page_vars, $defaults); if ($_FORM["applyFilter"] && is_object($current_user)) { // we have a new filter configuration from the user, and must save it if (!$_FORM["dontSave"]) { $url = $_FORM["url_form_action"]; unset($_FORM["url_form_action"]); $current_user->prefs[$_FORM["form_name"]] = $_FORM; $_FORM["url_form_action"] = $url; } } else { // we haven't been given a filter configuration, so load it from user preferences $_FORM = $current_user->prefs[$_FORM["form_name"]]; } $rtn["personOptions"] = page::select_options(person::get_username_list($_FORM["personID"]), $_FORM["personID"]); $rtn["dateFrom"] = $_FORM["dateFrom"]; $rtn["dateTo"] = $_FORM["dateTo"]; $rtn["personID"] = $_FORM["personID"]; $rtn["groupBy"] = $_FORM["groupBy"]; // GET $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
function load_task_filter($_FORM) { $current_user =& singleton("current_user"); $db = new db_alloc(); // Load up the forms action url $rtn["url_form_action"] = $_FORM["url_form_action"]; $rtn["hide_field_options"] = $_FORM["hide_field_options"]; //time Load up the filter bits has("project") and $rtn["projectOptions"] = project::get_list_dropdown($_FORM["projectType"], $_FORM["projectID"]); $_FORM["projectType"] and $rtn["projectType_checked"][$_FORM["projectType"]] = " checked"; $ops = array("0" => "Nobody"); $rtn["personOptions"] = page::select_options($ops + person::get_username_list($_FORM["personID"]), $_FORM["personID"]); $rtn["managerPersonOptions"] = page::select_options($ops + person::get_username_list($_FORM["managerID"]), $_FORM["managerID"]); $rtn["creatorPersonOptions"] = page::select_options(person::get_username_list($_FORM["creatorID"]), $_FORM["creatorID"]); $rtn["all_tags"] = task::get_tags(true); $rtn["tags"] = $_FORM["tags"]; $taskType = new meta("taskType"); $taskType_array = $taskType->get_assoc_array("taskTypeID", "taskTypeID"); $rtn["taskTypeOptions"] = page::select_options($taskType_array, $_FORM["taskTypeID"]); $_FORM["taskView"] and $rtn["taskView_checked_" . $_FORM["taskView"]] = " checked"; $taskStatii = task::get_task_statii_array(); $rtn["taskStatusOptions"] = page::select_options($taskStatii, $_FORM["taskStatus"]); $_FORM["showDescription"] and $rtn["showDescription_checked"] = " checked"; $_FORM["showDates"] and $rtn["showDates_checked"] = " checked"; $_FORM["showCreator"] and $rtn["showCreator_checked"] = " checked"; $_FORM["showAssigned"] and $rtn["showAssigned_checked"] = " checked"; $_FORM["showTimes"] and $rtn["showTimes_checked"] = " checked"; $_FORM["showPercent"] and $rtn["showPercent_checked"] = " checked"; $_FORM["showPriority"] and $rtn["showPriority_checked"] = " checked"; $_FORM["showTaskID"] and $rtn["showTaskID_checked"] = " checked"; $_FORM["showManager"] and $rtn["showManager_checked"] = " checked"; $_FORM["showProject"] and $rtn["showProject_checked"] = " checked"; $_FORM["showTags"] and $rtn["showTags_checked"] = " checked"; $_FORM["showParentID"] and $rtn["showParentID_checked"] = " checked"; $arrow = " -->"; $taskDateOps = array("" => "", "new" => "New Tasks", "due_today" => "Due Today", "overdue" => "Overdue", "d_created" => "Date Created" . $arrow, "d_assigned" => "Date Assigned" . $arrow, "d_targetStart" => "Estimated Start" . $arrow, "d_targetCompletion" => "Estimated Completion" . $arrow, "d_actualStart" => "Date Started" . $arrow, "d_actualCompletion" => "Date Completed" . $arrow); $rtn["taskDateOptions"] = page::select_options($taskDateOps, $_FORM["taskDate"], 45, false); if (!in_array($_FORM["taskDate"], array("new", "due_today", "overdue"))) { $rtn["dateOne"] = $_FORM["dateOne"]; $rtn["dateTwo"] = $_FORM["dateTwo"]; } $task_num_ops = array("" => "All results", 1 => "1 result", 2 => "2 results", 3 => "3 results", 4 => "4 results", 5 => "5 results", 10 => "10 results", 15 => "15 results", 20 => "20 results", 30 => "30 results", 40 => "40 results", 50 => "50 results", 100 => "100 results", 150 => "150 results", 200 => "200 results", 300 => "300 results", 400 => "400 results", 500 => "500 results", 1000 => "1000 results", 2000 => "2000 results", 3000 => "3000 results", 4000 => "4000 results", 5000 => "5000 results", 10000 => "10000 results"); $rtn["limitOptions"] = page::select_options($task_num_ops, $_FORM["limit"]); // unset vars that aren't necessary foreach ((array) $_FORM as $k => $v) { if (!$v) { unset($_FORM[$k]); } } // Get $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
function load_productSale_filter($_FORM) { $current_user =& singleton("current_user"); // display the list of project name. $db = new db_alloc(); if (!$_FORM['showAllProjects']) { $filter = "WHERE projectStatus = 'Current' "; } $query = prepare("SELECT projectID AS value, projectName AS label FROM project {$filter} ORDER by projectName"); $rtn["show_project_options"] = page::select_options($query, $_FORM["projectID"], 70); // display the list of user name. if (have_entity_perm("productSale", PERM_READ, $current_user, false)) { $rtn["show_userID_options"] = page::select_options(person::get_username_list(), $_FORM["personID"]); } else { $person = new person(); $person->set_id($current_user->get_id()); $person->select(); $person_array = array($current_user->get_id() => $person->get_name()); $rtn["show_userID_options"] = page::select_options($person_array, $_FORM["personID"]); } // display a list of status $status_array = productSale::get_statii(); unset($status_array["create"]); $rtn["show_status_options"] = page::select_options($status_array, $_FORM["status"]); // display the date from filter value $rtn["showAllProjects"] = $_FORM["showAllProjects"]; $options["clientStatus"] = array("Current"); $options["return"] = "dropdown_options"; $ops = client::get_list($options); $ops = array_kv($ops, "clientID", "clientName"); $rtn["clientOptions"] = page::select_options($ops, $_FORM["clientID"]); // Get $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
function load_timeSheet_filter($_FORM) { $current_user =& singleton("current_user"); // display the list of project name. $db = new db_alloc(); if (!$_FORM['showAllProjects']) { $filter = "WHERE projectStatus = 'Current' "; } $query = prepare("SELECT projectID AS value, projectName AS label FROM project {$filter} ORDER by projectName"); $rtn["show_project_options"] = page::select_options($query, $_FORM["projectID"], 70); // display the list of user name. if (have_entity_perm("timeSheet", PERM_READ, $current_user, false)) { $rtn["show_userID_options"] = page::select_options(person::get_username_list(), $_FORM["personID"]); } else { $person = new person(); $person->set_id($current_user->get_id()); $person->select(); $person_array = array($current_user->get_id() => $person->get_name()); $rtn["show_userID_options"] = page::select_options($person_array, $_FORM["personID"]); } // display a list of status $status_array = timeSheet::get_timeSheet_statii(); unset($status_array["create"]); if (!$_FORM["status"]) { $_FORM["status"][] = 'edit'; } $rtn["show_status_options"] = page::select_options($status_array, $_FORM["status"]); // display the date from filter value $rtn["dateFrom"] = $_FORM["dateFrom"]; $rtn["dateTo"] = $_FORM["dateTo"]; $rtn["userID"] = $current_user->get_id(); $rtn["showFinances"] = $_FORM["showFinances"]; $rtn["showAllProjects"] = $_FORM["showAllProjects"]; // Get $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
function load_project_filter($_FORM) { global $TPL; $current_user =& singleton("current_user"); $personSelect = "<select name=\"personID[]\" multiple=\"true\">"; $personSelect .= page::select_options(person::get_username_list($_FORM["personID"]), $_FORM["personID"]); $personSelect .= "</select>"; $rtn["personSelect"] = $personSelect; $m = new meta("projectStatus"); $projectStatus_array = $m->get_assoc_array("projectStatusID", "projectStatusID"); $rtn["projectStatusOptions"] = page::select_options($projectStatus_array, $_FORM["projectStatus"]); $rtn["projectTypeOptions"] = page::select_options(project::get_project_type_array(), $_FORM["projectType"]); $rtn["projectName"] = $_FORM["projectName"]; // Get $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
function show_person_options() { global $TPL; echo page::select_options(person::get_username_list($TPL["person_personID"]), $TPL["person_personID"]); }
$tf->select(); $TPL["show_tf_options"] = $tf->get_link(); $tf_sel = $productSale->get_value("tfID"); } $tf_sel or $tf_sel = config::get_config_item("mainTfID"); $tf_select = "<select name='tfID'>" . page::select_options($tflist, $tf_sel) . "</select>"; $TPL["show_person_options"] = person::get_fullname($productSale->get_value("personID")); $TPL["show_date"] = $productSale->get_value("productSaleDate"); $TPL["show_extRef"] = $productSale->get_value("extRef"); $TPL["show_extRefDate"] = $productSale->get_value("extRefDate"); if (!$productSale->get_id() || $productSale->get_value("status") != "finished" && !($productSale->get_value("status") == "admin" && !CAN_APPROVE_TRANSACTIONS)) { $TPL["show_client_options"] = $client_select; $TPL["show_project_options"] = $project_select; $TPL["show_tf_options"] = $tf_select; $personID = $productSale->get_value("personID") or $personID = $current_user->get_id(); $TPL["show_person_options"] = "<select name='personID'>" . page::select_options(person::get_username_list($personID), $personID) . "</select>"; $TPL["show_date"] = page::calendar("productSaleDate", $productSale->get_value("productSaleDate")); $TPL["show_extRef"] = "<input type='text' name='extRef' value='" . $productSale->get_value("extRef") . "' size='10'>"; $TPL["show_extRefDate"] = page::calendar("extRefDate", $productSale->get_value("extRefDate")); } $TPL["productSale_status"] = $productSale->get_value("status"); $amounts = $productSale->get_amounts(); $TPL = array_merge($TPL, $amounts); define("DISPLAY_PRODUCT_SALE_ITEM_EDIT", 1); define("DISPLAY_PRODUCT_SALE_ITEM_TRANSACTION_EDIT", 2); define("DISPLAY_PRODUCT_SALE_ITEM_TRANSACTION_VIEW", 3); define("DISPLAY_PRODUCT_SALE_EDIT", 4); // Show line item edit $productSaleID = $productSale->get_id(); $status = $productSale->get_value("status"); if ($productSaleID && $status == "edit") {