本文整理汇总了PHP中form_helper_prepare_dropdownfromdb函数的典型用法代码示例。如果您正苦于以下问题:PHP form_helper_prepare_dropdownfromdb函数的具体用法?PHP form_helper_prepare_dropdownfromdb怎么用?PHP form_helper_prepare_dropdownfromdb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_helper_prepare_dropdownfromdb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
/*
Define form structure
*/
$this->obj_form = new form_input();
$this->obj_form->formname = "services_bundles_service";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "services/bundles-service-add-process.php";
$this->obj_form->method = "post";
// service dropdown
$structure = form_helper_prepare_dropdownfromdb("id_service", "SELECT services.id as id, name_service as label FROM `services` LEFT JOIN service_types ON service_types.id = services.typeid WHERE service_types.name != 'bundle' ORDER BY name_service");
$this->obj_form->add_input($structure);
// hidden fields
$structure = NULL;
$structure["fieldname"] = "id_bundle";
$structure["type"] = "hidden";
$structure["defaultvalue"] = $this->id;
$this->obj_form->add_input($structure);
// submit section
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "Save Changes";
$this->obj_form->add_input($structure);
// define subforms
$this->obj_form->subforms["hidden"] = array("id_bundle");
$this->obj_form->subforms["bundle_services"] = array("id_service");
$this->obj_form->subforms["submit"] = array("submit");
$this->obj_form->load_data_error();
}
示例2: execute
function execute()
{
// define basic form details
$this->obj_form = new form_input();
$this->obj_form->formname = "service_group_add";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "services/groups-edit-process.php";
$this->obj_form->method = "post";
// general
$structure = NULL;
$structure["fieldname"] = "group_name";
$structure["type"] = "input";
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "group_description";
$structure["type"] = "input";
$this->obj_form->add_input($structure);
$structure = form_helper_prepare_dropdownfromdb("id_parent", "SELECT id, group_name as label, id_parent FROM service_groups");
$structure["options"]["search_filter"] = "yes";
$this->obj_form->add_input($structure);
// submit button
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "submit";
$this->obj_form->add_input($structure);
// define subforms
$this->obj_form->subforms["service_group_add"] = array("group_name", "group_description", "id_parent");
$this->obj_form->subforms["submit"] = array("submit");
// load any data returned due to errors
$this->obj_form->load_data_error();
}
示例3: execute
function execute()
{
// establish a new table object
$this->obj_table = new table();
$this->obj_table->language = $_SESSION["user"]["lang"];
$this->obj_table->tablename = "cdr_rate_tables";
// define all the columns and structure
$this->obj_table->add_column("standard", "rate_table_name", "");
$this->obj_table->add_column("standard", "name_vendor", "vendors.name_vendor");
$this->obj_table->add_column("standard", "rate_table_description", "");
// defaults
$this->obj_table->columns = array("rate_table_name", "name_vendor", "rate_table_description");
$this->obj_table->columns_order = array("rate_table_name");
$this->obj_table->columns_order_options = array("rate_table_name", "name_vendor");
// define SQL structure
$this->obj_table->sql_obj->prepare_sql_settable("cdr_rate_tables");
$this->obj_table->sql_obj->prepare_sql_addfield("id", "cdr_rate_tables.id");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN vendors ON vendors.id = cdr_rate_tables.id_vendor");
// acceptable filter options
$structure["fieldname"] = "searchbox";
$structure["type"] = "input";
$structure["sql"] = "(rate_table_name LIKE '%value%' OR rate_table_description LIKE '%value%')";
$this->obj_table->add_filter($structure);
$structure = form_helper_prepare_dropdownfromdb("name_vendor", "SELECT id, code_vendor as label, name_vendor as label1 FROM vendors ORDER BY name_vendor ASC");
$structure["sql"] = "cdr_rate_tables.id_vendor='value'";
$structure["options"]["search_filter"] = "yes";
$this->obj_table->add_filter($structure);
// load options
$this->obj_table->load_options_form();
// fetch all the service information
$this->obj_table->generate_sql();
$this->obj_table->load_data_sql();
}
示例4: charts_form_prepare_acccountdropdown
function charts_form_prepare_acccountdropdown($fieldname, $menu_name)
{
log_debug("inc_charts", "Executing charts_form_prepare_accountdropdown({$fieldname}, {$menu_name})");
// see if we need to fetch the ID for the name
// (see function comments - this will be phased out eventually)
if (is_int($menu_name)) {
log_debug("inc_charts", "Obsolete: Use of menu ID rather than menu name");
$menuid = $menu_name;
} else {
$menuid = sql_get_singlevalue("SELECT id as value FROM account_chart_menu WHERE value='{$menu_name}'");
}
// fetch list of suitable charts belonging to the menu requested.
$sql_query = "SELECT " . "account_charts.id as id, " . "account_charts.code_chart as label, " . "account_charts.description as label1 " . "FROM account_charts " . "LEFT JOIN account_charts_menus ON account_charts_menus.chartid = account_charts.id " . "WHERE account_charts_menus.menuid='{$menuid}' " . "ORDER BY account_charts.code_chart";
$return = form_helper_prepare_dropdownfromdb($fieldname, $sql_query);
// if we don't get any form data returned this means no charts with the required
// permissions exist in the database, so we need to return a graceful error.
if (!$return) {
$structure = NULL;
$structure["fieldname"] = $fieldname;
$structure["type"] = "text";
$structure["defaultvalue"] = "No suitable charts avaliable";
return $structure;
} else {
return $return;
}
}
示例5: execute
function execute()
{
// establish a new table object
$this->obj_table = new table();
$this->obj_table->language = $_SESSION["user"]["lang"];
$this->obj_table->tablename = "vendor_invoices";
// define all the columns and structure
$this->obj_table->add_column("standard", "code_invoice", "account_ap.code_invoice");
$this->obj_table->add_column("standard", "code_ordernumber", "account_ap.code_ordernumber");
$this->obj_table->add_column("standard", "code_ponumber", "account_ap.code_ponumber");
$this->obj_table->add_column("standard", "name_staff", "staff.name_staff");
$this->obj_table->add_column("date", "date_trans", "account_ap.date_trans");
$this->obj_table->add_column("date", "date_due", "account_ap.date_due");
$this->obj_table->add_column("price", "amount_tax", "account_ap.amount_tax");
$this->obj_table->add_column("price", "amount", "account_ap.amount");
$this->obj_table->add_column("price", "amount_total", "account_ap.amount_total");
$this->obj_table->add_column("price", "amount_paid", "account_ap.amount_paid");
// totals
$this->obj_table->total_columns = array("amount_tax", "amount", "amount_total", "amount_paid");
// defaults
$this->obj_table->columns = array("code_invoice", "name_staff", "date_trans", "date_due", "amount_total", "amount_paid");
$this->obj_table->columns_order = array("code_invoice");
// define SQL structure
$this->obj_table->sql_obj->prepare_sql_settable("account_ap");
$this->obj_table->sql_obj->prepare_sql_addfield("id", "account_ap.id");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN staff ON staff.id = account_ap.employeeid");
$this->obj_table->sql_obj->prepare_sql_addwhere("account_ap.vendorid='" . $this->id . "'");
// acceptable filter options
$this->obj_table->add_fixed_option("id", $this->id);
$structure = NULL;
$structure["fieldname"] = "date_start";
$structure["type"] = "date";
$structure["sql"] = "date_trans >= 'value'";
$this->obj_table->add_filter($structure);
$structure = NULL;
$structure["fieldname"] = "date_end";
$structure["type"] = "date";
$structure["sql"] = "date_trans <= 'value'";
$this->obj_table->add_filter($structure);
$structure = form_helper_prepare_dropdownfromdb("employeeid", "SELECT id, staff_code as label, name_staff as label1 FROM staff ORDER BY name_staff");
$structure["sql"] = "account_ap.employeeid='value'";
$this->obj_table->add_filter($structure);
$structure = NULL;
$structure["fieldname"] = "invoice_notes_search";
$structure["type"] = "input";
$structure["sql"] = "notes LIKE '%value%'";
$this->obj_table->add_filter($structure);
$structure = NULL;
$structure["fieldname"] = "hide_closed";
$structure["type"] = "checkbox";
$structure["options"]["label"] = "Hide Closed Invoices";
$structure["defaultvalue"] = "";
$structure["sql"] = "account_ap.amount_paid!=account_ap.amount_total";
$this->obj_table->add_filter($structure);
// load options
$this->obj_table->load_options_form();
// fetch all the chart information
$this->obj_table->generate_sql();
$this->obj_table->load_data_sql();
}
示例6: execute
function execute()
{
/*
Define form structure
*/
$this->obj_form = new form_input();
$this->obj_form->formname = "support_ticket_add";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "support/edit-process.php";
$this->obj_form->method = "post";
// general
$structure = NULL;
$structure["fieldname"] = "title";
$structure["type"] = "input";
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "date_start";
$structure["type"] = "date";
$structure["defaultvalue"] = date("Y-m-d");
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "date_end";
$structure["type"] = "date";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "details";
$structure["type"] = "textarea";
$structure["options"]["width"] = "600";
$structure["options"]["height"] = "100";
$this->obj_form->add_input($structure);
// status + priority
$structure = form_helper_prepare_dropdownfromdb("status", "SELECT id, value as label FROM support_tickets_status");
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
$structure = form_helper_prepare_dropdownfromdb("priority", "SELECT id, value as label FROM support_tickets_priority");
$this->obj_form->add_input($structure);
// customer/product/project/service ID
// submit section
if (user_permissions_get("support_write")) {
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "Save Changes";
$this->obj_form->add_input($structure);
} else {
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "message";
$structure["defaultvalue"] = "<p><i>Sorry, you don't have permissions to make changes to support_ticket records.</i></p>";
$this->obj_form->add_input($structure);
}
// define subforms
$this->obj_form->subforms["support_ticket_details"] = array("title", "priority", "details");
$this->obj_form->subforms["support_ticket_status"] = array("status", "date_start", "date_end");
$this->obj_form->subforms["submit"] = array("submit");
// fetch the form data
$this->obj_form->load_data_error();
}
示例7: execute
function execute()
{
// establish a new table object
$this->obj_table = new table();
$this->obj_table->language = $_SESSION["user"]["lang"];
$this->obj_table->tablename = "account_quotes";
// define all the columns and structure
$this->obj_table->add_column("standard", "code_quote", "account_quotes.code_quote");
$this->obj_table->add_column("standard", "name_customer", "CONCAT_WS(' -- ', customers.code_customer, customers.name_customer)");
$this->obj_table->add_column("standard", "name_staff", "CONCAT_WS(' -- ', staff.staff_code, staff.name_staff)");
$this->obj_table->add_column("date", "date_trans", "account_quotes.date_trans");
$this->obj_table->add_column("date", "date_validtill", "account_quotes.date_validtill");
$this->obj_table->add_column("price", "amount_tax", "account_quotes.amount_tax");
$this->obj_table->add_column("price", "amount", "account_quotes.amount");
$this->obj_table->add_column("price", "amount_total", "account_quotes.amount_total");
$this->obj_table->add_column("bool_tick", "sent", "account_quotes.sentmethod");
// totals
$this->obj_table->total_columns = array("amount_tax", "amount", "amount_total");
// defaults
$this->obj_table->columns = array("code_quote", "name_customer", "date_trans", "amount_total");
$this->obj_table->columns_order = array("code_quote");
$this->obj_table->columns_order_options = array("code_quote", "name_customer", "name_staff", "date_trans", "date_validtill", "sent");
// define SQL structure
$this->obj_table->sql_obj->prepare_sql_settable("account_quotes");
$this->obj_table->sql_obj->prepare_sql_addfield("id", "account_quotes.id");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN customers ON customers.id = account_quotes.customerid");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN staff ON staff.id = account_quotes.employeeid");
// acceptable filter options
$structure = NULL;
$structure["fieldname"] = "date_start";
$structure["type"] = "date";
$structure["sql"] = "date_trans >= 'value'";
$this->obj_table->add_filter($structure);
$structure = NULL;
$structure["fieldname"] = "date_end";
$structure["type"] = "date";
$structure["sql"] = "date_trans <= 'value'";
$this->obj_table->add_filter($structure);
$structure = form_helper_prepare_dropdownfromdb("employeeid", "SELECT id, staff_code as label, name_staff as label1 FROM staff ORDER BY name_staff");
$structure["sql"] = "account_quotes.employeeid='value'";
$structure["options"]["search_filter"] = "enabled";
$this->obj_table->add_filter($structure);
$structure = form_helper_prepare_dropdownfromdb("customerid", "SELECT id, code_customer as label, name_customer as label1 FROM customers ORDER BY name_customer");
$structure["sql"] = "account_quotes.customerid='value'";
$structure["options"]["search_filter"] = "enabled";
$this->obj_table->add_filter($structure);
$structure = NULL;
$structure["fieldname"] = "hide_closed";
$structure["type"] = "checkbox";
$structure["options"]["label"] = "Hide Expired Quotes";
$structure["defaultvalue"] = "enabled";
$structure["sql"] = "account_quotes.date_validtill > '" . date("Y-m-d") . "'";
$this->obj_table->add_filter($structure);
// load options
$this->obj_table->load_options_form();
// fetch all the chart information
$this->obj_table->generate_sql();
$this->obj_table->load_data_sql();
}
示例8: execute
function execute()
{
// define basic form details
$this->obj_form = new form_input();
$this->obj_form->formname = "cdr_rate_table_view";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "services/cdr-rates-edit-process.php";
$this->obj_form->method = "post";
// general
$structure = NULL;
$structure["fieldname"] = "rate_table_name";
$structure["type"] = "input";
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "rate_table_description";
$structure["type"] = "input";
$this->obj_form->add_input($structure);
$structure = form_helper_prepare_dropdownfromdb("id_vendor", "SELECT id, code_vendor as label, name_vendor as label1 FROM vendors ORDER BY name_vendor");
$structure["options"]["req"] = "yes";
$structure["options"]["width"] = "600";
$structure["options"]["search_filter"] = "yes";
$this->obj_form->add_input($structure);
$structure = form_helper_prepare_dropdownfromdb("id_usage_mode", "SELECT id, description as label FROM cdr_rate_usage_modes ORDER BY name");
$structure["options"]["req"] = "yes";
$structure["options"]["width"] = "600";
$this->obj_form->add_input($structure);
// hidden fields
$structure = NULL;
$structure["fieldname"] = "id";
$structure["type"] = "hidden";
$structure["defaultvalue"] = $this->obj_rate_table->id;
$this->obj_form->add_input($structure);
// submit button
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "submit";
$this->obj_form->add_input($structure);
// define subforms
$this->obj_form->subforms["rate_table_view"] = array("rate_table_name", "rate_table_description", "id_vendor", "id_usage_mode");
$this->obj_form->subforms["hidden"] = array("id");
if (user_permissions_get("services_write")) {
$this->obj_form->subforms["submit"] = array("submit");
} else {
$this->obj_form->subforms["submit"] = array("");
}
// load any data returned due to errors
if (error_check()) {
$this->obj_form->load_data_error();
} else {
$this->obj_rate_table->load_data();
$this->obj_form->structure["rate_table_name"]["defaultvalue"] = $this->obj_rate_table->data["rate_table_name"];
$this->obj_form->structure["rate_table_description"]["defaultvalue"] = $this->obj_rate_table->data["rate_table_description"];
$this->obj_form->structure["id_vendor"]["defaultvalue"] = $this->obj_rate_table->data["id_vendor"];
$this->obj_form->structure["id_usage_mode"]["defaultvalue"] = $this->obj_rate_table->data["id_usage_mode"];
}
}
示例9: execute
function execute()
{
/*
Define form structure
*/
$this->obj_form = new form_input();
$this->obj_form->formname = "users_permissions_staff";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "user/user-staffaccess-edit-process.php";
$this->obj_form->method = "post";
// staff member dropdown
$structure = form_helper_prepare_dropdownfromdb("id_staff", "SELECT id, staff_code as label, name_staff as label1 FROM `staff` ORDER BY name_staff");
$this->obj_form->add_input($structure);
$this->obj_form->subforms["user_permissions_selectstaff"] = array("id_staff");
/*
Permissions sub-form
*/
// run through all the avaliable permissions
$sql_perms_obj = new sql_query();
$sql_perms_obj->string = "SELECT * FROM `permissions_staff`";
$sql_perms_obj->execute();
if ($sql_perms_obj->num_rows()) {
$sql_perms_obj->fetch_array();
foreach ($sql_perms_obj->data as $data_perms) {
// define the checkbox
$structure = NULL;
$structure["fieldname"] = $data_perms["value"];
$structure["type"] = "checkbox";
$structure["options"]["label"] = $data_perms["description"];
// add checkbox
$this->obj_form->add_input($structure);
// add checkbox to subforms
$this->obj_form->subforms["user_permissions_staff"][] = $data_perms["value"];
}
}
// hidden fields
$structure = NULL;
$structure["fieldname"] = "id_user";
$structure["type"] = "hidden";
$structure["defaultvalue"] = $this->id;
$this->obj_form->add_input($structure);
// submit section
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "Save Changes";
$this->obj_form->add_input($structure);
// define subforms
$this->obj_form->subforms["hidden"] = array("id_user");
$this->obj_form->subforms["submit"] = array("submit");
/*
Note: We don't load from error data, since there should never
be any errors when using this form.
*/
}
示例10: execute
function execute()
{
// establish a new table object
$this->obj_table = new table();
$this->obj_table->language = $_SESSION["user"]["lang"];
$this->obj_table->tablename = "product_list";
// define all the columns and structure
$this->obj_table->add_column("standard", "code_product", "");
$this->obj_table->add_column("standard", "name_product", "");
$this->obj_table->add_column("standard", "account_sales", "CONCAT_WS(' -- ',account_charts.code_chart,account_charts.description)");
$this->obj_table->add_column("standard", "id_product_group", "product_groups.group_name");
$this->obj_table->add_column("price", "price_cost", "");
$this->obj_table->add_column("price", "price_sale", "");
$this->obj_table->add_column("percentage", "discount", "");
$this->obj_table->add_column("date", "date_start", "");
$this->obj_table->add_column("date", "date_end", "");
$this->obj_table->add_column("date", "date_current", "");
$this->obj_table->add_column("standard", "quantity_instock", "");
$this->obj_table->add_column("standard", "quantity_vendor", "");
// defaults
$this->obj_table->columns = array("code_product", "name_product", "account_sales", "price_cost", "price_sale");
$this->obj_table->columns_order = array("code_product");
$this->obj_table->columns_order_options = array("code_product", "name_product", "account_sales", "date_current", "quantity_instock", "quantity_vendor");
// define SQL structure
$this->obj_table->sql_obj->prepare_sql_settable("products");
$this->obj_table->sql_obj->prepare_sql_addfield("id", "products.id");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN account_charts ON account_charts.id = products.account_sales");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN product_groups ON product_groups.id = products.id_product_group");
// acceptable filter options
$structure = NULL;
$structure["fieldname"] = "searchbox";
$structure["type"] = "input";
$structure["sql"] = "(name_product LIKE '%value%' OR code_product LIKE '%value%')";
$this->obj_table->add_filter($structure);
$structure = form_helper_prepare_dropdownfromdb("id_product_group", "SELECT id, group_name as label FROM product_groups ORDER BY group_name ASC");
$structure["sql"] = "products.id_product_group='value'";
$structure["options"]["search_filter"] = "yes";
$this->obj_table->add_filter($structure);
$structure = NULL;
$structure["fieldname"] = "hide_ex_products";
$structure["type"] = "checkbox";
$structure["sql"] = "date_end='0000-00-00'";
$structure["defaultvalue"] = "on";
$structure["options"]["label"] = "Hide any products which are no longer sold";
$this->obj_table->add_filter($structure);
// load options
$this->obj_table->load_options_form();
// fetch all the product information
$this->obj_table->generate_sql();
$this->obj_table->load_data_sql();
}
示例11: execute
function execute()
{
// establish a new table object
$this->obj_table = new table();
$this->obj_table->language = $_SESSION["user"]["lang"];
$this->obj_table->tablename = "changelog";
// define all the columns and structure
$this->obj_table->add_column("timestamp", "timestamp", "");
$this->obj_table->add_column("standard", "server_name", "name_servers.server_name");
$this->obj_table->add_column("standard", "domain_name", "dns_domains.domain_name");
$this->obj_table->add_column("standard", "username", "");
$this->obj_table->add_column("standard", "log_type", "");
$this->obj_table->add_column("standard", "log_contents", "");
// defaults
$this->obj_table->columns = array("timestamp", "server_name", "domain_name", "username", "log_type", "log_contents");
$this->obj_table->sql_obj->prepare_sql_settable("logs");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN name_servers ON name_servers.id = logs.id_server");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN dns_domains ON dns_domains.id = logs.id_domain");
$this->obj_table->sql_obj->prepare_sql_addorderby_desc("timestamp");
// acceptable filter options
$structure = NULL;
$structure["fieldname"] = "searchbox";
$structure["type"] = "input";
$structure["sql"] = "(server_name LIKE '%value%' OR domain_name LIKE '%value%' OR log_type LIKE '%value%' OR log_contents LIKE '%value%')";
$this->obj_table->add_filter($structure);
$structure = NULL;
$structure["fieldname"] = "num_logs_rows";
$structure["type"] = "input";
$structure["sql"] = "";
$structure["defaultvalue"] = "1000";
$this->obj_table->add_filter($structure);
$structure = form_helper_prepare_dropdownfromdb("id_server_name", "SELECT id, server_name as label FROM name_servers ORDER BY server_name");
$structure["type"] = "dropdown";
$structure["sql"] = "id_server='value'";
$this->obj_table->add_filter($structure);
$structure = form_helper_prepare_dropdownfromdb("id_domain", "SELECT id, domain_name as label FROM dns_domains ORDER BY domain_name");
$structure["type"] = "dropdown";
$structure["sql"] = "id_domain='value'";
$this->obj_table->add_filter($structure);
// load options
if (isset($this->obj_server_name->id)) {
$this->obj_table->add_fixed_option("id", $this->obj_server_name->id);
}
$this->obj_table->load_options_form();
// generate SQL
$this->obj_table->generate_sql();
// load limit filter
$this->obj_table->sql_obj->string .= "LIMIT " . $this->obj_table->filter["filter_num_logs_rows"]["defaultvalue"];
// load data from DB
$this->obj_table->load_data_sql();
}
示例12: execute
function execute()
{
/*
Define form structure
*/
$this->obj_form = new form_input();
$this->obj_form->formname = "transaction_add";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "accounts/gl/edit-process.php";
$this->obj_form->method = "post";
// general
$structure = NULL;
$structure["fieldname"] = "code_gl";
$structure["type"] = "input";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "date_trans";
$structure["type"] = "date";
$structure["defaultvalue"] = date("Y-m-d");
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
$structure = form_helper_prepare_dropdownfromdb("employeeid", "SELECT id, staff_code as label, name_staff as label1 FROM staff WHERE date_end = '0000-00-00' ORDER BY staff_code");
$structure["options"]["req"] = "yes";
$structure["options"]["width"] = "600";
$structure["options"]["search_filter"] = "enabled";
$structure["defaultvalue"] = @$_SESSION["user"]["default_employeeid"];
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "description";
$structure["type"] = "input";
$structure["options"]["req"] = "yes";
$structure["options"]["width"] = "600";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "notes";
$structure["type"] = "textarea";
$structure["options"]["width"] = "600";
$structure["options"]["height"] = "50";
$this->obj_form->add_input($structure);
// submit button
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "Create Transaction";
$this->obj_form->add_input($structure);
// define subforms
$this->obj_form->subforms["general_ledger_transaction_details"] = array("code_gl", "date_trans", "employeeid", "description", "notes");
$this->obj_form->subforms["submit"] = array("submit");
// load any data returned due to errors
$this->obj_form->load_data_error();
}
示例13: execute
//.........这里部分代码省略.........
// general
$structure = form_helper_prepare_radiofromdb("billing_mode", "SELECT id, name as label, description as label1 FROM billing_modes WHERE active='1' AND name NOT LIKE '%advance%'");
$structure["options"]["req"] = "yes";
// replace all the -- joiners with <br> for clarity
for ($i = 0; $i < count($structure["values"]); $i++) {
$structure["translations"][$structure["values"][$i]] = str_replace("--", "<br><i>", $structure["translations"][$structure["values"][$i]]);
$structure["translations"][$structure["values"][$i]] .= "</i>";
}
$this->obj_form->add_input($structure);
// subforms
$this->obj_form->subforms["service_plan"] = array("name_service", "price", "price_setup", "discount", "billing_cycle", "billing_mode");
break;
case "phone_single":
case "phone_tollfree":
case "phone_trunk":
/*
Phones services are plans that get call cost values from rate tables.
*/
// general
$structure = form_helper_prepare_radiofromdb("billing_mode", "SELECT id, name as label, description as label1 FROM billing_modes WHERE active='1' AND name NOT LIKE '%advance%'");
$structure["options"]["req"] = "yes";
// replace all the -- joiners with <br> for clarity
for ($i = 0; $i < count($structure["values"]); $i++) {
$structure["translations"][$structure["values"][$i]] = str_replace("--", "<br><i>", $structure["translations"][$structure["values"][$i]]);
$structure["translations"][$structure["values"][$i]] .= "</i>";
}
$this->obj_form->add_input($structure);
// CDR info
$structure = NULL;
$structure["fieldname"] = "cdr_information";
$structure["type"] = "message";
$structure["defaultvalue"] = "<i>For phone services, call charges are defined in rate tables - you should setup general rate tables using the \"<a href=\"index.php?page=services/cdr-rates.php\">CDR Rate Tables</a>\" page. You can over-ride certain rates using the Rate Override page in the menu above.</i>";
$this->obj_form->add_input($structure);
$structure = form_helper_prepare_dropdownfromdb("id_rate_table", "SELECT id, rate_table_name as label FROM cdr_rate_tables");
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
// DDI options
if ($sql_plan_obj->data[0]["name"] == "phone_trunk") {
$structure = NULL;
$structure["fieldname"] = "phone_ddi_info";
$structure["type"] = "message";
$structure["defaultvalue"] = "<i>Use these fields to define the number of DDIs included in the plan as well as the cost of each DDI that a customer may want in addition of what is included with the plan.</i>";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "phone_ddi_included_units";
$structure["type"] = "input";
$structure["options"]["req"] = "yes";
$structure["defaultvalue"] = 1;
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "phone_ddi_price_extra_units";
$structure["type"] = "money";
$this->obj_form->add_input($structure);
}
// trunk options
if ($sql_plan_obj->data[0]["name"] == "phone_trunk" || $sql_plan_obj->data[0]["name"] == "phone_tollfree") {
$structure = NULL;
$structure["fieldname"] = "phone_trunk_info";
$structure["type"] = "message";
$structure["defaultvalue"] = "<i>Define the number of trunks (concurrent calls) that are included in the service, as well as the cost of each additional trunk that a customer may have.</i>";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "phone_trunk_included_units";
$structure["type"] = "input";
$structure["options"]["req"] = "yes";
$structure["defaultvalue"] = 1;
示例14: execute
function execute()
{
/*
Process Date Options
*/
// get the start date of the week
$this->date_selected_start = time_calculate_weekstart($this->date_selected_weekofyear, $this->date_selected_year);
// get the dates for each day of the week
$this->date_selected_daysofweek = time_calculate_daysofweek($this->date_selected_start);
// get the end date of the week
$this->date_selected_end = $this->date_selected_daysofweek[6];
/*
Employee Selection Form
*/
$this->obj_form_employee = new form_input();
$this->obj_form_employee->formname = "timereg_employee";
$this->obj_form_employee->language = $_SESSION["user"]["lang"];
// employee selection box
$sql_obj = new sql_query();
$sql_obj->prepare_sql_settable("staff");
$sql_obj->prepare_sql_addfield("id", "id");
$sql_obj->prepare_sql_addfield("label", "staff_code");
$sql_obj->prepare_sql_addfield("label1", "name_staff");
if ($this->access_staff_ids) {
$sql_obj->prepare_sql_addwhere("id IN (" . format_arraytocommastring($this->access_staff_ids) . ")");
}
$sql_obj->generate_sql();
$structure = form_helper_prepare_dropdownfromdb("employeeid", $sql_obj->string);
$structure["sql"] = "timereg.employeeid='value'";
$structure["options"]["autoselect"] = "on";
$structure["options"]["search_filter"] = "yes";
$this->obj_form_employee->add_input($structure);
// if there is currently no employee set, and there is only one
// employee in the selection box, automatically select it and update
// the session variables.
if (!$this->employeeid && count($structure["values"]) == 1) {
$this->employeeid = $structure["values"][0];
$_SESSION["form"]["timereg"]["employeeid"] = $structure["values"][0];
}
// if there is currently no employee set, and the user has configured
// a default employeeid, automatically select that ID and update the
// session variables
if (!$this->employeeid && $_SESSION["user"]["default_employeeid"]) {
$this->employeeid = $_SESSION["user"]["default_employeeid"];
$_SESSION["form"]["timereg"]["employeeid"] = $_SESSION["user"]["default_employeeid"];
}
$structure["options"]["autoselect"] = "on";
$structure["options"]["width"] = "600";
$structure["defaultvalue"] = $this->employeeid;
$this->obj_form_employee->add_input($structure);
// hidden values
$structure = NULL;
$structure["fieldname"] = "page";
$structure["type"] = "hidden";
$structure["defaultvalue"] = $_GET["page"];
$this->obj_form_employee->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "weekofyear";
$structure["type"] = "hidden";
$structure["defaultvalue"] = $this->date_selected_weekofyear;
$this->obj_form_employee->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "year";
$structure["type"] = "hidden";
$structure["defaultvalue"] = $this->date_selected_year;
$this->obj_form_employee->add_input($structure);
// submit button
$structure = NULL;
$structure["fieldname"] = "submit";
$structure["type"] = "submit";
$structure["defaultvalue"] = "Display";
$this->obj_form_employee->add_input($structure);
if ($this->employeeid) {
/*
DEFINE WEEK TABLE
We need to create a table showing all time booked for the currently
selected week.
1. Get a list of all project from the database that had time booked against
them this week.
2. Fetch total time spent on each project, for each day.
3. Display into a table, with easy edit + add links.
*/
// establish a new table object
$this->obj_table_week = new table();
$this->obj_table_week->language = $_SESSION["user"]["lang"];
$this->obj_table_week->tablename = "timereg_list";
// define all the columns and structure
$this->obj_table_week->add_column("standard", "projectandphase", "");
$this->obj_table_week->add_column("hourmins", "monday", "");
$this->obj_table_week->add_column("hourmins", "tuesday", "");
$this->obj_table_week->add_column("hourmins", "wednesday", "");
$this->obj_table_week->add_column("hourmins", "thursday", "");
$this->obj_table_week->add_column("hourmins", "friday", "");
$this->obj_table_week->add_column("hourmins", "saturday", "");
$this->obj_table_week->add_column("hourmins", "sunday", "");
// defaults
//.........这里部分代码省略.........
示例15: execute
function execute()
{
/*
Define form structure
*/
$this->obj_form = new form_input();
$this->obj_form->formname = "transaction_view";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "accounts/gl/edit-process.php";
$this->obj_form->method = "post";
// general
$structure = NULL;
$structure["fieldname"] = "code_gl";
$structure["type"] = "input";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "date_trans";
$structure["type"] = "date";
$structure["defaultvalue"] = date("Y-m-d");
$structure["options"]["req"] = "yes";
$this->obj_form->add_input($structure);
$sql_struct_obj = new sql_query();
$sql_struct_obj->prepare_sql_settable("staff");
$sql_struct_obj->prepare_sql_addfield("id", "staff.id");
$sql_struct_obj->prepare_sql_addfield("label", "staff.staff_code");
$sql_struct_obj->prepare_sql_addfield("label1", "staff.name_staff");
$sql_struct_obj->prepare_sql_addorderby("staff_code");
$sql_struct_obj->prepare_sql_addwhere("id = 'CURRENTID' OR date_end = '0000-00-00'");
$structure = form_helper_prepare_dropdownfromobj("employeeid", $sql_struct_obj);
$structure["options"]["req"] = "yes";
$structure["options"]["autoselect"] = "yes";
$structure["options"]["width"] = "600";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "description";
$structure["type"] = "input";
$structure["options"]["width"] = "600";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "description_useall";
$structure["type"] = "checkbox";
$structure["options"]["label"] = "Check this to use the description above as the description in all the rows below. Untick if you wish to have different messages for each transaction item.";
$structure["defaultvalue"] = "on";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "notes";
$structure["type"] = "textarea";
$structure["options"]["width"] = "600";
$structure["options"]["height"] = "50";
$this->obj_form->add_input($structure);
/*
Define transaction form structure
*/
// unless there has been error data returned, fetch all the transactions
// from the DB, and work out the number of rows
if (!isset($_SESSION["error"]["form"][$this->obj_form->formname])) {
$sql_trans_obj = new sql_query();
$sql_trans_obj->string = "SELECT date_trans, amount_debit, amount_credit, chartid, source, memo FROM `account_trans` WHERE type='gl' AND customid='" . $this->id . "'";
$sql_trans_obj->execute();
if ($sql_trans_obj->num_rows()) {
$sql_trans_obj->fetch_array();
$this->num_trans = $sql_trans_obj->data_num_rows + 1;
}
} else {
$this->num_trans = @security_script_input('/^[0-9]*$/', $_SESSION["error"]["num_trans"]) + 1;
}
// ensure there are always 2 rows at least, additional rows are added if required (ie viewing
// an existing transaction) or on the fly when needed by javascript UI.
if ($this->num_trans < 2) {
$this->num_trans = 2;
}
// transaction rows
for ($i = 0; $i < $this->num_trans; $i++) {
// account
$structure = form_helper_prepare_dropdownfromdb("trans_" . $i . "_account", "SELECT id, code_chart as label, description as label1 FROM account_charts WHERE chart_type!='1' ORDER BY code_chart");
$structure["options"]["width"] = "200";
$this->obj_form->add_input($structure);
// debit field
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_debit";
$structure["type"] = "input";
$structure["options"]["width"] = "80";
$this->obj_form->add_input($structure);
// credit field
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_credit";
$structure["type"] = "input";
$structure["options"]["width"] = "80";
$this->obj_form->add_input($structure);
// source
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_source";
$structure["type"] = "input";
$structure["options"]["width"] = "100";
$this->obj_form->add_input($structure);
// description
$structure = NULL;
$structure["fieldname"] = "trans_" . $i . "_description";
$structure["type"] = "textarea";
$this->obj_form->add_input($structure);
//.........这里部分代码省略.........