示例#1
0
 /**
  * It generates template parameters and saves them to local object property
  * 
  * It generates template parameters for the form and its sub items. e.g text box, textarea etc 
  * 
  * @param array $data contains form information
  *    id => the form id
  *    title => the page title	 
  *    action => string the form action
  *    parameters => the form action url parameters
  */
 public function Read($data = "")
 {
     /** The data id */
     $row_id = isset($data['form_data_id']) ? $data['form_data_id'] : "-1";
     /** The row data is fetched */
     $data['row_data'] = $this->GetRowData($row_id, $data['data_type']);
     /** The form fields are set */
     $form_field_html = $this->GetFormFields($data['data_type'], $data['fields_to_hide'], $data['row_data']);
     /** The template object is fetched */
     $template_obj = $this->GetComponent('template');
     /** The framework template url is fetched */
     $framework_template_url = $this->GetConfig("path", "framework_template_url");
     /** The form mode is set in the form action. The form url parameters are merged with the form url parameters given by the user */
     $parameters = array_merge(array("mode" => $data['mode']), $data['parameters']);
     /** The form id is set depending on the form mode */
     $form_id = $parameters['mode'] == "edit" ? "edit_form" : "add_form";
     /** The form action */
     $form_action = $this->GetComponent("application")->GetEncodedUrl("save_data", $this->GetConfig("general", "module"), "html", $parameters, true);
     /** The form page html */
     $form_page_html = $template_obj->Render("form", array("form_id" => $form_id, "form_title" => $data['title'], "form_action" => $form_action, "form_fields" => $form_field_html, "framework_template_url" => $framework_template_url));
     /** The template parameters for the page */
     $page_parameters = array("title" => $data['title'], "body" => $form_page_html);
     /** The parent Read function is called */
     parent::Read($page_parameters);
 }
示例#2
0
 /**
  * It generates template parameters and saves them to local object property
  * 
  * Used to set the extra javascript and css files for the list page
  * It also sets the parameters for the list page
  * 
  * @param array $data contains arameters for the list page table
  *    template_parameters => the parameters for the list page
  */
 public function Read($data = "")
 {
     /** The template object is fetched */
     $template_obj = $this->GetComponent('template');
     /** The html table object is fetched */
     $html_table_obj = $this->GetComponent('htmltable');
     /** The callback for formatting the table cells */
     $data['html_table']['cell_attributes_callback'] = array($this, "GetTableCellAttributes");
     /** Data is read from database */
     $table_rows = $html_table_obj->Read($data['html_table']);
     /** The edit and delete links are added to each row */
     for ($count1 = 0; $count1 < count($table_rows); $count1++) {
         /** The table link columns are added */
         for ($count2 = 0; $count2 < count($data['list_page']['links']); $count2++) {
             /** The parameters for fetching the link */
             $link_details = $data['list_page']['links'][$count2];
             /** The row id is added to the link parameters */
             $link_details['row_id'] = $table_rows[$count1][0];
             /** The data type is added to the link parameters */
             $link_details['data_type'] = $data['html_table']['database_reader_data']['data_type'];
             /** The link html is fetched */
             $table_rows[$count1][] = $this->GetLink($link_details);
         }
         /** The row data is filtered */
         $row_data = $this->FilterRowData($table_rows[$count1]);
         /** The updated row is added back to the table rows */
         $table_rows[$count1] = $row_data;
     }
     /** The table rows are loaded to the html table */
     $html_table_obj->Load($table_rows);
     /** Data is displayed */
     $table_data = $html_table_obj->Display();
     /** The input button html */
     $input_button_html = $this->GetInputButton($data['list_page']['input_button']['title'], $data['list_page']['input_button']['onclick'], $data['list_page']['input_button']['option'], $data['list_page']['input_button']['parameters']);
     /** The list page html */
     $list_page_html = $template_obj->Render("list_page", array("list_page_title" => $data['list_page']['list_page_title'], "framework_template_url" => $this->GetConfig("path", "framework_template_url"), "separator" => " | ", "input_button" => $input_button_html, "table_data" => $table_data));
     /** The template parameters for the page */
     $page_parameters = array("title" => $data['list_page']['title'], "body" => $list_page_html);
     /** The parent Read function is called */
     parent::Read($page_parameters);
 }