コード例 #1
0
ファイル: list.php プロジェクト: klan1/k1.lib
 /**
  * @return \k1lib\html\div|boolean
  */
 public function exec_board()
 {
     if (!$this->is_enabled) {
         return FALSE;
     }
     /**
      * HTML DB TABLE
      */
     if ($this->data_loaded) {
         if ($this->apply_label_filter) {
             $this->list_object->apply_label_filter();
         }
         if ($this->apply_field_label_filter) {
             $this->list_object->apply_field_label_filter();
         }
         if (\k1lib\forms\file_uploads::is_enabled()) {
             $this->list_object->apply_file_uploads_filter();
         }
         // IF NOT previous link applied this will try to apply ONLY on keys if are present on show-list filter
         if (!$this->list_object->get_link_on_field_filter_applied()) {
             $get_vars = ["auth-code" => "--authcode--", "back-url" => $_SERVER['REQUEST_URI']];
             $this->list_object->apply_link_on_field_filter(url::do_url("../{$this->controller_object->get_board_read_url_name()}/--rowkeys--/", $get_vars), crudlexs_base::USE_KEY_FIELDS);
         }
         // Show stats BEFORE
         if ($this->stats_enable && ($this->where_to_show_stats == self::SHOW_BEFORE_TABLE || $this->where_to_show_stats == self::SHOW_BEFORE_AND_AFTER_TABLE)) {
             $this->list_object->do_pagination()->append_to($this->board_content_div);
             $this->list_object->do_row_stats()->append_to($this->board_content_div);
         }
         /**
          * HTML OBJECT
          */
         $list_content_div = $this->list_object->do_html_object();
         $list_content_div->append_to($this->board_content_div);
         // Show stats AFTER
         if ($this->stats_enable && ($this->where_to_show_stats == self::SHOW_AFTER_TABLE || $this->where_to_show_stats == self::SHOW_BEFORE_AND_AFTER_TABLE)) {
             $this->list_object->do_row_stats()->append_to($this->board_content_div);
             $this->list_object->do_pagination()->append_to($this->board_content_div);
         }
         return $this->board_content_div;
     } else {
         $this->list_object->do_html_object()->append_to($this->board_content_div);
         return $this->board_content_div;
     }
 }
コード例 #2
0
ファイル: read.php プロジェクト: klan1/k1.lib
 /**
  * 
  * @param \k1lib\crudlexs\class_db_table $db_table
  * @param array $field_links_array
  * @param string $title
  * @param string $board_root
  * @param string $board_create
  * @param string $board_read
  * @param boolean $show_create
  * @return \k1lib\html\div|boolean
  */
 public function create_related_list(class_db_table $db_table, $field_links_array, $title, $board_root, $board_create, $board_read, $board_list, $use_back_url = FALSE, $clear_url = FALSE)
 {
     $table_alias = \k1lib\db\security\db_table_aliases::encode($db_table->get_db_table_name());
     $detail_div = new \k1lib\html\div();
     $this->related_list = $this->do_related_list($db_table, $field_links_array, $board_root, $board_read);
     if (!empty($this->related_list)) {
         $current_row_keys_text = $this->read_object->get_row_keys_text();
         $current_row_keys_text_auth_code = md5(\k1lib\K1MAGIC::get_value() . $current_row_keys_text);
         $detail_div->set_class("k1lib-related-data-list {$table_alias}");
         $related_title = $detail_div->append_h4($title, "{$table_alias}");
         $detail_div->append_div("related-messaje");
         if ($data_loaded) {
             $get_vars = ["auth-code" => $current_row_keys_text_auth_code, "back-url" => $_SERVER['REQUEST_URI']];
             $all_data_url = url::do_url(APP_URL . $board_root . "/" . $board_list . "/{$current_row_keys_text}/", $get_vars, FALSE);
             $this->related_html_object_show_all_data = \k1lib\html\get_link_button($all_data_url, board_read_strings::$button_all_data, "tiny");
             if ($this->related_show_all_data) {
                 $related_title->set_value($this->related_html_object_show_all_data, TRUE);
             }
         }
         if ($use_back_url) {
             $get_vars = ["auth-code" => $current_row_keys_text_auth_code, "back-url" => $_SERVER['REQUEST_URI']];
             $create_url = url::do_url(APP_URL . $board_root . "/" . $board_create . "/{$current_row_keys_text}/", $get_vars, TRUE);
         } else {
             $get_vars = ["auth-code" => $current_row_keys_text_auth_code];
             $create_url = url::do_url(APP_URL . $board_root . "/" . $board_create . "/{$current_row_keys_text}/", $get_vars, TRUE, ['back-url'], FALSE);
         }
         $this->related_html_object_show_new = \k1lib\html\get_link_button($create_url, board_list_strings::$button_new, "tiny");
         if ($this->related_show_new) {
             $related_title->set_value($this->related_html_object_show_new, TRUE);
         }
         $this->related_list->do_html_object()->append_to($detail_div);
         $this->related_html_table_object = $this->related_list->get_html_table();
         if ($db_table->get_total_rows() > $this->related_rows_to_show) {
             $this->related_list->do_pagination()->append_to($detail_div);
             $this->related_list->do_row_stats()->append_to($detail_div);
         }
         listing::$rows_per_page = $actual_rows_per_page;
     }
     // TODO: NONSENSE line !
     //        $this->set_related_show_new(TRUE);
     return $detail_div;
 }