Exemple #1
0
 public function fileEventSave()
 {
     View::select(null, null);
     $data = null;
     if (Input::hasPost('fechaSelect')) {
         $upload = new DwUpload('archivo', 'img/upload/eventos/');
         //$upload->setAllowedTypes('png|jpg|gif|jpeg|png');
         $upload->setEncryptName(TRUE);
         $this->data = $upload->save();
         if (!$this->data) {
             //retorna un array('path'=>'ruta', 'name'=>'nombre.ext');
             $data = array('error' => TRUE, 'message' => $upload->getError());
         } else {
             $fecha = Input::post('fechaSelect');
             $hora = Input::post('hora');
             $id = Input::post('id');
             $evento = new Evento();
             if (is_numeric($id) && $evento->find_first($id)) {
                 $evento->urlFile = "img/upload/eventos/{$this->data['name']}";
                 $evento->update();
                 $data = array('success' => true);
                 $data = $evento;
                 $data->networks = json_decode($data->networks);
             } else {
                 $return = array("start" => $fecha, "urlFile" => "img/upload/eventos/{$this->data['name']}", "constraint" => "", "author" => "", "hour" => $hora, "networks" => array("facebook" => "false", "twitter" => "false", "instagram" => "false", "linkedin" => "false", "pinterest" => "false", "youtube" => "false", "plus" => "false"));
                 $data = Evento::setEvento('create', $return, Session::get('id'));
                 $data->networks = json_decode($data->networks);
             }
         }
     }
     $this->data = $data;
     View::json();
 }
Exemple #2
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
$evento = new Evento();
$evento->setEvento($_POST['nombre']);