public function actionSamplepdf($id) { $model = $this->findModel($id); $imgLink = "../resources/activities/activity_" . $id . ".jpg"; $date = date("M d D", strtotime($model->startDatetime)); $startTime = date("g:i A", strtotime($model->startDatetime)); $endTime = date("g:i A", strtotime($model->endDatetime)); $content = ' <div class="container text-center"> <div class="row"> <div class="col-sm-8"> <h1>' . $model->Activity_name . '</h1> <p>' . $model->description . '</p> <p class="text-center"><img src="' . $imgLink . '" class="activity-detail-img"></p> </div> <div class="col-sm-4 activity-detail-technical" style="background-color: <?= \\app\\models\\ActivityType::getActivityTypeThemeColorById($model->ActivityType_id) ?>"> <h3>Date and Time</h3> ' . $date . '<br> ' . $startTime . ' - ' . $endTime . ' <h3>Venue</h3> ' . \app\models\Venue::getVenueNameById($model->Venue_id) . ' <h3>Person in Charge</h3> ' . \app\models\User::getUserFullNameById($model->personInCharge) . ' </div> </div> </div> '; $mpdf = new mPDF(); $mpdf->WriteHTML($content); $mpdf->Output(); exit; }
/** * Show the form for editing the specified resource. * * @param int $id * * @return mixed */ public function edit($id) { $fixture = Fixture::findOrFail($id); $divisions = Division::all(); $teams = Team::all(); $venues = Venue::all(); return view('admin.data-management.fixtures.edit', compact('fixture', 'divisions', 'teams', 'venues')); }
private function leftMenuCounts() { view()->composer('dashboard._partials.left.menu_bar', function ($view) { $view->with('usersCount', User::count()); $view->with('categoriesCount', Category::count()); $view->with('venuesCount', Venue::count()); $view->with('spacesCount', Space::count()); $view->with('amenitiesCount', Tag::where('type', 'amenity')->count()); }); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Venue::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->joinWith('venueType'); $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'map', $this->map])->andFilterWhere(['like', 'floorPlan', $this->floorPlan])->andFilterWhere(['like', 'venueType.name', $this->VenueType_id]); return $dataProvider; }
/** * Run the migrations. * * @return void */ public function up() { // Schema::create('venues', function (Blueprint $table) { $table->increments('id'); $table->string('venue'); $table->string('slug')->unique(); $table->string('city'); $table->string('state'); $table->string('place'); $table->string('address')->nullable(); $table->string('coords')->nullable(); $table->string('directions')->nullable(); $table->string('contacts')->nullable(); $table->timestamps(); $table->timestamp('published')->nullable(); $table->softDeletes(); }); Venue::create(['venue' => 'Crown Plaza Austin', 'slug' => 'texas-austin-crown-plaza-austin', 'city' => 'Austin', 'state' => 'Texas', 'place' => 'ChIJVzSZghjKRIYREyXBujdzq6w', 'directions' => 'http://www.ihg.com/crowneplaza/hotels/us/en/austin/ausgz/hoteldetail?cm_mmc=GoogleMaps-_-cp-_-USEN-_-ausgz#map-directions', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]); }
/** * @return \yii\db\ActiveQuery */ public function getVenues() { return $this->hasMany(Venue::className(), ['VenueType_id' => 'id']); }
protected function conference($route, $event) { $venue = Venue::where('slug', '=', $event->venue_slug)->published()->get(); $venue = !empty($venue[0]) ? (object) $venue[0]->toArray() : null; $options = Helpers::options($route, $event->slug, $event); // dd($options); $navs = Helpers::navigation($route, $options); $sub = Helpers::navigation($route, $options, true); $partners = (object) ['companies' => null, 'text' => null]; if (!empty($event->partners)) { $undo = Helpers::unserialize($event->partners); $companies = Partner::where(function ($query) use($undo) { foreach ($undo['partners'] as $i => $slug) { if ($i === 0) { $query->where('slug', '=', $slug); } else { $query->orWhere('slug', '=', $slug); } } })->published()->orderBy('company')->get(); if (!empty($undo['text'])) { $partners->text = $undo['text']; } if (is_object($companies)) { $partners->companies = []; foreach ($companies as $i => $company) { $partners->companies[] = (object) $company->toArray(); } } } $unfilteredTopics = Topic::where('conference_slug', '=', $event->slug)->published()->get(); $topics = []; foreach ($unfilteredTopics as $topic) { $topics[] = [$topic->title => $topic->text]; } if ((bool) $options->topics_by_alpha === true) { sort($topics); } //dd($topics); $agendasRaw = Agenda::where('conference_slug', '=', $event->slug)->published()->orderBy('timeslot')->orderBy('priority')->get(); $speakerList = []; $agendas = []; if (is_object($agendasRaw)) { foreach ($agendasRaw as $i => $agenda) { $agenda = (object) $agenda->toArray(); list($date, $time) = explode(' ', $agenda->timeslot); if (!empty($agenda->speakers)) { // $agenda->speakers = Helpers::unserialize($agenda->speakers); // dd($agenda->speakers); $agendaSpeakers = explode(',', $agenda->speakers); $agenda->speakers = []; if (is_array($agendaSpeakers)) { foreach ($agendaSpeakers as $s) { @(list($speakerType, $speakerSlug) = @explode('|', $s)); $agenda->speakers[$speakerType][] = $speakerSlug; } // dd($agenda->speakers); } } $agendas[$date][$time][] = $agenda; if (!empty($agenda->speakers)) { $speakersTypes = $agenda->speakers; if (is_array($speakersTypes)) { ksort($speakersTypes); // dd($speakersTypes); foreach ($speakersTypes as $speakers) { $speakerList = array_merge($speakerList, $speakers); } } } } } // dd($agendas); if (count($speakerList) > 0) { $speakers = Speaker::where(function ($query) use($speakerList) { $query->where('slug', '=', array_pop($speakerList)); while (count($speakerList) > 0) { $query->orWhere('slug', '=', array_pop($speakerList)); } })->published()->orderBy('last_name')->get(); $speakers = Helpers::keysByField($speakers, 'slug', function ($value, $key, $field, $array, $toObj) { $value->sessions = []; return $value; }, true); } if ((bool) $options->sponsor_levels === true) { $sponsors = Lookup::lookup('sponsors', ['conference_slug' => $event->slug], ['published' => true, 'sponsorlevels' => true]); } else { $sponsors = Lookup::lookup('sponsors', ['conference_slug' => $event->slug], ['published' => true]); } // dd($options); return view('pages/conference', compact('event', 'venue', 'partners', 'topics', 'agendas', 'speakers', 'sponsors', 'options', 'navs', 'sub')); }
protected function conference($route, $event) { $venue = Venue::where('slug', '=', $event->venue_slug)->published()->get(); $venue = !empty($venue[0]) ? (object) $venue[0]->toArray() : null; $event->options = !empty($event->options) ? Helpers::unserialize($event->options) : []; $options = Helpers::options($route, 'conference', $event->options); $options = (array) $options; foreach ($options as $key => $option) { if (is_string($option) && preg_match("/^([a-z]+):([a-z]+)\$/i", $option)) { list($foo, $bar) = explode(':', $option); $options[$key] = ${$foo}->{$bar}; } } $options = (object) $options; // dd($options); $navs = Helpers::navigation($route, $options); $sub = Helpers::navigation($route, $options, true); $partners = (object) ['companies' => null, 'text' => null]; if (!empty($event->partners)) { $undo = Helpers::unserialize($event->partners); $companies = Partner::where(function ($query) use($undo) { foreach ($undo['partners'] as $i => $slug) { if ($i === 0) { $query->where('slug', '=', $slug); } else { $query->orWhere('slug', '=', $slug); } } })->published()->orderBy('company')->get(); if (!empty($undo['text'])) { $partners->text = $undo['text']; } if (is_object($companies)) { $partners->companies = []; foreach ($companies as $i => $company) { $partners->companies[] = (object) $company->toArray(); } } } $agendasRaw = Agenda::where('conference_id', '=', $event->id)->published()->orderBy('timeslot')->orderBy('priority')->get(); $speakerList = []; $agendas = []; if (is_object($agendasRaw)) { foreach ($agendasRaw as $i => $agenda) { $agenda = (object) $agenda->toArray(); list($date, $time) = explode(' ', $agenda->timeslot); if (!empty($agenda->speakers)) { $agenda->speakers = Helpers::unserialize($agenda->speakers); } $agendas[$date][$time][] = $agenda; if (!empty($agenda->speakers)) { $speakersTypes = $agenda->speakers; if (is_array($speakersTypes)) { ksort($speakersTypes); foreach ($speakersTypes as $speakers) { $speakerList = array_merge($speakerList, $speakers); } } } } } if (count($speakerList) > 0) { $speakers = Speaker::where(function ($query) use($speakerList) { $query->where('slug', '=', array_pop($speakerList)); while (count($speakerList) > 0) { $query->orWhere('slug', '=', array_pop($speakerList)); } })->published()->orderBy('last_name')->get(); $speakers = Helpers::keysByField($speakers, 'slug', function ($value, $key, $field, $array, $toObj) { $value->sessions = []; return $value; }, true); } if ((bool) $options->sponsorlevels === true) { $sponsors = Lookup::lookup('sponsors', ['conference' => $event->id], ['published' => true, 'sponsorlevels' => true]); } else { $sponsors = Lookup::lookup('sponsors', ['conference' => $event->id], ['published' => true]); } // dd($sponsors); return view('pages/conference', compact('event', 'venue', 'partners', 'agendas', 'speakers', 'sponsors', 'options', 'navs', 'sub')); }
</td> <td class="activity-schedule-detail" style="border-left-color: <?php echo \app\models\ActivityType::getActivityTypeThemeColorById($row['ActivityType_id']); ?> "> <span class="title"><?php echo $row['Activity_name']; ?> </span><br> <span class="type"><?php echo \app\models\ActivityType::getActivityTypeNameById($row['ActivityType_id']); ?> </span> </td> <td class="activity-schedule-venue"><?php echo \app\models\Venue::getVenueNameById($row['Venue_id']); ?> </td> </tr> </table> </a> <?php } ?> <?php } else { ?> <?php
/** * Remove the specified resource from storage. * * @param int $id * * @return mixed */ public function destroy($id) { $canBeDeleted = empty(Venue::find($id)->fixtures->toArray()); if ($canBeDeleted) { Venue::destroy($id); \Flash::success('Venue deleted!'); } else { \Flash::error('Cannot delete because they are existing fixtures at this venue.'); } return redirect('admin/data-management/venues'); }
/** * Remove the specified resource from storage. * * @param int $id * * @param Request $request * * @return \Illuminate\Http\Response */ public function destroy($id, Request $request) { if ($request->user()->can('admin') || $request->user()->can('super')) { $venue = Venue::find($id); DB::transaction(function () use($venue) { $venue->admins()->detach(auth()->user()); $venue->delete(); session()->flash('message', ['warning', "{$venue->name} Successfully Deleted!"]); }); return redirect(action('VenueController@index')); } session()->flash('message', ['danger', 'Unauthorized!']); return redirect(action('VenueController@index')); }
} ?> <h3>Date and Time</h3> <?php echo date("M d D", strtotime($model->startDatetime)); ?> <br> <?php echo date("g:i A", strtotime($model->startDatetime)); ?> - <?php echo date("g:i A", strtotime($model->endDatetime)); ?> <h3>Venue</h3> <?php echo \app\models\Venue::getVenueNameById($model->Venue_id); ?> <h3>Person in Charge</h3> <?php echo \app\models\User::getUserFullNameById($model->personInCharge); ?> <br><br> <?php echo Html::a('Get PDF <span class="glyphicon glyphicon-download-alt"></span>', ['/activity/samplepdf', 'id' => $model->id], ['class' => 'btn btn-default', 'target' => '_blank']); ?> </div> </div> </div> <?php } else { $this->params['breadcrumbs'][] = ['label' => 'Activities', 'url' => ['index']];
?> <?php echo $form->field($model, 'personInCharge')->dropDownList(\app\models\User::getAllUsersOptions(), array('prompt' => '-- Select a User --')); ?> <?php echo $form->field($model, 'startDatetime')->widget(DateTimePicker::className(), ['language' => 'en', 'template' => '{input}', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'inline' => false, 'clientOptions' => ['startDate' => date("Y-m-d"), 'autoclose' => true, 'linkFormat' => 'yyyy-mm-dd hh:ii:ss']]); ?> <?php echo $form->field($model, 'endDatetime')->widget(DateTimePicker::className(), ['language' => 'en', 'template' => '{input}', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'inline' => false, 'clientOptions' => ['startDate' => date("Y-m-d"), 'endDate' => date("2017-01-01"), 'autoclose' => true, 'linkFormat' => 'yyyy-mm-dd hh:ii:ss']]); ?> <?php echo $form->field($model, 'Venue_id')->dropDownList(\app\models\Venue::getVenueOptions(), array('prompt' => '-- Select a Venue --')); ?> <?php echo $form->field($model, 'Topic_id')->dropDownList(\app\models\Topic::getTopicOptions(), array('prompt' => '-- Select a Topic --')); ?> <?php echo $form->field($model, 'ActivityType_id')->dropDownList(\app\models\ActivityType::getActivityTypeOptions(), array('prompt' => '-- Select a Type --')); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
public function getVenueNameById($id) { $raw = Venue::findOne($id); return $raw['name']; }
public function getVenue() { return $this->hasOne(Venue::className(), ['id' => 'Venue_id']); }
/** * Finds the Venue model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @param integer $VenueType_id * @return Venue the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id, $VenueType_id) { if (($model = Venue::findOne(['id' => $id, 'VenueType_id' => $VenueType_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }