本文整理汇总了PHP中Evento::find_first方法的典型用法代码示例。如果您正苦于以下问题:PHP Evento::find_first方法的具体用法?PHP Evento::find_first怎么用?PHP Evento::find_first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evento
的用法示例。
在下文中一共展示了Evento::find_first方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setEvento
/**
* Método para crear/modificar un objeto de base de datos
*
* @param string $medthod: create, update
* @param array $data: Data para autocargar el modelo
* @param array $optData: Data adicional para autocargar
*
* return object ActiveRecord
*/
public static function setEvento($method, $data, $usuario = null)
{
$obj = new Evento($data);
//Se carga los datos con los de las tablas
$obj->usuario_id = $usuario;
if (!empty($obj->id)) {
$old = new Evento();
if ($old->find_first($obj->id)) {
if ($method == 'create') {
$obj->id = $old->id;
$method = 'update';
}
}
}
return $obj->{$method}() ? $obj : FALSE;
}
示例2: fileEventSave
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();
}