本文整理汇总了PHP中Events::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::find方法的具体用法?PHP Events::find怎么用?PHP Events::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::find方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_eventsAction
public function search_eventsAction()
{
if ($this->request->isPost()) {
$eventName = $this->request->getPost('name');
$eventAddress = $this->request->getPost('address');
$country = Countries::findFirst(array('columns' => '*', 'conditions' => 'country LIKE :country:', 'bind' => array('country' => $eventAddress)));
$countryId = '';
if ($country) {
$countryId = $country->id;
}
if (!empty($eventName) && !empty($eventAddress) && !empty($countryId)) {
$event = Events::find(array('columns' => '*', 'conditions' => 'name LIKE :name: OR street LIKE :street: OR city LIKE :city: OR country_id = :country_id:', 'bind' => array('name' => '%' . $eventName . '%', 'street' => '%' . $eventAddress . '%', 'city' => '%' . $eventAddress . '%', 'country_id' => $countryId)));
}
if (!empty($eventName) && empty($eventAddress)) {
$event = Events::find(array('columns' => '*', 'conditions' => 'name LIKE :name: OR street LIKE :street: OR city LIKE :city:', 'bind' => array('name' => '%' . $eventName . '%', 'street' => '%' . $eventName . '%', 'city' => '%' . $eventName . '%')));
}
if (empty($eventName) && !empty($eventAddress) && !empty($countryId)) {
$event = Events::find(array('columns' => '*', 'conditions' => 'name LIKE :name: OR street LIKE :street: OR city LIKE :city: OR country_id = :country_id:', 'bind' => array('name' => '%' . $eventAddress . '%', 'street' => '%' . $eventAddress . '%', 'city' => '%' . $eventAddress . '%', 'country_id' => $countryId)));
}
if (empty($eventName) && !empty($eventAddress) && empty($countryId)) {
$event = Events::find(array('columns' => '*', 'conditions' => 'name LIKE :name: OR street LIKE :street: OR city LIKE :city:', 'bind' => array('name' => '%' . $eventAddress . '%', 'street' => '%' . $eventAddress . '%', 'city' => '%' . $eventAddress . '%')));
}
if (empty($eventName) && empty($eventAddress) && empty($countryId)) {
$event = Events::find();
}
$this->view->setVar('event', $event);
} else {
$event = Events::find();
}
$this->view->setVar('events', $event);
}
示例2: getEvent
public function getEvent($id)
{
if (Session::has('in') && !strcmp(Session::get('in'), 'gautepJ9')) {
return View::make('events.eventDisplay')->with('entries', Events::find($id));
}
return Redirect::to('admin/login')->with('isErr', true)->with('msg', 'You need to login first.');
}
示例3: saveModel
protected function saveModel($company = false)
{
if (Input::get('id')) {
$company = Company::find(Input::get('id'));
}
if (!$company) {
$company = new Company();
}
$company->name = Input::get('name');
$company->type = Input::get('type');
$company->references = Input::get('references');
$company->bank_details = Input::get('bank_details');
$company->tax_number = Input::get('tax_number');
$company->notes = Input::get('notes');
$address = $company->address()->first() ?: new Address();
$country = Country::where('id', Input::get('country'))->first();
$address->country()->associate($country);
$address->address = Input::get('address_address');
$address->postal_code = Input::get('address_postal_code');
$address->city = Input::get('address_city');
$address->state_province = Input::get('address_state_province');
$address->phone = Input::get('address_phone');
$address->fax = Input::get('address_fax');
$address->email = Input::get('address_email');
$address->website = Input::get('address_website');
$address->save();
$company->address()->associate($address);
$company->save();
if (Input::get('venue_id')) {
$company->venues()->detach(Venue::find(Input::get('venue_id')));
$company->venues()->attach(Venue::find(Input::get('venue_id')));
}
if (Input::get('contact_id')) {
$company->contacts()->detach(Contact::find(Input::get('contact_id')));
$company->contacts()->attach(Contact::find(Input::get('contact_id')));
}
if (Input::get('event_id')) {
$company->events()->detach(Events::find(Input::get('event_id')));
$company->events()->attach(Events::find(Input::get('event_id')));
}
return $company;
}
示例4: json_encode
$dataset_budget['highlightFill'] = "rgba(220,220,220,0.75)";
$dataset_budget['highlightStroke'] = "rgba(220,220,220,1)";
$dataset_budget['data'] = $data_budget;
$dataset[] = $dataset_budget;
foreach ($periods as $dt) {
$dt_end = clone $dt;
$start = $dt->modify('first day of this month');
$end = $dt_end->modify('last day of this month');
$d = '{' . $start->format('d') . '...' . $end->format('d') . '}';
$m = $start->format('m');
$y = $start->format('Y');
$events = new Events();
$search = array('date' => "{$m}/{$d}/{$y}", 'client_id' => $client_id, 'service_id' => $service_id);
$parameter = Events::getAsParameter($search, Events::getFields());
$parameter = json_encode($parameter);
$foundEvents = $events->find($parameter, $inclusionFirst);
error_log("{$m}/{$d}/{$y}");
if (!FileMaker::isError($foundEvents)) {
$data_scheduled[] = FM_Table::summarize($foundEvents, 'duration_unix') / 60 / 60;
} else {
$data_scheduled[] = 0;
}
}
$dataset_scheduled['fillColor'] = "rgba(151,187,205,0.5)";
$dataset_scheduled['strokeColor'] = "rgba(151,187,205,0.8)";
$dataset_scheduled['highlightFill'] = "rgba(151,187,205,0.75)";
$dataset_scheduled['highlightStroke'] = "rgba(151,187,205,1)";
$dataset_scheduled['data'] = $data_scheduled;
$dataset[] = $dataset_scheduled;
$data['datasets'] = $dataset;
echo json_encode($data);
示例5: createEvent
public static function createEvent($input)
{
$started_at = empty($input['started_at']) ? 'no' : preg_split("/([\\/: ])/", $input['started_at']);
$ended_at = empty($input['ended_at']) ? 'no' : preg_split("/([\\/: ])/", $input['ended_at']);
$input = array('event_category_id' => $input['event_category_id'], 'city_id' => $input['city_id'], 'email' => $input['email'], 'creator_fname' => $input['creator_fname'], 'creator_lname' => $input['creator_fname'], 'creator_email' => $input['creator_email'], 'name' => $input['name'], 'user_id' => Auth::check() ? Auth::user()->id : '', 'stewardship' => $input['stewardship'], 'description' => $input['description'], 'location' => $input['location'], 'website_url' => $input['website_url'], 'social_media_urls' => $input['social_media_urls'], 'started_at' => $started_at == 'no' ? '' : mktime((int) $started_at[3], (int) $started_at[4], 0, (int) $started_at[0], (int) $started_at[1], (int) $started_at[2]), 'ended_at' => $ended_at == 'no' ? '' : mktime((int) $ended_at[3], (int) $ended_at[4], 0, (int) $ended_at[0], (int) $ended_at[1], (int) $ended_at[2]));
$rules = array('event_category_id' => 'required', 'city_id' => 'required', 'creator_fname' => 'required', 'creator_lname' => 'required', 'creator_email' => 'required|email', 'email' => 'required|email', 'name' => 'required', 'stewardship' => 'required|min:5', 'description' => 'required|min:5', 'location' => 'required', 'started_at' => 'required', 'ended_at' => 'required');
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return $validator->errors()->all();
} else {
try {
// Mencatat pembuat target sosial
if (Auth::check()) {
$input['user_id'] = Auth::user()->id;
} else {
// Check apakah user ada di database
$check_user = User::where('email', $input['creator_email']);
if ($check_user->count() > 0) {
$input['user_id'] = $check_user->pluck('id');
} else {
// Membuat user baru dengan status draft (status:2)
$post = new User();
$post->firstname = $input['creator_fname'];
$post->lastname = $input['creator_lname'];
$post->email = $input['creator_email'];
$post->status = 2;
$post->save();
$input['user_id'] = $post->id;
}
}
unset($input['creator_fname']);
unset($input['creator_lname']);
unset($input['creator_email']);
$event = new Events();
$event->fill($input);
$event->save();
// digunakan untuk mengambil id user yang belum login
if (!Auth::check()) {
Session::put('update_id', $event->id);
}
// update
$update = Events::find($event->id);
$update->fill(array('slug' => Events::checkSlugName(Str::slug($input['name'])) > 0 ? strtolower(Str::slug($input['name'])) . $event->id : strtolower(Str::slug($input['name']))));
$update->save();
return "ok";
} catch (Exception $e) {
return "no";
}
}
}
示例6: saveModel
protected function saveModel($event = false)
{
if (Input::get('id')) {
$event = Events::find(Input::get('id'));
}
if (!$event) {
$event = new Events();
}
$event->name = Input::get('name');
$event->proposed_opening_time = Input::get('proposed_opening_time');
$event->proposed_closing_time = Input::get('proposed_closing_time');
$event->proposed_local_sponsors = Input::get('proposed_local_sponsors');
$event->promotional_activities = Input::get('promotional_activities');
$event->eval_financial_score = Input::get('eval_financial_score');
$event->eval_financial_text = Input::get('eval_financial_text');
$event->eval_marketing_score = Input::get('eval_marketing_score');
$event->eval_marketing_text = Input::get('eval_marketing_text');
$event->eval_travel_score = Input::get('eval_travel_score');
$event->eval_travel_text = Input::get('eval_travel_text');
$event->eval_production_score = Input::get('eval_production_score');
$event->eval_production_text = Input::get('eval_production_text');
$event->eval_extra_text = Input::get('eval_extra_text');
// new stuff 1
$event->curfew = Input::get('curfew');
$event->minimal_age_limit = Input::get('minimal_age_limit');
$event->alcohol_license = Input::get('alcohol_license');
$event->restrictions_on_merchandise_sales = Input::get('restrictions_on_merchandise_sales');
$event->sound_restrictions = Input::get('sound_restrictions');
$event->booked_for_setup_from = Input::get('booked_for_setup_from');
$event->booked_for_break_until = Input::get('booked_for_break_until');
// new stuff 2
$event->hotel1_name = Input::get('hotel1_name');
$event->hotel2_name = Input::get('hotel2_name');
$event->hotel1_website = Input::get('hotel1_website');
$event->hotel2_website = Input::get('hotel2_website');
$event->hotel1_travel_time_from_airport = Input::get('hotel1_travel_time_from_airport');
$event->hotel2_travel_time_from_airport = Input::get('hotel2_travel_time_from_airport');
$event->hotel1_travel_time_from_venue = Input::get('hotel1_travel_time_from_venue');
$event->hotel2_travel_time_from_venue = Input::get('hotel2_travel_time_from_venue');
$event->ticketsystem_enabled = Input::get('ticketsystem_enabled');
$event->currency_id = Input::get('currency_id');
$event->ticketsystem_recording_startdate = Input::get('ticketsystem_recording_startdate');
$event->ticketsystem_locked_for_promoter = Input::get('ticketsystem_locked_for_promoter');
$event->ticketsystem_autoremind_user_id = Input::get('ticketsystem_autoremind_user_id');
$event->ticketsystem_autoremind = Input::get('ticketsystem_autoremind');
$event->save();
if (Input::get('event_date')) {
//error_log('Event date '.json_encode(Input::get('event_date')));
$input_date = strtotime(Input::get('event_date'));
$date = $event->date()->first();
if ($date) {
// update current date
$date->datetime_start = date("Y-m-d H:i:s", $input_date);
$date->datetime_end = date("Y-m-d H:i:s", $input_date);
$date->update();
} else {
// create new date
$event_date = new Dates(['datetime_start' => date("Y-m-d H:i:s", $input_date), 'datetime_end' => date("Y-m-d H:i:s", $input_date)]);
$event_date->save();
$event->date()->attach($event_date);
}
$response = Event::fire('event.datechanged', array($event));
}
if (Input::get('contact_id')) {
$event->contacts()->detach(Contact::find(Input::get('contact_id')));
$event->contacts()->attach(Contact::find(Input::get('contact_id')));
}
if (Input::get('venue_id')) {
$event->venues()->detach(Venue::find(Input::get('venue_id')));
$event->venues()->attach(Venue::find(Input::get('venue_id')));
}
if (Input::get('company_id')) {
$event->companies()->detach(Company::find(Input::get('company_id')));
$event->companies()->attach(Company::find(Input::get('company_id')));
}
if (Input::get('promoter_id')) {
$event->users()->detach(User::find(Input::get('promoter_id')));
$event->users()->attach(User::find(Input::get('promoter_id')));
}
return $event;
}
示例7: newAction
//.........这里部分代码省略.........
}
$userSession = $this->session->get("userSession");
$eventName = $this->request->getPost("name");
$website = $this->request->getPost("website");
$telephone = $this->request->getPost("telephone");
$street = $this->request->getPost("street");
$city = $this->request->getPost("city");
$info = $this->request->getPost("event_info");
$category = $this->request->getPost("category");
$country = $this->request->getPost("country");
$raw_address = $this->request->getPost("address");
$latitude = $this->request->getPost("lat");
$longitude = $this->request->getPost("lng");
$dates = $this->request->getPost("date");
$fromTimes = $this->request->getPost("fromTime");
$toTimes = $this->request->getPost("toTime");
$event = new Events();
$event->created = date('Y-m-d H:i:s');
$event->modified = date('Y-m-d H:i:s');
$event->member_id = $userSession['id'];
$event->name = $eventName;
$event->event_date = $this->request->getPost("date");
$event->website = $website;
$event->telephone = $telephone;
$event->street = $street;
$event->city = $city;
$event->country_id = $country;
$event->event_category_id = $category;
$event->lng = $longitude;
$event->lat = $latitude;
$event->eventinfo = $info;
if ($event->create()) {
$id = $event->id;
$i = 0;
foreach ($dates as $date) {
$eventDatetime = new EventDatetimes();
$eventDatetime->event_id = $id;
$eventDatetime->date = $date;
$eventDatetime->from_time = $fromTimes[$i];
$eventDatetime->to_time = $toTimes[$i];
$i++;
if (!$eventDatetime->create()) {
$this->view->disable();
echo "failed to insert event date and time in event_datetimes table. :(";
}
}
$this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New event has been posted');
if ($this->request->hasFiles() == true) {
$uploads = $this->request->getUploadedFiles();
$isUploaded = false;
$ctr = 1;
foreach ($uploads as $upload) {
# define a "unique" name and a path to where our file must go
$fileName = $upload->getname();
$fileInfo = new SplFileInfo($fileName);
$fileExt = $fileInfo->getExtension();
$fileExt = strtolower($fileExt);
$newFileName = substr(md5(uniqid(rand(), true)), 0, 10) . date('ymdhis') . '.' . $fileExt;
$fileImageExt = array('jpeg', 'jpg', 'png');
$fileType = '';
$filePath = '';
$path = '';
if (in_array($fileExt, $fileImageExt)) {
$path = 'img/event/' . $newFileName;
$filePath = 'img/event/';
//$fileType = 'Image';
}
# move the file and simultaneously check if everything was ok
$upload->moveTo($path) ? $isUploaded = true : ($isUploaded = false);
if ($isUploaded) {
$eventPhotos = new EventPhotos();
$eventPhotos->created = date('Y-m-d H:i:s');
$eventPhotos->modified = date('Y-m-d H:i:s');
$eventPhotos->member_id = $userSession['id'];
$eventPhotos->event_id = $id;
$eventPhotos->file_path = $filePath;
$eventPhotos->filename = $newFileName;
$eventPhotos->caption = $this->request->getPost('caption');
//$ctr++;
if ($eventPhotos->create()) {
echo "success";
} else {
$this->view->disable();
print_r($eventPhotos->getMessages());
}
}
}
}
} else {
$this->view->disable();
print_r($event->getMessages());
}
return $this->response->redirect('event/view/' . $id);
}
$events = Events::find();
$categories = EventsCategories::find();
$countries = Countries::find();
$this->view->setVar('events', $events);
$this->view->setVars(['events' => $events, 'categories' => $categories, 'countries' => $countries]);
}
示例8: view
public function view($id)
{
$events = Events::find($id);
$events->views += 1;
$events->save();
if (Auth::guest()) {
$events->ismember = false;
} else {
$events->ismember = $this->checkmembers($id);
}
return View::make('events.view')->with('events', $events);
}
示例9: getDelete
public function getDelete($id = '')
{
if ($id == '') {
return Redirect::to($this->route)->with('msg_error', Lang::get('messages.events_display_err'));
} else {
$event = Events::find($id);
$delete = Events::destroy($id);
if (!$delete) {
return Redirect::to($this->route . '/trash')->with('msg_error', Lang::get('messages.events_delete_err', array('title' => $event->title)));
} else {
return Redirect::to($this->route . '/trash')->with('msg_success', Lang::get('messages.events_delete', array('title' => $event->title)));
}
}
}
示例10: getEvent
public function getEvent($id)
{
$event = Events::find($id);
date_default_timezone_set('Asia/Bangkok');
$date11 = $event->start;
$date21 = $event->finish;
if (date("Y-m-d H:i:s") < $date11) {
$date1 = new DateTime($date11);
$date2 = new DateTime(date("Y-m-d H:i:s"));
$interval = $date2->diff($date1);
if ($interval->days == 0) {
$event['status'] = "-3";
$event['hr'] = $interval->h;
} else {
//$event['status'] = $interval->days;
$event['status'] = "-3";
}
//$event['status'] = $interval->days;
} elseif (date("Y-m-d H:i:s") >= $date11 && date("Y-m-d H:i:s") <= $date21) {
$event['status'] = "-1";
} elseif (date("Y-m-d H:i:s") >= $date21) {
$event['status'] = "-2";
} else {
$event['status'] = "9999";
}
$times = array("start", "finish");
for ($i = 0; $i < sizeof($times); $i++) {
$strDate = $event->{$times}[$i];
$strYear = date("Y", strtotime($strDate)) + 543;
$strMonth = date("n", strtotime($strDate));
$strDay = date("j", strtotime($strDate));
$strHour = date("H", strtotime($strDate));
$strMinute = date("i", strtotime($strDate));
$strSeconds = date("s", strtotime($strDate));
$strMonthCut = array("", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม ", "พฤศจิกายน", "ธันวาคม");
$strMonthThai = $strMonthCut[$strMonth];
$event->{$times}[$i] = "{$strDay} {$strMonthThai} {$strYear} เวลา {$strHour}:{$strMinute} น.";
//$event['stat'] = 'newenw';
}
$this->breadcrumbs->push('กิจกรรม', URL::to('/events'));
$this->breadcrumbs->push($event->name, URL::to('/events/' . $id . '/show'));
$this->breadcrumbs->generate();
return View::make('home.showEvent')->with('event', $event);
}
示例11: createEvent
public static function createEvent($input)
{
$started_at = empty($input['started_at']) ? 'no' : preg_split("/([\\/: ])/", $input['started_at']);
$ended_at = empty($input['ended_at']) ? 'no' : preg_split("/([\\/: ])/", $input['ended_at']);
$input = array('event_category_id' => $input['event_category_id'], 'city_id' => $input['city_id'], 'email' => $input['email'], 'name' => $input['name'], 'user_id' => Auth::check() ? Auth::user()->id : '', 'stewardship' => $input['stewardship='], 'description' => $input['description'], 'location' => $input['location'], 'website_url' => $input['website_url'], 'social_media_urls' => $input['social_media_urls'], 'started_at' => $started_at == 'no' ? '' : mktime((int) $started_at[3], (int) $started_at[4], 0, (int) $started_at[0], (int) $started_at[1], (int) $started_at[2]), 'ended_at' => $ended_at == 'no' ? '' : mktime((int) $ended_at[3], (int) $ended_at[4], 0, (int) $ended_at[0], (int) $ended_at[1], (int) $ended_at[2]));
$rules = array('event_category_id' => 'required', 'city_id' => 'required', 'name' => 'required', 'stewardship' => 'required|min:5', 'description' => 'required|min:5', 'location' => 'required', 'started_at' => 'required', 'ended_at' => 'required');
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return $validator->errors()->all();
} else {
try {
$event = new Events();
$event->fill($input);
$event->save();
// digunakan untuk mengambil id user yang belum login
if (!Auth::check()) {
Session::put('update_id', $event->id);
}
// update
$update = Events::find($event->id);
$update->fill(array('slug' => Events::checkSlugName(Str::slug($input['name'])) > 0 ? strtolower(Str::slug($input['name'])) . $event->id : strtolower(Str::slug($input['name']))));
$update->save();
return "ok";
} catch (Exception $e) {
return "no";
}
}
}
示例12: edit
/**
* Show the form for editing the specified event.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$event = Events::find($id);
return View::make('events.edit', compact('event'));
}
示例13: getShowEvent
public function getShowEvent($id)
{
$event = Events::find($id);
$columns = Schema::getColumnListing('events');
return View::make('admin.show_event')->with('event', $event)->with('columns', $columns);
}
示例14: saveEvent
public function saveEvent()
{
$inputs = Input::all();
/* ["_token"]=>
string(40) "ZUiNHvF83pNBXJMeBNTFVTLTiyDSYC75y6dMiNeN"
["eventIdEdit"]=>
string(1) "1"
["eventNameEdit"]=>
string(9) "Baratheon"
["eventDateEdit"]=>
string(10) "2015-11-10"
["eventDescriptionEdit"]=>
string(5) "afsad"
["eventLocationEdit"]=>
string(4) "asdf"
["eventTypeEdit"]=>
string(1) "1"
["stateEdit"]=>
string(2) "17"
["cityEdit"]=>
string(6) "175345" */
$event = Events::find($inputs['eventIdEdit']);
$event->name = $inputs['eventNameEdit'];
$event->event_description = $inputs['eventDescriptionEdit'];
$event->type = $inputs['eventTypeEdit'];
$event->area = $inputs['eventLocationEdit'];
$event->state = $inputs['stateEdit'];
$event->city = $inputs['cityEdit'];
$event->event_date = $inputs['eventDateEdit'];
$event->save();
if ($event) {
return Response::json(array("status" => "success"));
} else {
return Response::json(array("status" => "failed"));
}
}