function show_productCost_new($template, $percent = false) { global $TPL; $t = new meta("currencyType"); $currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID"); $productCost = new productCost(); $productCost->set_values(); // wipe clean $TPL["currencyOptions"] = page::select_options($currency_array, $productCost->get_value("currencyTypeID")); $TPL["taxOptions"] = page::select_options(array("" => "Exempt", 1 => "Included", 0 => "Excluded"), "1"); $TPL["display"] = "display:none"; include_template($template); }
function _get( $setting, $template, $itemId ) { /* ONLYR FOR CATEGORY TEMPLATE */ $rett = ''; $id = $itemId; $temp = $template; switch( $template ){ case 'front-page': case 'single': case 'page': $rett = meta::get( $itemId , 'post-' . $setting ); if( $rett ) break; $rett = myThemes::get( $template . '-' . $setting ); if( $rett ) break; $rett = myThemes::get( $setting ); break; default: { $rett = myThemes::get( $setting ); break; } } return $rett; }
function my_box_post_layout($post) { $layouts = array('right' => get_template_directory_uri() . '/media/admin/images/left.layout.png', 'left' => get_template_directory_uri() . '/media/admin/images/right.layout.png', 'full' => get_template_directory_uri() . '/media/admin/images/full.layout.png'); $sidebars = myThemes::get('sidebars-list'); if (!is_array($sidebars)) { $sidebars = array(); } $values = array('main-sidebar' => __('Main Sidebar', 'myThemes'), 'front-page-sidebar' => __('Front Page Sidebar', 'myThemes'), 'page-sidebar' => __('Page Sidebar', 'myThemes'), 'single-sidebar' => __('Single Sidebar', 'myThemes'), 'additional-sidebar' => __('Additional Sidebar', 'myThemes')); /* LAYOUT */ echo ahtml::template(array('type' => array('template' => 'inline', 'input' => 'logic'), 'label' => __('Use custom layout', 'myThemes'), 'fieldName' => 'use-post-layout', 'action' => "{'t' : '.mythemes-post-layout' , 'f' : '-' }", 'value' => meta::get($post->ID, 'use-post-layout'))); $use_post_layout = meta::get($post->ID, 'use-post-layout'); if (strlen($use_post_layout) == 0 || $use_post_layout === "0") { $classes = 'mythemes-post-layout hidden'; } else { $classes = 'mythemes-post-layout'; } if ($post->post_type == 'post') { $type = 'single'; } else { $type = $post->post_type; } $rett = ahtml::template(array('type' => array('template' => 'inline', 'input' => 'imageSelect'), 'values' => $layouts, 'coll' => 2, 'label' => __('Select Layout', 'myThemes'), 'fieldName' => 'post-layout', 'value' => meta::dget($post->ID, 'post-layout', myThemes::get($type . '-layout')), 'action' => "[ 'hs' , { 'full' : '.mythemes-layout-sidebar' } ]")); if (meta::get($post->ID, 'post-layout') == 'full') { $sidebarClass = 'mythemes-layout-sidebar hidden'; } else { $sidebarClass = 'mythemes-layout-sidebar'; } $rett .= ahtml::template(array('type' => array('template' => 'inline', 'input' => 'select'), 'values' => $values, 'label' => __('Select sidebar', 'myThemes'), 'fieldName' => 'post-sidebar', 'templateClass' => $sidebarClass, 'value' => meta::dget($post->ID, 'post-sidebar', myThemes::get($type . '-sidebar')))); echo ahtml::template(array('type' => array('template' => 'code'), 'content' => $rett, 'templateClass' => $classes)); }
/** * Show the login page * @Developer brandon * @Date May 19, 2010 */ public function new_one() { if (user::logged_in()) { url::redirect(''); } parent::new_one(); layout::add(View::factory('shared/mentions')->render(), 'pre_footer'); meta::set_title('Login'); }
/** * Make sure that the one to update belongs to the user * @Developer brandon * @Date May 19, 2010 */ public function edit($id = NULL) { $journal = ORM::factory('journal', $id); if ($journal->user->id != user::current()->id) { url::redirect(''); } meta::set_title(date::user_friendly_date($journal->created_at) . ' : ' . $journal->title); parent::edit($id); }
/** * Clean up the show page URL * @Developer brandon * @Date Oct 11, 2010 */ public function show($name = NULL) { $blog = ORM::factory('blog')->where('name', format::dash_to_space($name))->find(); // Set the title meta::set_title(ucwords($blog->name)); // Set the description meta::set_description($blog->synopsis); // Show the page parent::show($blog); }
public static function download() { // Get default currency $default_currency = config::get_config_item("currency"); // Get list of active currencies $meta = new meta("currencyType"); $currencies = $meta->get_list(); foreach ((array) $currencies as $code => $currency) { if ($code == $default_currency) { continue; } if ($ret = exchangeRate::update_rate($code, $default_currency)) { $rtn[] = $ret; } if ($ret = exchangeRate::update_rate($default_currency, $code)) { $rtn[] = $ret; } } return $rtn; }
/** * Clean up the show page URL * @Developer brandon * @Date Oct 11, 2010 */ public function show($id = NULL) { // Find the product that we are trying to access $product = ORM::factory('product', $id); // Set the title meta::set_title(ucwords($product->name)); // Set the description meta::set_description($product->description); // Show the page parent::show($product); }
public function testInsert() { $data['member_lv_id'] = 1; $data['uname'] = 'oooo' . time(); $data['passwd'] = 'shopex'; $data['email'] = '*****@*****.**'; $data['qq'] = '393161358'; $this->obj_member->insert($data); die; self::$id = $data['member_id']; }
public function __construct() { parent::__construct(); ssl::force_ssl(); meta::set_keywords('Daily Journal, Free Journal, Private Diary, Private Journal, Free Online Journal, Online Journaling, Write Messages, My Diary, Secure Diary, Secure Journal, Journal, Diary'); meta::set_description('Keep a free online journal or diary to remember events in your life. Secure, simple and free. Access from anywhere.'); // Add Analytics to the page, except on journal pages if ($this->model_name != 'journal') { layout::add(View::factory('shared/analytics'), 'footer'); } }
/** * Require administrator login * @Developer brandon * @Date Oct 11, 2010 */ public function __construct() { parent::__construct(); $this->template = View::factory('layouts/admin'); meta::set_title(store::name() . ' | Admin | ' . ucwords(Router::$controller)); // Set the route for updating and creating files Kohana::config_set('routes.base_crud_route', 'admin/'); // Require an admin login if we are in production. if (IN_PRODUCTION) { customer::require_admin_login(); } ORM::factory('audit_trail')->create(array('user_id' => customer::current(), 'store_id' => store::get(), 'controller' => Router::$controller, 'method' => Router::$method, 'object_id' => $this->input->post('id'))); }
static function transform1($params) { $url = $params['image']; $data = $params['data']; $info = image::image_info($url); $path = $info['path']; if (!io::file_exists($path)) { throw new \Exception(resources::message('FILE_NOT_EXISTS', $path)); } if (meta::exists($info['id'])) { $meta = meta::get($info['id']); $spath = util::apath($meta['orig']); $data = isset($meta['data']) ? image::combine_transform($meta['data'], $data) : $data; } else { $spath = $path; } $id = util::id(); $name = $id . '.' . $info['ext']; $dpath = DRAFT_CONTENT_DIR . '/' . $name; image::transform_image($spath, $dpath, $data); meta::put($id, array('orig' => util::rpath($spath), 'oid' => $info['id'], 'path' => util::rpath($dpath), 'name' => $name, 'data' => $data, 'image' => true)); return array('status' => 0, 'url' => DRAFT_CONTENT_URL . '/' . $name); }
$clientContact->output_vcard(); return; } else { if ($_POST["delete"]) { $client->read_globals(); $client->delete(); alloc_redirect($TPL["url_alloc_clientList"]); } else { $client->set_id($clientID); $client->select(); } $client->set_values("client_"); } } } $m = new meta("clientStatus"); $clientStatus_array = $m->get_assoc_array("clientStatusID", "clientStatusID"); $TPL["clientStatusOptions"] = page::select_options($clientStatus_array, $client->get_value("clientStatus")); $clientCategories = config::get_config_item("clientCategories") or $clientCategories = array(); foreach ($clientCategories as $k => $v) { $cc[$v["value"]] = $v["label"]; } $TPL["clientCategoryOptions"] = page::select_options($cc, $client->get_value("clientCategory")); $client->get_value("clientCategory") and $TPL["client_clientCategoryLabel"] = $cc[$client->get_value("clientCategory")]; // client contacts if ($_POST["clientContact_save"] || $_POST["clientContact_delete"]) { $clientContact = new clientContact(); $clientContact->read_globals(); if ($_POST["clientContact_save"]) { #$clientContact->set_value('clientID', $_POST["clientID"]); $clientContact->save();
function read_db_record($db) { $this->set_id($db->f($this->key_field->get_name())); $this->read_array($db->row, "", SRC_DATABASE); $this->all_row_fields = $db->row; $have_perm = $this->have_perm(PERM_READ); if (!$have_perm) { $m = new meta(); $meta_tables = (array) $m->get_tables(); $meta_tables = array_keys($meta_tables); if (in_array($this->data_table, (array) $meta_tables)) { return true; } $this->clear(); } return $have_perm; }
alloc_redirect($TPL["url_alloc_transaction"] . "new=true"); } if ($_POST["saveGoTf"]) { alloc_redirect($TPL["url_alloc_transactionList"] . "tfID=" . $transaction->get_value("tfID")); } alloc_redirect($TPL["url_alloc_transaction"] . "transactionID=" . $transaction->get_id()); } } } else { if ($_POST["delete"]) { $transaction->delete(); alloc_redirect($TPL["url_alloc_transactionList"] . "tfID=" . $transaction->get_value("tfID")); } } $transaction->set_tpl_values(); $t = new meta("currencyType"); $currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID"); $TPL["currencyOptions"] = page::select_options($currency_array, $transaction->get_value("currencyTypeID")); $TPL["product"] = page::htmlentities($transaction->get_value("product")); $TPL["statusOptions"] = page::select_options(array("pending" => "Pending", "rejected" => "Rejected", "approved" => "Approved"), $transaction->get_value("status")); $transactionTypes = transaction::get_transactionTypes(); $TPL["transactionTypeOptions"] = page::select_options($transactionTypes, $transaction->get_value("transactionType")); is_object($transaction) and $TPL["transactionTypeLink"] = $transaction->get_transaction_type_link(); $db = new db_alloc(); $tf = new tf(); $options = $tf->get_assoc_array("tfID", "tfName"); // Special cases for the current tfID and fromTfID $options = add_tf($transaction->get_value("tfID"), $options, "tfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)"); $options = add_tf($transaction->get_value("fromTfID"), $options, "fromTfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)"); $TPL["tfIDOptions"] = page::select_options($options, $transaction->get_value("tfID")); $TPL["fromTfIDOptions"] = page::select_options($options, $transaction->get_value("fromTfID"));
/** * Set the title for the cart * @Developer brandon * @Date Oct 11, 2010 */ public function __construct() { parent::__construct(); meta::set_title('Shopping Cart'); $this->cart = cart::get(); }
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo meta::get_title(); ?> | <?php echo store::name(); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="<?php echo meta::get_description(); ?> " /> <meta name="keywords" content="<?php echo meta::get_keywords(); ?> " /> <?php echo theme::stylesheet('css/main'); echo theme::script('js/jquery'); echo theme::script('/js/application'); echo theme::render_script(); ?> </head> <body id="<?php echo theme::body_id(); ?> " class="<?php echo theme::body_class(); ?>
/** * Set the title for the sessions * @Developer brandon * @Date Oct 11, 2010 */ public function __construct() { parent::__construct(); meta::set_title('Login or Register'); }
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; }
$tf = new tf(); $tf->set_id($TPL["project_cost_centre_tfID"]); $tf->select(); $TPL["cost_centre_tfID_label"] = $tf->get_link(); } $query = prepare("SELECT roleName,roleID FROM role WHERE roleLevel = 'project' ORDER BY roleSequence"); $db->query($query); #$project_person_role_array[] = ""; while ($db->next_record()) { $project_person_role_array[$db->f("roleID")] = $db->f("roleName"); } $email_type_array = array("None" => "None", "Assigned Tasks" => "Assigned Tasks", "All Tasks" => "All Tasks"); $t = new meta("currencyType"); $currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID"); $projectType_array = project::get_project_type_array(); $m = new meta("projectStatus"); $projectStatus_array = $m->get_assoc_array("projectStatusID", "projectStatusID"); $timeUnit = new timeUnit(); $rate_type_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelB"); $TPL["project_projectType"] = $projectType_array[$TPL["project_projectType"]]; $TPL["projectType_options"] = page::select_options($projectType_array, $TPL["project_projectType"]); $TPL["projectStatus_options"] = page::select_options($projectStatus_array, $TPL["project_projectStatus"]); $TPL["project_projectPriority"] or $TPL["project_projectPriority"] = 3; $projectPriorities = config::get_config_item("projectPriorities") or $projectPriorities = array(); $tp = array(); foreach ($projectPriorities as $key => $arr) { $tp[$key] = $arr["label"]; } $TPL["projectPriority_options"] = page::select_options($tp, $TPL["project_projectPriority"]); $TPL["project_projectPriority"] and $TPL["priorityLabel"] = " <div style=\"display:inline; color:" . $projectPriorities[$TPL["project_projectPriority"]]["colour"] . "\">[" . $tp[$TPL["project_projectPriority"]] . "]</div>"; $TPL["defaultTimeSheetRate"] = $project->get_value("defaultTimeSheetRate");
/** * Load up the controller * @developer Brandon Hansen * @date Jun 8, 2010 */ public function __construct() { parent::__construct(); meta::set_title('Remembering Life'); layout::add(View::factory('shared/mentions')->render(), 'pre_footer'); }
function get_project_type_array() { // optimization static $rows; if (!$rows) { $m = new meta("projectType"); $rows = $m->get_assoc_array("projectTypeID", "projectTypeID"); } return $rows; }
} get_cached_table("config", true); // flush cache if (has("finance")) { $tf = new tf(); $options = $tf->get_assoc_array("tfID", "tfName"); } $TPL["mainTfOptions"] = page::select_options($options, config::get_config_item("mainTfID")); $TPL["outTfOptions"] = page::select_options($options, config::get_config_item("outTfID")); $TPL["inTfOptions"] = page::select_options($options, config::get_config_item("inTfID")); $TPL["taxTfOptions"] = page::select_options($options, config::get_config_item("taxTfID")); $TPL["expenseFormTfOptions"] = page::select_options($options, config::get_config_item("expenseFormTfID")); $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"]);
<?php defined('LEAN') or die('Access Denied'); $meta = new meta(); ?> <!DOCTYPE html> <html lang="ru"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="keywords" content="<?php echo $meta->get_content()['keywords']; ?> "> <meta name="description" content="<?php echo $meta->get_content()['description']; ?> "> <title><?php echo $meta->get_content()['title']; ?> </title> <link rel="stylesheet" href="<?php echo config::TEMPLATE; ?> css/main.css"> <script src="<?php echo config::TEMPLATE; ?> js/jquery.js"></script> <script src="<?php
/** * Display the missing page url * @Developer Brandon Hansen * @Date April 19, 2010 */ public function error_404() { header('HTTP/1.0 404 Not Found'); meta::set_title('This Page will be Forever Missed'); $this->template->set('title', 'Missing Page')->set('content', View::factory('errors/404')); }
/** * Set the home page * @Developer brandon * @Date Oct 11, 2010 */ public function home() { meta::set_title('Welcome'); $this->template->set('content', View::factory('themes/' . theme::get() . '/home')); }
} else { alloc_error("No permissions to generate TF list"); } } //special case for disabled TF. Include it in the list, but also add a warning message. $tf = new tf(); $tf->set_id($transactionRepeat->get_value("tfID")); if ($tf->select() && !$tf->get_value("tfActive")) { $TPL["message_help"][] = "This expense is allocated to an inactive TF. It will not create transactions."; } $tf = new tf(); $tf->set_id($transactionRepeat->get_value("fromTfID")); if ($tf->select() && !$tf->get_value("tfActive")) { $TPL["message_help"][] = "This expense is sourced from an inactive TF. It will not create transactions."; } $m = new meta("currencyType"); $currencyOps = $m->get_assoc_array("currencyTypeID", "currencyTypeID"); $TPL["currencyTypeOptions"] = page::select_options($currencyOps, $transactionRepeat->get_value("currencyTypeID")); $TPL["tfOptions"] = page::select_options($q, $transactionRepeat->get_value("tfID")); $TPL["fromTfOptions"] = page::select_options($q, $transactionRepeat->get_value("fromTfID")); $TPL["basisOptions"] = page::select_options(array("weekly" => "weekly", "fortnightly" => "fortnightly", "monthly" => "monthly", "quarterly" => "quarterly", "yearly" => "yearly"), $transactionRepeat->get_value("paymentBasis")); $TPL["transactionTypeOptions"] = page::select_options(transaction::get_transactionTypes(), $transactionRepeat->get_value("transactionType")); if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $current_user->have_role("admin")) { $TPL["adminButtons"] .= ' <select name="changeTransactionStatus"><option value="">Transaction Status<option value="approved">Approve<option value="rejected">Reject<option value="pending">Pending</select> '; } if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $transactionRepeat->get_value("status") == "pending") { $TPL["message_help"][] = "This Repeating Expense will only create Transactions once its status is Approved."; } else { if (!$transactionRepeat->get_id()) {
function show_new_timeSheet($template) { global $TPL; global $timeSheet; global $timeSheetID; $current_user =& singleton("current_user"); // Don't show entry form for new timeSheet. if (!$timeSheetID) { return; } if (is_object($timeSheet) && ($timeSheet->get_value("status") == 'edit' || $timeSheet->get_value("status") == 'rejected') && ($timeSheet->get_value("personID") == $current_user->get_id() || $timeSheet->have_perm(PERM_TIME_INVOICE_TIMESHEETS))) { $TPL["currency"] = page::money($timeSheet->get_value("currencyTypeID"), '', "%S"); // If we are editing an existing timeSheetItem $timeSheetItem_edit = $_POST["timeSheetItem_edit"] or $timeSheetItem_edit = $_GET["timeSheetItem_edit"]; $timeSheetItemID = $_POST["timeSheetItemID"] or $timeSheetItemID = $_GET["timeSheetItemID"]; if ($timeSheetItemID && $timeSheetItem_edit) { $timeSheetItem = new timeSheetItem(); $timeSheetItem->currency = $timeSheet->get_value("currencyTypeID"); $timeSheetItem->set_id($timeSheetItemID); $timeSheetItem->select(); $timeSheetItem->set_values("tsi_"); $TPL["tsi_rate"] = $timeSheetItem->get_value("rate", DST_HTML_DISPLAY); $taskID = $timeSheetItem->get_value("taskID"); $TPL["tsi_buttons"] = ' <button type="submit" name="timeSheetItem_delete" value="1" class="delete_button">Delete<i class="icon-trash"></i></button> <button type="submit" name="timeSheetItem_save" value="1" class="save_button default">Save Item<i class="icon-ok-sign"></i></button> '; $timeSheetItemDurationUnitID = $timeSheetItem->get_value("timeSheetItemDurationUnitID"); $TPL["tsi_commentPrivate"] and $TPL["commentPrivateChecked"] = " checked"; $TPL["ts_rate_editable"] = $timeSheet->can_edit_rate(); $timeSheetItemMultiplier = $timeSheetItem->get_value("multiplier"); // Else default values for creating a new timeSheetItem } else { $TPL["tsi_buttons"] = '<button type="submit" name="timeSheetItem_save" value="1" class="save_button">Add Item<i class="icon-plus-sign"></i></button>'; $TPL["tsi_personID"] = $current_user->get_id(); $timeSheet->load_pay_info(); $TPL["tsi_rate"] = $timeSheet->pay_info["project_rate"]; $timeSheetItemDurationUnitID = $timeSheet->pay_info["project_rateUnitID"]; $TPL["ts_rate_editable"] = $timeSheet->can_edit_rate(); } $taskID or $taskID = $_GET["taskID"]; $TPL["taskListDropdown_taskID"] = $taskID; $TPL["taskListDropdown"] = $timeSheet->get_task_list_dropdown("mine", $timeSheet->get_id(), $taskID); $TPL["tsi_timeSheetID"] = $timeSheet->get_id(); $timeUnit = new timeUnit(); $unit_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelA"); $TPL["tsi_unit_options"] = page::select_options($unit_array, $timeSheetItemDurationUnitID); $timeSheetItemDurationUnitID and $TPL["tsi_unit_label"] = $unit_array[$timeSheetItemDurationUnitID]; $m = new meta("timeSheetItemMultiplier"); $tsMultipliers = $m->get_list(); foreach ($tsMultipliers as $k => $v) { $multiplier_array[$k] = $v["timeSheetItemMultiplierName"]; } $TPL["tsi_multiplier_options"] = page::select_options($multiplier_array, $timeSheetItemMultiplier); include_template($template); } }
* * allocPSA is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with allocPSA. If not, see <http://www.gnu.org/licenses/>. */ define("NO_REDIRECT", 1); require_once "../alloc.php"; //usleep(1000); $t = timeSheetItem::parse_time_string($_REQUEST["time_item"]); $timeUnit = new timeUnit(); $units = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelA"); $timeSheetItemMultiplier = new meta("timeSheetItemMultiplier"); $tsims = $timeSheetItemMultiplier->get_list(); foreach ($t as $k => $v) { if ($v) { if ($k == "taskID") { $task = new task(); $task->set_id($v); if ($task->select()) { $v = $task->get_id() . " " . $task->get_link(); } else { $v = "Task " . $v . " not found."; } } else { if ($k == "unit") { $v = $units[$v]; } else {
function rebuild_cache($table) { $cache =& singleton("cache"); if (meta::$tables[$table]) { $m = new meta($table); $cache[$table] = $m->get_list(); } else { $db = new db_alloc(); $db->query("SELECT * FROM " . $table); while ($row = $db->row()) { $cache[$table][$db->f($table . "ID")] = $row; } } // Special processing for person and config tables if ($table == "person") { $people = $cache["person"]; foreach ($people as $id => $row) { if ($people[$id]["firstName"] && $people[$id]["surname"]) { $people[$id]["name"] = $people[$id]["firstName"] . " " . $people[$id]["surname"]; } else { $people[$id]["name"] = $people[$id]["username"]; } } uasort($people, "sort_by_name"); $cache["person"] = $people; } else { if ($table == "config") { // Special processing for config table $config = $cache["config"]; foreach ($config as $id => $row) { $rows_config[$row["name"]] = $row; } $cache["config"] = $rows_config; } } singleton("cache", $cache); }