예제 #1
0
파일: news.php 프로젝트: greor/satin-spb
 public function action_categories()
 {
     $list = array();
     $page = Page_Route::page_by_alias('news');
     if (!empty($page)) {
         $news_category = new News_Category();
         $list = $news_category->get_list($page['id']);
     }
     $this->template = View_Theme::factory('widgets/template/news/categories', array('list' => $list, 'page' => $page));
 }
예제 #2
0
파일: base.php 프로젝트: greor/satin-spb
 protected function init()
 {
     $request = $this->request->current();
     $this->config = Kohana::$config->load($this->config)->as_array();
     $this->acl_init();
     $this->site_init();
     $helper_acl = new Helper_ACL($this->acl);
     $a2_config = Kohana::$config->load('admin/a2/base')->as_array();
     $helper_acl->inject($a2_config);
     if (Route::name($request->route()) == 'modules') {
         $this->module_page_id = (int) $request->query('page');
         $this->module_config = empty($this->module_config) ? Helper_Module::code_by_controller($request->controller()) : $this->module_config;
         $_pages = $this->get_module_pages($this->module_config);
         if ($_pages->count() > 0) {
             if ($this->module_page_id == 0) {
                 $this->module_page_id = $_pages->rewind()->current()->id;
             }
             foreach ($_pages as $_item) {
                 $_link = URL::base() . Page_Route::dynamic_base_uri($_item->id);
                 $this->module_pages[$_item->id] = $_item->title . " [ {$_link} ]";
             }
         }
         $this->module_config = Helper_Module::load_config($this->module_config);
         if (!Kohana::$is_cli) {
             $config = Arr::get($this->module_config, 'a2');
             $helper_acl->inject($config);
         }
         if (!$this->acl->is_allowed($this->user, $request->controller() . '_controller', 'access')) {
             throw new HTTP_Exception_404();
         }
     }
     $injectors = array();
     foreach ($this->injectors as $_key => $_array) {
         $params = Arr::get($_array, 1);
         if (class_exists($_array[0])) {
             $object = new $_array[0]($request, $this->user, $this->acl, $params);
             $injectors[$_key] = $object;
         }
     }
     $this->injectors = $injectors;
     unset($injectors);
     $this->is_cancel = $request->post('cancel') == 'cancel';
     $this->back_url = $request->query('back_url');
     $this->post_check_empty_files();
     $this->post_check_deleted_fields();
 }
예제 #3
0
파일: base.php 프로젝트: greor/satin-spb
 protected function breadcrumbs($page_id = NULL)
 {
     $page_id = empty($page_id) ? $this->page_id : $page_id;
     $return = array();
     $url_base = URL::base();
     if (!empty($page_id)) {
         $current_page_id = $page_id;
         $stop = FALSE;
         while (!$stop) {
             $_tmp = Page_Route::page_by_id($current_page_id);
             $return[] = array('title' => $_tmp['title'], 'link' => $url_base . $_tmp['url']);
             $current_page_id = $_tmp['parent_id'];
             if ($current_page_id == 0) {
                 $stop = TRUE;
             }
         }
     }
     $return[] = array('title' => __('Home page'), 'link' => $url_base);
     return array_reverse($return);
 }
예제 #4
0
파일: route.php 프로젝트: greor/satin-spb
 public static function uri($page_id, $name, array $params = NULL, $region = TRUE)
 {
     if (empty(self::$dynamic_routes)) {
         foreach (Kohana::list_files('config' . DIRECTORY_SEPARATOR . 'routes') as $file_key => $file) {
             $_tmp = explode(DIRECTORY_SEPARATOR, $file_key);
             $config_file_name = array_pop($_tmp);
             $routes_config = Kohana::$config->load('routes/' . str_replace('.php', '', $config_file_name))->as_array();
             foreach ($routes_config as $key => $value) {
                 $route = new Route(Arr::get($value, 'uri_callback'), Arr::get($value, 'regex'));
                 $route->defaults(Arr::get($value, 'defaults'));
                 self::$dynamic_routes[$key] = $route;
             }
         }
     }
     if (isset(self::$dynamic_routes[$name])) {
         $base_uri = $page_id !== FALSE ? Page_Route::dynamic_base_uri($page_id) : '_module/' . $name;
         $route_uri = self::$dynamic_routes[$name]->uri($params, $region);
         return $base_uri . $route_uri;
     }
     return NULL;
 }
예제 #5
0
파일: detail.php 프로젝트: greor/satin-spb
<?php

defined('SYSPATH') or die('No direct script access.');
$titlebar_title = Arr::get($properties['Title'], 'value');
if (empty($titlebar_title)) {
    $titlebar_title = $CATEGORY->title;
}
if (Arr::path($properties, 'Paralax.value.Image_1920.value')) {
    echo View_Theme::factory('layout/titlebar/parallax', array('properties' => $properties, 'title' => $titlebar_title));
} else {
    echo View_Theme::factory('layout/titlebar/default', array('title' => $titlebar_title));
}
$item = end($BREADCRUMBS);
$category_uri = str_replace(URL::base() . Page_Route::uri($PAGE_ID, 'catalog'), '', Arr::get($item, 'link'));
$list_link = Page_Route::uri($PAGE_ID, 'catalog', array('category_uri' => $category_uri));
?>
	<div class="container">
		<div class="eight columns">
<?php 
echo View_Theme::factory('modules/catalog/detail/images', array('list' => $images));
// 			echo HTML::anchor($list_link, __('To the product list'), array(
// 				'class' => 'button product-list-button',
// 			));
?>
		
		</div>
		<div class="eight columns">
			<div class="product-page">
				<section class="title">
					<h1><?php 
echo HTML::chars($orm->title);
예제 #6
0
파일: page.php 프로젝트: greor/satin-spb
 public function action_page()
 {
     $link = URL::base() . Page_Route::dynamic_base_uri($this->request->page['data']);
     $this->request->current()->redirect($link);
 }
예제 #7
0
파일: list.php 프로젝트: greor/satin-spb
$page = Page_Route::page_by_alias('catalog');
if (empty($page) or empty($list)) {
    return;
}
?>
	<div class="container">
		<div class="sixteen columns">
			<h3 class="headline"><?php 
echo __('Best deals');
?>
</h3>
			<span class="line margin-bottom-0"></span>
		</div>
		<div class="sixteen columns products" style="margin-left: 0;">
<?php 
$detail_tpl = URL::base() . Page_Route::uri($page['id'], 'catalog_element', array('element_uri' => '{ELEMENT_URI}', 'element_id' => '{ELEMENT_ID}'));
$orm_helper = ORM_Helper::factory('catalog_Element');
foreach ($list as $_orm) {
    $_link = str_replace(array('{ELEMENT_URI}', '{ELEMENT_ID}'), array($_orm->uri, $_orm->id), $detail_tpl);
    $_thumb_1 = NULL;
    if (!empty($_orm->image_1)) {
        $_src = $orm_helper->file_uri('image_1', $_orm->image_1);
        $_thumb_1 = Thumb::uri('list_420x535', $_src);
        unset($_src);
    } else {
        $_thumb_1 = Thumb::uri('list_420x535_no_img', $NO_IMG);
    }
    $_thumb_2 = NULL;
    if (!empty($_orm->image_2)) {
        $_src = $orm_helper->file_uri('image_2', $_orm->image_2);
        $_thumb_2 = Thumb::uri('list_420x535', $_src);
예제 #8
0
파일: sitemap.php 프로젝트: greor/satin-spb
 private function _staff_items($page)
 {
     $return = array();
     $url_base = $this->domain . URL::base();
     $return[] = $this->_page_item($page);
     $categories_uri = array();
     $category_link_tpl = $url_base . Page_Route::uri($page['id'], 'staff', array('category_uri' => '{category_uri}'));
     $item_link_tpl = $url_base . Page_Route::uri($page['id'], 'staff', array('category_uri' => '{category_uri}', 'name' => '{name}'));
     $_code = $this->site_code == 'moscow' ? '' : $this->site_code;
     $category_link_tpl = Route::set_region($category_link_tpl, $_code);
     $item_link_tpl = Route::set_region($item_link_tpl, $_code);
     $db_categories = ORM::factory('staff_Category')->exclude_hidden_elements($this->site_id == $this->site_id_master)->find_all();
     foreach ($db_categories as $_item) {
         $categories_uri[$_item->id] = $_item->uri;
         if ($_item->page_id == $page['id'] and $_item->site_id == $page['site_id']) {
             $return[] = array('loc' => str_replace('{category_uri}', $_item->uri, $category_link_tpl), 'changefreq' => $page['sm_changefreq'], 'priority' => $page['sm_priority']);
         }
     }
     $db_staff = ORM::factory('staff')->where('site_id', '=', $this->site_id)->and_where('page_id', '=', $page['id'])->find_all();
     $stop = $db_staff->count() <= 0;
     while (!$stop) {
         $_item = $db_staff->current();
         $stop = $_item == FALSE ? TRUE : FALSE;
         if ($_item != FALSE) {
             $_category_uri = Arr::get($categories_uri, $_item->category_id);
             if ($_category_uri == NULL) {
                 $db_staff->next();
                 continue;
             }
             $_last_mod = $_item->updated == '0000-00-00 00:00:00' ? $_item->created : $_item->updated;
             $return[] = array('loc' => str_replace(array('{category_uri}', '{name}'), array($_category_uri, $_item->uri), $item_link_tpl), 'lastmod' => $_last_mod, 'changefreq' => $page['sm_changefreq'], 'priority' => $page['sm_priority']);
         }
         $db_staff->next();
     }
     return $return;
 }
예제 #9
0
파일: items.php 프로젝트: greor/satin-spb
<?php

defined('SYSPATH') or die('No direct script access.');
$list_tpl = URL::base() . Page_Route::uri($PAGE_ID, 'catalog', array('category_uri' => $CATEGORY->uri));
/*
 * FIXME $list_tpl
 */
$orm_helper = ORM_Helper::factory('catalog_Category');
foreach ($list_categories as $_orm) {
    $_link = $list_tpl . '/' . $_orm->uri;
    if (!empty($_orm->image)) {
        $_src = $orm_helper->file_uri('image', $_orm->image);
        $_thumb = Thumb::uri('list_420x420', $_src);
    } else {
        $_thumb = Thumb::uri('list_420x420_no_img', $NO_IMG);
    }
    ?>
	
		<div class="four columns">
			<a href="<?php 
    echo $_link;
    ?>
" class="img-caption" >
				<figure>
<?php 
    echo HTML::image($_thumb, array('alt' => $_orm->title));
    ?>
					
					<figcaption>
						<h3><?php 
    echo HTML::chars($_orm->title);
예제 #10
0
파일: list.php 프로젝트: greor/satin-spb
								
							</span>
						</header>
<?php 
    if (!empty($_orm->announcement)) {
        echo '<p>', $_orm->announcement, '</p>';
    }
    ?>
		
						<a href="<?php 
    echo $_link;
    ?>
" class="button color">Узнать больше</a>
					</section>
				</article>
<?php 
}
?>
		
				<div class="clearfix"></div>
<?php 
$link = URL::base() . Page_Route::uri($PAGE_ID, 'news');
echo $paginator->render($link);
?>
			</div>
		</div>
<?php 
echo View_Theme::factory('modules/news/sidebar', array('data' => Arr::path($properties, 'TextBlock.value')));
?>
	</div>
예제 #11
0
파일: form.php 프로젝트: greor/satin-spb
    if (!empty($form_orm->text) and $form_orm->text_show_top) {
        echo $form_orm->text;
    }
    ?>
				
					<section id="contact">
						<div id="result">
							<div class="success"><?php 
    echo __('Thank you for your message!');
    ?>
</div>
						</div>
						<form method="post" name="contactform" id="contactform">
							<fieldset>
<?php 
    $action = URL::base() . Page_Route::uri($PAGE_ID, 'feedback');
    $g_recaptcha = Kohana::$config->load('g-recaptcha');
    $supported_types = array('text', 'textarea');
    foreach ($form_fields as $_field) {
        if (!in_array($_field['type'], $supported_types)) {
            continue;
        }
        $_id = uniqid();
        $_name = "field_{$_field['id']}";
        echo '<div><label for="', $_id, '">', HTML::chars($_field['title']);
        $_required = 'false';
        if ($_field['required']) {
            echo '<span>*</span>';
            $_required = 'true';
        }
        echo '</label>';
예제 #12
0
        echo __('Article'), ': ', $_orm->code;
        ?>
</small>
								</section>
							</a>
						</figure>
					</div>
<?php 
    }
    ?>
	
				<div class="clearfix"></div>
<?php 
    $request = Request::current();
    $query_array = array();
    $filter_array = $request->query('filter');
    if (!empty($filter_array)) {
        $query_array['filter'] = $filter_array;
    }
    $order = $request->query('order');
    if (!empty($order)) {
        $query_array['order'] = $order;
    }
    $category_uri = Request::current()->param('category_uri');
    $link = URL::base() . Page_Route::uri($PAGE_ID, 'catalog', array('category_uri' => implode('/', array_reverse($category_uri)), 'query' => Helper_Page::make_query_string($query_array)));
    echo $paginator->render($link);
    ?>
			</div>
		</div>
<?php 
}
예제 #13
0
파일: request.php 프로젝트: greor/satin-spb
 public static function factory($uri = TRUE, HTTP_Cache $cache = NULL, $injected_routes = array())
 {
     $request = parent::factory($uri, $cache, $injected_routes);
     // for admin routes
     $exluded_routes = array('admin', 'admin_error', 'modules');
     if ($request->route() !== NULL and in_array($request->route()->route_name, $exluded_routes)) {
         return $request;
     }
     // for public routes
     $request->define_site();
     ORM_Base::$filter_mode = ORM_Base::FILTER_FRONTEND;
     ORM_Base::$site_id = $request->site_id;
     ORM_Base::$site_id_master = $request->site_id_master;
     if ($request->route() !== NULL) {
         return $request;
     }
     $request_uri = $request->uri();
     $request->page = $page = Page_Route::page($request->uri());
     if ($page !== NULL) {
         $routes = array();
         if ($page['type'] == 'module' and !Helper_Module::is_stanalone($page['data'])) {
             $routes_config = Kohana::$config->load('routes/' . $page['data'])->as_array();
             $request->set_module_routes($routes_config, $page['uri_full'], $page['id'], $cache);
         } elseif (Helper_Module::is_stanalone($page['data'])) {
             /*
              * For controllers which no need admin side (only public contoller) 
              * and have one action (by default is 'index')
              * Can have route file or default controller (controller name equal 'data' field value) 
              */
             $routes_config = Kohana::$config->load('routes/' . $page['data'])->as_array();
             if (empty($routes_config)) {
                 $name = $page['id'] . '<->standalone_page';
                 $uri_callback = $page['uri_full'];
                 $defaults = array('directory' => 'standalone', 'controller' => $page['data']);
                 $route = new Route($uri_callback);
                 $route->defaults($defaults);
                 $routes[$name] = $route;
                 Route::set($name, $uri_callback)->defaults($defaults);
                 $processed_uri = Request::process_uri($request_uri, $routes);
                 if ($processed_uri !== NULL) {
                     $request->set_dinamic_route($processed_uri, $cache);
                 }
             } else {
                 $request->set_module_routes($routes_config, $page['uri_full'], $page['id'], $cache);
             }
         } else {
             /*
              * For simple static pages
              */
             $name = $page['id'] . '<->std_page';
             $uri_callback = $page['uri_full'];
             $defaults = array('controller' => 'page', 'action' => $page['type']);
             $route = new Route($uri_callback);
             $route->defaults($defaults);
             $routes[$name] = $route;
             Route::set($name, $uri_callback)->defaults($defaults);
             $processed_uri = Request::process_uri($request_uri, $routes);
             if ($processed_uri !== NULL) {
                 $request->set_dinamic_route($processed_uri, $cache);
             }
         }
     } else {
         Kohana::$log->add(Log::ERROR, 'Page for :uri not found. [:file][:line] ', array(':file' => Debug::path(__FILE__), ':line' => __LINE__, ':uri' => $request->uri()));
         throw new HTTP_Exception_404();
     }
     return $request;
 }
예제 #14
0
파일: detail.php 프로젝트: greor/satin-spb
						<span class="month"><?php 
echo __(date('M', $public_ts));
?>
</span>
					</section>
		
					<section class="post-content">
						<header class="meta">
							<h1><?php 
echo HTML::chars($orm->title);
?>
</h1>
							<span>
								<i class="fa fa-caret-right"></i>
<?php 
echo HTML::anchor(Page_Route::uri($PAGE_ID, 'news', array('category_uri' => $orm->category->uri)), $orm->category->title);
?>
								
							</span>
						</header>
<?php 
echo $orm->text;
echo View_Theme::factory('layout/share', array('page_id' => 'news:element:' . $orm->id));
?>
						<div class="clearfix"></div>
					</section>
				</article>
			</div>
		</div>
<?php 
echo View_Theme::factory('modules/news/sidebar', array('data' => Arr::path($properties, 'TextBlock.value')));
예제 #15
0
<?php

defined('SYSPATH') or die('No direct script access.');
if (empty($list) or count($list) < 2) {
    return;
}
?>
	<div class="widget">
		<h3 class="headline"><?php 
echo __('Categories');
?>
</h3><span class="line"></span><div class="clearfix"></div>
		<nav class="categories">
			<ul>
<?php 
$link_tpl = URL::base() . Page_Route::uri($page['id'], 'news', array('category_uri' => '{uri}'));
foreach ($list as $_orm) {
    echo '<li>', HTML::anchor(str_replace('{uri}', $_orm->uri, $link_tpl), $_orm->title), '</li>';
}
echo '<li>', HTML::anchor(URL::base() . Page_Route::uri($page['id'], 'news'), __('All categories')), '</li>';
?>
			
			</ul>
		</nav>
	</div>
예제 #16
0
파일: catalog.php 프로젝트: greor/satin-spb
 private function _get_category($id)
 {
     $result = NULL;
     $catalog_category = new Catalog_Category();
     $path = $catalog_category->get_path($id);
     $list = array();
     $category_uri = URL::base() . Page_Route::uri($this->page_id, 'catalog');
     do {
         $result = current($path);
         $category_uri .= '/' . $result->uri;
         $this->breadcrumbs[] = array('title' => $result->title, 'link' => $category_uri);
     } while (next($path));
     return $result;
 }