Ejemplo n.º 1
0
    /**
     *@package FkException extends Exception
     *@since v0.1 beta
     *@method show()
     *@param $tpl_exception
     *@desc  Prints the FkExeption error.
     *       To use the parameter $tpl_exception layouts see the  defined
     *       templates on freekore/sys_messages/exceptions
     * */
    public function show($tpl_exception = 'common')
    {
        $tpl_exception = SYSTEM_PATH . '/freekore/sys_messages/exceptions/' . $tpl_exception . '.php';
        // Mensaje amigable en caso que no este activo el interactive
        if (@$GLOBALS['FKORE']['RUNNING']['app']['interactive'] != TRUE) {
            if (file_exists(SYSTEM_PATH . '/app/errors/error_general.php')) {
                $tpl_exception = SYSTEM_PATH . '/app/errors/error_general.php';
            } else {
                $tpl_exception = SYSTEM_PATH . '/freekore/sys_messages/page/default_error_general.php';
            }
        }
        $inc_files_arr = get_included_files();
        $tot_inc_files = count($inc_files_arr);
        $details = '<h3>Included Files</h3>' . implode('<br />', $inc_files_arr) . ' <br /> Total:' . $tot_inc_files . '<h3>Memoria Usada</h3><p>' . fk_memory_usage() . '</p>';
        $exc_cont = file_get_contents($tpl_exception);
        $find = array('{message}', '{trace}', '{description}', '{solution}', '{solution_code}', '{details}', '{error_code}');
        $repl = array($this->getMessage(), $this, $this->description, $this->solution, $this->solution_code, $details, $this->error_code);
        $exc_cont = str_replace($find, $repl, $exc_cont);
        if (fk_post('ajax') == 1) {
            echo $exc_cont;
        } else {
            ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FreeKore PHP</title>
		<?php 
            echo fk_css();
            ?>
		<?php 
            echo fk_js();
            ?>
</head>

<body>
		<?php 
            echo $exc_cont;
            ?>
</body>
</html>
		<?php 
        }
        die;
    }
Ejemplo n.º 2
0
function fk_count_empty_fields($arr, $method = 'POST')
{
    $method = strtoupper($method);
    $err_cnt = 0;
    foreach ($arr as $v) {
        if ($method == 'POST') {
            if (!isset($_POST[$v]) || trim(fk_post($v)) == '') {
                $err_cnt++;
            }
        } else {
            if (!isset($_GET[$v]) || trim(fk_post($v)) == '') {
                $err_cnt++;
            }
        }
    }
    return $err_cnt;
}
Ejemplo n.º 3
0
 /**
  *@package AppForm
  *@method get_post_record_id()
  *@desc returns de id record
  *@since v0.3.4
  **/
 public static function get_post_record_id()
 {
     $id_form = fk_post('AppFormID');
     $RecordId = '';
     if (fk_post($id_form . '-i') != '') {
         $RecordId = fk_post($id_form . '-i');
     }
     return $RecordId;
 }
Ejemplo n.º 4
0
 private function saveLines()
 {
     $tableId = $this->tableId;
     $total = fk_post($tableId . '_tot');
     for ($i = 1; $i <= $total; $i++) {
         $id_rec = fk_post($tableId . '_recId-' . $i);
         $Ar = new ActiveRecord($this->table_name);
         if ($id_rec > 0) {
             //UPDATE
             //procesar fields to save
             foreach ($this->fields_to_save as $key => $value_from) {
                 $arr_src = array('{table-id}', '{row-id}');
                 $arr_repl = array($tableId . '_', '-' . $i);
                 $value = str_replace($arr_src, $arr_repl, $value_from);
                 $Ar->fields[$key] = fk_post($value);
             }
             $Ar->fields[$this->record_id_name] = $id_rec;
             $Ar->display_queries = true;
             $Ar->update();
         } else {
             //INSERT
             //procesar fields to save
             foreach ($this->fields_to_save as $key => $value_from) {
                 $arr_src = array('{table-id}', '{row-id}');
                 $arr_repl = array($tableId . '_', '-' . $i);
                 $value = str_replace($arr_src, $arr_repl, $value_from);
                 $Ar->fields[$key] = fk_post($value);
             }
             $Ar->insert();
         }
     }
 }
Ejemplo n.º 5
0
 public function renderAllComponent($getCurrentUrl)
 {
     $this->currentUrl = $getCurrentUrl;
     $GLOBALS['currentUrl'] = $this->currentUrl;
     $GLOBALS['tableFields'] = $this->tableFields;
     $GLOBALS['tableName'] = $this->tableName;
     $GLOBALS['fixedC'] = $this->fixedC;
     $GLOBALS['rules'] = $this->rules;
     $oper = fk_post('oper');
     if ($oper == '') {
         // Default
         //fk_header_blank();
         fk_header();
         fkore::_use('app/plugins/FileImporter/import1.php');
         fk_footer();
     } elseif ($oper == 'step2') {
         //fk_header_blank();
         //fk_header();
         fkore::_use('app/plugins/FileImporter/import2.php');
         //fk_footer();
     } elseif ($oper == 'step3') {
         //fk_header_blank();
         //fk_header();
         fkore::_use('app/plugins/FileImporter/import3.php');
         //fk_footer();
     }
 }
Ejemplo n.º 6
0
 /**
  *@package AppList
  *@since v0.3.2
  *@method getOrderByProcesed()
  * */
 public static function getFiltersProcesed($columns, $oper = 'WHERE')
 {
     $filters = '';
     if (fk_post('p') != '') {
         $p = str_replace(' ', '%', fk_post('p'));
         $filters .= ' ' . $oper . ' ( ' . implode(' like "%' . $p . '%" or ', $columns) . ' like "%' . $p . '%" )';
     }
     return $filters;
 }
Ejemplo n.º 7
0
 private function get_date()
 {
     //		$interv_day = new DateInterval('P1D');
     //		$interv_week = new DateInterval('P1W');
     //		$interv_month = new DateInterval('P1M');
     //		$interv_year = new DateInterval('P1Y');
     $y = date('Y');
     $m = date('m');
     $d = date('d');
     if (fk_post('fkc-date') !== '') {
         $p_date = explode('-', fk_post('fkc-date'));
         $y = $p_date[0];
         $m = $p_date[1];
         $d = $p_date[2];
     }
     $this->Date = new DateTime();
     $this->Date->setDate($y, $m, $d);
     // update labels with right dates and input
     $this->update_date_labels();
 }
Ejemplo n.º 8
0
<h1>Paso 3 de 3</h1>

<?php 
$Imp = new FileImporter();
$Imp->tableName = $GLOBALS['tableName'];
$Imp->fixedC = $GLOBALS['fixedC'];
$Imp->rules = $GLOBALS['fixedC'];
$rules = fk_post('rules');
//---------------------
//IMPORTAR
//---------------------
if ($Imp->importToDB()) {
    echo fk_message('ok', ' ' . $Imp->registros_importados . ' registros fueron importados', false);
} else {
    echo fk_message('alert', $Imp->result_message, false);
}
?>
<input type="button" class="btn"
	onclick="$('#cont2').show(800); $('#cont3').hide(500);"
	value=" &laquo; Regresar ">
	
	<input type="button" class="btn" onclick="window.close()" value=" Cerrar ">
Ejemplo n.º 9
0
<form id="frm3" id="frm3" onsubmit="return false;">
<h1>Paso 2 de 3</h1>
<div>
<?php 
echo fk_message('warning', '<b>Elija informaci&oacute;n:</b> Seleccione las columnas y los renglones que desea importar', false);
$Imp = new FileImporter();
$File = new ActiveRecord('uploads');
$File->find(fk_post('archivo'));
$f = uploads_directory() . '/' . $File->fields['archivo'];
$tablefields = $GLOBALS['tableFields'];
?>
<div style="width:100%; height:500px; overflow:auto;">
<?php 
// Imprime tabla de resultado
$Imp->importExcelData($f, $tablefields);
?>
</div>
<input type="button" class="btn" onclick="$('#cont').show(800); $('#cont2').hide(800);" value=" &laquo; Regresar ">
<input type="submit" class="btn" value="Importar &raquo;">

</div>
<div class="clear"></div>
</form>
 <script type="text/javascript">
<!--

$("#frm3").validate({
	 submitHandler: function(form) {
		 
		      var pArgs = {pDiv:'cont3', 
						  pUrl:'<?php