public function run() { $participants = DB::table('event_participant')->get(); foreach ($participants as $participant) { $player = Player::find($participant->player_id); $user = User::find($participant->user_id); $event = Evento::find($participant->event_id); $payment = Payment::find($participant->payment_id); $uuid = Uuid::generate(); $new = new Participant(); $new->id = $uuid; $new->firstname = $player->firstname; $new->lastname = $player->lastname; $new->due = $event->getOriginal('fee'); $new->early_due = $event->getOriginal('early_fee'); $new->early_due_deadline = $event->early_deadline; $new->method = 'full'; $new->plan_id = Null; $new->player_id = $player->id; $new->event_id = $participant->event_id; $new->accepted_on = $participant->created_at; $new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname; $new->accepted_user = $participant->user_id; $new->status = 1; $new->created_at = $participant->created_at; $new->updated_at = $participant->updated_at; $new->save(); $update = Item::where('payment_id', '=', $payment->id)->firstOrFail(); $update->participant_id = $uuid; $update->save(); } }
public static function getListadoEventoss($usuario_id) { $obj = new Evento(); $conditions = "usuario_id = {$usuario_id}"; $columns = "id, start, end, color, author, notes, urlFile, idPosicion, hour1, day1, hour2, day2, fileUrl, networks, description"; return $obj->find("columns: {$columns}", "conditions: {$conditions}"); }
public function register_visualization($document_id) { $documento = \Documento::find($document_id); if (!$documento) { return \Response::json(['error' => 'No existe ningun documento con id = ' . $document_id], 200); } $auth_token = \Request::header('authorization'); $user = \User::where('auth_token', '=', $auth_token)->first(); $idevento = \Input::get('session_id'); if ($idevento) { $evento = \Evento::find($idevento); if (!$evento) { return \Response::json(['error' => 'No existe ninguna sesión con id = ' . $idevento], 200); } $v = new \Visualizacion(); $v->idusers = $user->id; $v->ideventos = $evento->ideventos; $v->iddocumentos = $document_id; $v->save(); } else { // obtener todos los eventos asociados al documento $eventos = \DocumentosEvento::where('iddocumentos', '=', $document_id)->get(); foreach ($eventos as $evento) { $v = new \Visualizacion(); $v->idusers = $user->id; $v->ideventos = $evento->ideventos; $v->iddocumentos = $document_id; $v->save(); } } return \Response::json(['success' => 1], 200); }
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); } }
public function postAct() { $apagar = Evento::find(Input::get('id')); $apagar->titulo = Input::get('titulo'); $apagar->sinopse = Input::get('sinopse'); $apagar->categoria = Input::get('categoria'); $apagar->protagonista = Input::get('protagonista'); $apagar->autor = Input::get('autor'); $apagar->update(); $eventos = Evento::all(); return View::make('Evento.EventoVisu')->with('eventos', $eventos); }
public function vistaEditar($id, $next) { //Me quedo con el item, buscando por id $evento = Evento::find($id); $secciones = parent::seccionesDinamicas(); if ($evento) { $this->array_view['item'] = $evento->texto()->item(); $this->array_view['evento'] = $evento; $this->array_view['secciones'] = $secciones; $this->array_view['continue'] = $next; return View::make($this->folder_name . '.agregar', $this->array_view); } else { $this->array_view['texto'] = Lang::get('controllers.error_carga_pagina'); return View::make($this->project_name . '-error', $this->array_view); } }
public function obtenerDatosEvento() { if (Request::ajax()) { $evento = Evento::find(Input::get("id")); $reunion = Reunion::whereEventosId(Input::get("id"))->first(); $datos = array(); $datos['nombre'] = $reunion->asunto; $fechayhora = $evento->start; $fechayhora = explode(" ", $fechayhora); $datos['ordinaria'] = $reunion->ordinaria == '1' ? "Ordinaria" : "Extraordinaria"; $datos['fecha'] = $fechayhora[0]; $datos['hora'] = $fechayhora[1]; $datos['asignatura'] = Asignatura::whereId(Asignatura::asignaturaJDAActual())->pluck('nombre'); $datos['departamento'] = Departamento::whereId(Academia::whereId(Asignatura::whereId(Asignatura::asignaturaJDAActual())->pluck('academia_id'))->pluck('departamentos_id'))->pluck('nombre'); $datos['fecha_actual'] = date('Y-m-d'); return Response::json(array('success' => true, 'datos' => $datos)); } }
public function event($id) { //add security to avoid stealing of information $user = Auth::user(); Excel::create('roster', function ($excel) use($id) { $excel->sheet('Sheetname', function ($sheet) use($id) { $event = Evento::find($id); $team = array(); if ($event->children->count() > 0) { foreach ($event->children as $e) { foreach ($e->participants as $member) { $team[] = $member; } } } else { $team = Participant::where('event_id', '=', $id)->with('event')->get(); } $sheet->setOrientation('landscape'); $sheet->loadView('export.lacrosse.roster', ['members' => $team]); }); })->download('xlsx'); }
public static function destacar($input) { $respuesta = array(); $reglas = array(); $validator = Validator::make($input, $reglas); if ($validator->fails()) { $respuesta['mensaje'] = $validator; $respuesta['error'] = true; } else { $evento = Evento::find($input['evento_id']); $data = array('item_id' => $evento->texto()->item()->id, 'seccion_id' => $evento->texto()->item()->seccionItem()->id); $item = Item::destacar($data); $respuesta['mensaje'] = 'Evento destacado.'; $respuesta['error'] = false; $respuesta['data'] = $evento; } return $respuesta; }
public function PaymentStore($club, $id) { $uuid = Uuid::generate(); $uuid2 = Uuid::generate(); $user = Auth::user(); $club = Club::find($club); $event = Evento::find($id); $cart = Cart::contents(true); //Addition for stub feature $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail(); //check if follower equal club if ($follow->club_id != $club->id) { $param = array('ccnumber' => str_replace('_', '', Input::get('card')), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip'), 'discount' => Input::get('discount'), 'club' => $club->id, 'firstname' => $user->profile->firstname, 'lastname' => $user->profile->lastname, 'phone' => $user->profile->mobile); } else { $param = array('customer_vault_id' => $user->profile->customer_vault, 'discount' => Input::get('discount'), 'club' => $club->id); } $payment = new Payment(); $transaction = $payment->sale($param); if ($transaction->response == 3 || $transaction->response == 2) { return Redirect::action('ClubPublicController@PaymentCreate', array($club->id, $event->id))->with('error', $transaction->responsetext); } else { foreach (Cart::contents() as $item) { $player = Player::find($item->player_id); $payment->id = $uuid; $payment->customer = $user->profile->customer_vault; $payment->transaction = $transaction->transactionid; $payment->subtotal = $transaction->subtotal; $payment->service_fee = $transaction->fee; $payment->total = $transaction->total; $payment->promo = $transaction->promo; $payment->tax = $transaction->tax; $payment->discount = $transaction->discount; $payment->club_id = $club->id; $payment->user_id = $user->id; $payment->player_id = $player->id; $payment->event_type = $event->type_id; $payment->type = $transaction->type; $payment->save(); $participant = new Participant(); $participant->id = $uuid2; $participant->firstname = $player->firstname; $participant->lastname = $player->lastname; $participant->due = $event->getOriginal('fee'); $participant->early_due = $event->getOriginal('early_fee'); $participant->early_due_deadline = $event->early_deadline; $participant->event_id = $item->event_id; $participant->player_id = $player->id; $participant->accepted_on = Carbon::Now(); $participant->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname; $participant->accepted_user = $user->id; $participant->status = 1; $participant->method = 'full'; $participant->save(); $salesfee = $item->price / getenv("SV_FEE") - $item->price; $sale = new Item(); $sale->description = $item->name; $sale->quantity = $item->quantity; $sale->price = $item->price; $sale->fee = $salesfee; $sale->payment_id = $uuid; $sale->event_id = $item->event_id; $sale->participant_id = $uuid2; $sale->save(); if ($event->max < $event->participants->count()) { //add to waitlist $waitlist = new Waitlist(); $waitlist->id = Uuid::generate(); $waitlist->participant_id = $uuid2; $waitlist->event_id = $event->id; $waitlist->save(); return $waitlist; } } //email receipt $payment->receipt($transaction, $club->id, $item->player_id); return Redirect::action('ClubPublicController@PaymentSuccess', array($club->id, $event->id))->with('result', $transaction); } }
/** * Show the form for creating a new resource. * GET /calendar/create * * @return Response */ public function create($id) { $event = Evento::find($id); $club = Club::find($event->club_id); return View::make('icalendar.create')->with('event', $event)->with('club', $club); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $authuser = Auth::user(); $evento = Evento::find($id); if ($evento) { $evntimgs = $evento->imagenes; foreach ($evntimgs as $evntimg) { File::delete('images/eventos/' . $evento->imagen); } File::delete('images/eventos/' . $evento->imagen); $evento->delete(); } return Redirect::to('administracion/eventos')->with(array('usuarioimg' => $authuser->imagen, 'usuarionombre' => $authuser->nombre, 'usuarioid' => $authuser->id)); // }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($idEvento) { $response = array(); if (Request::ajax()) { $response['id'] = $idEvento; $response['datos'] = Input::all(); $response['success'] = true; $evento = Evento::find($idEvento); $evento->start = Input::get('fecha_hora'); $evento->nombre = Input::get('nombre'); $evento->descripcion = Input::get('descripcion'); $evento->save(); return json_encode($response); } return array('success' => false); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $event = Evento::find($id); $status = $event->delete(); if ($status) { return Redirect::action('EventoController@index'); } return Redirect::action('EventoController@index')->withErrors($status); }
public function submit_upload_file() { if (Auth::check()) { $data["inside_url"] = Config::get('app.inside_url'); $data["user"] = Session::get('user'); $data["permisos"] = Session::get('permisos'); if (in_array('side_nuevo_evento', $data["permisos"])) { // Validate the info, create rules for the inputs $attributes = array('archivo' => 'Documento'); $messages = array(); $rules = array('archivo' => 'required|max:15360|mimes:pdf,doc,docx,xls,xlsx,ppt,pptx'); // Run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules, $messages, $attributes); // If the validator fails, redirect back to the form $ideventos = Input::get('ideventos'); if ($validator->fails()) { return Redirect::to('eventos/upload_file/' . $ideventos)->withErrors($validator)->withInput(Input::all()); } else { if (Input::hasFile('archivo')) { $archivo = Input::file('archivo'); $rutaDestino = 'files/eventos/'; $nombreArchivo = $archivo->getClientOriginalName(); $nombreArchivoEncriptado = Str::random(27) . '.' . pathinfo($nombreArchivo, PATHINFO_EXTENSION); $peso = $archivo->getSize(); $uploadSuccess = $archivo->move($rutaDestino, $nombreArchivoEncriptado); /* Creo el documento */ $documento = new Documento(); $documento->titulo = $nombreArchivo; $documento->idtipo_documentos = 1; // ¡Que viva el hardcode! $documento->nombre_archivo = $nombreArchivoEncriptado; $documento->ruta = $rutaDestino; $documento->peso = $peso; $documento->save(); /* Creo la relación de evento con documento */ $documentos_evento = new DocumentosEvento(); $documentos_evento->ideventos = $ideventos; $documentos_evento->iddocumentos = $documento->iddocumentos; $documentos_evento->save(); /* Envio las notificaciones via e-mail a los voluntarios */ $evento = Evento::find($ideventos); $emails_voluntarios = Asistencia::getUsersPorEvento($evento->ideventos)->get(); $emails = array(); foreach ($emails_voluntarios as $email_voluntario) { $emails[] = $email_voluntario->email; } Mail::send('emails.eventDocumento', array('evento' => $evento, 'documento' => $documento), function ($message) use($emails, $evento) { $message->to($emails)->subject('Se subió un nuevo documento de AFI Perú.'); }); //Enviar las push notifications a los voluntarios $voluntarios = Asistencia::getUserPushInfoByEvento($evento->ideventos)->get(); foreach ($voluntarios as $voluntario) { if ($voluntario->push_documents && $voluntario->uuid) { $message = 'Se subió un nuevo documento de AFI Perú.'; Helpers::pushAPNS($voluntario->uuid, $message, 3); } } // Enviar las push notifications (android) a los voluntarios $gcm_tokens = Asistencia::getUsersToNotificateDocumentUploaded($ideventos)->get()->lists('gcm_token'); $title = 'AFI Perú - Nuevo documento'; $message = 'Se subió un nuevo documento de AFI Perú: ' . $documento->titulo; $type = 3; $m = ['title' => $title, 'message' => $message, 'type' => $type]; Helpers::pushGCM($gcm_tokens, $m); // Llamo a la función para registrar el log de auditoria $descripcion_log = "Se subió el documento con id {{$documento->iddocumentos}}"; Helpers::registrarLog(7, $descripcion_log); } Session::flash('message', 'Se subió correctamente el archivo.'); return Redirect::to('eventos/upload_file/' . $ideventos); } } else { // Llamo a la función para registrar el log de auditoria $descripcion_log = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'"; Helpers::registrarLog(10, $descripcion_log); Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.'); return Redirect::to('/dashboard'); } } else { return View::make('error/error'); } }
public function delete($participant) { $user = Auth::user(); $club = $user->clubs()->FirstOrFail(); $participant = Participant::Find($participant); $player = Player::Find($participant->player_id); $event = Evento::find($participant->event->id); // $payment = Payment::find($payment); $title = 'League Together - ' . $event->name . ' Event'; return View::make('app.club.event.participant.delete')->with('page_title', $title)->withEvent($event)->withClub($club)->withPlayer($player)->with('participant', $participant)->withUser($user); }
private function superaHoras() { $supera = false; //Número de horas ya reservadas en global $nh = Auth::user()->numHorasReservadas(); //número de horas del evento a modificar (hay que restarlas de $nh) $event = Evento::find(Input::get('idEvento')); $nhcurrentEvent = sgrDate::diffHours($event->horaInicio, $event->horaFin); //Actualiza el valor de horas ya reservadas quitando las del evento que se modifica $nh = $nh - $nhcurrentEvent; //Estas son las horas que se quieren reservar $nhnewEvent = sgrDate::diffHours(Input::get('hInicio'), Input::get('hFin')); //máximo de horas a la semana $maximo = Config::get('options.max_horas'); //credito = máximo (12) menos horas ya reservadas (nh) $credito = $maximo - $nh; //número de horas que aún puede el alumno reservar if ($credito < $nhnewEvent) { $supera = true; } //$supera = 'nh='.$nh.',$nhnewEvent='.$nhnewEvent.',nhcurrentEvent='.$nhcurrentEvent; return $supera; }
public function doRefund($id) { $user = Auth::user(); $club = $user->clubs()->FirstOrFail(); $uuid = Uuid::generate(); $payment = Payment::where('club_id', '=', $club->id)->where('transaction', '=', $id)->FirstOrFail(); $user_parent = User::find($payment->user_id); $uuid = Uuid::generate(); if ($payment->event_type) { $participant = Participant::Find($payment->items->first()->participant_id); $event = Evento::find($participant->event->id); } else { $participant = Member::Find($payment->items->first()->member_id); $event = Team::find($participant->team->id); } $player = Player::Find($participant->player->id); //$amount = $payment->getOriginal('subtotal'); $amount = Input::get('amount'); if ($amount > $payment->getOriginal('subtotal')) { return Redirect::action('AccountingController@refund', $payment->transaction)->with('error', "You cannot refund more than " . $payment->getOriginal('subtotal')); } if ($amount <= 0 || $amount == '') { return Redirect::action('AccountingController@refund', $payment->transaction)->with('error', "Amount must be more than 0"); } if ($amount > 0) { $param = array('transactionid' => $payment->transaction, 'club' => $club->id, 'amount' => number_format($amount, 2, ".", "")); $transaction = $payment->refund($param); if ($transaction->response == 3 || $transaction->response == 2) { return Response::json($transaction); return Redirect::action('AccountingController@transaction', $payment->transaction)->with('error', $transaction->responsetext); } else { $payment1 = new Payment(); $payment1->id = $uuid; $payment1->customer = $user_parent->profile->customer_vault; $payment1->transaction = $transaction->transactionid; $payment1->subtotal = -$transaction->total; $payment1->total = -$transaction->total; $payment1->club_id = $club->id; $payment1->user_id = $user_parent->id; $payment1->player_id = $player->id; $payment1->type = $transaction->type; $sale = new Item(); $sale->description = $event->name . " ({$transaction->type})"; $sale->quantity = 1; $sale->price = -$transaction->total; $sale->payment_id = $uuid; if ($payment->event_type) { $payment1->event_type = $event->type_id; } else { $payment1->event_type = NULL; } $payment1->save(); $sale->save(); $data = array('club' => $club, 'transaction' => $transaction, 'user' => $user, 'contact' => $user_parent); //send notification for refund confirmation $mail = Mail::send('emails.receipt.refund', $data, function ($message) use($user, $club, $user_parent) { $message->to($user_parent->email)->subject("Refund Confirmation | " . $club->name); foreach ($club->users()->get() as $value) { $message->bcc($value->email, $club->name); } }); } //end of transaction result } //end of amount test return Redirect::action('AccountingController@transaction', $payment->transaction); }
/** * Show the form for editing the specified evento. * * @param int $id * @return Response */ public function edit($id) { $evento = Evento::find($id); return View::make('eventos.edit', compact('evento')); }