public function Render($form = "", $response_location = "", $url = "", $args = "") { $errorMsg = ''; $errors = FALSE; $Load = new Load(); if (function_exists('is_empty') == FALSE) { // Load validate helper $Load->Helper('validate'); } if (is_empty($form) == FALSE) { $this->form = $form; } if (is_empty($response_location) == FALSE) { $this->response_location = $response_location; } if (is_empty($url) == FALSE) { $this->url = $url; } if (is_empty($args) == FALSE) { $this->args = $args; } if (is_empty($this->form)) { $errorMsg .= ' form requerido :$obj-> Form("id-form")<br /> '; $errors = TRUE; } if (is_empty($this->response_location)) { $errorMsg .= ' response_location requerido : $obj-> ResponseLocation("id-div-location")<br /> '; $errors = TRUE; } if (is_empty($this->url)) { $errorMsg .= ' url requerida : $obj-> Url("Controller/Action")<br /> '; $errors = TRUE; } if ($errors == TRUE) { echo 'Error:<br />' . $errorMsg; return FALSE; } else { // Crear respuesta $butonsCode = $this->RenderButtons(); $params = 'form:' . $this->form . ';url:' . $this->url . ';args:' . $this->args . ';'; $fx = new ajax('submit', $this->response_location, $params); $Result = ' <script type="text/javascript"> <!-- ' . $butonsCode . ' $("#' . $this->form . '").validate({ submitHandler: function(form) { ' . $fx->render() . ' return false; },invalidHandler: function(form, validator){ var errors = validator.numberOfInvalids(); if (errors) { alert("Por favor, llena los campos obligatorios");} } }); //--> </script>'; return $Result; } }
/** *@package AppForm *@since v0.1 *@method PrintList() *@desc Returns the records as a table * */ private function PrintListOld() { $html = ''; $db = new db(); $db->connect(); $db->query_assoc($this->sql_list); $row_cnt = 0; $tot_cols = 0; // Toolbar $toolbar = $this->PrintToolBar(); $html .= $this->title; $html .= $toolbar; $html .= '<table cellpadding="0" cellspacing="0" border="0" class="tbl-list display" id="lst-' . $this->IdObject . '">'; while ($rec = $db->next()) { $row_cnt++; if ($row_cnt == 1) { $tot_cols = count($rec); //Llenar las columnas $html .= '<thead><tr>'; $html .= '<th> </th>'; if ($this->btn_edit_disabled == FALSE) { $html .= '<th> </th>'; } if ($this->btn_delete_disabled == FALSE) { $html .= '<th> </th>'; } $cnt_cols = 0; foreach ($rec as $k => $v) { $cnt_cols++; if ($cnt_cols > 1) { $html .= '<th>' . ucwords(strtolower(strtr($k, '_', ' '))) . '</th>'; } } $html .= '</tr></thead> <tbody>'; } $id_field_name = $this->DbRecord->id_field_name; //$html.= '<tr onclick="'.$fx_sel_rec->render().'">'; $html .= '<tr>'; $fx_sel_rec = new ajax('submit', 'pannel-1-' . $this->IdObject, 'args:op=' . encode('selec-record') . '&rec-srch=' . $rec[$id_field_name] . ';form:' . $this->IdObject . ';url:' . $this->CurrentPage); $html .= '<td><a href="javascript:void(0)" onclick="' . $fx_sel_rec->render() . '"><img src="' . HTTP . '/_HTML/img/ico_view.png"></a></td>'; // BTN EDIT if ($this->btn_edit_disabled == FALSE) { $fx_edit_rec = new ajax('submit', 'pannel-1-' . $this->IdObject, 'args:op=' . encode('edit') . '&i=' . $rec[$id_field_name] . ';form:' . $this->IdObject . ';url:' . $this->CurrentPage); $html .= '<td><a href="javascript:void(0)" onclick="' . $fx_edit_rec->render() . '"><img src="' . HTTP . '/_HTML/img/ico_edit.png"></a></td>'; } // BTN DELETE if ($this->btn_delete_disabled == FALSE) { $fx_del_rec = new ajax('submit', 'pannel-1-' . $this->IdObject, 'args:op=' . encode('del') . '&i=' . $rec[$id_field_name] . '&viewas=list;form:' . $this->IdObject . ';url:' . $this->CurrentPage); $html .= '<td><a href="javascript:void(0)" onclick="if(confirm(\'' . __('Eliminar Registro?') . '\')){' . $fx_del_rec->render() . ';}"><img src="' . HTTP . '/_HTML/img/ico_delete.png"></a></td>'; } $cnt_cols = 0; foreach ($rec as $k => $v) { $cnt_cols++; if ($cnt_cols > 1) { $html .= '<td>' . utf8_encode($rec[$k]) . '</td>'; } } $html .= '</tr>'; } $html .= '</tbody></table>'; // $fx_table = new ajax('submit', 'pannel-1-' . $this->IdObject, 'args:op=' . encode('fill-list') . ';form:' . $this->IdObject . ';url:' . $this->CurrentPage); $html .= '<script> $(document).ready(function(){ $("#lst-' . $this->IdObject . '").dataTable( { "sPaginationType": "full_numbers", "bJQueryUI": false, "iDisplayLength": 100, "aaSorting": [[0,"asc"]] } ); });</script> '; /*$("#lst-'.$this->IdObject.'").dataTable({ "bJQueryUI": true, "bProcessing": true, "bServerSide": true, "sAjaxSource": HTTP+"'.$this->CurrentPage.'", "sPaginationType": "full_numbers", "aaSorting": [[ 0, "desc" ]], "iDisplayLength": 10, "fnServerData": function ( sSource, aoData, fnCallback ) { // Add some extra data to the sender aoData.push( { "name": "op", "value": "'.encode('fill-list').'" } ); $.getJSON( sSource, aoData, function (json) { // Do whatever additional processing you want on the callback, then tell DataTables fnCallback(json); } ); } } );*/ /* */ // Returns result ob_start(); eval('?>' . $html . '<?php '); echo $ViewResult = ob_get_contents(); ob_end_clean(); return $ViewResult; }
private function get_buttons($row) { $btns = ''; if ($this->enable_buttons) { $url = $this->currentUrl; $divPannel = $this->divPannel; $xEdit = new ajax('url', $divPannel, 'url:' . $url . ';args:op=' . encode('edit') . '&' . $this->butons_IdObject . '-i=' . $row[$this->id_field_name]); $xView = new ajax('url', $divPannel, 'url:' . $url . ';args:op=' . encode('selec-record') . '&rec-srch=' . $row[$this->id_field_name]); $xDelete = new ajax('url', $divPannel, 'url:' . $url . ';args:op=' . encode('del') . '&' . $this->butons_IdObject . '-i=' . $row[$this->id_field_name] . '&viewas=list'); $btns .= '<a href="javascript:void(0);" onclick="' . $xView->render() . '"><img title="' . __('Ver') . '" src="' . HTTP . '_HTML/img/ico_view.png" width="20"></a>'; if ($this->btn_edit_visible) { $btns .= ' <a class="btnedit" href="javascript:void(0);" onclick="' . $xEdit->render() . '"><img title="' . __('Editar') . '" src="' . HTTP . '_HTML/img/ico_edit.png" width="20"></a>'; } if ($this->btn_delete_visible) { $btns .= ' <a href="javascript:void(0);" onclick="if(confirm(\'Eliminar Registro?\')){' . $xDelete->render() . '}"><img title="' . __('Eliminar') . '" src="' . HTTP . '_HTML/img/ico_delete.png" width="20"></a>'; } } return $btns; }
/** *@package AppList *@since v0.2 *@method PrintCommonList() * */ private function PrintCommonList() { if ($this->enable_buttons == true) { if ($this->butons_IdObject == '') { echo 'Error:(AppList Object) $this->butons_IdObject no definido<br>'; echo 'Cuando se habilita $this->enable_buttons==true debe enviarse el parametro $this->butons_IdObject = "El AppFormID del formulario" '; return ''; } } $divContentId = 'dvApLstCont' . $this->formId; $html = ''; // Run the process to execute query, pagger variables $this->runQueryProcess(); $this->createFilter(); $this->createPagger(); $ajaxSubmitStr = ''; if ($this->printFormTag == true) { $ajaxSubmit = new ajax_submit(); $ajaxSubmitStr = $ajaxSubmit->Render($this->formId, $divContentId, $this->currentUrl); } $html .= '<div id="' . $divContentId . '">'; if ($this->printFormTag == true) { $html .= '<form name="' . $this->formId . '" id="' . $this->formId . '">'; } $html .= $this->filter . $ajaxSubmitStr; if ($this->printFormTag == true) { $html .= '</form>'; } $html .= '<table class="tbl-1" style="width:100%">'; $line = 0; while ($row = $this->db_queryapplist->next()) { $tot_cols = count($row) / 2; // Print header if ($line == 0) { $html .= '<thead><tr>'; if ($this->enable_buttons) { $html .= '<th style="width:100px;"> </th>'; } $col_cnt = 0; foreach ($row as $cols => $val) { if ($cols != $this->id_field_name) { $col_cnt++; $html .= '<th>' . self::sort_column($col_cnt, $cols, $this->formId) . '</th>'; } } $html .= '</tr></thead>'; } //Print rows $html .= '<tr>'; if ($this->enable_buttons) { $url = $this->currentUrl; $divPannel = $this->divPannel; $xEdit = new ajax('url', $divPannel, 'url:' . $url . ';args:op=' . encode('edit') . '&' . $this->butons_IdObject . '-i=' . $row[$this->id_field_name]); $xView = new ajax('url', $divPannel, 'url:' . $url . ';args:op=' . encode('selec-record') . '&rec-srch=' . $row[$this->id_field_name]); $xDelete = new ajax('url', $divPannel, 'url:' . $url . ';args:op=' . encode('del') . '&' . $this->butons_IdObject . '-i=' . $row[$this->id_field_name] . '&viewas=list'); $html .= '<td>'; $html .= '<a href="javascript:void(0);" onclick="' . $xView->render() . '"><img title="' . __('Ver') . '" src="' . HTTP . '_HTML/img/ico_view.png" width="20"></a>'; $html .= ' <a href="javascript:void(0);" onclick="' . $xEdit->render() . '"><img title="' . __('Editar') . '" src="' . HTTP . '_HTML/img/ico_edit.png" width="20"></a>'; $html .= ' <a href="javascript:void(0);" onclick="if(confirm(\'Eliminar Registro?\')){' . $xDelete->render() . '}"><img title="' . __('Eliminar') . '" src="' . HTTP . '_HTML/img/ico_delete.png" width="20"></a>'; $html .= '</td>'; } foreach ($row as $cols => $val) { if ($cols != $this->id_field_name) { $html .= '<td>' . $val . '</td>'; } } $html .= '</tr>'; $line++; } // end while $html .= '</table>'; $html .= $this->pagger; $html .= '</div>'; // Contenedor return $html; }
private function get_tab_day() { $fx_d_today = new ajax('submit', 'cal-pnl-1', 'form:fkc-frm-day;url:' . $this->Url . ';args:oper=' . encode('d_today')); $fx_d_prev = new ajax('submit', 'cal-pnl-1', 'form:fkc-frm-day;url:' . $this->Url . ';args:oper=' . encode('d_prev')); $fx_d_next = new ajax('submit', 'cal-pnl-1', 'form:fkc-frm-day;url:' . $this->Url . ';args:oper=' . encode('d_next')); $horas = $this->getHoras(); $event_day_list = $this->getEventDayList(); $hoy_disabled = ''; //$hoy_disabled = 'disabled="disabled"'; $html = '<div > <input type="button" class="btn" ' . $hoy_disabled . ' onclick="' . $fx_d_today->render() . '" value=" Hoy "> <input type="button" class="btn" onclick="' . $fx_d_prev->render() . '" value=" « "> <input type="button" class="btn" onclick="' . $fx_d_next->render() . '" value=" » "> ' . $this->fecha_header_label . ' <div class="day-view"> ' . $this->input_date . ' <table style="width:100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div class="dy-head"> <h3>' . $this->dia_label . '</h3> <div class="new-agend"> </div> </div> </td> </tr> <tr> <td><div class="dy-body"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td width="50"><div class="col-1">' . $horas . '</div></td> <td width="%" valign="top"><div class="col-2">' . $event_day_list . '</div></td></tr> </table> </div> </td> </tr> </table> </div> </div> '; return $html; }