Exemplo n.º 1
0
Arquivo: Event.php Projeto: jiak94/api
 public function cancelEvent($eventId, $token)
 {
     $rs = array();
     $model = new Model_Event();
     $rs = $model->cancelEvent($eventId, $token);
     return $rs;
 }
Exemplo n.º 2
0
 /**
  * Render content.
  *
  * @return  string
  */
 public function content()
 {
     ob_start();
     // Stamp
     echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true);
     // Location
     if ($this->event->venue) {
         echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name);
     } elseif ($this->event->venue_name) {
         echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : '';
     } elseif ($this->event->city_name) {
         echo ' @ ', HTML::chars($this->event->city_name);
     }
     // Flyer
     if ($flyer = $this->event->flyer()) {
         echo '<figure>', HTML::image($flyer->image_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
     } elseif ($this->event->flyer_front_url) {
         echo '<figure>', HTML::image($this->event->flyer_front_url, ['class' => 'img-responsive']), '</figure>';
     }
     // Favorites
     if ($this->event->favorite_count) {
         echo '<span class="stats"><i class="fa fa-heart"></i> ' . $this->event->favorite_count . '</span>';
     }
     return ob_get_clean();
 }
Exemplo n.º 3
0
 public function eventAction()
 {
     if ($this->_request->isPost()) {
         $data = $this->_request->getParams();
         unset($data["action"]);
         unset($data["controller"]);
         unset($data["module"]);
         $data["create_admin"] = $this->admin->{"id"};
         $event_modle = new Model_Event();
         $event_modle->saveEvent($data);
         echo "<h2>Created !!!</h2>";
     }
 }
Exemplo n.º 4
0
 /**
  * Get newsfeed item as HTML
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get(Model_NewsFeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_EVENT:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = __('added new event<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-calendar icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
             }
             break;
         case self::TYPE_EVENT_EDIT:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = __('updated event<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-calendar icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
             }
             break;
         case self::TYPE_FAVORITE:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = __('added event to favorites<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-heart icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
             }
             break;
     }
     return $text;
 }
Exemplo n.º 5
0
 /**
  * Get event attached to gallery.
  *
  * @return  Model_Event
  */
 public function event()
 {
     try {
         return $this->event_id ? Model_Event::factory($this->event_id) : null;
     } catch (AutoModeler_Exception $e) {
         return null;
     }
 }
Exemplo n.º 6
0
 /**
  * Creates a new event.
  *
  * @param string $name The name of the event.
  *
  * @return Model_Event
  */
 public static function create($name)
 {
     $event = Model_Event::forge();
     $event->name = $name;
     try {
         $event->save();
     } catch (FuelException $e) {
         Log::error($e);
         return false;
     }
     return $event;
 }
Exemplo n.º 7
0
Arquivo: day.php Projeto: anqh/events
 /**
  * Render flyer.
  *
  * @return  string
  */
 public function flyer()
 {
     if ($image = $this->event->flyer_front()) {
         $icon = $image->get_url($image::SIZE_ICON);
     } elseif ($image = $this->event->flyer_back()) {
         $icon = $image->get_url($image::SIZE_ICON);
     } elseif (count($flyers = $this->event->flyers())) {
         $image = $flyers[0]->image();
         $icon = $image->get_url($image::SIZE_ICON);
     } else {
         $icon = null;
     }
     return $icon ? HTML::anchor(Route::model($this->event), HTML::image($icon, array('alt' => __('Flyer'))), array('class' => 'avatar')) : '<div class="avatar empty"><i class="icon-picture"></i></div>';
 }
Exemplo n.º 8
0
Arquivo: venues.php Projeto: anqh/anqh
 /**
  * Action: combine
  */
 public function action_combine()
 {
     $this->history = false;
     // Load original venue
     $venue_id = (int) $this->request->param('id');
     $venue = Model_Venue::factory($venue_id);
     if (!$venue->loaded()) {
         throw new Model_Exception($venue, $venue_id);
     }
     Permission::required($venue, Model_Venue::PERMISSION_COMBINE);
     // Build page
     $this->view = new View_Page($venue->name);
     $this->view->tab = 'venue';
     $this->view->tabs[] = array('link' => Route::url('venues'), 'text' => '&laquo; ' . __('Back to Venues'));
     $this->view->tabs['venue'] = array('link' => Route::model($venue), 'text' => __('Venue'));
     // Load duplicate venue
     $duplicate_id = (int) $this->request->param('param');
     if ($duplicate_id) {
         $duplicate = Model_Venue::factory($duplicate_id);
         if (!$duplicate->loaded()) {
             throw new Model_Exception($duplicate, $duplicate_id);
         }
         if (Security::csrf_valid()) {
             // Combine
             // Update events
             Model_Event::merge_venues($venue_id, $duplicate_id);
             // Copy info from duplicate
             $new_data = false;
             foreach (array('description', 'url', 'hours', 'info', 'address', 'zip', 'city_name', 'latitude', 'longitude', 'foursquare_id', 'foursquare_category_id') as $data) {
                 if ($duplicate[$data] && !$venue[$data]) {
                     $venue[$data] = $duplicate[$data];
                     $new_data = true;
                 }
             }
             if ($new_data) {
                 $venue->save();
             }
             // Remove duplicate
             $duplicate->delete();
             $this->request->redirect(Route::model($venue));
         } else {
             // Confirm
             $this->view->add(View_Page::COLUMN_CENTER, $this->section_venue_combine($venue, $duplicate));
         }
     } else {
         // Select parent
         $this->view->add(View_Page::COLUMN_CENTER, $this->section_venue_combine($venue));
     }
 }
Exemplo n.º 9
0
 public function action_day_events()
 {
     $year = $this->request->param('year', date('Y'));
     $month = $this->request->param('month', date('m'));
     $day = $this->request->param('day', date('d'));
     $event_type = $this->request->param('event_type');
     $date = date('Y-m-d', mktime(0, 0, 0, (int) $month, (int) $day, $year));
     $events = Model_Event::daily_events($date);
     $day_events = array();
     foreach ($events as $event) {
         $day_events[] = Calendar_Event::factory($event->eventtype)->day_event($event);
     }
     $view = View::factory('calendar/day_events')->set('date', $date)->set('day_events', $day_events);
     $this->content = $view;
 }
Exemplo n.º 10
0
Arquivo: events.php Projeto: anqh/anqh
 /**
  * Get anchor to newsfeed item target.
  *
  * @static
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get_link(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_EVENT:
         case self::TYPE_EVENT_EDIT:
         case self::TYPE_FAVORITE:
             $event = Model_Event::factory($item->data['event_id']);
             if ($event->loaded()) {
                 $text = HTML::anchor(Route::model($event), '<i class="fa fa-calendar"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'));
             }
             break;
     }
     return $text;
 }
Exemplo n.º 11
0
Arquivo: topic.php Projeto: anqh/anqh
 /**
  * Action: event
  */
 public function action_event()
 {
     $event_id = (int) $this->request->param('id');
     $event = Model_Event::factory($event_id);
     if (!$event->loaded()) {
         throw new Model_Exception($event, $event_id);
     }
     // Redirect
     if ($topic = Model_Forum_Topic::factory()->find_by_bind($event, 'events')) {
         // Topic existing
         $this->request->redirect(Route::model($topic));
     } else {
         // @todo Create new topic
         $this->request->redirect(Route::get('forum')->uri());
     }
 }
Exemplo n.º 12
0
Arquivo: topic.php Projeto: anqh/forum
 /**
  * Action: event
  */
 public function action_event()
 {
     $event_id = (int) $this->request->param('id');
     $event = Model_Event::factory($event_id);
     if (!$event->loaded()) {
         throw new Model_Exception($event, $event_id);
     }
     // Go to before or after event discussion?
     $time = $this->request->param('time');
     if (!$time) {
         $time = $event->stamp_begin > time() ? 'before' : 'after';
     }
     $bind = $time == 'before' ? 'events_upcoming' : 'events_past';
     // Redirect
     if ($topic = Model_Forum_Topic::factory()->find_by_bind($event, $bind)) {
         // Topic existing
         $this->request->redirect(Route::model($topic));
     } else {
         // @todo Create new topic
         $this->request->redirect(Route::get('forum')->uri());
     }
 }
Exemplo n.º 13
0
Arquivo: user.php Projeto: anqh/core
 /**
  * Get favorite events timeline.
  *
  * @param   Model_User  $user
  * @return  View_Events_Timeline
  */
 public function section_favorites(Model_User $user)
 {
     $upcoming = Model_Event::factory()->find_favorites_upcoming($user, 0, 'DESC');
     $past = Model_Event::factory()->find_favorites_past($user, 0);
     $favorites = array();
     foreach ($upcoming as $event) {
         $favorites[] = $event;
     }
     foreach ($past as $event) {
         $favorites[] = $event;
     }
     return new View_Events_Timeline($favorites);
 }
Exemplo n.º 14
0
 /**
  * Find upcoming events at venue.
  *
  * @param   integer  $limit
  * @return  Database_Result
  */
 public function find_events_upcoming($limit = 25)
 {
     return $this->find_related('event', DB::select_array(Model_Event::factory()->fields())->where('stamp_begin', '>=', strtotime('today'))->order_by('stamp_begin', 'DESC')->limit($limit));
 }
Exemplo n.º 15
0
 /**
  * Действие для редактирования матча
  * 
  * @param int $id
  */
 public function action_edit($id = null)
 {
     is_null($id) and \Response::redirect_back('admin/competitions/matches');
     if (!($match = \Model_Match::find($id, array('related' => array('season', 'team_1', 'team_2', 'matches_events', 'matches_events.event'))))) {
         \Session::set_flash('error', 'Матч не найден.');
         \Response::redirect_back('admin/competitions/matches');
     }
     $val = \Model_Match::validate('edit');
     if ($val->run()) {
         $match->status_id = \Input::post('status_id');
         $match->date = strtotime(\Input::post('date'));
         $match->name = \Input::post('name');
         $match->team_1_goals = \Input::post('team_1_goals');
         $match->team_2_goals = \Input::post('team_2_goals');
         $match->team_1_lineup = \Input::post('team_1_lineup');
         $match->team_2_lineup = \Input::post('team_2_lineup');
         $match->add_data = \Input::post('add_data');
         if ($match->save()) {
             // Если нужно редактировать турнирную таблицу
             if (\Input::post('change_table')) {
                 \Model_Table::edit_table($match->season_id, $match->team_1_id, $match->team_2_id, $match->team_1_goals, $match->team_2_goals);
             }
             \Session::set_flash('success', 'Данные матча обновлены.');
             \Response::redirect_back('admin/competitions/matches/edit/' . $id);
         } else {
             Session::set_flash('error', 'Could not update match #' . $id);
         }
     } else {
         if (\Input::method() == 'POST') {
             $match->status_id = $val->validated('status_id');
             $match->date = $val->validated('date');
             $match->name = $val->validated('name');
             $match->team_1_goals = $val->validated('team_1_goals');
             $match->team_2_goals = $val->validated('team_2_goals');
             $match->team_1_lineup = $val->validated('team_1_lineup');
             $match->team_2_lineup = $val->validated('team_2_lineup');
             $match->add_data = $val->validated('add_data');
             \Session::set_flash('error', $val->error());
         }
         $this->template->set_global('match', $match, false);
         $this->template->set_global('events', \Model_Event::get_events_for_select(), false);
     }
     $this->template->content = \View::forge('competitions/matches/edit');
 }
Exemplo n.º 16
0
 /**
  * Destroy controller
  */
 public function after()
 {
     if ($this->ajax || $this->internal) {
         // AJAX and HMVC requests
         $this->response->body($this->response->body() . '');
     } else {
         if ($this->auto_render) {
             // Normal requests
             $session = Session::instance();
             // Save current URI
             /* Moved to Controller
             			if ($this->history && $this->response->status() < 400) {
             				$uri = $this->request->current_uri();
             				unset($this->breadcrumb[$uri]);
             				$this->breadcrumb = array_slice($this->breadcrumb, -9, 9, true);
             				$this->breadcrumb[$uri] = $this->page_title;
             				$session
             					->set('history', $uri . ($_GET ? URL::query($_GET) : ''))
             					->set('breadcrumb', $this->breadcrumb);
             			}
             			 */
             // Controller name as the default page id if none set
             empty($this->page_id) and $this->page_id = $this->request->controller();
             // Stylesheets
             $styles = array('ui/boot.css' => null, 'ui/typo.css' => null, 'ui/base.css' => null, 'ui/jquery-ui.css' => null, 'http://fonts.googleapis.com/css?family=Nobile:regular,bold' => null);
             // Generic views
             Widget::add('breadcrumb', View::factory('generic/breadcrumb', array('breadcrumb' => $this->breadcrumb, 'last' => !$this->history)));
             Widget::add('actions', View::factory('generic/actions', array('actions' => $this->page_actions)));
             Widget::add('navigation', View::factory('generic/navigation', array('items' => Kohana::$config->load('site.menu'), 'selected' => $this->page_id)));
             if (!empty($this->tabs)) {
                 Widget::add('subnavigation', View::factory('generic/navigation', array('items' => $this->tabs, 'selected' => $this->tab_id)));
             }
             /*
             			Widget::add('tabs', View::factory('generic/tabs_top', array(
             				'tabs'     => $this->tabs,
             				'selected' => $this->tab_id
             			)));
             */
             // Footer
             Widget::add('footer', View_Module::factory('events/event_list', array('mod_id' => 'footer-events-new', 'mod_class' => 'article grid4 first cut events', 'mod_title' => __('New events'), 'events' => Model_Event::factory()->find_new(10))));
             Widget::add('footer', View_Module::factory('forum/topiclist', array('mod_id' => 'footer-topics-active', 'mod_class' => 'article grid4 cut topics', 'mod_title' => __('New posts'), 'topics' => Model_Forum_Topic::factory()->find_by_latest_post(10))));
             Widget::add('footer', View_Module::factory('blog/entry_list', array('mod_id' => 'footer-blog-entries', 'mod_class' => 'article grid4 cut blogentries', 'mod_title' => __('New blogs'), 'entries' => Model_Blog_Entry::factory()->find_new(10))));
             // Skin
             $skins = Kohana::$config->load('site.skins');
             $skin = 'dark';
             //$session->get('skin', 'dark');
             $skin_imports = array('ui/mixin.less', 'ui/grid.less', 'ui/layout.less', 'ui/widget.less', 'ui/custom.less');
             // Dock
             $classes = array();
             foreach ($skins as $skin_name => &$skin_config) {
                 $skin_config['path'] = 'ui/' . $skin_name . '/skin.less';
                 $classes[] = HTML::anchor(Route::get('setting')->uri(array('action' => 'skin', 'value' => $skin_name)), $skin_config['name'], array('class' => 'theme', 'rel' => $skin_name));
             }
             //Widget::add('dock', __('Theme') . ': ' . implode(', ', $classes));
             // Language selection
             $available_languages = Kohana::$config->load('locale.languages');
             if (count($available_languages)) {
                 $languages = array();
                 foreach ($available_languages as $lang => $locale) {
                     $languages[] = HTML::anchor('set/lang/' . $lang, HTML::chars($locale[2]));
                 }
                 //				Widget::add('dock', ' | ' . __('Language: ') . implode(', ', $languages));
             }
             // Search
             /*
             			Widget::add('search', View_Module::factory('generic/search', array(
             				'mod_id' => 'search'
             			)));
             */
             // Visitor card
             Widget::add('visitor', View::factory('generic/visitor', array('user' => self::$user)));
             // Time & weather
             Widget::add('dock', ' | ' . View::factory('generic/clock', array('user' => self::$user)));
             // Pin
             Widget::add('dock', ' | ' . HTML::anchor('#pin', '&#9650;', array('title' => __('Lock menu'), 'class' => 'icon unlock', 'onclick' => '$("#header").toggleClass("pinned"); return false;')));
             // End
             Widget::add('end', View::factory('generic/end'));
             // Analytics
             if ($google_analytics = Kohana::$config->load('site.google_analytics')) {
                 Widget::add('head', HTML::script_source("\nvar tracker;\nhead.js(\n\t{ 'google-analytics': 'http://www.google-analytics.com/ga.js' },\n\tfunction() {\n\t\ttracker = _gat._getTracker('" . $google_analytics . "');\n\t\ttracker._trackPageview();\n\t}\n);\n"));
             }
             // Open Graph
             $og = array();
             foreach ((array) Anqh::open_graph() as $key => $value) {
                 $og[] = '<meta property="' . $key . '" content="' . HTML::chars($value) . '" />';
             }
             if (!empty($og)) {
                 Widget::add('head', implode("\n", $og));
             }
             // Share
             if (Anqh::share()) {
                 if ($share = Kohana::$config->load('site.share')) {
                     // 3rd party share
                     Widget::add('share', View_Module::factory('share/share', array('mod_class' => 'like', 'id' => $share)));
                     Widget::add('foot', View::factory('share/foot', array('id' => $share)));
                 } else {
                     if ($facebook = Kohana::$config->load('site.facebook')) {
                         // Facebook Like
                         Widget::add('share', View_Module::factory('facebook/like'));
                         Widget::add('ad_top', View::factory('facebook/connect', array('id' => $facebook)));
                     }
                 }
             }
             // Ads
             $ads = Kohana::$config->load('site.ads');
             if ($ads && $ads['enabled']) {
                 foreach ($ads['slots'] as $ad => $slot) {
                     Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE);
                 }
             }
             // And finally the profiler stats
             if (self::$user && self::$user->has_role('admin')) {
                 //in_array(Kohana::$environment, array(Kohana::DEVELOPMENT, Kohana::TESTING))) {
                 Widget::add('foot', View::factory('generic/debug'));
                 Widget::add('foot', View::factory('profiler/stats'));
             }
             // Do some CSS magic to page class
             $page_class = explode(' ', $this->language . ' ' . $session->get('page_width', 'fixed') . ' ' . $session->get('page_main', 'left') . ' ' . $this->request->action() . ' ' . $this->page_class);
             // Controller set classes
             $page_class = implode(' ', array_unique(array_map('trim', $page_class)));
             // Bind the generic page variables
             $this->template->set('styles', $styles)->set('skin', $skin)->set('skins', $skins)->set('skin_imports', $skin_imports)->set('language', $this->language)->set('page_id', $this->page_id)->set('page_class', $page_class)->set('page_title', $this->page_title)->set('page_subtitle', $this->page_subtitle);
             // Add statistics
             $queries = 0;
             if (Kohana::$profiling) {
                 foreach (Profiler::groups() as $group => $benchmarks) {
                     if (strpos($group, 'database') === 0) {
                         $queries += count($benchmarks);
                     }
                 }
             }
             $total = array('{memory_usage}' => number_format((memory_get_peak_usage() - KOHANA_START_MEMORY) / 1024, 2) . 'KB', '{execution_time}' => number_format(microtime(true) - KOHANA_START_TIME, 5), '{database_queries}' => $queries, '{included_files}' => count(get_included_files()));
             $this->template = strtr($this->template, $total);
             // Render page
             if ($this->auto_render === true) {
                 $this->response->body($this->template);
             }
         }
     }
     return parent::after();
 }
Exemplo n.º 17
0
Arquivo: page.php Projeto: anqh/core
 /**
  * Destroy controller.
  */
 public function after()
 {
     if ($this->_request_type !== Controller::REQUEST_INITIAL) {
         // AJAX and HMVC requests
         $this->response->body((string) $this->response->body());
     } else {
         if ($this->auto_render) {
             // Normal requests
             // Stylesheets
             $styles = array('ui/jquery-ui.css', 'http://fonts.googleapis.com/css?family=Terminal+Dosis');
             // Skins
             $selected_skin = $this->session->get('skin', 'blue');
             // Less files needed to build a skin
             $less_imports = array('ui/mixin.less', 'ui/anqh.less');
             $skins = array(HTML::style('static/css/bootstrap.css'), HTML::style('static/css/bootstrap-responsive.css'));
             foreach (array('blue') as $skin) {
                 $skinsi[] = Less::style('ui/' . $skin . '.less', array('title' => $skin, 'rel' => $skin == $selected_skin ? 'stylesheet' : 'alternate stylesheet'), false, $less_imports);
             }
             // Footer
             $section = new View_Events_List();
             $section->class .= ' span4';
             $section->title = __('New events');
             $section->events = Model_Event::factory()->find_new(10);
             Widget::add('footer', $section);
             $section = new View_Topics_List();
             $section->class .= ' span4';
             $section->title = __('New posts');
             $section->topics = Model_Forum_Topic::factory()->find_by_latest_post(10);
             Widget::add('footer', $section);
             $section = new View_Blogs_List();
             $section->class .= ' span4';
             $section->title = __('New blogs');
             $section->blog_entries = Model_Blog_Entry::factory()->find_new(10);
             Widget::add('footer', $section);
             // Open Graph
             $og = array();
             foreach ((array) Anqh::open_graph() as $key => $value) {
                 $og[] = '<meta property="' . $key . '" content="' . HTML::chars($value) . '" />';
             }
             if (!empty($og)) {
                 Widget::add('head', implode("\n", $og));
             }
             // Analytics
             if ($google_analytics = Kohana::$config->load('site.google_analytics')) {
                 Widget::add('head', HTML::script_source("\nvar tracker;\nhead.js(\n\t{ 'google-analytics': 'http://www.google-analytics.com/ga.js' },\n\tfunction() {\n\t\ttracker = _gat._getTracker('" . $google_analytics . "');\n\t\ttracker._trackPageview();\n\t}\n);\n"));
             }
             // Ads
             /*			$ads = Kohana::$config->load('site.ads');
             			if ($ads && $ads['enabled']) {
             				foreach ($ads['slots'] as $ad => $slot) {
             					if ($slot == 'side') {
             						$this->view->add(View_Page::COLUMN_SIDE, View::factory('ads/' . $ad));
             					} else {
             						Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE);
             					}
             				}
             			}*/
             // Do some CSS magic to page class
             $page_class = array_merge(array($this->language, $this->request->action(), self::$user ? 'authenticated' : 'unauthenticated'), explode(' ', $this->page_class));
             $page_class = implode(' ', array_unique($page_class));
             // Set the generic page variables
             $this->view->styles = $styles;
             $this->view->skins = $skins;
             $this->view->language = $this->language;
             $this->view->id = $this->page_id;
             $this->view->class = $page_class;
             if ($this->page_actions) {
                 $this->view->tabs = $this->page_actions;
             }
             if ($this->page_breadcrumbs) {
                 $this->view->breadcrumbs = $this->page_breadcrumbs;
             }
             // And finally the profiler stats
             if (self::$user && self::$user->has_role('admin')) {
                 //in_array(Kohana::$environment, array(Kohana::DEVELOPMENT, Kohana::TESTING))) {
                 Widget::add('foot', View::factory('generic/debug'));
                 Widget::add('foot', View::factory('profiler/stats'));
             }
         }
     }
     parent::after();
 }
Exemplo n.º 18
0
Arquivo: day.php Projeto: anqh/anqh
 /**
  * Render flyer.
  *
  * @return  string
  */
 public function flyer()
 {
     $icon = ($flyer = $this->event->flyer()) ? $flyer->image_url(Model_Image::SIZE_THUMBNAIL) : $this->event->flyer_front_url;
     return HTML::anchor(Route::model($this->event), $icon ? HTML::image($icon, array('alt' => __('Flyer'))) : '<i class="fa fa-calendar"></i>');
 }
Exemplo n.º 19
0
 /**
  * IS: Parameter date-start, date-end, sortby, sortorder terdeklarasi
  * FS: Mengirimkan ke viewer: event, formattedDateStart, formattedDateEnd
  * Desc: Fungsi untuk menampilkan halaman hasil pencarian
  */
 public function searchAction()
 {
     if ($this->_hasParam('date-start')) {
         // Param
         $dateStart = $this->_getParam('date-start');
         $dateEnd = $this->_getParam('date-end');
         $sortBy = $this->_getParam('sortby');
         $sortOrder = $this->_getParam('sortorder', 'desc');
         // Model
         $eventModel = new Model_Event();
         // Data
         $event = $eventModel->getAllSearchEvent($dateStart, $dateEnd, array('sort_by' => $sortBy, 'sort_order' => $sortOrder), $this->_languageId);
         // format tanggal ke bentuk yang lebih manusiawi
         $format = "j M Y";
         $formattedDateStart = date($format, strtotime($dateStart));
         $formattedDateEnd = date($format, strtotime($dateEnd));
         // menentukan title
         if ($dateStart == $dateEnd) {
             $titlePage = 'Event Search Result For ' . $formattedDateStart;
         } else {
             // jika range tanggal
             $titlePage = 'Event Search Result From ' . $formattedDateStart . ' To ' . $formattedDateEnd;
         }
         $this->_generateSorter($sortBy, $sortOrder);
         // View
         $this->view->event = parent::setPaginator($event);
         $this->view->formattedDateStart = $dateStart;
         $this->view->formattedDateEnd = $dateEnd;
         // Render
         $this->render('index');
     }
 }
Exemplo n.º 20
0
Arquivo: edit.php Projeto: anqh/anqh
    /**
     * Render content.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        ?>

<div id="preview"></div>

<?php 
        echo Form::open(null, array('id' => 'form-event', 'class' => 'row'));
        ?>

<div class="col-md-8">

	<?php 
        if ($this->event_errors || $this->venue_errors) {
            ?>
	<div class="alert alert-danger">
		<strong><?php 
            echo __('Error happens!');
            ?>
</strong>
		<ul class="">
			<?php 
            foreach ((array) $this->event_errors as $error) {
                ?>
			<li><?php 
                echo $error;
                ?>
</li>
			<?php 
            }
            ?>
			<?php 
            foreach ((array) $this->venue_errors as $error) {
                ?>
			<li><?php 
                echo __('Venue');
                ?>
: <?php 
                echo $error;
                ?>
</li>
			<?php 
            }
            ?>
		</ul>
	</div>
	<?php 
        }
        ?>

	<fieldset id="fields-primary">
		<?php 
        echo Form::input_wrap('name', $this->event->name, array('class' => 'input-lg'), __('Name'), Arr::get($this->event_errors, 'name'), __("Please don't use dates in the name, looks nasty everywhere as the date is usually shown automagically."));
        ?>

		<?php 
        echo Form::textarea_wrap('info', $this->event->info, array('class' => 'input-lg', 'rows' => 20), true, __('Information'), Arr::get($this->event_errors, 'info'), __('Remember, only the first few rows are visible in the calendar view.'), true);
        ?>
	</fieldset>

	<fieldset>
		<?php 
        echo Form::button('save', __('Save event'), array('type' => 'submit', 'class' => 'btn btn-success btn-lg'));
        ?>
		<?php 
        echo Form::button('preview', __('Preview'), array('class' => 'btn btn-default btn-lg', 'data-content-class' => '*', 'data-prepend' => '#preview'));
        ?>
		<?php 
        echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : '';
        ?>

		<?php 
        echo Form::csrf();
        ?>
		<?php 
        echo Form::hidden('latitude', $this->venue->latitude, array('data-geo' => 'lat'));
        ?>
		<?php 
        echo Form::hidden('longitude', $this->venue->longitude, array('data-geo' => 'lng'));
        ?>
		<?php 
        echo Form::hidden('city', $this->event->city_name, array('data-geo' => 'locality'));
        ?>
		<?php 
        echo Form::hidden('venue_id', $this->venue->id);
        ?>
		<?php 
        echo Form::hidden('foursquare_id', $this->venue->foursquare_id);
        ?>
	</fieldset>
</div>

<div class="col-md-4">

	<fieldset id="fields-when" class="row form-inline">
		<div class="col-md-3">
			<?php 
        echo Form::input_wrap('stamp_begin[date]', is_numeric($this->event->stamp_begin) ? Date::format('DMYYYY', $this->event->stamp_begin) : $this->event->stamp_begin, array('class' => 'date', 'maxlength' => 10, 'size' => 7, 'placeholder' => 'd.m.yyyy'), __('From'), Arr::Get($this->event_errors, 'stamp_begin'));
        ?>
		</div>

		<div class="col-md-3">
			<?php 
        echo Form::select_wrap('stamp_begin[time]', array_reverse(Date::hours_minutes(30, true)), is_numeric($this->event->stamp_begin) ? Date::format('HHMM', $this->event->stamp_begin) : (empty($this->event->stamp_begin) ? '22:00' : $this->event->stamp_begin), array('class' => 'time'), '&nbsp;', Arr::get($this->event_errors, 'stamp_begin'));
        ?>
		</div>

		<div class="col-md-3">
			<?php 
        echo Form::select_wrap('stamp_end[time]', Date::hours_minutes(30, true), is_numeric($this->event->stamp_end) ? Date::format('HHMM', $this->event->stamp_end) : (empty($this->event->stamp_end) ? '04:00' : $this->event->stamp_end), array('class' => 'time'), __('To'), Arr::get($this->event_errors, 'stamp_end'));
        ?>
		</div>

		<div class="col-md-3">
			<?php 
        echo Form::input_wrap('stamp_end[date]', is_numeric($this->event->stamp_end) ? Date::format('DMYYYY', $this->event->stamp_end) : $this->event->stamp_end, array('class' => 'date', 'maxlength' => 10, 'size' => 7, 'placeholder' => 'd.m.yyyy'), '&nbsp;', Arr::Get($this->event_errors, 'stamp_end'));
        ?>
		</div>
	</fieldset>

	<br>

	<fieldset id="fields-venue" class="row">
		<div class="col-md-12">
			<?php 
        echo Form::input_wrap('city_name', $this->event->city_name, null, __('City'), Arr::get($this->event_errors, 'city_name'));
        ?>
		</div>

		<div class="col-md-7">
			<?php 
        echo Form::input_wrap('venue_name', $this->event->venue_name, (bool) $this->event->venue_hidden ? array('disabled') : null, __('Venue'), Arr::get($this->event_errors, 'venue_name'));
        ?>
		</div>

		<div class="col-md-5">
			<br>
			<?php 
        echo Form::checkbox_wrap('venue_hidden', 'true', (bool) $this->event->venue_hidden, array('id' => 'field-ug'), __('Underground'));
        ?>
		</div>

		<div class="col-md-12 venue-placeholder hidden">
			<label><?php 
        echo __('Venue');
        ?>
</label>
			<p>
				<span class="venue-name"><?php 
        echo $this->event->venue_name;
        ?>
</span>,
				<span class="venue-city"><?php 
        echo $this->event->city_name;
        ?>
</span>
				<a href="#venue"><?php 
        echo __('Change');
        ?>
</a>
			</p>
		</div>
	</fieldset>

	<div id="map" class="well"></div>

	<fieldset>
		<?php 
        if (!$this->event->flyer_id) {
            echo Form::input_wrap('flyer', $this->event->flyer_url, array('type' => 'url', 'placeholder' => 'http://'), __('Flyer'), $this->flyer_error, __('If you have the flyer only locally you can upload it after saving the event.'));
        }
        ?>

		<?php 
        echo Form::input_wrap('url', $this->event->url, array('type' => 'url', 'placeholder' => 'http://'), __('Homepage'), Arr::get($this->event_errors, 'url'));
        ?>
	</fieldset>

	<fieldset id="fields-tickets" class="row">
		<div class="col-md-4">
			<?php 
        echo Form::input_wrap('price', $this->event->price, $this->event->price === '0.00' ? array('disabled', 'type' => 'number', 'min' => 0, 'step' => 0.5) : array('type' => 'number', 'min' => 0, 'step' => 0.5), __('Tickets'), Arr::get($this->event_errors, 'tickets'), null, '&euro;');
        ?>
		</div>

		<div class="col-md-8">
			<br>
			<?php 
        echo Form::checkbox_wrap('free', 'true', $this->event->price === '0.00', array('id' => 'field-free'), __('Free entry'));
        ?>
		</div>

		<div class="col-md-12">
			<?php 
        echo Form::input_wrap('ticket_url', $this->event->ticket_url, array('placeholder' => 'http://'), __('Buy tickets from'), Arr::get($this->event_errors, 'ticket_url'));
        ?>
		</div>

		<div class="col-md-5">
			<?php 
        echo Form::input_wrap('age', $this->event->age, array('type' => 'number', 'min' => 0, 'max' => 50, 'maxlength' => 3), __('Age limit'), Arr::get($this->event_errors, 'age'), null, __('years'));
        ?>
		</div>
	</fieldset>

	<fieldset id="fields-music">
		<?php 
        echo Form::checkboxes_wrap('tag', $this->tags(), $this->event->tags(), array('class' => 'block-grid three-up'), __('Music'), $this->event_errors);
        ?>
	</fieldset>
</div>

		<?php 
        echo Form::close();
        echo $this->javascript();
        return ob_get_clean();
    }
Exemplo n.º 21
0
Arquivo: info.php Projeto: anqh/events
 /**
  * Render content.
  *
  * @return  string
  */
 public function content()
 {
     ob_start();
     /*
     // Stamp
     if ($this->event->stamp_begin != $this->event->stamp_end):
     	echo ($this->event->stamp_end ?
     		'<i class="icon-time icon-white"></i> ' . __('From :from to :to', array(
     			':from' => HTML::time(Date::format('HHMM', $this->event->stamp_begin), $this->event->stamp_begin),
     			':to'   => HTML::time(Date::format('HHMM', $this->event->stamp_end), $this->event->stamp_end)
     		)) :
     		'<i class="icon-time icon-white"></i> ' . __('From :from onwards', array(
     			':from' => HTML::time(Date::format('HHMM', $this->event->stamp_begin), $this->event->stamp_begin),
     		))) . '<br />';
     endif;
     */
     // Price
     if ($this->event->price == 0) {
         echo '<i class="icon-shopping-cart icon-white"></i> ' . __('Free entry') . '<br />';
     } elseif ($this->event->price > 0) {
         echo '<i class="icon-shopping-cart icon-white"></i> ' . __('Tickets :price', array(':price' => '<var>' . Num::currency($this->event->price, $this->event->stamp_begin) . '</var>'));
         echo ($this->event->price2 !== null ? ', ' . __('presale :price', array(':price' => '<var>' . Num::currency($this->event->price2, $this->event->stamp_begin) . '</var>')) : '') . '<br />';
     }
     // Age limit
     if ($this->event->age > 0) {
         echo '<i class="icon-user icon-white"></i> ' . __('Age limit') . ': ' . __(':years years', array(':years' => '<var>' . $this->event->age . '</var>')) . '<br />';
     }
     // Homepage
     if (!empty($this->event->homepage)) {
         echo '<i class="icon-home icon-white"></i> ' . HTML::anchor($this->event->homepage, Text::limit_url($this->event->homepage, 25)) . '<br />';
     }
     // Tags
     if ($tags = $this->event->tags()) {
         echo '<i class="icon-music icon-white"></i> ' . implode(', ', $tags) . '<br />';
     } elseif (!empty($this->event->music)) {
         echo '<i class="icon-music icon-white"></i> ' . $this->event->music . '<br />';
     }
     /*
     // Venue
     if ($_venue = $this->event->venue()):
     
     	// Venue found from db
     	$venue   = HTML::anchor(Route::model($_venue), HTML::chars($_venue->name));
     	$address = $_venue->address
     	 ? HTML::chars($_venue->address) . ', ' . HTML::chars($_venue->city_name)
     	 : HTML::chars($_venue->city_name);
     
     	if ($_venue->latitude):
     		$map = array(
     			'marker'     => HTML::chars($_venue->name),
     			'infowindow' => HTML::chars($_venue->address) . '<br />' . HTML::chars($_venue->city_name),
     			'lat'        => $_venue->latitude,
     			'long'       => $_venue->longitude
     		);
     		Widget::add('foot', HTML::script_source('
     head.ready("anqh", function() {
     	$("#event-info a[href=#map]").on("click", function toggleMap(event) {
     $("#map").toggle("fast", function openMap() {
     	$("#map").googleMap(' .  json_encode($map) . ');
     });
     
     return false;
     	});
     });
     '));
     	endif;
     
     elseif ($this->event->venue_name):
     
     	// No venue in db
     	$venue   = $this->event->venue_url
     		? HTML::anchor($this->event->venue_url, HTML::chars($this->event->venue_name))
     		: HTML::chars($this->event->venue_name);
     	$address = HTML::chars($this->event->city_name);
     
     else:
     
     	// Venue not set
     	$venue   = $this->event->venue_hidden ? __('Underground') : __('(Unknown)');
     	$address = HTML::chars($this->event->city_name);
     
     endif;
     echo '<address><strong><i class="icon-map-marker icon-white"></i> ', $venue, '</strong>' . ($address ? ', ' . $address : '') . '<br />';
     if (isset($map)):
     	echo HTML::anchor('#map', __('Toggle map')) . '<br />';
     	echo '<div id="map" style="display: none">', __('Map loading') . '</div>';
     endif;
     echo '</address>';
     */
     // Meta
     echo '<br /><footer class="meta">';
     echo __('Added') . ' ' . HTML::time(Date::format(Date::DMY_SHORT, $this->event->created), $this->event->created);
     if ($this->event->modified) {
         echo ', ' . __('last modified') . ' ' . HTML::time(Date::short_span($this->event->modified, false), $this->event->modified);
     }
     echo '</footer>';
     return ob_get_clean();
 }
Exemplo n.º 22
0
 /**
  * Get events.
  *
  * @return  View_Events_List
  */
 public function section_events_updated()
 {
     $section = new View_Events_List();
     $section->title = __('Updated events');
     $section->events = Model_Event::factory()->find_modified(10);
     return $section;
 }
Exemplo n.º 23
0
Arquivo: api.php Projeto: anqh/anqh
 /**
  * Prepare event for data array
  *
  * @param   Model_Event  $event
  * @param   array        $fields
  * @return  array
  */
 protected function _prepare_event(Model_Event $event, array $fields = null)
 {
     $data = array();
     empty($fields) and $fields = self::$_fields;
     foreach ($fields as $field) {
         switch ($field) {
             // Raw value
             case 'age':
             case 'created':
             case 'favorite_count':
             case 'flyer_id':
             case 'dj':
             case 'id':
             case 'info':
             case 'modified':
             case 'name':
             case 'price':
             case 'price2':
             case 'stamp_begin':
             case 'stamp_end':
             case 'venue_id':
                 $data[$field] = $event->{$field};
                 break;
                 // Custom value
             // Custom value
             case 'venue':
                 $data[$field] = ($venue = $event->venue()) ? $venue->name : $event->venue_name;
                 break;
             case 'city':
                 $data[$field] = ($venue = $event->venue()) ? $venue->city_name : $event->city_name;
                 break;
             case 'flyer':
             case 'flyer_icon':
             case 'flyer_thumb':
                 if ($field === 'flyer_icon') {
                     $size = Model_Image::SIZE_ICON;
                 } else {
                     if ($field === 'flyer__thumb') {
                         $size = Model_Image::SIZE_THUMBNAIL;
                     } else {
                         $size = null;
                     }
                 }
                 $data[$field] = ($flyer = $event->flyer()) ? $flyer->image_url($size) : null;
                 break;
             case 'music':
                 if ($tags = $event->tags()) {
                     $music = implode(', ', $tags);
                 } else {
                     if (!empty($event->music)) {
                         $music = $event->music;
                     } else {
                         $music = null;
                     }
                 }
                 $data[$field] = $music;
                 break;
             case 'url':
                 $data[$field] = URL::site(Route::model($event), true);
                 break;
         }
     }
     return $data;
 }
Exemplo n.º 24
0
Arquivo: edit.php Projeto: anqh/events
    /**
     * Render content.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        echo Form::open(null, array('id' => 'form-event', 'class' => 'row'));
        ?>

		<!--
			<?php 
        if ($this->event_errors) {
            ?>
			<ul class="errors">
				<?php 
            foreach ($this->event_errors as $error) {
                ?>
				<li><?php 
                echo $error;
                ?>
</li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
        ?>
			<?php 
        if ($this->venue_errors) {
            ?>
			<ul class="errors">
				<?php 
            foreach ($this->venue_errors as $error) {
                ?>
				<li><?php 
                echo $error;
                ?>
</li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
        ?>
		-->

			<div class="span8">
				<fieldset id="fields-primary">
					<?php 
        echo Form::control_group(Form::input('name', $this->event->name, array('class' => 'input-block-level')), array('name' => __('Event')), Arr::get($this->event_errors, 'name'));
        ?>

					<?php 
        echo Form::control_group(Form::textarea('dj', $this->event->dj, array('class' => 'input-block-level'), true), array('dj' => __('Line-up')), Arr::get($this->event_errors, 'dj'));
        ?>

					<?php 
        echo Form::control_group(Form::textarea_editor('info', $this->event->info, array('class' => 'input-block-level'), true), array('info' => __('Other information')), Arr::get($this->event_errors, 'info'));
        ?>

				</fieldset>

				<fieldset class="form-actions">
					<?php 
        echo Form::button('save', __('Save event'), array('type' => 'submit', 'class' => 'btn btn-success btn-large'));
        ?>
					<?php 
        echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : '';
        ?>

					<?php 
        echo Form::csrf();
        ?>
					<?php 
        echo Form::hidden('latitude', $this->venue->latitude);
        ?>
					<?php 
        echo Form::hidden('longitude', $this->venue->longitude);
        ?>
					<?php 
        echo Form::hidden('venue_id', $this->venue->id);
        ?>
				</fieldset>
			</div>

			<div class="span4">

				<fieldset id="fields-when" class="row">
					<?php 
        echo Form::control_group(Form::input('stamp_begin[date]', is_numeric($this->event->stamp_begin) ? Date::format('DMYYYY', $this->event->stamp_begin) : $this->event->stamp_begin, array('class' => 'date', 'maxlength' => 10, 'placeholder' => 'd.m.yyyy')), array('stamp_begin[date]' => __('Date')), Arr::get($this->event_errors, 'stamp_begin'), null, array('class' => 'span1'));
        ?>

					<?php 
        echo Form::control_group(Form::select('stamp_begin[time]', array_reverse(Date::hours_minutes(30, true)), is_numeric($this->event->stamp_begin) ? Date::format('HHMM', $this->event->stamp_begin) : (empty($this->event->stamp_begin) ? '22:00' : $this->event->stamp_begin), array('class' => 'time')), array('stamp_begin[time]' => __('From')), Arr::get($this->event_errors, 'stamp_begin'), null, array('class' => 'span1'));
        ?>

					<?php 
        echo Form::control_group(Form::select('stamp_end[time]', Date::hours_minutes(30, true), is_numeric($this->event->stamp_end) ? Date::format('HHMM', $this->event->stamp_end) : (empty($this->event->stamp_end) ? '04:00' : $this->event->stamp_end), array('class' => 'time')), array('stamp_end[time]' => __('To')), Arr::get($this->event_errors, 'stamp_end'), null, array('class' => 'span1'));
        ?>
				</fieldset>

				<?php 
        echo Form::control_group(Form::input('homepage', $this->event->homepage, array('class' => 'input-block-level', 'placeholder' => 'http://')), array('homepage' => __('Homepage')), Arr::get($this->event_errors, 'homepage'));
        ?>

				<fieldset id="fields-venue">
					<legend>
						<?php 
        echo Form::control_group('<label class="checkbox">' . Form::checkbox('venue_hidden', 'true', (bool) $this->event->venue_hidden, array('id' => 'field-ug')) . ' ' . __('Underground') . '</label>', null, null, null, array('class' => 'span2'));
        ?>

						<?php 
        echo __('Venue');
        ?>
					</legend>
					<?php 
        echo Form::control_group(Form::input('venue_name', $this->event->venue_name, (bool) $this->event->venue_hidden ? array('class' => 'input-block-level', 'disabled' => 'disabled') : array('class' => 'input-block-level')), array('venue_name' => __('Venue')), Arr::get($this->event_errors, 'venue_name'), null, array('id' => 'group-venue'));
        ?>

					<?php 
        echo Form::control_group(Form::input('city_name', $this->event->city_name, array('class' => 'input-block-level')), array('city_name' => __('City')), Arr::get($this->event_errors, 'city_name'));
        ?>
				</fieldset>

				<fieldset id="fields-tickets">
					<legend>
						<?php 
        echo Form::control_group('<label class="checkbox">' . Form::checkbox('free', 'true', $this->event->price === '0.00', array('id' => 'field-free')) . ' ' . __('Free entry') . '</label>', null, null, null, array('class' => 'span2'));
        ?>

						<?php 
        echo __('Tickets');
        ?>
					</legend>

					<?php 
        echo Form::control_group('<div class="input-append">' . Form::input('price', $this->event->price, $this->event->price === '0.00' ? array('class' => 'input-mini', 'disabled' => 'disabled') : array('class' => 'input-mini')) . '<span class="add-on">&euro;</span>' . '</div>', array('price' => __('Tickets')), Arr::get($this->event_errors, 'price'), null, array('id' => 'group-price'));
        ?>

					<?php 
        echo Form::control_group('<div class="input-append">' . Form::input('age', $this->event->age, array('class' => 'input-mini')) . '<span class="add-on">years</span>' . '</div>', array('age' => __('Age limit')), Arr::get($this->event_errors, 'age'));
        ?>
				</fieldset>

				<fieldset id="fields-music">
					<legend><?php 
        echo __('Music');
        ?>
</legend>
					<?php 
        echo Form::checkboxes_wrap('tag', $this->tags(), $this->event->tags(), null, $this->event_errors, null, 'block-grid three-up');
        ?>
				</fieldset>
			</div>

		<?php 
        echo Form::close();
        echo $this->javascript();
        return ob_get_clean();
    }
Exemplo n.º 25
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        // Load images
        $flyers = $this->event->flyers();
        if ((!count($flyers) || !$flyers->current()->image()) && $this->event->flyer_front_url) {
            // Legacy support
            $flyer_url = ($flyer = $flyers->current()) ? $flyer->image_url() : $this->event->flyer_front_url;
            echo HTML::image($flyer_url, ['class' => 'img-responsive']);
        } elseif (count($flyers)) {
            // Check for actions
            if (Permission::has($this->event, Model_Event::PERMISSION_UPDATE)) {
                $action_uri = Route::model($this->event, 'flyer');
            }
            // Check for missing default image
            $active_id = $this->event->flyer_id;
            if (!$active_id) {
                $active_id = $flyers->current()->id;
            }
            $slide = 0;
            ?>

<div class="carousel">

	<?php 
            if (count($flyers) > 1) {
                ?>
	<ol class="carousel-indicators">

		<?php 
                foreach ($flyers as $flyer) {
                    ?>
		<li data-target="#<?php 
                    echo $this->id;
                    ?>
" data-slide-to="<?php 
                    echo $slide++;
                    ?>
"<?php 
                    echo $flyer->id == $active_id ? ' class="active"' : '';
                    ?>
></li>
		<?php 
                }
                ?>

	</ol>
	<?php 
            }
            ?>

	<div class="carousel-inner">

		<?php 
            foreach ($flyers as $flyer) {
                if ($flyer->image()) {
                    ?>

		<div class="item<?php 
                    echo $flyer->id == $active_id ? ' active' : '';
                    ?>
">

			<?php 
                    echo HTML::anchor(Route::model($flyer), HTML::image($flyer->image()->get_url(), ['class' => 'img-responsive']));
                    ?>

			<?php 
                    if (isset($action_uri)) {
                        ?>

			<div class="actions">
				<?php 
                        if ($flyer->id == $this->event->flyer_id) {
                            echo HTML::anchor('#', '<i class="fa fa-picture-o"></i> ' . __('Set as default'), array('class' => 'btn btn-default btn-xs image-change disabled'));
                        } else {
                            echo HTML::anchor($action_uri . '?token=' . Security::csrf() . '&default=' . $flyer->id, '<i class="fa fa-picture-o"></i> ' . __('Set as default'), array('class' => 'btn btn-default btn-xs image-change'));
                        }
                        ?>
				<?php 
                        echo HTML::anchor($action_uri . '?token=' . Security::csrf() . '&delete=' . $flyer->id, '<i class="fa fa-trash-o"></i> ' . __('Delete'), array('class' => 'btn btn-default btn-xs image-delete'));
                        ?>
			</div>

			<?php 
                    }
                    ?>

		</div>

		<?php 
                }
            }
            ?>

	</div>

	<?php 
            if (count($flyers) > 1) {
                ?>
	<a class="carousel-control left" href="#<?php 
                echo $this->id;
                ?>
" data-slide="prev"><i class="fa fa-chevron-left icon-prev"></i></a>
	<a class="carousel-control right" href="#<?php 
                echo $this->id;
                ?>
" data-slide="next"><i class="fa fa-chevron-right icon-next"></i></a>
	<?php 
            }
            ?>

</div>

<?php 
        } elseif (Permission::has($this->event, Model_Event::PERMISSION_UPDATE)) {
            // Add new flyer
            echo HTML::anchor(Route::model($this->event, 'flyer'), '<i class="fa fa-picture-o"></i> ' . __('Upload flyer'), array('class' => 'empty ajaxify'));
        }
        return ob_get_clean();
    }
Exemplo n.º 26
0
Arquivo: api.php Projeto: anqh/events
 /**
  * Prepare event for data array
  *
  * @param   Model_Event  $event
  * @param   array        $fields
  * @return  array
  */
 protected function _prepare_event(Model_Event $event, array $fields = null)
 {
     $data = array();
     empty($fields) and $fields = self::$_fields;
     foreach ($fields as $field) {
         switch ($field) {
             // Raw value
             case 'id':
             case 'name':
             case 'homepage':
             case 'stamp_begin':
             case 'stamp_end':
             case 'dj':
             case 'info':
             case 'age':
             case 'price':
             case 'price2':
             case 'created':
             case 'modified':
             case 'favorite_count':
                 $data[$field] = $event->{$field};
                 break;
                 // Custom value
             // Custom value
             case 'venue':
                 $data[$field] = ($venue = $event->venue()) ? $venue->name : $event->venue_name;
                 break;
             case 'city':
                 $data[$field] = ($city = $event->city()) ? $city->name : $event->city_name;
                 break;
             case 'country':
                 $data[$field] = ($country = $event->country()) ? $country->name : '';
                 break;
             case 'flyer_front':
             case 'flyer_back':
             case 'flyer_front_icon':
             case 'flyer_back_icon':
             case 'flyer_front_thumb':
             case 'flyer_back_thumb':
                 if (strpos($field, 'icon')) {
                     $column = str_replace('_icon', '', $field) . '_image_id';
                     $size = Model_Image::SIZE_ICON;
                 } else {
                     if (strpos($field, '_thumb')) {
                         $column = str_replace('_thumb', '', $field) . '_image_id';
                         $size = Model_Image::SIZE_THUMBNAIL;
                     } else {
                         $column = $field . '_image_id';
                         $size = null;
                     }
                 }
                 $image = new Model_Image($event->{$column});
                 $data[$field] = $image->loaded() ? $image->get_url($size) : null;
                 break;
             case 'music':
                 if ($tags = $event->tags()) {
                     $music = implode(', ', $tags);
                 } else {
                     if (!empty($event->music)) {
                         $music = $event->music;
                     } else {
                         $music = null;
                     }
                 }
                 $data[$field] = $music;
                 break;
             case 'url':
                 $data[$field] = URL::site(Route::model($event), true);
                 break;
         }
     }
     return $data;
 }
Exemplo n.º 27
0
 /**
  * Get gallery edit form.
  *
  * @param   Model_Event  $event  Bound event, if any
  * @return  View_Gallery_Edit
  */
 public function section_gallery_edit(Model_Event $event = null)
 {
     $section = new View_Gallery_Edit($event);
     // Add suggestions if creating new
     if (!$event) {
         $events = Model_Event::factory()->find_favorites_past(self::$user, 10);
         if ($events && count($events)) {
             $section->events = $events;
         }
     }
     return $section;
 }
 public function eventsAction()
 {
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $user = Zend_Auth::getInstance()->getIdentity();
         $eventsList = new Model_Event();
         $this->view->list = $eventsList->getList($user->iUserId);
     }
 }
Exemplo n.º 29
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        // Load images
        $flyers = $this->event->flyers();
        if (!count($flyers) && $this->event->flyer_front_url) {
            // Legacy support
            echo HTML::image($this->event->flyer_front_url, array('width' => 290));
        } elseif (count($flyers)) {
            // Check for actions
            if (Permission::has($this->event, Model_Event::PERMISSION_UPDATE, self::$_user)) {
                $action_uri = Route::model($this->event, 'image');
            }
            // Check for missing default image
            $active_id = $this->event->flyer_front_image_id;
            if (!$active_id) {
                $active_id = $flyers->current()->image_id;
            }
            ?>

	<div class="carousel-inner">

		<?php 
            foreach ($flyers as $flyer) {
                ?>

		<div class="item<?php 
                echo $flyer->image_id == $active_id ? ' active' : '';
                ?>
">

			<?php 
                echo HTML::image($flyer->image()->get_url(), array('width' => 290));
                ?>

			<?php 
                if (isset($action_uri)) {
                    ?>

			<div class="btn-group">
				<?php 
                    if ($flyer->image_id == $this->event->flyer_front_image_id) {
                        echo HTML::anchor('#', __('As front'), array('class' => 'btn btn-mini image-change disabled'));
                        echo HTML::anchor($action_uri . '?token=' . Security::csrf() . '&back=' . $flyer->image_id, __('As back'), array('class' => 'btn btn-mini image-change'));
                    } elseif ($flyer->image_id == $this->event->flyer_back_image_id) {
                        echo HTML::anchor($action_uri . '?token=' . Security::csrf() . '&front=' . $flyer->image_id, __('As front'), array('class' => 'btn btn-mini image-change'));
                        echo HTML::anchor('#', __('As back'), array('class' => 'btn btn-mini image-change disabled'));
                    } else {
                        echo HTML::anchor($action_uri . '?token=' . Security::csrf() . '&front=' . $flyer->image_id, __('As front'), array('class' => 'btn btn-mini image-change'));
                        echo HTML::anchor($action_uri . '?token=' . Security::csrf() . '&back=' . $flyer->image_id, __('As back'), array('class' => 'btn btn-mini image-change'));
                    }
                    ?>
				<?php 
                    echo HTML::anchor($action_uri . '?token=' . Security::csrf() . '&delete=' . $flyer->image_id, '<i class="icon-trash"></i> ' . __('Delete'), array('class' => 'btn btn-mini image-delete'));
                    ?>
			</div>

			<?php 
                }
                ?>

		</div>

<?php 
            }
            ?>

</div>

<?php 
            if (count($flyers) > 1) {
                ?>
<a class="carousel-control left" href="#<?php 
                echo $this->id;
                ?>
" data-slide="prev">&lsaquo;</a>
<a class="carousel-control right" href="#<?php 
                echo $this->id;
                ?>
" data-slide="next">&rsaquo;</a>
<?php 
            }
            ?>

<?php 
        } elseif (Permission::has($this->event, Model_Event::PERMISSION_UPDATE, self::$_user)) {
            // Add new flyer
            echo HTML::anchor(Route::model($this->event, 'image'), '<i class="icon-picture icon-white"></i> ' . __('Add flyer'), array('class' => 'empty ajaxify'));
        }
        return ob_get_clean();
    }
Exemplo n.º 30
0
Arquivo: page.php Projeto: anqh/anqh
 /**
  * Destroy controller.
  */
 public function after()
 {
     if ($this->_request_type !== Controller::REQUEST_INITIAL) {
         // AJAX and HMVC requests
         $this->response->body((string) $this->response->body());
     } else {
         if ($this->auto_render) {
             // Normal requests
             // Footer
             $section = new View_Events_List();
             $section->class .= ' col-sm-4';
             $section->title = __('New events');
             $section->events = Model_Event::factory()->find_new(10);
             $this->view->add(View_Page::COLUMN_FOOTER, $section);
             $section = new View_Topics_List();
             $section->class .= ' col-sm-4';
             $section->topics = Model_Forum_Topic::factory()->find_by_latest_post(10);
             $this->view->add(View_Page::COLUMN_FOOTER, $section);
             $section = new View_Blogs_List();
             $section->class .= ' col-sm-4';
             $section->title = __('New blogs');
             $section->blog_entries = Model_Blog_Entry::factory()->find_new(10);
             $this->view->add(View_Page::COLUMN_FOOTER, $section);
             // Ads
             /*			$ads = Kohana::$config->load('site.ads');
             			if ($ads && $ads['enabled']) {
             				foreach ($ads['slots'] as $ad => $slot) {
             					if ($slot == 'side') {
             						$this->view->add(View_Page::COLUMN_SIDE, View::factory('ads/' . $ad));
             					} else {
             						Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE);
             					}
             				}
             			}*/
             // Theme
             $theme = $this->session->get('theme');
             //Arr::get($_COOKIE, 'theme');
             if (!in_array($theme, array_keys(Kohana::$config->load('site.themes')))) {
                 if (Visitor::$user) {
                     $theme = Visitor::$user->setting('ui.theme');
                 }
                 if (!$theme) {
                     $theme = Kohana::$config->load('site.theme');
                 }
                 $this->session->set('theme', $theme);
             }
             // Do some CSS magic to page class
             $page_class = array_merge(array('theme-' . $theme, Visitor::$user ? 'authenticated' : 'unauthenticated'), explode(' ', $this->page_class));
             $page_class = implode(' ', array_unique($page_class));
             // Set the generic page variables
             $this->view->language = $this->language;
             $this->view->id = $this->page_id;
             $this->view->class = $page_class;
             if ($this->page_actions) {
                 $this->view->tabs = $this->page_actions;
             }
             if ($this->page_breadcrumbs) {
                 $this->view->breadcrumbs = $this->page_breadcrumbs;
             }
             // Set meta data
             if (!Anqh::page_meta('title')) {
                 Anqh::page_meta('title', $this->view->title ? $this->view->title : Kohana::$config->load('site.site_name'));
             }
             // And finally the profiler stats
             if (Visitor::$user && Visitor::$user->has_role('admin')) {
                 Widget::add('foot', new View_Generic_Debug());
                 Widget::add('foot', View::factory('profiler/stats'));
             }
         }
     }
     parent::after();
 }