$tabops = array("home" => "Home", "client" => "Clients", "project" => "Projects", "task" => "Tasks", "time" => "Time", "invoice" => "Invoices", "sale" => "Sales", "person" => "People", "wiki" => "Wiki", "inbox" => "Inbox", "tools" => "Tools"); $selected_tabops = config::get_config_item("allocTabs") or $selected_tabops = array_keys($tabops); $TPL["allocTabsOptions"] = page::select_options($tabops, $selected_tabops); $m = new meta("currencyType"); $currencyOptions = $m->get_assoc_array("currencyTypeID", "currencyTypeName"); $TPL["currencyOptions"] = page::select_options($currencyOptions, config::get_config_item("currency")); $db = new db_alloc(); $display = array("", "username", ", ", "emailAddress"); $person = new person(); $people =& get_cached_table("person"); foreach ($people as $p) { $peeps[$p["personID"]] = $p["name"]; } // get the default time sheet manager/admin options $TPL["defaultTimeSheetManagerListText"] = get_person_list(config::get_config_item("defaultTimeSheetManagerList")); $TPL["defaultTimeSheetAdminListText"] = get_person_list(config::get_config_item("defaultTimeSheetAdminList")); $days = array("Sun" => "Sun", "Mon" => "Mon", "Tue" => "Tue", "Wed" => "Wed", "Thu" => "Thu", "Fri" => "Fri", "Sat" => "Sat"); $TPL["calendarFirstDayOptions"] = page::select_options($days, config::get_config_item("calendarFirstDay")); $TPL["timeSheetPrintOptions"] = page::select_options($TPL["timeSheetPrintOptions"], $TPL["timeSheetPrint"]); $commentTemplate = new commentTemplate(); $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName"); $TPL["rssStatusFilterOptions"] = page::select_options(task::get_task_statii_array(true), config::get_config_item("rssStatusFilter")); if (has("timeUnit")) { $timeUnit = new timeUnit(); $rate_type_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelB"); } $TPL["timesheetRate_options"] = page::select_options($rate_type_array, config::get_config_item("defaultTimeSheetUnit")); $TPL["main_alloc_title"] = "Setup - " . APPLICATION_NAME; include_template("templates/configM.tpl"); function get_person_list($personID_array) {
try { $sql = "SELECT actor_id, first_name, last_name, last_update\n FROM actor"; $stmt = $conn->prepare($sql); $stmt->execute(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $person_list[] = array('actor_id' => $row['actor_id'], 'first_name' => $row['first_name'], 'last_name' => $row['last_name']); } } catch (PDOException $e) { echo "Error: " . $e->getMessage(); } umakeConn(); return $person_list; } $possible_url = array("get_person_list", "get_person"); $value = "Ops, ocorreu um erro"; if (isset($_GET["action"]) && in_array($_GET["action"], $possible_url)) { switch ($_GET["action"]) { case "get_person_list": $value = get_person_list(); break; case "get_person": if (isset($_GET["id"])) { $value = get_person_by_id($_GET["id"]); } else { $value = "Missing argument | faltou argumentos"; } break; } } //return JSON array exit(json_encode($value));