コード例 #1
0
ファイル: read.php プロジェクト: klan1/k1.lib
 /**
  * @param \k1lib\crudlexs\class_db_table $db_table
  * @param array $field_links_array
  * @param string $board_root
  * @param string $board_read
  * @param boolean $clear_url
  * @return \k1lib\crudlexs\listing|boolean
  */
 public function do_related_list(class_db_table $db_table, $field_links_array, $board_root, $board_read, $clear_url = FALSE)
 {
     $table_alias = \k1lib\db\security\db_table_aliases::encode($db_table->get_db_table_name());
     if ($this->is_enabled && $this->read_object->is_valid()) {
         /**
          * Clients list
          */
         if ($db_table->get_state()) {
             if ($this->related_use_rows_key_text) {
                 $current_row_keys_array = $this->read_object->get_row_keys_array();
                 $db_table->set_field_constants($current_row_keys_array);
                 $db_table->set_query_filter($current_row_keys_array, TRUE, $this->related_do_clean_array_on_query_filter);
             }
             /**
              * LIST OBJECT must be created here to know if ther is data or not to show
              * all data button.
              */
             $this->related_list = new \k1lib\crudlexs\listing($db_table, FALSE);
             $this->related_list->set_rows_per_page($this->related_rows_to_show);
             $data_loaded = $this->related_list->load_db_table_data($this->related_use_show_rule);
             if ($data_loaded) {
                 if ($this->related_apply_filters) {
                     $this->related_apply_filters();
                     $this->related_apply_link_read_field($field_links_array, $board_root, $board_read, $clear_url);
                 }
             }
             return $this->related_list;
         } else {
             trigger_error("DB Table couldn't be opened : " . $db_table->get_db_table_name(), E_USER_NOTICE);
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
コード例 #2
0
ファイル: list.php プロジェクト: klan1/k1.lib
 /**
  * @return \k1lib\html\div|boolean
  */
 public function start_board()
 {
     if (!parent::start_board()) {
         return FALSE;
     }
     if ($this->list_object->get_state()) {
         /**
          * BACK
          */
         if ($this->back_enable && isset($_GET['back-url'])) {
             $back_url = \k1lib\urlrewrite\get_back_url();
             $back_link = \k1lib\html\get_link_button($back_url, board_read_strings::$button_back);
             $back_link->append_to($this->button_div_tag);
         }
         /**
          * NEW BUTTON
          */
         $related_url_keys_text = url::get_url_level_value_by_name("related_url_keys_text");
         if (empty($related_url_keys_text)) {
             $related_url_keys_text = "";
             $new_link = \k1lib\html\get_link_button(url::do_url("../{$this->controller_object->get_board_create_url_name()}/" . $related_url_keys_text), board_list_strings::$button_new);
         } else {
             $related_url_keys_text .= "/";
             $new_link = \k1lib\html\get_link_button(url::do_url("../../{$this->controller_object->get_board_create_url_name()}/" . $related_url_keys_text), board_list_strings::$button_new);
         }
         if ($this->create_enable) {
             //                $new_link = \k1lib\html\get_link_button(url::do_url("../{$this->controller_object->get_board_create_url_name()}/" . $related_url_keys_text), board_list_strings::$button_new);
             //                $new_link = \k1lib\html\get_link_button("../{$this->controller_object->get_board_create_url_name()}/?back-url={$this_url}", board_list_strings::$button_new);
             $new_link->append_to($this->button_div_tag);
         }
         /**
          * Search
          */
         if ($this->search_enable) {
             $search_iframe = new \k1lib\html\iframe(url::do_url($this->controller_object->get_controller_root_dir() . "search/?just-controller=1&caller-url=" . urlencode($_SERVER['REQUEST_URI'])), 'utility-iframe', "search-iframe");
             //                $this->board_content_div->append_child_tail($search_iframe);
             DOM::html()->body()->append_child_tail($search_iframe);
             //                $search_iframe->append_to($this->board_content_div);
             $search_buttom = new \k1lib\html\a(NULL, " " . board_list_strings::$button_search, "_self");
             $search_buttom->set_id("search-button");
             $search_buttom->set_attrib("class", "button fi-page-search");
             $search_buttom->append_to($this->button_div_tag);
             if (isset($_POST) && isset($_POST['from-search']) && urldecode($_POST['from-search']) == $_SERVER['REQUEST_URI']) {
                 //                    if ($this->)
                 /**
                  * decrypt post field names
                  */
                 $incomming_search_data = \k1lib\forms\check_all_incomming_vars($_POST);
                 if ($this->list_object->get_do_table_field_name_encrypt()) {
                     $search_data = $this->list_object->decrypt_field_names($incomming_search_data);
                 } else {
                     $search_data = $incomming_search_data;
                 }
                 $this->controller_object->db_table->set_query_filter($search_data);
                 $search_post = \k1lib\common\serialize_var($_POST, urlencode($_SERVER['REQUEST_URI']));
                 /**
                  * Clear search
                  */
                 $clear_search_buttom = new \k1lib\html\a(url::do_url($_SERVER['REQUEST_URI']), board_list_strings::$button_search_cancel, "_self");
                 $search_buttom->set_value(" " . board_list_strings::$button_search_modify);
                 $clear_search_buttom->set_attrib("class", "button warning");
                 $clear_search_buttom->append_to($this->button_div_tag);
             } else {
                 $search_post = \k1lib\common\unset_serialize_var(urlencode($_SERVER['REQUEST_URI']));
             }
         }
         $this->data_loaded = $this->list_object->load_db_table_data($this->show_rule_to_apply);
         return $this->board_content_div;
     } else {
         DOM_notification::queue_mesasage(board_base_strings::$error_mysql_table_not_opened, "alert", $this->notifications_div_id);
         DOM_notification::queue_title(board_base_strings::$error_mysql);
         $this->list_object->make_invalid();
         $this->is_enabled = FALSE;
         return FALSE;
     }
 }