예제 #1
0
파일: update.php 프로젝트: klan1/k1.lib
 /**
  * @return \k1lib\html\div|boolean
  */
 public function start_board()
 {
     if (!parent::start_board()) {
         return FALSE;
     }
     /**
      * IFRAME for KF tool
      */
     $fk_iframe = new \k1lib\html\iframe('', 'utility-iframe', "fk-iframe");
     DOM::html()->body()->content()->append_child_tail($fk_iframe);
     if (!empty($this->row_keys_text)) {
         if ($this->update_object->get_state()) {
             $this->update_object->set_back_url(\k1lib\urlrewrite\get_back_url());
             $this->update_object->set_do_table_field_name_encrypt(TRUE);
             $this->controller_object->db_table->set_db_table_show_rule($this->show_rule_to_apply);
             $this->data_loaded = $this->update_object->load_db_table_data();
             $this->update_object->catch_post_data();
             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);
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
예제 #2
0
파일: search.php 프로젝트: klan1/k1.lib
 /**
  * @return \k1lib\html\div|boolean
  */
 public function start_board()
 {
     if (!parent::start_board()) {
         return FALSE;
     }
     /**
      * IFRAME for KF tool
      */
     $fk_iframe = new \k1lib\html\iframe('', 'utility-iframe', "fk-iframe");
     DOM::html()->body()->content()->append_child_tail($fk_iframe);
     if ($this->search_object->get_state()) {
         $close_search_buttom = new \k1lib\html\a(NULL, " " . \k1lib\common_strings::$button_cancel, "_parent");
         $close_search_buttom->set_id("close-search-button");
         $close_search_buttom->set_attrib("class", "button warning fi-page-close");
         $close_search_buttom->set_attrib("onClick", "parent.close_search();");
         $close_search_buttom->append_to($this->button_div_tag);
         $this->search_object->set_search_catch_post_enable($this->search_catch_post_enable);
         $this->search_object->set_html_column_classes("column large-11 medium-11 small-12");
         $this->search_object->set_html_form_column_classes("large-11");
         $this->search_object->do_html_object()->append_to($this->board_content_div);
         return $this->board_content_div;
     } else {
         DOM_notification::queue_mesasage(board_base_labels::$error_mysql_table_not_opened, "alert", $this->notifications_div_id);
         DOM_notification::queue_title(board_base_labels::$error_mysql);
         return FALSE;
     }
 }
예제 #3
0
파일: functions.php 프로젝트: klan1/k1.lib
function error_404($non_found_name)
{
    header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found", true, 404);
    DOM::start();
    DOM::html()->body()->append_h1('404 Not found');
    DOM::html()->body()->append_p('The controller file \'' . $non_found_name . '\' is not on path.');
    echo DOM::generate();
    trigger_error('App error fired', E_USER_NOTICE);
    exit;
}
예제 #4
0
파일: global.php 프로젝트: klan1/k1.lib
function d($var, $var_dump = FALSE, $trigger_notice = TRUE)
{
    //    trigger_error(__FILE__, E_USER_ERROR);
    $msg = $var_dump ? var_export($var, TRUE) : print_r($var, TRUE);
    if ($trigger_notice) {
        trigger_error($msg, E_USER_NOTICE);
    }
    if (DOM::is_started()) {
        $pre = new \k1lib\html\pre($msg);
        if (!empty(DOM::html()->body()->get_element_by_id("k1lib-output"))) {
            k1lib\notifications\on_DOM::queue_title('Message from K1.lib', 'warning');
            k1lib\notifications\on_DOM::queue_mesasage($pre->generate(), 'warning');
        } else {
            echo $pre->generate();
        }
    } else {
        echo $msg;
    }
}
예제 #5
0
 /**
  * One line config for more time to party and less coding :)
  * @param string $app_base_dir Use here \k1app\APP_BASE_URL
  * @param \PDO $db DB app object
  * @param string $db_table_name Table to open from the DB
  * @param string $controller_name Name for html title and controller name tag
  * @param string $template_place_name_html_title 
  * @param string $template_place_name_controller_name 
  */
 public function __construct($app_base_dir, \PDO $db, $db_table_name, $controller_name, $title_tag_class = null)
 {
     /**
      * URL Management
      */
     $this->controller_root_dir = $app_base_dir . url::make_url_from_rewrite('this');
     $this->controller_url_value = url::get_url_level_value('this');
     $this->controller_board_url_value = $this->set_and_get_next_url_value();
     /**
      * DB Table 
      */
     $this->db_table = new \k1lib\crudlexs\class_db_table($db, $db_table_name);
     /**
      * Controller name for add on <html><title> and controller name tag
      */
     $this->controller_name = $controller_name;
     $this->html_title_tags = DOM::html()->body()->get_elements_by_class($title_tag_class);
     if (!empty($this->html_title_tags)) {
         $span = (new \k1lib\html\span("subheader"))->set_value($controller_name);
         foreach ($this->html_title_tags as $tag) {
             $tag->set_value($span);
         }
         DOM::html()->head()->set_title(DOM::html()->head()->get_title() . " | {$controller_name}");
     }
     //        temply::set_place_value($this->template_place_name_html_title, " | $controller_name");
     //        temply::set_place_value($this->template_place_name_controller_name, $controller_name);
     /**
      * SET FROM LANG HACK
      */
     $this->board_list_name = controller_base_strings::$board_list_name;
     $this->board_create_name = controller_base_strings::$board_create_name;
     $this->board_read_name = controller_base_strings::$board_read_name;
     $this->board_update_name = controller_base_strings::$board_update_name;
     $this->board_delete_name = controller_base_strings::$board_delete_name;
     if (DOM::html()->body()) {
         $js_file = dirname(__DIR__) . '/js/crudlexs.js';
         if (file_exists($js_file)) {
             $js_content = file_get_contents($js_file);
             $js_script = new \k1lib\html\script();
             $js_script->set_value($js_content);
             DOM::html()->body()->append_child_tail($js_script);
         } else {
             d($js_file);
         }
     }
 }
예제 #6
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;
     }
 }
예제 #7
0
 public function set_board_name($board_name)
 {
     if (!empty($board_name)) {
         $head = DOM::html()->head();
         $current_html_title = $head->get_title();
         $head->set_title($current_html_title . " - " . $board_name);
         if (is_array($this->controller_object->html_title_tags)) {
             foreach ($this->controller_object->html_title_tags as $tag) {
                 $tag->set_value(" - {$board_name}", TRUE);
             }
         }
     }
 }
예제 #8
0
파일: classes.php 프로젝트: klan1/k1.lib
 static function insert_messases_on_DOM($order = 'asc')
 {
     if (isset($_SESSION['k1lib_notifications']) && empty(self::$data)) {
         self::$data =& $_SESSION['k1lib_notifications'];
     }
     if (isset($_SESSION['k1lib_notifications_titles']) && empty(self::$data_titles)) {
         self::$data_titles =& $_SESSION['k1lib_notifications_titles'];
     }
     if (isset(self::$data[self::$section_name]) && !empty(self::$data[self::$section_name])) {
         if ($order == 'asc') {
             self::$data[self::$section_name] = array_reverse(self::$data[self::$section_name]);
         }
         $tag_object = DOM::html()->body()->get_element_by_id("k1lib-output");
         foreach (self::$data[self::$section_name] as $tag_id => $types_messages) {
             if ($tag_object->get_attribute("id") != $tag_id) {
                 $tag_object = DOM::html()->body()->get_element_by_id($tag_id);
                 if (empty($tag_object)) {
                     if (DOM::html()->body()->header()) {
                         $tag_object = DOM::html()->body()->header()->append_div(NULL, $tag_id);
                     } else {
                         $tag_object = DOM::html()->body()->append_child_head(new \k1lib\html\div(NULL, $tag_id));
                     }
                 }
                 // else no needed
             }
             // else no needed
             foreach ($types_messages as $type => $messages) {
                 $call_out = new \k1lib\html\foundation\callout();
                 $call_out->set_class($type);
                 if (isset(self::$data_titles[self::$section_name][$type]) && !empty(self::$data_titles[self::$section_name][$type])) {
                     $call_out->set_title(self::$data_titles[self::$section_name][$type]);
                 }
                 if (count($messages) === 1) {
                     $call_out->set_message($messages[0]);
                     $call_out->append_to($tag_object);
                 } else {
                     $ul = new \k1lib\html\ul();
                     foreach ($messages as $message) {
                         $ul->append_li($message);
                     }
                     $call_out->set_message($ul);
                     $call_out->append_to($tag_object);
                 }
             }
         }
     }
     unset($_SESSION['k1lib_notifications']);
     unset($_SESSION['k1lib_notifications_titles']);
 }