本文整理汇总了PHP中Evento::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Evento::save方法的具体用法?PHP Evento::save怎么用?PHP Evento::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evento
的用法示例。
在下文中一共展示了Evento::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
//read the post input (use this technique if you have no post variable name):
$post = file_get_contents("php://input");
//decode json post input as php array:
$data = CJSON::decode($post, true);
//Event is a Yii model:
$evento = new Evento();
//load json data into model:
$evento->attributes = $data;
//this is for responding to the client:
$response = array();
//save model, if that fails, get its validation errors:
if ($evento->save() == false) {
$response['success'] = false;
$response['errors'] = $evento->errors;
} else {
$response['success'] = true;
//respond with the saved contact in case the model/db changed any values
//$response['evento'] = $evento;
}
//respond with json content type:
header('Content-type:application/json');
//encode the response as json:
echo CJSON::encode($response);
exit;
}
示例2: handleCreate
public function handleCreate()
{
try {
if (Request::ajax()) {
$error = false;
$idEvento = Input::get('idevento');
$eventoUpdated = Evento::find($idEvento);
if ($eventoUpdated) {
$eventoUpdated->idconfiguraciontrampa = Input::get('idctrampa');
$eventoUpdated->fechaevento = Input::get('fechaevento');
$eventoUpdated->idclasificaiontrampa = Input::get('idclasificacion');
$eventoUpdated->semana = Input::get('semana');
$eventoUpdated->observaciones = Input::get('observaciones');
$eventoUpdated->save();
} else {
$evento = new Evento();
$evento->idconfiguraciontrampa = Input::get('idctrampa');
$evento->fechaevento = Input::get('fechaevento');
$evento->idclasificaiontrampa = Input::get('idclasificacion');
$evento->semana = Input::get('semana');
$evento->observaciones = Input::get('observaciones');
$evento->save();
}
$resultado = array('error' => false, 'msg' => 'created successfully');
return Response::json($resultado);
}
} catch (Exception $ex) {
$resultado = array('error' => true, 'msg' => 'Error saving data');
return Response::json($resultado);
}
}
示例3: postMensajero
public function postMensajero()
{
$id = Input::get('recibo_id');
$recibo = Recibo::find($id);
$evento = new Evento();
$client_id = '830870432482-po6o126nspi5d3iukgkn7ni6m0qpg5mq.apps.googleusercontent.com';
$email_address = '830870432482-po6o126nspi5d3iukgkn7ni6m0qpg5mq@developer.gserviceaccount.com';
$key_file_location = app_path('key/Bifrost-7c8d70841343.p12');
$client = new Google_Client();
$client->setApplicationName('Bifrost');
$key = file_get_contents($key_file_location);
$scopes = implode(' ', array(Google_Service_Calendar::CALENDAR));
$cred = new Google_Auth_AssertionCredentials($email_address, array($scopes), $key);
$client->setAssertionCredentials($cred);
if ($client->getAuth()->isAccessTokenExpired()) {
$client->getAuth()->refreshTokenWithAssertion($cred);
}
$service = new Google_Service_Calendar($client);
$event = new Google_Service_Calendar_Event(array('summary' => 'Cobranza Programada', 'location' => 'Domicilio del cliente', 'description' => Input::get('detalles'), 'start' => array('date' => Input::get('fecha')), 'end' => array('date' => Input::get('fecha'))));
$createdEvent = $service->events->insert('hivbe3rp5ta2vm4tuq3qfqu4u8@group.calendar.google.com', $event);
$evento->recibo_id = $id;
$evento->evento = $createdEvent->getId();
$recibo->mensajero = 1;
$evento->save();
$recibo->save();
return Response::json(array('status', 'ok'));
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$user = Auth::user();
$club = $user->clubs()->FirstOrFail();
$validator = Validator::make(Input::all(), Evento::$rules);
if ($validator->passes()) {
$event = new Evento();
$event->name = Input::get('name');
$event->type_id = Input::get('type');
$event->location = Input::get('location');
$event->date = Input::get('date');
$event->end = Input::get('end');
$event->fee = Input::get('fee');
$event->early_fee = Input::get('early_fee');
$event->early_deadline = Input::get('early_deadline');
$event->open = Input::get('open');
$event->close = Input::get('close');
$event->notes = Input::get('notes');
$event->status = Input::get('status');
$event->max = Input::get('max');
$event->user_id = $user->id;
$event->club_id = $club->id;
$event->save();
if ($event->id) {
return Redirect::action('EventoController@index')->with('messages', 'Event created successfully');
}
}
$error = $validator->errors()->all(':message');
return Redirect::action('EventoController@create')->withErrors($validator)->withInput();
}
示例5: crear
public function crear()
{
$req = $this->request;
$vdt = $this->validarEvento($req->post());
$autor = $this->session->getUser();
$evento = new Evento();
$evento->cuerpo = $vdt->getData('cuerpo');
$evento->lugar = $vdt->getData('lugar');
$evento->fecha = Carbon\Carbon::parse($vdt->getData('fecha'));
$evento->save();
$contenido = new Contenido();
$contenido->titulo = $vdt->getData('titulo');
$contenido->puntos = 0;
$contenido->categoria_id = $vdt->getData('categoria');
$contenido->autor()->associate($autor);
$contenido->contenible()->associate($evento);
$partido = $autor->partido;
if (isset($partido) && $vdt->getData('asociar')) {
$contenido->impulsor()->associate($partido);
}
$contenido->save();
TagCtrl::updateTags($contenido, TagCtrl::getTagIds($vdt->getData('tags')));
$log = UserlogCtrl::createLog('newEventoo', $autor->id, $evento);
if ($contenido->impulsor) {
NotificacionCtrl::createNotif($partido->afiliados()->lists('id'), $log);
}
$this->flash('success', 'Su evento fue creado exitosamente.');
$this->redirectTo('shwEvento', array('idEve' => $evento->id));
}
示例6: creaNuovoEvento
public function creaNuovoEvento($data, $conn = null, $use_swift = true)
{
$evento = new Evento();
$evento->fromArray($data);
$evento->save($conn);
$this->sendMail($evento, $use_swift);
}
示例7: storeEventos
public function storeEventos()
{
$dados = new Evento();
$dados->nome = Input::get('nome');
$dados->local = Input::get('local');
$dados->data_evento = Input::get('ano') . '/' . Input::get('mes') . '/' . Input::get('dia') . ' ' . Input::get('hr') . ':' . Input::get('min');
$dados->valor_ingresso = Input::get('valor');
$dados->artista_principal = Input::get('artista');
$dados->artista_secundario = Input::get('musicos');
$dados->descricao = Input::get('descricao');
$dados->endereco = Input::get('endereco');
$dados->numero = Input::get('numero');
$dados->complemento = Input::get('complemento');
$dados->bairro = Input::get('bairro');
$dados->cidade = Input::get('cidade');
$dados->estado = Input::get('estado');
$dados->coordenadas = Input::get('coord');
$dados->cronograma = Input::get('resp');
$dados->ativo = 1;
$dados->album = 0;
$dados->save();
$destino = str_replace(' ', '_', strtolower(public_path() . "/images/eventos/{$dados->nome}"));
if (Input::hasFile('img')) {
$nome = "evento_" . str_replace(' ', '_', strtolower($dados->nome)) . "." . Input::file('img')->getClientOriginalExtension();
$img = Input::file('img');
$img->move($destino, $nome);
}
return View::make('/admin/cadastros/eventos', array('ok' => true));
}
示例8: testSave
public function testSave()
{
$data = array('titolo' => 'phpday2010!!!', 'descrizione' => 'questo è il talk per il phpday 2010!', 'data_inizio' => '2010-05-14', 'data_fine' => '2010-05-15');
$evento = new Evento();
$evento->fromArray($data);
$evento->save($this->pdo);
$xml_dataset = $this->createFlatXMLDataSet(dirname(__FILE__) . '/../fixtures/evento.xml');
$this->assertDataSetsEqual($xml_dataset, $this->getConnection()->createDataSet(array('evento')));
}
示例9: postGravar
public function postGravar()
{
$evento = new Evento();
$evento->titulo = Input::get('titulo');
$evento->sinopse = Input::get('sinopse');
$evento->categoria = Input::get('categoria');
$evento->protagonista = Input::get('protagonista');
$evento->autor = Input::get('autor');
$evento->save();
$eventos = Evento::all();
return View::make('Evento.eventoVisu')->with('eventos', $eventos);
}
示例10: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Evento();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Evento'])) {
$model->attributes = $_POST['Evento'];
$model->estatus_did = 1;
if ($model->save()) {
$this->redirect(array('index'));
}
} else {
if (isset($_POST["title"])) {
$model->nombre = $_POST['title'];
$model->fechaInicio_ft = $_POST['start'];
$model->fechaFin_ft = $_POST['end'];
$model->estatus_did = 1;
if ($model->save()) {
$this->redirect(array('index'));
}
}
}
$this->render('create', array('model' => $model));
}
示例11: testPostEventoCorrecto
public function testPostEventoCorrecto()
{
$destino = Enhance::getCodeCoverageWrapper('EventosControllerClass');
$destino->postEvento();
$eventos = new Evento();
$eventos->nombre = 'Concierto Dani Martin';
$eventos->fecha = '2014-08-01';
$eventos->hora = '23:30';
$eventos->tipo = 'musica';
$eventos->aforo = '1000';
$eventos->descripcion = 'concierto del ex-cantante de ECDL en Berja';
$eventos->save();
$this->call('POST', 'eventos');
$this->assertRedirectedToRoute('eventos');
}
示例12: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Evento();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Evento'])) {
$model->attributes = $_POST['Evento'];
echo '<pre>';
print_r($model->attributes);
echo "</pre>";
exit;
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例13: postEvento
public function postEvento()
{
$reglas = array('nombre' => array('required', 'min:8', 'unique:eventos'), 'fecha' => 'required', 'hora' => 'required', 'tipo' => 'required', 'aforo' => 'required', 'descripcion' => 'required');
$validator = Validator::make(Input::all(), $reglas);
if ($validator->fails()) {
return Redirect::to('/eventos')->withErrors($validator)->withInput();
} else {
$eventos = new Evento();
$eventos->nombre = Input::get('nombre');
$eventos->fecha = Input::get('fecha');
$eventos->hora = Input::get('hora');
$eventos->tipo = Input::get('tipo');
$eventos->aforo = Input::get('aforo');
$eventos->descripcion = Input::get('descripcion');
$eventos->save();
return Redirect::to('eventos');
}
}
示例14: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new Evento;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Evento']))
{
$model->attributes=$_POST['Evento'];
$model->utilizador_oid = Utilizador::getIdByUsername(
Yii::app()->user->name
);
if($model->save())
$this->redirect(array('//pagevento/index','id'=>$model->idevento));
}
$this->render('create',array(
'model'=>$model,
));
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
if (Request::ajax()) {
$response = array();
$evento = new Evento();
$evento->start = Input::get('fecha_hora');
$evento->nombre = Input::get('nombre');
$evento->descripcion = Input::get('descripcion');
$evento->ambito_evento = Input::get('ambito_evento');
$evento->profesores_id = Auth::user()->id;
if ($evento->validate()) {
if (empty(Input::get('asunto'))) {
$evento->save();
return Response::json(array('success' => true));
} else {
$reunion = new Reunion();
$reunion->asunto = Input::get('asunto');
$reunion->descripcion = Input::get('descripcion_reunion');
if (empty(Input::get('ordinaria'))) {
$reunion->ordinaria = 0;
} else {
$reunion->ordinaria = 1;
}
if ($reunion->validate()) {
$evento->save();
$reunion->eventos_id = $evento->id;
$reunion->save();
return Response::json(array('success' => true));
} else {
return Response::json(array('success' => false, 'errores' => $reunion->errors()->toArray()));
}
}
} else {
return Response::json(array('success' => false, 'errores' => $evento->errors()->toArray()));
}
} else {
return Response::json(array('success' => false));
}
}