/**
  *@package AppList
  *@since v0.2
  *@method Render()
  * */
 public function Render($getCurrentUrl)
 {
     $this->currentUrl = $getCurrentUrl;
     // Parent CurrentUrl
     $rs = '';
     $this->formaLimit();
     // Reasignar op si viene tbl_op
     $op_2 = fk_post_get($this->tableId . '_op');
     if (trim($op_2) != '') {
         $this->operation = decode($op_2);
     }
     switch ($this->operation) {
         case 'add-lines':
             $this->processNewLineHtml();
             $rs .= $this->new_line_html;
             break;
         case 'save-lines':
             if ($this->save_function != NULL) {
                 // Custom function
                 call_user_func_array($this->save_function['function'], $this->save_function['parrameters']);
                 $rs .= $this->PrintList();
             } else {
                 // Default save function
                 $this->saveLines();
                 $rs .= fk_ok_message('Información guardada');
                 $rs .= $this->PrintList();
             }
             break;
         case 'delete-line':
             $this->deleteLine();
             break;
         default:
             $rs .= $this->PrintList();
             break;
     }
     // End switch
     return $rs;
 }
 private function update_file_data()
 {
     // Guarda referencia en la db
     $this->record_id = $_POST['id'];
     $this->FileRecord->find($_POST['id']);
     //$this->FileRecord-> fields[$this->fld_id] = $_POST['id'];
     //$this->FileRecord -> fields[$this->fdl_id_user] = $_SESSION['id_usuario'];
     //$this->FileRecord-> fields[$this->fld_path] = $this->Directory;
     //$this->FileRecord-> fields[$this->fld_type] = $this->file_type;
     //$this->FileRecord -> fields[$this->fld_file] = $this->file_name;
     $this->FileRecord->fields[$this->fld_title] = $_POST['title'];
     $this->FileRecord->fields[$this->fld_leyend] = $_POST['leyend'];
     $this->FileRecord->fields[$this->fld_desc] = $_POST['desc'];
     $this->FileRecord->fields[$this->fld_updated_date] = date('Y-m-d H:i:s');
     $this->FileRecord->update();
     echo fk_ok_message(__('Cambios Guardados'));
 }
Beispiel #3
0
 /**
  *@package AppForm
  *@since v0.1 beta
  *@method PrintSearchResult()
  *@desc  Returns the search result
  * */
 private function PrintSeachResults()
 {
     $db = new db();
     $db->connect();
     $proyection_fields = $this->SearchCustomFields;
     if (trim($this->SearchCustomFields) != '*') {
         $proyection_fields = $this->DbRecord->id_field_name . ' as Id, ' . $this->SearchCustomFields;
     }
     //pa($this->DbRecord-> form_fields);
     $where = '';
     if ($_POST['srch-by-field'] == '0') {
         $where_fields = '';
         foreach ($this->DbRecord->form_fields as $f) {
             $where_fields .= $f['Field'] . ' like "%' . $_POST['srch-word'] . '%" OR ';
         }
         $where_fields = substr($where_fields, 0, -3);
         $where = ' WHERE (' . $where_fields . ')';
     } else {
         $where = ' WHERE (' . $_POST['srch-by-field'] . ' like "%' . $_POST['srch-word'] . '%") ';
     }
     $sqlSrch = 'SELECT ' . $proyection_fields . ' FROM ' . $this->model . ' ' . $where . ' ' . $this->DbRecord->SqlAnd . ' ';
     $db->query_assoc($sqlSrch);
     $data_rs = '';
     $tot = $db->num_rows();
     if ($tot == 0) {
         $data_rs .= fk_alert_message($tot . ' resultados', false);
     } else {
         $data_rs .= fk_ok_message($tot . ' resultados', false);
     }
     $data_rs .= '<table class="tbl-1" style="width:100%" border="0" cellspacing="0" cellpadding="0" >';
     $cnt = 0;
     while ($rows = $db->next()) {
         $cnt++;
         //pa($rows);
         if ($cnt % 2 == 0) {
             $even_odd = 'even';
         } else {
             $even_odd = 'odd';
         }
         if ($cnt == 1) {
             // Header
             $data_rs .= '<tr><th>&nbsp</th>';
             foreach ($rows as $col => $val) {
                 $data_rs .= '<th>' . ucwords(strtolower(strtr($col, '_', ' '))) . '</th>';
             }
             $data_rs .= '</tr>';
         }
         if (trim($this->SearchCustomFields) != '*') {
             $id_record = $rows['Id'];
         } else {
             $id_record = $rows[$this->DbRecord->id_field_name];
         }
         $fx_sel_rec = new ajax('url', 'pannel-1-' . $this->IdObject, 'args:op=' . encode('selec-record') . '&rec-srch=' . $id_record . ';form:' . $this->IdObject . ';url:' . $this->CurrentPage);
         $data_rs .= '<tr class="' . $even_odd . '" onclick="' . $fx_sel_rec->render() . '"><td><a href="javascript:void(0)">Ver</a></td>';
         foreach ($rows as $col => $val) {
             $data_rs .= '<td>' . $val . '</td>';
         }
         $data_rs .= '</tr>';
     }
     $data_rs .= '</table>';
     echo $data_rs;
 }