Пример #1
0
 public function loadEvents()
 {
     $slug = $this->property('slug');
     if (!($e = MyEvents::where('is_published', true)->find($slug))) {
         return 'kurtjensen.mycalendar::lang.event.error_not_found';
     }
     $maxLen = $this->property('title_max', 100);
     $link = $e->link ? $e->link : '';
     return ['name' => $e->name, 'date' => $e->date, 'time' => $e->human_time, 'link' => $link, 'text' => $e->text];
 }
Пример #2
0
 public function loadEvents()
 {
     $slug = $this->property('slug');
     if (!($e = MyEvents::where('is_published', true)->find($slug))) {
         return 'Event not found!';
     }
     $maxLen = $this->property('title_max', 100);
     $link = $e->link ? $e->link : '';
     return ['name' => $e->name, 'date' => $e->date, 'time' => $e->human_time, 'link' => $link, 'text' => $e->text];
 }
Пример #3
0
 public function loadEvents()
 {
     $MyEvents = [];
     if ($this->usePermissions) {
         $this->loadPermissions();
         $query = MyEvents::whereIn('id', CategorysEvents::whereIn('category_id', Category::whereIn('permission_id', $this->permarray)->lists('id'))->lists('event_id'))->whereNotIn('id', CategorysEvents::whereIn('category_id', Category::where('permission_id', Settings::get('deny_perm'))->lists('id'))->lists('event_id'))->where('is_published', true);
     } else {
         $query = MyEvents::where('is_published', true);
     }
     $events = $query->where('month', '>=', date('m'))->where('year', '>=', date('Y'))->orderBy('time')->get();
     //                    ->whereNotIn('permission_id', Settings::get('deny_perm'))
     $maxLen = $this->property('title_max', 100);
     $linkPage = $this->property('linkpage', '');
     foreach ($events as $e) {
         $title = strlen($e->text) > 50 ? substr(strip_tags($e->text), 0, $maxLen) . '...' : $e->text;
         $link = $e->link ? $e->link : ($linkPage ? Page::url($linkPage, ['slug' => $e->id]) : '#EventDetail"
         	data-request="onShowEvent"
         	data-request-data="evid:' . $e->id . '"
         	data-request-update="\'Events::details\':\'#EventDetail\'" data-toggle="modal" data-target="#myModal');
         $MyEvents[$e->year][$e->month][$e->day][] = ['name' => $e->name . ' ' . $e->human_time, 'title' => $title, 'link' => $link, 'id' => $e->id, 'owner' => $e->user_id];
     }
     return $MyEvents;
 }
Пример #4
0
 protected function onDelete()
 {
     $eventId = post('id');
     if (!($eventId && $this->user)) {
         return null;
     }
     $myevent = MyCalEvent::where('user_id', $this->user->id)->find($eventId);
     $myevent->delete();
     $this->onRun();
 }