Beispiel #1
0
    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 fk_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;
        }
    }
    private function get_tab_week()
    {
        $fx_d_prev = new fk_ajax('submit', 'cal-pnl-1', 'form:fkc-frm-day;url:' . $this->Url . ';args:oper=' . encode('d_prev'));
        $fx_d_next = new fk_ajax('submit', 'cal-pnl-1', 'form:fkc-frm-day;url:' . $this->Url . ';args:oper=' . encode('d_next'));
        $horas = $this->getHoras();
        $html = '<div >
	
	
	<div>
	<input type="button" onclick="' . $fx_d_prev->render() . '" value=" &laquo; ">
	<input type="button" onclick="' . $fx_d_next->render() . '" value=" &raquo; ">
	 
	
	
	' . $this->rango_fecha_header_label . ' 
	</div>
	
	<div class="day-view">
	' . $this->input_date . '
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div class="dy-head"> <h3>' . $this->dia_label . '</h3> 
        <div><input type="text"></div>
        </div>
        </td>
  </tr>
  <tr>
    <td><div class="dy-body"> 
    
      <div class="col-1">' . $horas . '
      </div>
      <div class="col-2">
      
      </div>
     
    </div>
     </td>
  </tr>
</table>
</div>
	</div>	
	';
        return $html;
    }
Beispiel #3
0
    /**
     *@package AppForm
     *@since v0.1
     *@method PrintList()
     *@desc  Returns the records as a table
     * */
    private function PrintList()
    {
        $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>';
                $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;
            $fx_sel_rec = new fk_ajax('submit', 'pannel-1-' . $this->IdObject, 'args:op=' . encode('selec-record') . '&rec-srch=' . $rec[$id_field_name] . ';form:' . $this->IdObject . ';url:' . $this->CurrentPage);
            $html .= '<tr onclick="' . $fx_sel_rec->render() . '">';
            $cnt_cols = 0;
            foreach ($rec as $k => $v) {
                $cnt_cols++;
                if ($cnt_cols > 1) {
                    $html .= '<td>' . $rec[$k] . '</td>';
                }
            }
            $html .= '</tr>';
        }
        $html .= '</tbody></table>';
        //
        $fx_table = new fk_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": true,
		 "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;
    }