connect(DB::parseDSN('mysql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));
if(DB::isError($result_conn)){ die($result_conn->getDebugInfo()); }
$sql=" SELECT "
."dentalprograms.ID, "
."dentalprograms.country, "
."dentalprograms.program, "
."dentalprograms.name, "
."dentalprograms.address, "
."dentalprograms.city, "
."dentalprograms.state, "
."dentalprograms.state1, "
."dentalprograms.zip, "
."dentalprograms.telephone, "
."dentalprograms.coordinator, "
."dentalprograms.lastaccred, "
."dentalprograms.nextaccred, "
."dentalprograms.lat, "
."dentalprograms.lng "
."FROM dentalprograms Where dentalprograms.program='Clinic'"
;
$debug_mode = false; /* display SQL statements while processing */
$messaging = true; /* display system messages on a screen */
$unique_prefix = "a_"; /* prevent overlays - must be started with a letter */
$dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
$default_order_field = "state1";
$default_order_type = "ASC";
$dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);
$dg_encoding = "utf8";
$dg_collation = "utf8_unicode_ci";
$dgrid->setEncoding($dg_encoding, $dg_collation);
$postback_method = "ajax";
$dgrid->SetPostBackMethod($postback_method);
$dg_language = "en";
$dgrid->setInterfaceLang($dg_language);
$direction = "ltr";
$dgrid->setDirection($direction);
## *** set layouts: 0 - tabular(horizontal) - default, 1 - columnar(vertical)
$layouts = array("view"=>0, "edit"=>1, "details"=>1, "filter"=>1);
$dgrid->setLayouts($layouts);
$view_template = "";
$add_edit_template = "";
$details_template['body'] = "
{program} | {name} | {address} | {city} | {state} | {zip} | {telephone} |
";
$details_template['footer'] = "";
$dgrid->SetTemplates($view_template, $add_edit_template, $details_template);
$modes = array(
"add" =>array("view"=>false, "edit"=>false, "type"=>"link"),
"edit" =>array("view"=>false, "edit"=>true, "type"=>"link", "byFieldValue"=>""),
"cancel" =>array("view"=>false, "edit"=>false, "type"=>"link"),
"details" =>array("view"=>false, "edit"=>true, "type"=>"link"),
"delete" =>array("view"=>false, "edit"=>false, "type"=>"image")
);
$dgrid->setModes($modes);
$css_class = "blue";
$dgrid->SetCssClass($css_class);
## +-- Scrolling --------------------------------------------------------------+
## *** allow scrolling on datagrid
$scrolling_option = true;
$dgrid->AllowScrollingSettings($scrolling_option);
## *** set scrolling settings (optional)
$scrolling_height = "250px"; /* ex.: "190px" or "190" */
$dgrid->SetScrollingSettings($scrolling_height);
$multirow_option = false;
$dgrid->allowMultirowOperations($multirow_option);
$multirow_operations = array(
"delete" => array("view"=>false),
"details" => array("view"=>false)
);
$dgrid->setMultirowOperations($multirow_operations);
$http_get_vars = array("act", "id");
$dgrid->SetHttpGetVars($http_get_vars);
$printing_option = false;
$dgrid->allowPrinting($printing_option);
$exporting_option = false;
$dgrid->allowExporting($exporting_option);
$sorting_option = true;
$dgrid->allowSorting($sorting_option);
$paging_option = true;
$rows_numeration = false;
$numeration_sign = "N #";
$dropdown_paging = true;
$dgrid->AllowPaging($paging_option, $rows_numeration, $numeration_sign, $dropdown_paging);
$bottom_paging = array("results"=>true, "results_align"=>"left", "pages"=>false, "pages_align"=>"center", "page_size"=>false, "page_size_align"=>"right");
/// $top_paging = array("results"=>false, "results_align"=>"left", "pages"=>false, "pages_align"=>"center", "page_size"=>false, "page_size_align"=>"right");
/// $pages_array = array("25"=>"25", "30"=>"30", "35"=>"35", "40"=>"40", "45"=>"45", "50"=>"50", "55"=>"55", "60"=>"60", "65"=>"65", "70"=>"70");
$default_page_size = 500;
$paging_arrows = array("first"=>"First", "previous"=>"Previous", "next"=>"Next", "last"=>"Last");
$dgrid->setPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size, $paging_arrows );
$filtering_option = false;
$show_search_type = false;
$dgrid->AllowFiltering($filtering_option, $show_search_type);
$filtering_fields = array(
"Country" =>array("type"=>"dropdownlist", "table"=>"dentalprograms", "field"=>"country", "field_view"=>"", "order"=>"ASC", "source"=>"self", "case_sensitive"=>"false", "comparison_type"=>"string", "width"=>"", "multiple"=>"false", "multiple_size"=>"4", "on_js_event"=>""),
"State" =>array("type"=>"dropdownlist", "table"=>"dentalprograms", "field"=>"state1", "field_view"=>"", "order"=>"ASC", "source"=>"self", "case_sensitive"=>"false", "comparison_type"=>"string", "width"=>"", "multiple"=>"false", "multiple_size"=>"4", "on_js_event"=>""),
"City" =>array("type"=>"dropdownlist", "table"=>"dentalprograms", "field"=>"city", "field_view"=>"", "order"=>"ASC", "source"=>"self", "case_sensitive"=>"false", "comparison_type"=>"string", "width"=>"", "multiple"=>"false", "multiple_size"=>"4", "on_js_event"=>""),
);
$dgrid->setFieldsFiltering($filtering_fields);
$vm_table_properties = array("width"=>"100%");
$dgrid->setViewModeTableProperties($vm_table_properties);
$vm_colimns = array(
"name" =>array("header"=>"Dental School", "type"=>"linktoview", "align"=>"left", "width"=>"210px", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal", "summarize"=>"false", "sort_type"=>"string", "sort_by"=>"", "visible"=>"true", "field_data"=>"name", "rel"=>"", "title"=>"", "href"=>"", "on_js_event"=>""),
"city" =>array("header"=>"City", "type"=>"label", "align"=>"left", "width"=>"210px", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal"),
"state1" =>array("header"=>"State", "type"=>"label", "align"=>"left", "width"=>"210px", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal")
);
$dgrid->setColumnsInViewMode($vm_colimns);
$em_table_properties = array("width"=>"85%");
$dgrid->SetEditModeTableProperties($em_table_properties);
$dm_table_properties = array("width"=>"100%");
$dgrid->setDetailsModeTableProperties($dm_table_properties);
$table_name = "dentalprograms";
$primary_key = "ID";
$condition = "";
$dgrid->setTableEdit($table_name, $primary_key, $condition);
$em_columns = array(
"name" =>array("header"=>"Dental School", "type"=>"textbox", "width"=>"210px", "req_type"=>"ry", "title"=>"Dental School", "unique"=>true),
"address" =>array("header"=>"Location","type"=>"textbox", "width"=>"210px", "req_type"=>"rt", "title"=>"Address"),
"city" =>array("header"=>"City", "type"=>"textbox", "source"=>"self", "view_type"=>"dropdownlist", "width"=>"210px", "req_type"=>"ri", "title"=>"City"),
"state" =>array("header"=>"State", "type"=>"textbox", "source"=>"self", "view_type"=>"dropdownlist", "width"=>"210px", "req_type"=>"ri", "title"=>"State"),
"zip" =>array("header"=>"Zipcode", "type"=>"enum", "req_type"=>"st", "width"=>"210px", "title"=>"Zipcode"),
"telephone" =>array("header"=>"Telephone", "type"=>"textbox", "width"=>"210px", "req_type"=>"st", "title"=>"Telephone"),
"lat" =>array("header"=>"Get Directions To:", "type"=>"link", "req_type"=>"ri", "width"=>"210px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "field_key"=>"lat", "field_key_1"=>"lng", "field_data"=>"name", "rel"=>"", "title"=>"", "target"=>"_blank", "href"=>"http://maps.google.com/maps?saddr=&daddr=({0},{1})"),
);
$dgrid->SetColumnsInEditMode($em_columns);
$auto_column_in_edit_mode = false;
$dgrid->setAutoColumnsInEditMode($auto_column_in_edit_mode);
?>