コード例 #1
0
ファイル: creating.php プロジェクト: klan1/k1.lib
 /**
  * Override the original function to create an empty array the meets the requiriements for all the metods
  * @return boolean
  */
 public function load_db_table_data($blank_data = FALSE)
 {
     if (!$blank_data) {
         return parent::load_db_table_data();
     } else {
         $headers_array = [];
         $blank_row_array = [];
         $show_rule = $this->db_table->get_db_table_show_rule();
         foreach ($this->db_table->get_db_table_config() as $field => $config) {
             if (!empty($this->db_table->get_constant_fields()) && array_key_exists($field, $this->db_table->get_constant_fields())) {
                 continue;
             }
             if ($show_rule === NULL || $config[$show_rule]) {
                 $headers_array[$field] = $field;
                 $blank_row_array[$field] = "";
             }
         }
         if (!empty($headers_array) && !empty($blank_row_array)) {
             $this->db_table_data[0] = $headers_array;
             $this->db_table_data[1] = $blank_row_array;
             $this->db_table_data_filtered = $this->db_table_data;
             return TRUE;
         } else {
             return FALSE;
         }
     }
 }
コード例 #2
0
ファイル: reading.php プロジェクト: klan1/k1.lib
 public function __construct($db_table, $row_keys_text, $custom_auth_code = "")
 {
     if (!empty($row_keys_text)) {
         parent::__construct($db_table, $row_keys_text, $custom_auth_code);
     } else {
         DOM_notification::queue_mesasage(object_base_strings::$error_no_row_keys_text, "alert", $this->notifications_div_id, \k1lib\common_strings::$error);
     }
     /**
      * Necessary for do not loose the inputs with blank or null data
      */
     $this->skip_blanks_on_filters = TRUE;
 }
コード例 #3
0
ファイル: listing.php プロジェクト: klan1/k1.lib
 public function load_db_table_data($show_rule = null)
 {
     // FIRST of all, get TABLE total rows
     $this->total_rows = $this->db_table->get_total_rows();
     // THEN get from GET vars if there is a row per page value
     if (isset($_GET[$this->object_id . "-rows"])) {
         $possible_rows_to_set = $_GET[$this->object_id . "-rows"];
         if ($possible_rows_to_set <= $this->total_rows) {
             self::$rows_per_page = $possible_rows_to_set;
         } else {
             // DO NOTHING
         }
     }
     // now we can know the total pages
     $this->total_pages = ceil($this->total_rows / self::$rows_per_page);
     // The rows per page have to have a value, if is not set then we have to set it as the total rows
     if (self::$rows_per_page == 0) {
         self::$rows_per_page = $this->total_rows;
     }
     /**
      * Catch the GET value for pagination
      */
     if (isset($_GET[$this->object_id . "-page"])) {
         $possible_page_to_set = $_GET[$this->object_id . "-page"];
         if ($possible_page_to_set >= 1 && $possible_page_to_set <= $this->total_pages) {
             $this->actual_page = $possible_page_to_set;
         } else {
             $this->actual_page = 1;
         }
     }
     // SQL Limit time !
     if (self::$rows_per_page !== 0) {
         $offset = ($this->actual_page - 1) * self::$rows_per_page;
         $this->db_table->set_query_limit($offset, self::$rows_per_page);
     }
     if ($this->do_orderby_headers) {
         $this->apply_orderby_headers();
     }
     // GET DATA with a SQL Query
     if (parent::load_db_table_data($show_rule)) {
         $this->total_rows_filter = $this->db_table->get_total_data_rows();
         $this->first_row_number = $this->db_table->get_query_offset() + 1;
         $this->last_row_number = $this->db_table->get_query_offset() + $this->db_table->get_total_data_rows();
         return TRUE;
     } else {
         return FALSE;
     }
 }