public function __toString()
 {
     $field = $this->field_name;
     $choices = $this->args->choices;
     $checks[$this->field_value] = $this->field_value;
     return fpp::RadioGroup($field, $choices, $checks);
 }
Esempio n. 2
0
 public function admin()
 {
     echo fpp::jlib();
     $admin = new KfppAdmin();
     $admin->SetModule("Usuarios", 'active_test');
     $admin->SetModule("Usuarios", 'peliculas');
     $admin->SetModule("Usuarios", 'comprobantes');
     $admin->SetModule("Usuarios", 'suma');
     echo $admin;
 }
Esempio n. 3
0
 public function autoblock()
 {
     echo "puedo meter codigo cualquiera";
     echo fpp::jlib();
     $table = 'comprobantes';
     $model = "fpp_{$table}_Model";
     $libload = new $model();
     $libload->set_property('edit', 1);
     $libload->set_property('delete', 1);
     $libload->set_property('add', 1);
     $str = $libload->blockfields();
     unset($libload);
     $table = 'persona';
     $model = "fpp_{$table}_Model";
     $libload = new $model();
     $libload->set_property('edit', 1);
     $libload->set_property('delete', 1);
     $libload->set_property('add', 1);
     $str .= $libload->blockfields();
     return $str;
 }
Esempio n. 4
0
 /**
  * constructor de Link y Ajax javascript
  * requiere obligadamente algunos Atributos como el Nombre del Model actual
  * argumentos : db_table 
  */
 protected function AjaxConstruct($field_html)
 {
     $table_this = substr($this->attributes->NameModel, '4', '-6');
     $uri = new Uri();
     $uri_string = $uri->string();
     $uri_string = str_replace($table_this, $this->args->db_table, $uri_string);
     $uri_string_save = $uri_string;
     $uri_string = explode('/edit/', $uri_string);
     $bl = count($uri_string);
     if (count($uri_string) == 1) {
         $uri_string = explode('/add', $uri_string_save);
     }
     $uri_string_ajax = url::base(FALSE) . $uri_string[0] . '/ajax/' . $this->PkID . '/ajaxfield/' . $this->field_name;
     $uri_string_ajax = str_replace(array("mod/" . $this->args->db_table, 'tbl_' . $this->args->db_table), array("mod/" . $table_this, 'tbl_' . $table_this), $uri_string_ajax);
     $_SESSION['PKID'] = $this->PkID;
     $uri_string = $uri_string[0] . '/add';
     $href = fpp::iconify('Agregar', 'plusthick');
     $props = array("class" => 'AjaxOTO', "id" => 'AjaxTBL_' . $this->field_name, "logme" => $bl, 'refresh_to' => $uri_string_ajax, 'field_name' => $this->field_name);
     $href = html::anchor($uri_string, $href, $props);
     $div = "<div class='AjaxTBL_{$this->field_name} DIVJAX' style='display:none;' ></div>";
     return $div . "<table border=0><tr><td>" . $field_html . '</td><td>' . $href . '</td></tr></table>';
 }
Esempio n. 5
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
  <title>AdminGenerator</title>
  <meta name="GENERATOR" content="Quanta Plus">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <?php 
echo fpp::jlib();
echo html::stylesheet(array('media/site.css'));
echo html::script(array('media/script.js'));
?>
  <script>
    $(document).ready(function(){
      $("select[multiple=multiple]").css("height",'150px');
      $(".detailwn2").click(function(){
        id = $(this).attr('id');
//         alert(id)
        objn = $("#wndt_"+id);
//         alert("#wndt_"+id);
        objn.dialog({ resizable: false,width: 587,autoOpen: false,modal:false ,title:"Detalles de pedido"  });
        objn.dialog('open');
        return false;
      });    
    })
  </script>
</head>
<body class="nostyles">
<?php 
echo $content;
?>
Esempio n. 6
0
?>
</p>
      </div>
      </div>
      <div class="Filtrar"><?php 
echo form::submit("Filtrar", "Filtrar");
?>
</div>
      <div class="EliminarSel"><?php 
echo form::submit("EliminarSel", "Eliminar Seleccionados");
?>
</div>
    </td>
    <td class="borde" width="30%" valign="top">
      <div class="fpp_extra_options">
		<div class="filterbox"><?php 
echo $filterbox;
?>
</div>
        <?php 
echo $add == FALSE ? '' : html::anchor($base . 'add', fpp::iconify('Agregar', 'plusthick') . ' Agregar Nuevo');
?>
      </div>
      <div><?php 
echo $filters;
?>
</div>
    </td>
  </tr>
</table>
</form>
Esempio n. 7
0
 private function _crypt_me($str)
 {
     return fpp::cryptme($str);
 }
Esempio n. 8
0
    public static function jlib()
    {
        $media = basics::media();
        $lib = fpp::jlib();
        $lib .= <<<EOT
<script src="{$media}js/easySlider1.7.js" type="text/javascript"></script>
<link href="{$media}css/kohana.css" rel="stylesheet" type="text/css" />
<script src="{$media}js/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="{$media}js/DD_roundies.js"></script>
<script src="{$media}js/util.js"></script>
EOT;
        return $lib;
    }
Esempio n. 9
0
 public function blockfields($id = null)
 {
     $idorigin = $id;
     if ($id != null) {
         settype($id, 'integer');
     }
     if ($id === 0 and $idorigin != 'LOOK') {
         return NULL;
     }
     $msg = null;
     $types = new fpp_fieldtype_Model($this->meta);
     $types->SetPkID($id);
     $types->AddAttributes('NameModel', get_class($this));
     $types->AddAttributes('Primary', $this->_FirstPrimary);
     $fields =& $types->fields;
     $this->_apply_php($types);
     $arrayWhere = null;
     $select = null;
     $arrayTables[] = $this->_Table;
     $first = null;
     $items = $this->show;
     $OneToMany = array();
     //construccion de qu campos se van a mostrar
     if ($items == "AUTO") {
         $items = array();
         foreach ($this->meta as $fieldname => $props) {
             $items[] = $fieldname;
         }
     }
     //cargando las propiedades de cada campo
     $OTMSelect = array();
     foreach ($items as $fieldname) {
         if ($first == null) {
             $first = $fieldname;
         }
         $object = $fields->{$fieldname};
         $db_field = "{$this->_Table}.{$fieldname}";
         if ($object->typefield != 'OneToMany') {
             $select[] = $db_field;
         } else {
             $OTMSelect[] = $fieldname;
         }
         $titles[$fieldname] = $this->_File_i18n == null ? $object->verbose : Kohana::lang($this->_File_i18n . '.' . $object->verbose);
         $choice[$fieldname] = $object->choices;
     }
     if ($this->_AddField != null) {
         foreach ($this->_AddField as $data) {
             $table = $data['table'];
             $db_field = "{$table}.{$data['field']}";
             $select[] = $db_field;
             $arrayTables[$table] = $table;
         }
     }
     //si es post , grabara los cambios
     if (request::method() == 'post' and $this->_OnlyRead == FALSE) {
         $save = $this->save;
         if ($save == 'AUTO') {
             $save = array();
             foreach ($this->meta as $fieldname => $props) {
                 $save[] = $fieldname;
             }
         }
         $input = Input::instance();
         foreach ($save as $field) {
             $foreach_typefield =& $types->fields->{$field}->typefield;
             if ($types->fields->{$field}->typefield == 'CheckField' and @$_POST[$field] == '') {
                 $_POST[$field] = FALSE;
             }
             if ($foreach_typefield == 'PasswordField') {
                 $_POST[$field] = fpp::cryptme($_POST[$field]);
             }
             if ($input->post($field) !== null and $types->fields->{$field}->typefield != 'OneToMany' and $types->fields->{$field}->typefield != 'TabularModel') {
                 $inp = $input->post($field);
                 $tmp_inp = $inp;
                 if ($types->fields->{$field}->post_exec != null and request::method() == 'post') {
                     $value = $input->post($field);
                     eval($types->fields->{$field}->post_exec . ';');
                     $inp = $value;
                 }
                 $update_fields[$field] = $inp;
             }
             //Preparando los Uno a muchos, y muchos a muchos
             if ($types->fields->{$field}->typefield == 'OneToMany' or $types->fields->{$field}->typefield == 'TabularModel') {
                 $modtable = substr($types->fields->{$field}->model, 4);
                 $metaOTM = fpp::GetOTM($modtable, $this->_Table);
                 $metaOTM['fieldhtml'] = $input->post($field);
                 $metaOTM['pk'] = $field;
                 $OneToMany[$field] = $metaOTM;
                 $this->db->delete($modtable, array($metaOTM['primary'] => $id));
             }
         }
         /**/
         if ($this->_AddKeyField != null) {
             foreach ($this->_AddKeyField as $field => $FValue) {
                 $update_fields[$field] = $FValue;
             }
         }
         if (isset($_FILES)) {
             foreach ($_FILES as $key => $value) {
                 // Checking Files (Upload Only Images)
                 $this->file_type = $_FILES[$key]['type'];
                 if (!($this->file_type != 'image/jpg' && $this->file_type != 'image/x-png' && $this->file_type != 'image/pjpeg' && $this->file_type != 'image/jpeg' && $this->file_type != 'image/gif' && $this->file_type != 'video/avi' && $this->file_type != 'video/msvideo' && $this->file_type != 'video/x-msvideo' && $this->file_type != 'image/png')) {
                     //Execute IF statment
                     try {
                         $retupload = upload::save($_FILES[$key]);
                     } catch (Exception $e) {
                         echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
                         die;
                     }
                     $retupload = explode('upload/', $retupload);
                     if (count($retupload) > 1) {
                         $retupload = $retupload[1];
                         $update_fields[$key] = $retupload;
                         $value = $retupload;
                         if ($types->fields->{$key}->post_exec != null and request::method() == 'post') {
                             eval($types->fields->{$key}->post_exec . ';');
                         }
                     }
                 }
             }
         }
         if ($id != null) {
             try {
                 $status = $this->db->update($this->_Table, $update_fields, array($first => $id));
             } catch (Exception $e) {
                 echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
                 die;
             }
         } else {
             try {
                 $status = $this->db->insert($this->_Table, $update_fields);
                 $id = $status->insert_id();
             } catch (Exception $e) {
                 echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
                 die;
             }
         }
         if (@$_SESSION['PKID'] != "" and @$_GET['AJAX_NO_LOAD'] == TRUE) {
             $_SESSION['PKID_OTM'] = $id;
         }
         if (is_array($OneToMany)) {
             foreach ($OneToMany as $valueOTM) {
                 if (is_array($valueOTM['fieldhtml'])) {
                     foreach ($valueOTM['fieldhtml'] as $value) {
                         $arrOTMnew = array($valueOTM['primary'] => $id, $valueOTM['secondary'] => $value);
                         $this->db->insert($valueOTM['table'], $arrOTMnew);
                     }
                 }
             }
         }
         $this->_Response = TRUE;
         $msg = fpp::fppmsg('Guardo Correctamente');
     }
     if ($id != null or $idorigin == 'LOOK') {
         //Inicializacion del query (construccion & carga)
         $strinTables = implode(',', $arrayTables);
         $select = implode(',', $select);
         $query = $this->db->select($select)->from($strinTables)->limit(1, 0);
         if (is_array($arrayWhere)) {
             $stringWhere = implode(' AND ', $arrayWhere);
             $query = $query->where($stringWhere);
         }
         if ($idorigin != 'LOOK') {
             $wherearray[] = "{$first} = {$id}";
         }
         if ($this->_AddKeyField != null) {
             foreach ($this->_AddKeyField as $Fkey => $FValue) {
                 $wherearray[] = "{$Fkey} = {$FValue}";
             }
         }
         if ($this->_FilterActive != null) {
             foreach ($this->_FilterActiveByInfo as $filter => $value) {
                 $wherearray[] = "{$this->_Table}.{$filter} = {$value}";
             }
         }
         $where_string = implode(' AND ', $wherearray);
         $query = $query->where($where_string);
         try {
             $rows = $query->get();
         } catch (Exception $e) {
             echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
             die;
         }
         //escribiendo los campos de acuerdo a sus propiedades
         $data = new StdClass();
         $types->base_uri = $this->base_uri;
         $valid_count = FALSE;
         foreach ($rows as $row) {
             foreach ($OTMSelect as $nameOTM) {
                 $row->{$nameOTM} = 'null';
             }
             foreach ($row as $name => $value) {
                 $valid_count = TRUE;
                 if ($this->_OnlyRead == TRUE) {
                     $data->{$name} = $value;
                 } else {
                     $types->field_value = $value;
                     //          Si el campo es un "OneToMany"
                     if ($types->fields->{$name}->typefield == 'OneToMany' or $types->fields->{$name}->typefield == 'TabularModel') {
                         if (@$OneToMany[$name]['table'] == '') {
                             $modtable = substr($types->fields->{$name}->model, 4);
                             $OneToMany[$name] = fpp::GetOTM($modtable, $this->_Table);
                         }
                         $OTMArr = null;
                         //              Tomo el campo primario y secundario
                         $OTMdb_field = $OneToMany[$name]['secondary'];
                         $OTMdb_pk = $OneToMany[$name]['primary'];
                         $valuelistOTM = null;
                         try {
                             $valuelistOTM = $this->db->from($OneToMany[$name]['table'])->select($OTMdb_field)->where(array($OTMdb_pk => $id))->get();
                         } catch (Exception $e) {
                             echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
                             die;
                         }
                         foreach ($valuelistOTM as $rowOTM) {
                             $OTMArr[] = $rowOTM->{$OTMdb_field};
                         }
                         $types->field_value = $OTMArr;
                     }
                     $types->field_name = $name;
                     $arrayorder[$name] = $types->ObjectField($name);
                 }
             }
             foreach ($this->meta as $fieldname => $props) {
                 $data->{$fieldname} = $arrayorder[$fieldname];
             }
         }
     } else {
         foreach ($items as $name) {
             $valid_count = TRUE;
             $types->field_name = $name;
             $types->field_value = NULL;
             $data->{$name} = $types->ObjectField($name);
         }
     }
     //VIRTUAL
     if ($this->virtual != null) {
         $dirf = dirname(__FILE__);
         include_once $dirf . '/types/' . $this->virtual . '.php';
         $data->virtualfield = new $this->virtual();
         $data->virtualfield->id_table = $id;
         $titles['virtualfield'] = $data->virtualfield->title;
     }
     if ($this->virtualclone != null) {
         $dirf = dirname(__FILE__);
         include_once $dirf . '/types/' . $this->virtualclone . '.php';
         $data->virtualfieldc = new $this->virtualclone();
         $data->virtualfieldc->id_table = $id;
         $titles['virtualfieldc'] = $data->virtualfieldc->title;
     }
     //VIRTUAL
     if ($valid_count == FALSE) {
         return NULL;
     }
     $this->retfields = $data;
     //Setting Ajax
     $form = null;
     $attrform = null;
     if (@$_GET['AJAX_NO_LOAD'] == TRUE) {
         $form .= '<script>$(document).ready(function(){$(".FORM_AJAX").submit(function(){ return post_ajax(this); })});</script>';
         $attrform = array("class" => 'FORM_AJAX');
     }
     $urlform = NULL;
     if ($id > 0) {
         $this->uri = URI::Instance();
         $urlform = str_replace("add", "edit/" . $id, $this->uri);
     }
     $form .= form::open_multipart($urlform, $attrform);
     if ($this->GetFieldAjax != NULL) {
         $FAjax = $this->GetFieldAjax;
         return $data->{$FAjax};
     }
     $view_info = $this->_TabView == TRUE ? 'tabmodel' : 'info';
     $str = View::factory($this->templatedir . $view_info)->set('msg', $msg)->set('data', $data)->set('form', $form)->set('only_read', $this->_OnlyRead)->set('titles', $titles)->set('tblname', $this->_Table)->render();
     return $str;
 }
Esempio n. 10
0
<?php 
if ($data != null) {
    foreach ($data as $row) {
        ?>
    <tr>
      <td style="padding-left:5px"><?php 
        echo form::checkbox('check_delete[' . $row->{$first_field} . ']', TRUE);
        ?>
</td>
      <?php 
        foreach ($row as $value) {
            ?>
        <td><?php 
            echo $value;
            ?>
 &nbsp;</td>        
      <?php 
        }
        //Edit
        echo $edit == true ? "<td width='35' align='center'>" . html::anchor($base . 'edit/' . $row->{$first_field}, fpp::iconify('Editar', 'pencil')) . "</td>" : "";
        //Delete
        echo $delete == true ? "<td width='35' align='center'>" . html::anchor($base . 'delete/' . $row->{$first_field}, fpp::iconify('Eliminar', 'trash')) . "</td>" : "";
        //Read
        echo $read == true ? "<td width='35' align='center'>" . html::anchor($base . 'read/' . $row->{$first_field}, fpp::iconify('Ver', 'search')) . "</td>" : "";
        ?>
    </tr>
  <?php 
    }
}
?>
</table>
Esempio n. 11
0
 public function password_recovery()
 {
     $id = 0;
     $passto = false;
     $errors = array();
     $msg = "";
     if ($this->ispost()) {
         $input = Input::Instance();
         $mail = $input->post('mail');
         if ($mail == '') {
             $errors[] = __("El Email no puede estar vacio", false);
         } else {
             if (valid::email($mail) == false) {
                 $errors[] = __("El Email no es valido", false);
             } else {
                 $orm = $this->table->db2cls();
                 $result = $orm->load($mail, 'mail_client');
                 $id = (int) $result->id_client;
                 if ($id == 0) {
                     $errors[] = __("El Email no existe", false);
                 } else {
                     $passto = true;
                     $passwordgenorig = basics::passwordgenerator();
                     $passwordgen = fpp::cryptme($passwordgenorig);
                     $result->password_client = $passwordgen;
                     $href = html::anchor($this->href_store);
                     basics::mail_html_utf8($mail, __('Recuperación de clave de acceso', false), __("Estimado Cliente, <br/>Su nueva contraseña es", false) . " {$passwordgenorig} <br/>{$href}", $this->mail_store, "Floreria Rosabel");
                     $passto = true;
                     $result->save();
                 }
             }
         }
         $msg = $passto == false ? basics::diverror($errors) : basics::diverror(array(__("E-mail enviado, revise su buz&oacute;n", false)));
     }
     $this->content = View::factory("main/recovery_password")->set("msg", $msg)->render();
 }