Esempio n. 1
0
 function detail()
 {
     //detail//
     $forward_from = array_search("forward_from", $this->uri->segment_array());
     if ($forward_from !== false) {
         $key = $this->uri->segment($forward_from + 1);
         $data["link"] = anchor("controller/listing/back_to/{$key}", ">> go to prev page");
     } else {
         $data["link"] = anchor("controller/listing", "go to prev page");
     }
     //enddetail//
     $content["content"] = $this->load->view('rapyd/persistence', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//detail//", "//enddetail//");
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 2
0
 function multipk()
 {
     //dataedit//
     $this->rapyd->load("dataedit");
     echo RAPYD_URI_SEARCH;
     $edit = new DataEdit("Relation Detail", "articles_related");
     $edit->article = new dropdownField("Article", "art_id");
     $edit->article->option("", "");
     $edit->article->options("SELECT article_id, CONCAT('(',article_id,')') as article FROM articles");
     $edit->relation = new dropdownField("Rel Article", "rel_id");
     $edit->relation->option("", "");
     $edit->relation->options("SELECT article_id, CONCAT('(',article_id,')') as article FROM articles");
     $edit->build();
     $data["content"] = $edit->output;
     //enddataedit//
     $content["content"] = $this->load->view('rapyd/tests', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//dataedit//", "//enddataedit//");
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 3
0
 function _render($view, $data = null, $highlight = array())
 {
     $content["content"] = $this->load->view($view, $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["theme"] = $this->rapyd->config->item("theme");
     $content["style"] = $this->load->view("rapyd/style_" . $content["theme"], null, true);
     $language_ON = $this->rapyd->config->item("rapyd_lang_ON");
     $content["language_links"] = isset($language_ON) && $language_ON === True ? " " . language_links() : "|  rapyd_lang is off";
     $content["code"] = "";
     foreach ($highlight as $block) {
         if (isset($block["title"]) and $block["title"] != "") {
             $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">### ' . $block["title"] . ' ###</span><br/>';
         }
         if (isset($block["id"]) and $block["id"] != "") {
             $content["code"] .= highlight_code_file($block["file"], "//" . $block["id"] . "//", "//end" . $block["id"] . "//");
         } else {
             $content["code"] .= highlight_code_file($block["file"]);
         }
     }
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 4
0
 function gridedit()
 {
     //gridedit//
     $this->rapyd->load("datagrid", "dataedit");
     //grid
     $grid = new DataGrid("Comment List", "comments");
     $grid->order_by("comment_id", "desc");
     $grid->per_page = 5;
     $grid->use_function("substr");
     $grid->column("comment", "<substr><#comment#>|0|50</substr>..", 'width="350"');
     $baseuri = "rapyd/crudworkflow/gridedit/osp/" . $this->uri->segment(5);
     $link_show = anchor("{$baseuri}/show/<#comment_id#>", "Show");
     $link_edit = anchor("{$baseuri}/modify/<#comment_id#>", "Modify");
     $link_delete = anchor("{$baseuri}/delete/<#comment_id#>", "Delete");
     $link_do_delete = anchor("{$baseuri}/do_delete/<#comment_id#>", "Do Delete");
     $grid->add("{$baseuri}/create");
     $grid->column("actions", "{$link_show} - {$link_edit} - {$link_delete} - {$link_do_delete}");
     $grid->build();
     //edit
     $edit = new DataEdit("Comment Detail", "comments");
     $edit->back_uri = $baseuri;
     //flow redirection (direct return to the back_uri after actions)
     $edit->back_save = true;
     $edit->back_delete = true;
     $edit->back_cancel_save = true;
     $edit->back_cancel_delete = true;
     $edit->aticle_id = new autoupdateField("article_id", 1);
     $edit->body = new textareaField("Comment", "comment");
     $edit->body->rule = "required";
     $edit->body->rows = 5;
     $edit->buttons("modify", "save", "undo", "delete");
     $edit->build();
     $data["crud"] = $grid->output . $edit->output;
     //endgridedit//
     $content["content"] = $this->load->view('rapyd/crudworkflow', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//gridedit//", "//endgridedit//");
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 5
0
 function ajaxsearch()
 {
     //filteredgrid//
     $this->rapyd->load("datafilter");
     //filter
     $filter = new DataFilter("Article Search", "articles");
     $filter->title = new inputField("Title", "title");
     $filter->title->insertValue = $this->rapyd->session->get("title");
     $filter->build();
     //offset
     $osp = "/osp";
     $osp .= $this->rapyd->uri->is_set("osp") ? "/" . $this->rapyd->uri->get("osp", 1) : "0";
     //prototype
     rapydlib("prototype");
     $this->rapyd->script[] = "\n    Event.observe(window, 'load', init, false);\n\n    function init(){\n      Event.observe('title', 'keyup', do_search, false);\n      do_search();\n    }\n\n    function do_search() \n    { \n      var url = '" . site_url('rapyd/ajaxsamples/ajaxgrid' . $osp) . "'; \n      var pars = 'title='+escape(\$F('title'));  \n      var myUdater = new Ajax.Updater('search_results', url,{method:'post',parameters:pars});\n    }\n    ";
     $data["content"] = $filter->output . '<div id="search_results" style="height:200px"></div>';
     //endfilteredgrid//
     $content["content"] = $this->load->view('rapyd/ajaxsearch', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//filteredgrid//", "//endfilteredgrid//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//ajax callback <br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//ajaxgrid//", "//endajaxgrid//");
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 6
0
 function directdataedit()
 {
     if ($this->uri->segment(5) === "1" && $this->uri->segment(4) === "do_delete") {
         show_error("Please do not delete the first record, it's required by DataObject sample");
     }
     //directdataedit//
     $this->rapyd->load("dataedit");
     $edit = new DataEdit("Article Detail", "articles");
     //$edit->gfid = $GFID;
     /********************************************************************************************
      * NOTES 6:                                                                                  *
      * Now the controller doesn't need extra code to read the GFID.DE component read it directly.*
      * DE->back_url doesn't need '/back' URI clause to work with back session, if DE find a GFID *
      * it automaticaly rewrite back_url and add GFID and '/back'                                 *
      * Theres is 2 ways to give the GFID to DE by the URI or by "$edit->gfid = $GFID;" if we use *
      * it befor DE->build(); (see NOTE 1 in dataedit class)                                      *
      *********************************************************************************************/
     $edit->back_url = site_url("rapyd/sessiontest/grid");
     //Seting for direct return to the Grid
     $edit->back_save = true;
     $edit->back_cancel_save = true;
     $edit->back_cancel_delete = true;
     $edit->title = new inputField("Title", "title");
     $edit->title->rule = "trim|required|max_length[20]";
     $edit->body = new editorField("Body", "body");
     $edit->body->rule = "required";
     $edit->body->rows = 10;
     $edit->author = new dropdownField("Author", "author_id");
     $edit->author->option("", "");
     $edit->author->options("SELECT author_id, firstname FROM authors");
     $edit->checkbox = new checkboxField("Public", "public", "y", "n");
     $edit->datefield = new dateField("Date", "datefield", "eu");
     if ($this->uri->segment(4) === "1") {
         $edit->buttons("modify", "save", "undo", "back");
     } else {
         $edit->buttons("modify", "save", "undo", "delete", "back");
     }
     $edit->build();
     $test = "Current GFID =" . (string) $edit->gfid . "<br> Current back url = " . $edit->back_url;
     $data["edit"] = $edit->output;
     //enddirectdataedit//
     $content["content"] = $test . $this->load->view('rapyd/dataedit', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//directdataedit//", "//enddirectdataedit//");
     $this->load->view('rapyd/template_test', $content);
 }
Esempio n. 7
0
 function datagrid2()
 {
     //datagrid2//
     $this->rapyd->load("datagrid");
     $this->load->helpers("file");
     $file_names = get_filenames("uploads/banners/");
     foreach ($file_names as $name) {
         $file = array();
         $file["name"] = $name;
         //you can build your filesize function..
         //preview function(if they are images)
         $file["details"] = "etc..";
         $files[] = $file;
     }
     $grid = new DataGrid("Fiel List", $files);
     $grid->per_page = 5;
     $grid->column("Name", "name");
     $grid->column("details", "details");
     $grid->column("delete", anchor("rapyd/samples/delete_file/<#name#>", "delete"));
     $grid->build();
     $data["grid"] = $grid->output;
     //enddatagrid2//
     $content["content"] = $this->load->view('rapyd/datagrid', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//datagrid2//", "//enddatagrid2//");
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 8
0
 function dataedit()
 {
     if ($this->uri->segment(5) === "1" && $this->uri->segment(4) === "do_delete") {
         show_error("Please do not delete the first record, it's required by DataObject sample");
     }
     //dataedit//
     $this->rapyd->load("dataedit");
     $edit = new DataEdit("Article Detail", "articles");
     $edit->back_url = site_url("inventario/crudsamples/filteredgrid");
     $edit->title = new inputField("Title", "title");
     $edit->title->rule = "trim|required|max_length[20]";
     $edit->body = new editorField("Body", "body");
     $edit->body->rule = "required";
     $edit->body->rows = 10;
     $edit->author = new dropdownField("Author", "itstra");
     $edit->author->option("", "");
     $edit->author->options("SELECT numero, codigo FROM itstra");
     $r_uri = "inventario/crudsamples/comments_grid/<#article_id#>/list";
     $edit->related = new iframeField("related", $r_uri, "210");
     $edit->related->when = array("show", "modify");
     $edit->checkbox = new checkboxField("Public", "public", "y", "n");
     $edit->datefield = new dateField("Date", "datefield", "eu");
     if ($this->uri->segment(4) === "1") {
         $edit->buttons("modify", "save", "undo", "back");
     } else {
         $edit->buttons("modify", "save", "undo", "delete", "back");
     }
     $edit->use_function("callback_test");
     $edit->test = new freeField("Test", "test", "<callback_test><#numero#>|3</callback_test>");
     $edit->build();
     $data["edit"] = $edit->output;
     //enddataedit//
     //$this->_session_dump();
     $content["content"] = $this->load->view('rapyd/dataedit', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//dataedit//", "//enddataedit//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//comments grid <br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//commentsgrid//", "//endcommentsgrid//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//comments edit <br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//commentsedit//", "//endcommentsedit//");
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 9
0
 function dataedit()
 {
     if ($this->uri->segment(5) === "1" && $this->uri->segment(4) === "do_delete") {
         show_error("Please do not delete the first record, it's required by DataObject sample");
     }
     //dataedit//
     $this->rapyd->load("dataedit");
     $edit = new DataEdit("Article Detail", "articles");
     $edit->back_url = site_url("rapyd/supercrud/filteredgrid");
     $edit->title = new inputField("Title", "title");
     $edit->title->rule = "trim|required|max_length[20]";
     $edit->body = new textareaField("Body", "body");
     $edit->body->rule = "required";
     $edit->body->rows = 8;
     $r_uri = "rapyd/supercrud/related/<#article_id#>/related/show";
     $edit->related = new iframeField("related", $r_uri, "210");
     $edit->related->when = array("show", "modify");
     $edit->author = new dropdownField("Author", "author_id");
     $edit->author->option("", "");
     $edit->author->options("SELECT author_id, firstname FROM authors");
     $edit->checkbox = new checkboxField("Public", "public", "y", "n");
     $edit->datefield = new dateField("Date", "datefield", "d/m/Y");
     if ($this->uri->segment(4) === "1") {
         $edit->buttons("modify", "save", "undo");
     } else {
         $edit->buttons("modify", "save", "undo", "delete");
     }
     $edit->build();
     $data["edit"] = $edit->output;
     //enddataedit//
     $content["content"] = $this->load->view('rapyd/dataedit_complex', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//dataedit//", "//enddataedit//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//related function<br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//relatedlist//", "//endrelatedlist//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//related_search function<br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//relatedsearch//", "//endrelatedsearch//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//related_remove function<br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//relatedremove//", "//endrelatedremove//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//related_add function<br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//relatedadd//", "//endrelatedadd//");
     $this->load->view('rapyd/template', $content);
 }
Esempio n. 10
0
 function dataform()
 {
     //dataform//
     $this->rapyd->load("dataform");
     $form = new DataForm("rapyd/datam/dataform/process", null);
     $form->title = new inputField("Title", "title");
     $form->title->rule = "trim|required|max_length[20]";
     $form->body = new editorField("Body", "body");
     $form->body->rule = "required";
     $form->body->rows = 10;
     $form->checkbox = new checkboxField("Public", "public", "y", "n");
     $form->submit("btnsubmit", "SUBMIT");
     $form->build_form();
     if ($form->on_show()) {
         $data["form_status"] = "Form displayed correctly";
     }
     if ($form->on_success()) {
         $posted_data = nl2br(var_export($_POST, true));
         $data["form_status"] = "Successful post:<br/>" . $posted_data;
     }
     if ($form->on_error()) {
         $data["form_status"] = "There are errors";
     }
     $data["form"] = $form->output;
     //enddataform//
     $content["content"] = $this->load->view('rapyd/dataform', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//dataform//", "//enddataform//");
     $this->load->view('rapyd/template', $content);
 }