Exemplo n.º 1
0
}
$class_name = "TransportProgramming";
//$class_name1="MyExpense";
//$class_name2="MyExpensePerson";
$table_name = $class_name::get_table_name();
$order_name = !empty($_GET["order_name"]) ? $_GET["order_name"] : 'id';
$order_type = !empty($_GET["order_type"]) ? $_GET["order_type"] : 'ASC';
//echo get_where_string($class_name);
$page = !empty($_GET['page']) ? (int) $_GET["page"] : 1;
$per_page = 20;
$where = get_where_string($class_name);
$total_count = $class_name::count_all_where($where);
$pagination = new Pagination($page, $per_page, $total_count);
require_once LIB_PATH . DS . 'download' . DS . 'download_csv.php';
$sql = "SELECT * FROM {$table_name} ";
$sql .= " " . get_where_string($class_name);
if (isset($order_name)) {
    $sql .= " ORDER BY {$order_name} {$order_type} ";
}
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
//echo "<p>$sql</p>";
//unset($_GET);
$result_class = $class_name::find_by_sql($sql);
$query_string = remove_get(array('view', 'page'));
$view_full_table = !empty($_GET) ? (int) $_GET["view"] : 0;
if ($view_full_table == 1) {
    $page_link_view = $class_name::$page_manage . $query_string . "page=" . u($page) . "&view=" . u(0);
    $page_link_text = $class_name::$page_name . " short view";
    //$add_view="&view=".u(1);
    $offset = "col-md-offset-2";
Exemplo n.º 2
0
 public static function display_table_head_new($long_short = 0, $edit = true)
 {
     // $query_string= urldecode($_SERVER['QUERY_STRING']);
     $query_string = remove_get(array('order_name', 'order_type', 'page'));
     if ($long_short == 1) {
         $table_field = static::$db_fields_table_display_full;
     } else {
         $table_field = static::$db_fields_table_display_short;
     }
     $output = "";
     $where = get_where_string(get_called_class());
     $found_count = static::count_all_where($where);
     $total_count = static::count_all();
     if ($found_count !== $total_count) {
         //            $output.="<b>Found records: <span style='color:blue;'> ".h($found_count)." of ".h($total_count)."</span></b> | ";
     }
     foreach ($_GET as $key => $val) {
         $key_clean = str_replace("_", " ", $key);
         $key_clean = ucfirst($key_clean);
         if (!empty($_GET[$key]) && !in_array($key, array('page', 'view'))) {
             //                $output.="<b>".h($key_clean)." <span style='color:blue;'> ".h(urldecode($_GET[$key]))."</span></b> | ";
         }
     }
     //        $output.= "<tr>";
     foreach ($table_field as $fieldname) {
         if (property_exists(new static(), $fieldname)) {
             $fieldname = str_replace("_", " ", $fieldname);
             $fieldname = ucfirst($fieldname);
             $output .= "<th class='text-center'>" . $fieldname . "</th>";
         }
     }
     if ($edit) {
         //            $output.= "<th colspan=\"1\" class=\"text-center\" style='vertical-align:middle;'>Actions</th>";
         $output .= "<th>Actions</th>";
         $output .= "<th></th>";
     }
     //        $output.= "</tr>";
     return $output;
 }