public function render($args = NULL) { parent::render($args); $this->template->content = $this->pages->where('code', $this->actual)->fetch(); $this->template->setFile(__DIR__ . "/Page.latte"); $this->template->render(); }
public function render($args = NULL) { parent::render($args); // TODO: Change the autogenerated stub $this->template->setFile(__DIR__ . "/NewsletterControl.basic.latte"); $this->template->render(); }
public function render($args = NULL) { parent::render($args); $this->template->setFile(__DIR__ . "/TagsControl.latte"); $this->template->tags = $args; $this->template->render(); }
public function render($args = NULL) { parent::render($args); $this->template->value = $this->value; $this->value++; $this->template->render(); }
public function render($args = NULL) { parent::render($args); $this->template->controls = $this->controls; $this->template->setFile(__DIR__ . "/EventsTable.latte"); $this->template->render(); }
public function render($args = NULL) { parent::render($args); $template = $this->template; $template->setFile(__DIR__ . '/PhotosControl.latte'); $template->render(); }
public function render($args = NULL) { parent::render($args); $this->id = (int) $args['id']; $this['termsForm']['event_id']->setValue($this->id); $event = $this->context->createServiceEvents()->get($this->id); if ($event) { $times = $this->context->createServiceTerms()->where('event_id', $this->id); if ($times->count() > 0) { foreach ($times as $value) { $terms['terms'][$value->id]['time_id'] = $value->id; $df = date_create_from_format("Y-m-d", substr($value->date_from, 0, 10)); if ($df) { $terms['terms'][$value->id]['date_from'] = $df->format('d. m. Y'); } $df = date_create_from_format("Y-m-d", substr($value->date_to, 0, 10)); if ($df) { $terms['terms'][$value->id]['date_to'] = $df->format('d. m. Y'); } $terms['terms'][$value->id]['time_from'] = $value->time_from; $terms['terms'][$value->id]['time_to'] = $value->time_to; $terms['terms'][$value->id]['visible'] = $value->visible; if ($value->every_monday) { $terms['terms'][$value->id]['every_monday'] = 1; } if ($value->every_tuesday) { $terms['terms'][$value->id]['every_tuesday'] = 1; } if ($value->every_wednesday) { $terms['terms'][$value->id]['every_wednesday'] = 1; } if ($value->every_thursday) { $terms['terms'][$value->id]['every_thursday'] = 1; } if ($value->every_friday) { $terms['terms'][$value->id]['every_friday'] = 1; } if ($value->every_saturday) { $terms['terms'][$value->id]['every_saturday'] = 1; } if ($value->every_sunday) { $terms['terms'][$value->id]['every_sunday'] = 1; } if ($value->repeat) { $terms['terms'][$value->id]['repeat'] = 1; } } $this['termsForm']->setDefaults($terms); $this['termsForm']['terms']->remove($this['termsForm']['terms'][0]); } $this->template->event = $event; $this->template->setFile(__DIR__ . "/EventTermsControl.latte"); $this->template->id = $args['id']; $this->template->new = $this->new; $this->template->render(); } else { throw new Exception('There is no event with ID #' . $this->id); } }
public function render($args = NULL) { parent::render($args); $this->template->files = $this->context->createServiceFiles()->where('isImage', '1')->where('imageSizeX > 150')->where('imageSizeY > 150')->where('delete', '0')->limit(10)->order('first DESC, file.created DESC')->group(':subject_x_file.subject_id'); //$this->template->subjects = $this->context->createServicePlaces()->fetchVisible(); $this->template->setFile(__DIR__ . "/PhotoStream.latte"); // $this->template->setTranslator($this->context->translator); $this->template->render(); }
public function render($args = NULL) { parent::render($args); $this->template->articles = $this->articles->order('created DESC')->limit($this->count); $f = $this->template->getFile(); if (!isset($f)) { $this->template->setFile(__DIR__ . "/Competitions.latte"); } $this->template->headline = $this->headline; $this->template->render(); }
public function render($args = NULL) { parent::render($args); if ($args) { $this->template->setFile(__DIR__ . "/FlashMessages.latte"); $this->template->flashes = $args; $this->template->grid = $this->withGrid; $this->template->top = $this->top; $this->template->render(); } }
public function render($args = NULL) { parent::render($args); if (isset($args['id'])) { $this->template->item = $this->context->createServiceEvents()->get($args['id']); } elseif (isset($args['item'])) { $this->template->item = $args['item']; } $this->template->setFile(__DIR__ . "/EventItemControl.latte"); $this->template->render(); }
/** * (non-phpDoc) * * @see Nette\Application\Control#render() */ public function render($args = NULL) { parent::render($args); $tmp = $this->context->createServiceTimes()->fetchPublic()->where('DATEDIFF(event_time.date_from, CURDATE()) >= 0')->where('prefered', 1)->order('event_time.date_from ')->group('event_time.event_id')->limit(4); if ($tmp->count() == 0) { $tmp = $this->context->createServiceTimes()->fetchPublic()->where('DATEDIFF(event_time.date_from, CURDATE()) >= 0')->order('event_time.date_from ')->group('event_time.event_id')->limit(4); } $this->template->events = $tmp; $this->template->setFile(__DIR__ . "/HomepageCalendarControl.latte"); $this->template->setTranslator($this->translator); $this->template->render(); }
/** * @param null $args */ public function render($args = NULL) { parent::render($args); // TODO: Change the autogenerated stub $articles = $this->articles->where('published < NOW()')->order('created DESC')->limit(10)->fetchPairs('created'); $venues = $this->venues->fetchVisible()->order('created DESC')->limit(10)->fetchPairs('created'); $competitions = $this->competitions->order('created DESC')->limit(10)->fetchPairs('created'); $output = $articles + $venues + $competitions; krsort($output); $this->template->items = $output; $this->template->setFile(__DIR__ . "/StreamControl.basic.latte"); $this->template->render(); }
public function render($args = NULL) { parent::render($args); $this->template->database = $this->context->database; $this->template->subjects = $this->subjects->fetchAd($this->strict); $this->template->type = $this->type; $this->template->setFile(__DIR__ . "/BannerSubjects.latte"); dibi::begin(); foreach ($this->subjects as $key => $value) { dibi::query('update subject set ad_show_count=ad_show_count+1 where id=' . $key); } dibi::commit(); $this->template->render(); }
public function render($args = NULL) { parent::render($args); if (($this->presenter->name == 'Calendar' || $this->presenter->name == 'Catalog') && $this->presenter->action == 'detail' && isset($this->presenter->template->item->id)) { $item = $this->presenter->template->item; $id = $item->id; $this->template->id = $id; $this->template->backlink = $this->presenter->storeRequest(); if ($this->parent->user->id === $item->user_id || $this->parent->user->isInRole('administrator')) { if ($this->parent instanceof CalendarPresenter) { $this->template->setFile(__DIR__ . "/RemoteControl.event.latte"); } elseif ($this->parent instanceof CatalogPresenter) { $this->template->setFile(__DIR__ . "/RemoteControl.place.latte"); } if ($this->template->getFile() !== null) { $this->template->render(); } } } }
public function render($args = NULL) { parent::render($args); if (is_array($args)) { $this->id = (int) $args['id']; } elseif (is_int($args)) { $this->id = $args; } $this->user = $this->presenter->user; $place = $this->context->createServicePlaces()->get($this->id); $this['toolsForm']->setDefaults($place); if ($place) { $this->template->setFile(__DIR__ . "/AdminToolsPlaceControl.latte"); $this->template->place = $place; $this->template->id = $this->id; $this->template->render(); } else { throw new \Nette\InvalidStateException('There is no place with ID #' . $this->id); } }
public function render($args = NULL) { parent::render($args); $this['fileUploadForm']['id']->setValue((string) $args['id']); $this['fileUploadForm']['type']->setValue($args['type']); $this->template->setFile(__DIR__ . "/ManagePhotosControl.latte"); $this->template->id = $args['id']; $this->template->type = $args['type']; if (isset($args['backbutton'])) { $this->template->backbutton = $args['backbutton']; } else { $this->template->backbutton = true; } if ($args['type'] == 'event') { $this->template->placeFiles = $this->context->createServiceFiles()->where(':subject_x_file.subject_id', $this->context->createService('events')->get($args['id'])->subject_id); } if ($args['type'] == 'place') { $places = $this->context->createService('events')->where('subject_id', $args['id'])->fetchAll(); $this->template->eventFiles = $this->context->createServiceFiles()->where(':event_x_file.event_id', array_keys($places)); } $this->template->userFiles = $this->context->createServiceFiles()->where('user_id', $this->getPresenter()->user->id); $this->template->render(); }
/** * (non-phpDoc) * * @see Nette\Application\Control#render() */ public function render($args = NULL) { parent::render($args); $httpRequest = $this->context->getService('httpRequest'); $this->template->hash = $httpRequest->getUrl()->path; if ($this->presenter->name == 'Calendar') { $this->template->type = 'event'; } else { $this->template->type = 'place'; } if ($this->tab == '') { $this->handleEvents(); } $cache = new Cache($this->context->getService('cacheStorage'), 'tabs'); // akce na miste $key = "subject_id/" . $this->subject->id; if (in_array('events', $this->tabs) && $this->subject->id != 1) { $events = $this->context->createServiceTimes()->where('event_time.event.subject_id', $this->subject->id)->fetchVisibleEvent()->fetchCurrent()->group('event_time.event_id')->limit(5); if ($this->excludeEvent) { $events->where('event_time.event_id != ' . $this->excludeEvent); } } else { $events = new \Nette\ArrayHash(); //workaround pro prazdny eventy a nasledujici IF } $eventsCount = $cache->load($key); if ($eventsCount === NULL) { $eventsCount = $events->count(); $cache->save($key, $eventsCount, array(Cache::EXPIRE => "8 hours", Cache::SLIDING => true, Cache::TAGS => array('events', 'event'))); } $this->template->events = $events; $this->template->eventsCount = $eventsCount; if ($this->tab == 'events' && $eventsCount == 0) { if ($this->template->type == 'event') { $this->tab = "nearEvents"; } else { $this->tab = "nearPlaces"; } } if ($this->lat == "") { $this->lat = $this->subject->lat; } if ($this->lon == "") { $this->lon = $this->subject->lon; } // akce v okoli try { /* @var $nearEvents \EventsTimes */ $nearEvents = in_array('nearEvents', $this->tabs) ? $this->context->createServiceTimes()->nearEvent($this->lat, $this->lon, $this->distance, $this->excludeEvent, $this->excludePlace)->fetchCurrent()->fetchVisibleEvent()->limit(5)->group('event_time.event_id') : NULL; if ($this->tab == 'nearEvents' && $nearEvents->count() == 0) { if ($this->template->type == 'event') { $this->tab = "nearPlaces"; } else { $this->tab = "events"; } } $distances = array(); foreach ($nearEvents as $key => $time) { $gps = Geolocation::getCoordsFromText($time->event_time->event->subject_gps); $distances[$time->id] = Geolocation::getDistance($this->lat, $this->lon, $gps[0], $gps[1]); } $this->template->nearEvents = $nearEvents; $this->template->nearEventsDistances = $distances; } catch (DibiException $e) { if ($e->getCode() == 1) { // no near events $this->tab = "nearPlaces"; } else { $this->flashMessage($e->getMessage(), 'warning'); } } // mista v okoli try { $places = in_array('nearPlaces', $this->tabs) ? $this->context->createServicePlaces()->near($this->lat, $this->lon, $this->distance)->fetchVisible()->fetchUnDeleted()->limit(5)->fetchVisible() : NULL; if ($this->subject) { $places->where('subject.id != ', $this->subject->id); } if ($this->excludePlace) { $places->where('subject.id != ' . $this->excludePlace); } $distances = array(); foreach ($places as $key => $place) { $distances[$place->id] = Geolocation::getDistance($this->lat, $this->lon, $place->lat, $place->lon); } $this->template->nearPlaces = $places; $this->template->nearPlacesDistances = $distances; if ($this->tab == 'nearPlaces' && $this->template->nearPlaces->count() == 0) { if ($this->template->type == 'event') { $this->tab = "events"; } else { $this->tab = "nearEvents"; } } $this->template->subject = $this->subject; } catch (DibiException $e) { if ($e->getCode() == 1) { $this->tab = "events"; } else { $this->flashMessage($e->getMessage(), 'warning'); } } $this->template->distance = $this->distance / 1000; $this->template->active = $this->tab; $this->template->tabs = $this->tabs; $texy = new Texy(); $this->template->registerHelper('texy', callback($texy, 'process')); $helpers = $this->context->myTemplateHelpers; $this->template->registerHelperLoader(array($helpers, 'loader')); $this->template->setFile(__DIR__ . "/Tabs.latte"); $this->template->render(); }
public function render($args = NULL) { parent::render($args); $this->template->new = $this->new; if (isset($this->params['set_subject_id'])) { $subject_id = $this->params['set_subject_id']; } elseif (isset($args['subjectid'])) { $subject_id = (int) $args['subjectid']; } else { $subject_id = false; } if (isset($this->params['rewrite'])) { $this->rewrite = (bool) $this->params['rewrite']; } if (isset($args['id'])) { $this->id = (int) $args['id']; // kdyz NULL tak vraci 0 //$this->type = (string) $args['type']; $this['eventForm']['id']->setValue($this->id); //$this['eventForm']['type']->setValue($this->id); $event = $this->context->createService('events')->get($this->id); if ($event) { $tx = new Texy(); $tx->alignClasses['left'] = 'fl'; $tx->alignClasses['right'] = 'fr'; //$tx->imageModule->root = $this->httpRequest->url->baseUrl; // $tx->imageModule->fileRoot = $this->getHttpRequest()->url->baseUrl; // $tx->imageModule->linkedRoot = $this->getHttpRequest()->url->baseUrl; // $tx->linkModule->root = $this->getHttpRequest()->url->baseUrl; $tx->headingModule->top = 4; $pl = (array) $event->toArray(); $pl['description'] = $tx->process($pl['description']); $this['eventForm']->setDefaults($pl); $this['eventForm']['categories']->setDefaultValue($event->related('event_x_category')->fetchPairs('category_id', 'category_id')); $this->template->id = $args['id']; //$this->template->type = $args['type']; } else { throw new Exception('There is no event with ID #' . $this->id); } } if ($subject_id) { $place = $this->context->createService('places')->get($subject_id); $session = $this->presenter->getSession(get_class($this)); $form = $session['form']; if ($form) { $this['eventForm']->setDefaults($form); } if ($this->rewrite) { $this['eventForm']['subject_name']->setDefaultValue($place->name); $this['eventForm']['shire_id']->setDefaultValue($place->locality->shire_id); $this['eventForm']['subject_city']->setDefaultValue($place->locality->name); $this['eventForm']['subject_locality_nickname']->setDefaultValue($place->locality_nickname); $this['eventForm']['subject_street']->setDefaultValue($place->street); $this['eventForm']['subject_zip']->setDefaultValue($place->zip); $this['eventForm']['subject_gps']->setDefaultValue($place->map_coords); $this['eventForm']['subject_www']->setDefaultValue($place->web); $this['eventForm']['subject_phone']->setDefaultValue($place->phone); $this['eventForm']['subject_email']->setDefaultValue($place->email); $this['eventForm']['subject_facebook']->setDefaultValue($place->facebook); } else { $this['eventForm']['subject_name']->setDefaultValue($form['subject_name'] != '' ? $form['subject_name'] : $place->name); $this['eventForm']['shire_id']->setDefaultValue($form['shire_id'] != '' ? $form['shire_id'] : $place->locality->shire_id); $this['eventForm']['subject_city']->setDefaultValue($form['subject_city'] != '' ? $form['subject_city'] : $place->locality->name); $this['eventForm']['subject_locality_nickname']->setDefaultValue($form['subject_locality_nickname'] != '' ? $form['subject_locality_nickname'] : $place->locality_nickname); $this['eventForm']['subject_street']->setDefaultValue($form['subject_street'] != '' ? $form['subject_street'] : $place->street); $this['eventForm']['subject_zip']->setDefaultValue($form['subject_zip'] != '' ? $form['subject_zip'] : $place->zip); $this['eventForm']['subject_gps']->setDefaultValue($form['subject_gps'] != '' ? $form['subject_gps'] : $place->map_coords); $this['eventForm']['subject_www']->setDefaultValue($form['subject_www'] != '' ? $form['subject_www'] : $place->web); $this['eventForm']['subject_phone']->setDefaultValue($form['subject_phone'] != '' ? $form['subject_phone'] : $place->phone); $this['eventForm']['subject_email']->setDefaultValue($form['subject_email'] != '' ? $form['subject_email'] : $place->email); $this['eventForm']['subject_facebook']->setDefaultValue($form['subject_facebook'] != '' ? $form['subject_facebook'] : $place->facebook); } $this['eventForm']['subject_id']->setDefaultValue($subject_id); } $this->template->setFile(__DIR__ . "/EventDescriptionControl.latte"); $this->template->render(); }