public function action_hotspot($application = null, $hotspot = null)
 {
     // Check if we have valid application
     $item = \Application\Model_Application::find_one_by_id($application);
     // If no, redirect back to home page
     if (!$item) {
         \Response::redirect(\Uri::front_create('/'));
     }
     if (\Input::is_ajax()) {
         // Check if we have valid hotspot
         $hotspot = \Application\Model_Application_Image::find_one_by_id($hotspot);
         // If not show error message
         if (!$hotspot) {
             echo 'Invalid link. Please try again!';
             exit;
         }
         // Load hotspot view
         echo \Theme::instance()->view($this->view_dir . 'hotspot')->set('hotspot', $hotspot, false);
     } else {
         \Response::redirect(\Uri::front_create('application/' . $item->seo->slug));
     }
 }
						<?php 
// Get pages
$pages = \Application\Model_Application::find(function ($query) {
    $query->order_by('sort', 'asc');
    $query->order_by('id', 'asc');
});
$application = isset($application) ? $application : false;
$link = isset($link) ? $link : 'update';
$selected = isset($selected) ? $selected : false;
?>
						
                        <div class="side_tree_holder">
                            <div class="tree_heading">
                                <h4><?php 
echo $application ? 'News Categories' : 'News Categories';
?>
</h4>
                                <div id="sidetreecontrol" class="sidetreecontrol"><a href="#">Collapse All</a><a href="#">Expand All</a></div>
                            </div>
                            <div class="tree_content">
                            	<div id="sidetree">
                                
                                	<?php 
if (!$application && empty($pages)) {
    ?>
                                		<div class="wide"><span class="req">Note: </span> There are no pages yet.</div>
                                	<?php 
} else {
    ?>
                                	
	                                    <ul class="treeview" id="tree">
Beispiel #3
0
 /**
  * Index page
  * 
  * @access  public
  * @param   $slug
  */
 public function action_index($slug = false, $gallery_id = null)
 {
     // Get home page
     $home_page = \Config::get('details.locked_items.home_page');
     $gallery_page = \Config::get('details.locked_items.gallery');
     $item = false;
     if ($slug == 'referrals' && strtolower(\Sentry::user()->groups()[0]['name']) != 'club members') {
         \Messages::error('Only club members can access this page.');
         \Response::redirect('/');
     }
     //var_dump($slug);die();
     // Find content by slug
     if ($slug !== false) {
         $item = \Page\Model_Page::get_by_slug($slug);
     } elseif ($slug === false) {
         $item = \Page\Model_Page::find_one_by_id($home_page);
     }
     if ($item) {
         // Home page is always without slug so we redirect if someone tries to access home page with slug
         if ($item->id == $home_page && $slug !== false) {
             \Response::redirect(\Uri::base(false));
         }
     } else {
         // Send to 404 page
         throw new \HttpNotFoundException();
     }
     $result = \Page\Model_Page::get_content_file($item->id);
     if ($result) {
         foreach ($result as $rs) {
             $item->content_file_pdf = $rs->file;
             //pdf file
             $item->content_file_title = $rs->title;
             //pdf title
         }
     }
     // Default view file
     $view_file = 'default';
     // Fill in home page slug if none is supplied
     if ($slug === false && $item->id == $home_page) {
         $slug = $item->seo->slug;
         // Home page has its standard template
         $view_file = 'home';
     } else {
         // Search for page specific template
         $files = \File::read_dir($this->theme_view_path);
         if (!empty($files)) {
             foreach ($files as $file) {
                 $path_parts = pathinfo($file);
                 if (strpos($path_parts['filename'], '_') === 0) {
                     $file_id = substr($path_parts['filename'], strripos($path_parts['filename'], '_') + 1);
                     if (is_numeric($file_id) && $item->id == $file_id) {
                         $view_file = $path_parts['filename'];
                     }
                 }
             }
         }
     }
     $stock_options = \Config::load('stock-option.db');
     // TODO delete this
     srand($item->id);
     $this->page_theme = \Theme::instance()->set_partial('content', $this->view_dir . $view_file);
     $this->page_theme->set('item', $item, false);
     $this->page_theme->set('manage_stock', $stock_options['manage_stock'], false);
     $this->page_theme->set('hide_out_of_stock', $stock_options['hide_out_of_stock'], false);
     $this->page_theme->set('allow_buy_out_of_stock', $stock_options['allow_buy_out_of_stock'], false);
     if ($item->id == $gallery_page) {
         if ($gallery_id && \Input::is_ajax()) {
             // This will return gallery images only if it is ajax call
             $this->returnGalleryImages($gallery_id);
         }
     }
     // Data for home page
     if ($view_file == 'home') {
         $featured_products = \Product\Model_Group::find_one_by_id(4);
         if ($featured_products) {
             $featured_products = $featured_products->products;
         }
         $this->page_theme->set('featured_products', $featured_products, false);
         $categories = \Product\Model_Category::find(array('where' => array('parent_id' => 0, 'status' => 1), 'order_by' => array('sort' => 'asc'), 'limit' => 8));
         $this->page_theme->set('categories', $categories, false);
         $applications = \Application\Model_Application::find(array('where' => array('parent_id' => 0, 'status' => 1), 'order_by' => array('sort' => 'asc'), 'limit' => 8));
         $this->page_theme->set('applications', $applications, false);
         // $this->page_theme->set('blog', $this->wp_blog(), false);
     }
     \View::set_global('title', $item->seo->meta_title ?: $item->title);
     \View::set_global('meta_description', $item->seo->meta_description ?: '');
     \View::set_global('meta_keywords', $item->seo->meta_keywords ?: '');
     $robots = array('meta_robots_index' => $item->seo->meta_robots_index == 1 ? 'index' : 'noindex', 'meta_robots_follow' => $item->seo->meta_robots_follow == 1 ? 'follow' : 'nofollow');
     \View::set_global('robots', $robots);
     \View::set_global('canonical', $item->seo->canonical_links);
     \View::set_global('h1_tag', $item->seo->h1_tag);
     if ($item->seo->redirect_301) {
         \Response::redirect($item->seo->redirect_301);
     }
 }