Exemplo n.º 1
0
 public function postSubmit(EventReq $req)
 {
     $event = new Event();
     $event->save();
     $event->staff()->attach(\Auth::user(), ['created_at' => $event->created_at, 'updated_at' => $event->updated_at]);
     $id_slug = slugify($event->id, $event->title);
     return redirect()->action('EventController@getDetails', $id_slug);
 }
Exemplo n.º 2
0
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     }
     return $this->render('create', ['model' => $model, 'users' => $this->getUsers(), 'typeEvents' => $this->getTypeEvents(), 'events' => $this->getEvents(), 'defaultEvent' => $this->getDefaultEvent()]);
 }
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemplo n.º 4
0
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'zal' => Zal::find()->asArray()->orderBy('name_zal')->all(), 'client' => Client::find()->asArray()->orderBy('name_client')->all(), 'users' => Users::find()->asArray()->where(['status' => 10])->orderBy('username')->all()]);
     }
 }
Exemplo n.º 5
0
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post())) {
         $model->save();
         //var_dump($model->getErrors()); die;
     }
     return $this->render('create', array('model' => $model));
 }
Exemplo n.º 6
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $event = new Event();
     $event->event_name = "Test Event";
     $event->event_start_date = Carbon::createFromFormat('Y-m-d h:i A', '2016-05-21 12:00 PM')->toDateTimeString();
     $event->event_end_date = Carbon::createFromFormat('Y-m-d h:i A', '2016-05-21 3:30 PM')->toDateTimeString();
     $user = User::find(1);
     $event->user_id = $user->id;
     $event->save();
 }
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($date)
 {
     if (Yii::$app->user->can('admin')) {
         $model = new Event();
         $model->created_date = $date;
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             return $this->redirect(['index', 'id' => $model->id]);
         } else {
             return $this->renderAjax('create', ['model' => $model]);
         }
     }
 }
Exemplo n.º 8
0
 public function edit(EventRequest $request, Event $event)
 {
     $this->authorize('edit-event');
     $input = $request->all();
     $event->update($input);
     if ($request->hasFile('image')) {
         $event->image = $this->handleUpload($request);
     }
     $event->save();
     event(new EventChanged($event, ['type' => 'event', 'status' => 'edited']));
     $request->session()->flash('success', 'Event has been updated.');
     return redirect('/event/' . $event->id);
 }
Exemplo n.º 9
0
 public function store(Request $request)
 {
     $input = Input::except('token');
     $event = new Event();
     $validator = $event->getValidator($input);
     if ($validator->fails()) {
         return $this->respondInvalidData($validator->errors());
     }
     $event->fill($input);
     $event->user_id = Auth::user()->id;
     $event->save();
     return $this->respondCreateSuccess($event->event_name . ' created');
 }
Exemplo n.º 10
0
 /**
  * Save event data in the database
  *
  * @param array $data
  * @throws \Exception
  */
 public function save(array $data)
 {
     // Check event type
     if (!$this->hasValidEventType($data)) {
         throw new \Exception(\Yii::t("app", "Event has a invalid type: Should not be recorded."));
     }
     // Prepare the data for the model validation
     $eventData = ['Event' => $data];
     // New Event Model
     $eventModel = new Event();
     // Populate Event Model and Save (with validation)
     if (!$eventModel->load($eventData) || !$eventModel->save()) {
         throw new \Exception(Yii::t("app", "Error saving Event Model"));
     }
 }
Exemplo n.º 11
0
 public static function createEvent(EEvent $event, UserId $event_owner, $self = true, UserId $user_connected = null, $data_connected = null)
 {
     $e = new Event();
     $e->event_owner = $event_owner->getId();
     $e->event_type = $event->getValue();
     if (!is_null($user_connected)) {
         $e->event_user_connected = $user_connected->getId();
     }
     $data_c = [];
     $data_c['self_mode'] = $self;
     $e->event_data_connected = json_encode($data_c);
     $date = new \DateTime();
     $e->date = $date->format("Y-m-d H:i:s");
     $e->save();
 }
Exemplo n.º 12
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // ---------------------------------------------------------------------
     // CONFERENCE 1
     // ---------------------------------------------------------------------
     $conference = ['name' => 'India Conference', 'description' => 'A conference in India.', 'start_date' => '2016-03-01', 'end_date' => '2016-03-31', 'address' => 'Sansad Marg, Connaught Place, New Delhi, Delhi 110001, India', 'city' => 'New Delhi', 'country' => 'India', 'capacity' => 1000, 'status' => 'approved'];
     $conference = Conference::create($conference);
     $event = ['name' => 'Opening Ceremony', 'description' => 'Welcome!', 'facilitator' => 'TBD', 'date' => '2016-05-01', 'start_time' => '09:00:00', 'end_time' => '10:00:00', 'address' => 'Sansad Marg, Connaught Place, New Delhi, Delhi 110001, India', 'city' => 'New Delhi', 'country' => 'India', 'capacity' => 1000, 'status' => 'approved'];
     $event = new Event($event);
     $event->conference()->associate($conference);
     $event->save();
     // ---------------------------------------------------------------------
     // CONFERENCE 2
     // ---------------------------------------------------------------------
     $conference = ['name' => 'Canada Conference', 'description' => 'A conference in Canada.', 'start_date' => '2016-05-11', 'end_date' => '2016-05-20', 'address' => '1055 Canada Pl, Vancouver, BC V6C 0C3, Canada', 'city' => 'Vancouver', 'country' => 'Canada', 'capacity' => 1000, 'status' => 'approved'];
     $conference = Conference::create($conference);
     $event = ['name' => 'Opening Ceremony', 'description' => 'Welcome!', 'facilitator' => 'TBD', 'date' => '2016-05-11', 'start_time' => '09:00:00', 'end_time' => '10:00:00', 'address' => '1055 Canada Pl, Vancouver, BC V6C 0C3, Canada', 'city' => 'Vancouver', 'country' => 'Canada', 'capacity' => 1000, 'status' => 'approved'];
     $event = new Event($event);
     $event->conference()->associate($conference);
     $event->save();
     // ---------------------------------------------------------------------
     // CONFERENCE 3
     // ---------------------------------------------------------------------
     $conference = ['name' => 'France Conference', 'description' => 'A conference in France.', 'start_date' => '2016-05-21', 'end_date' => '2016-05-30', 'address' => '17 Boulevard Saint-Jacques, Paris 75014, France', 'city' => 'Paris', 'country' => 'France', 'capacity' => 1000, 'status' => 'approved'];
     $conference = Conference::create($conference);
     $event = ['name' => 'Opening Ceremony', 'description' => 'Welcome!', 'facilitator' => 'TBD', 'date' => '2016-05-21', 'start_time' => '09:00:00', 'end_time' => '10:00:00', 'address' => '17 Boulevard Saint-Jacques, Paris 75014, France', 'city' => 'Paris', 'country' => 'France', 'capacity' => 1000, 'status' => 'approved'];
     $event = new Event($event);
     $event->conference()->associate($conference);
     $event->save();
     // ---------------------------------------------------------------------
     // CONFERENCE 4
     // ---------------------------------------------------------------------
     $conference = ['name' => 'CPSC 319 Final Demos', 'description' => 'Teams present their projects.', 'start_date' => '2016-03-31', 'end_date' => '2016-04-07', 'address' => 'Hugh Dempster Pavilion, 6245 Agronomy Road, Vancouver, BC V6T 1Z4', 'city' => 'Vancouver', 'country' => 'Canada', 'capacity' => 100, 'status' => 'approved'];
     $conference = Conference::create($conference);
     $event = ['name' => 'Project 2 Final Demos', 'description' => 'Teams 5 to 8 present their projects.', 'facilitator' => 'Dr Ahmed Awad', 'date' => '2016-03-31', 'start_time' => '12:30:00', 'end_time' => '14:00:00', 'address' => 'Hugh Dempster Pavilion, 6245 Agronomy Road, Vancouver, BC V6T 1Z4', 'city' => 'Vancouver', 'country' => 'Canada', 'capacity' => 100, 'status' => 'approved'];
     $event = new Event($event);
     $event->conference()->associate($conference);
     $event->save();
     $event = ['name' => 'Project 3 Final Demos', 'description' => 'Teams 9 to 12 present their projects.', 'facilitator' => 'Dr Ahmed Awad', 'date' => '2016-04-05', 'start_time' => '12:30:00', 'end_time' => '14:00:00', 'address' => 'Hugh Dempster Pavilion, 6245 Agronomy Road, Vancouver, BC V6T 1Z4', 'city' => 'Vancouver', 'country' => 'Canada', 'capacity' => 100, 'status' => 'pending'];
     $event = new Event($event);
     $event->conference()->associate($conference);
     $event->save();
     $event = ['name' => 'Project 1 Final Demos', 'description' => 'Teams 1 to 4 present their projects.', 'facilitator' => 'Dr Ahmed Awad', 'date' => '2016-04-07', 'start_time' => '12:30:00', 'end_time' => '14:00:00', 'address' => 'Hugh Dempster Pavilion, 6245 Agronomy Road, Vancouver, BC V6T 1Z4', 'city' => 'Vancouver', 'country' => 'Canada', 'capacity' => 100, 'status' => 'pending'];
     $event = new Event($event);
     $event->conference()->associate($conference);
     $event->save();
 }
Exemplo n.º 13
0
 /**
  * Create an Event for a Conference.
  *
  * @param  EventRequest  $request
  * @param  int  $cid
  * @return Response
  */
 public function store(EventRequest $request, $cid)
 {
     try {
         $user = $this->getUser($request);
         $conference = Conference::find($cid);
         if (!$conference->exists()) {
             return response()->error(404, 'Conference Not Found');
         }
         $event = new Event($request->all());
         $event->conference()->associate($conference);
         $event->save();
         $event->managers()->attach($user);
         $this->addActivity($user->getKey(), 'requested', $event->getKey(), 'event');
         return response()->success();
     } catch (Exception $e) {
         return response()->error();
     }
 }
Exemplo n.º 14
0
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($date)
 {
     $model = new Event();
     $model->user_id = Yii::$app->user->id;
     $model->date = $date;
     if ($model->load(Yii::$app->request->post())) {
         //var_dump($model);
         $model->shared_with = implode(',', $model->shared_with);
         if ($model->save()) {
             Yii::$app->notification->notify($model->title, $model, $model->user, Yii::$app->controller->id, $model->shared_with);
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } elseif (Yii::$app->request->isAjax) {
         return $this->renderAjax('_form', ['model' => $model]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
<div class="row">
    <div class="col-lg-12 line99">

    </div>
</div>
<br>

<div class="col-lg-12 textEvent2">
    <?php 
$customer = new Event();
$idUser = Yii::$app->user->identity->id;
$customer->idUser = $idUser;
$customer->textEvent = Html::encode($model->subject);
$customer->Date = "2000-" . Html::encode($model->month) . "-" . Html::encode($model->day);
$customer->save();
$day = Html::encode($model->day);
$month = Html::encode($model->month);
$Month_rus = ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'];
$showMonth = $Month_rus[$month - 1];
echo "<b>" . $day . " " . $showMonth . " </b> будет <b>" . Html::encode($model->subject) . " </b>!";
?>

 </div>

<div class="col-lg-12 ">
    <div class="btn-toolbar">
        <div class="btn-group btn-group-lg">
            <a class="btn btn-default addCase" href="<?php 
echo \Yii::$app->urlManager->createUrl(['site/index']);
?>
Exemplo n.º 16
0
 public function createEvent(Request $request)
 {
     $validator = Validator::make($request->all(), ['title' => 'required|string', 'description' => 'required|string', 'begin' => 'required|integer', 'end' => 'required|integer']);
     if ($validator->fails()) {
         return $validator->errors()->all();
     }
     if ($request->end < $request->begin) {
         return "invalid time";
     }
     $event = new Event();
     $event->title = $request->title;
     $event->description = $request->description;
     // unnecessary, should just be forcing api to datetime
     $event->begin = Carbon::createFromTimestamp($request->begin, 'America/New_York')->toDateTimeString();
     $event->end = Carbon::createFromTimestamp($request->end, 'America/New_York')->toDateTimeString();
     $event->save();
     return "success";
 }
Exemplo n.º 17
0
 /**
  * new-Action (Formularauswertung)
  */
 public function postNew()
 {
     $validator = Validator::make(Request::all(), Event::$rules);
     // validation has passed, write events in range on that date to xml File
     $geocoding_arr = Event::lookup(Request::input('adress'));
     $date = strtotime(Request::input('date'));
     (double) ($lat = $geocoding_arr['latitude']);
     (double) ($lng = $geocoding_arr['longitude']);
     //Start XML file, create parent node
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     if ($validator->passes()) {
         // validation has passed, save event in DB
         $event = new Event();
         $event->title = Request::input('name');
         $event->content = Request::input('content');
         $event->link = Request::input('link');
         $event->type = Request::input('type');
         $event->latitude = $lat;
         $event->longitude = $lng;
         $event->save();
         return redirect('events')->with('message', 'success|Event erfolgreich angelegt!');
     } else {
         // validation has failed, display error messages
         return redirect('events/new')->with('message', 'danger|Die folgenden Fehler sind aufgetreten:')->withErrors($validator)->withInput();
     }
 }
Exemplo n.º 18
0
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (\Yii::$app->user->isGuest) {
         return $this->redirect('/site/denied/');
     }
     $user = \Yii::$app->user->identity;
     if (!$user->admin && count($user->organisations) == 0) {
         return $this->redirect('/site/denied/');
     }
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemplo n.º 19
0
 protected function migrate_events()
 {
     $website = Website::first();
     $data_users = User::get();
     foreach ($data_users as $user) {
         $users[$user['username']] = $user;
     }
     // get old articles
     DB::connection('mongodb')->collection('posts')->where('category', 'regex', '/events/i')->chunk(1000, function ($data) use($new_collection, $users, $website) {
         foreach ($data as $x) {
             unset($tags);
             $tags[] = 'events';
             if (str_is('*car free day*', strtolower($x['title']))) {
                 $tags[] = 'cfd';
             }
             if (str_is('*seminar*', strtolower($x['title']))) {
                 $tags[] = 'seminar';
             }
             if (str_is('*opening*', strtolower($x['title']))) {
                 $tags[] = 'opening';
             }
             if (str_is('*ustad*', strtolower($x['title']))) {
                 $tags[] = 'religius';
             }
             if (str_is('*clothing*', strtolower($x['title']))) {
                 $tags[] = 'pameran';
             }
             if (str_is('*konser*', strtolower($x['title'])) || str_is('*concert*', strtolower($x['title'])) || str_is('*cherry bell*', strtolower($x['title']))) {
                 $tags[] = 'konser';
             }
             if (str_is('*brawijaya*', strtolower($x['title']))) {
                 $tags[] = 'brawijaya';
             }
             if (str_is('*stand up comedy*', strtolower($x['title']))) {
                 $tags[] = 'stand up comedy';
             }
             if (str_is('*job fair*', strtolower($x['title'])) || str_is('*career expo*', strtolower($x['title']))) {
                 $tags[] = 'job fair';
             }
             if (str_is('*film*', strtolower($x['title']))) {
                 $tags[] = 'film';
             }
             if (str_is('*film*', strtolower($x['title']))) {
                 $tags[] = 'film';
             }
             if (str_is('*lomba*', strtolower($x['title'])) || str_is('*kompetisi*', strtolower($x['title']))) {
                 $tags[] = 'kompetisi';
             }
             if ($x['tgl_published']) {
                 $news = new Event(['title' => $x['title'], 'slug' => str_replace('.', '', $x['url']), 'summary' => str_limit(strip_tags(str_replace("\n", "", $x['full'])), 125), 'content' => $x['full'], 'published_at' => date('Y-m-d H:i:s', $x['tgl_published']->sec), 'created_at' => $x['tgl'], 'updated_at' => $x['tgl'], 'user_id' => array_key_exists($x['author'], $users) ? $users[$x['author']]->id : $users['dita']->id, 'started_at' => $x['extra_field']['event_tgl_start']->sec, 'ended_at' => isset($x['extra_field']['event_tgl_end']) ? $x['extra_field']['event_tgl_end']->sec : $x['extra_field']['event_tgl_start']->sec, 'location' => isset($x['extra_field']['event_lokasi']) ? $x['extra_field']['event_lokasi'] : '', 'komunitas_id' => Directory::where('ori_id', '=', $x['extra_field']['event_komunitas'])->first()->id, 'views' => isset($x['views']) ? $x['views'] : 0]);
                 if (!$news->save()) {
                     print_r($news->toArray());
                     dd($news->getErrors());
                 }
                 // ----------------------------------------------------------------------------------------------------
                 // IMAGE
                 // ----------------------------------------------------------------------------------------------------
                 $s_image = new Image(['name' => 'sm', 'path' => $x['thumbmail'], 'title' => '', 'description' => '']);
                 $m_image = new Image(['name' => 'md', 'path' => $x['image'], 'title' => '', 'description' => '']);
                 $l_image = new Image(['name' => 'lg', 'path' => $x['image'], 'title' => '', 'description' => '']);
                 $news->images()->updateOrCreate(['name' => 'sm'], $s_image->toArray());
                 $news->images()->updateOrCreate(['name' => 'md'], $m_image->toArray());
                 $news->images()->updateOrCreate(['name' => 'lg'], $l_image->toArray());
                 // ----------------------------------------------------------------------------------------------------
                 // TAG
                 // ----------------------------------------------------------------------------------------------------
                 unset($tags_model);
                 $tags_model = new Collection();
                 foreach ($tags as $tag) {
                     $tags_model[] = Tag::firstOrCreate(['name' => $tag]);
                 }
                 foreach ($tags_model as $k => $v) {
                     if (!$tags_model[$k]->save()) {
                         dd($tags_model[$k]->getErrors());
                     }
                 }
                 if (count($tags_model)) {
                     $news->tags()->sync($tags_model->lists('id'));
                 }
                 // ----------------------------------------------------------------------------------------------------
                 // WEBSITE
                 // ----------------------------------------------------------------------------------------------------
                 $news->websites()->sync([$website->id]);
                 // ----------------------------------------------------------------------------------------------------
                 // LOG
                 // ----------------------------------------------------------------------------------------------------
                 // $news->authored()->attach(array_key_exists($x['author'], $users) ? $users[$x['author']]->id : $users['dita']->id, ['original_data' => json_encode([]), 'updated_data' => $news->toJson()]);
             }
             // $news->websites()->associate($website);
             // $news->save();
         }
     });
     // save to new tables
 }
Exemplo n.º 20
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $geocoding_arr = Event::lookup(Request::input('adress'));
     $date = strtotime(Request::input('date'));
     (double) ($lat = $geocoding_arr['latitude']);
     (double) ($lng = $geocoding_arr['longitude']);
     //
     $event = new Event();
     $event->title = Request::input('title');
     $event->content = Request::input('content');
     $event->link = Request::input('link');
     $event->type = Request::input('type');
     $event->latitude = $lat;
     $event->longitude = $lng;
     $event->save();
     $response = new \stdClass();
     $response->success = true;
     $response->total = 1;
     $response->data = $event;
     return response()->json($response);
 }
Exemplo n.º 21
0
 /**
  * Добавление события
  * @return string
  */
 public function actionEvents()
 {
     if (Yii::$app->getRequest()->getQueryParam('user')) {
         $start_day = strtotime('now 00:00:00', time() + 7 * 60 * 60);
         $user = MarkUser::findOne(Yii::$app->getRequest()->getQueryParam('user'));
         if (!$user) {
             return 'Доступ запрещен!';
         }
         if (Yii::$app->getRequest()->getQueryParam('text') && Yii::$app->getRequest()->getQueryParam('cat')) {
             if (Categories::find()->where("name like '" . trim(Yii::$app->getRequest()->getQueryParam('cat') . "'"))->one()) {
                 $cat_id = Categories::find()->where(['name' => Yii::$app->getRequest()->getQueryParam('cat')])->one()->id;
                 //$item->cat_id = Categories::find()->where("name like '".trim(Yii::$app->getRequest()->getQueryParam('cat')."'"))->one()->id;
             } else {
                 return "Категория!";
             }
             $act = new DiaryActs();
             $act->model_id = 10;
             $act->user_id = $user->id;
             //return var_dump($act);
             if ($act->save(false)) {
                 $event = new Event();
                 $event->act_id = $act->id;
                 $event->cat_id = $cat_id;
                 if (Yii::$app->getRequest()->getQueryParam('old_data_ev')) {
                     $event->old_data = Yii::$app->getRequest()->getQueryParam('old_data_ev');
                 }
                 $event->user_id = $act->user_id;
                 $event->text = Yii::$app->getRequest()->getQueryParam('text');
                 if (!$event->validate()) {
                     return 'Данные введены некорректно';
                 } else {
                     if ($event->save()) {
                         return "<p>Событие сохранено!</p>";
                     } else {
                         return 'Ошибка сохранения';
                     }
                 }
             }
         }
         $today_event_acts = implode(',', ArrayHelper::map(DiaryActs::find()->where("time > {$start_day} and user_id = " . $user->id . " and model_id = 10")->all(), 'id', 'id'));
         $today_event = [];
         //return var_dump($today_event_acts);
         if ($today_event_acts) {
             $today_event = Event::find()->where("act_id  IN (" . $today_event_acts . ")")->orderBy('id DESC')->andWhere(["old_data" => 0])->all();
         }
         //return var_dump($today_event);
         return $this->renderPartial('add_event', ['user' => $user, 'today_event' => $today_event]);
     }
 }
Exemplo n.º 22
0
 /**
  * Create event messages. If the message is reporting location, we use
  * eventKey to store coordinates in order to save estate.
  *
  * @param array $fields
  * @return Message|null
  */
 protected function createEvent(array $fields)
 {
     $basic = $this->createBasic($fields);
     $event = new Event();
     $extra = collect($fields)->filter(function ($val, $name) {
         return !in_array($name, $this->common);
     });
     $event->event = Str::lower($extra->get('Event'));
     $event->ticket = $extra->get('Ticket');
     // Weixin sent empty array for unsubscribe event
     $event->eventKey = $extra->get('EventKey') ?: null;
     if ($extra->has('Latitude')) {
         $event->eventKey = implode(';', $extra->only('Latitude', 'Longitude', 'Precision')->values()->toArray());
     }
     $event->save();
     $event->message()->save($basic);
     return $basic;
 }