예제 #1
0
파일: catalog.php 프로젝트: greor/satin-spb
 public function action_related()
 {
     $request = $this->request->current();
     $limit = $request->query('limit');
     if (empty($limit)) {
         $limit = $this->default_limit;
     }
     $exclude = $request->query('exclude');
     $category = (int) $request->query('category');
     $orm_helper = ORM_Helper::factory('catalog_Element');
     $helper_property = $orm_helper->property_helper();
     $orm = $orm_helper->orm();
     if (!empty($exclude)) {
         $orm->where('id', 'NOT IN', $exclude);
     }
     if (!empty($category)) {
         $orm->where('category_id', '=', $category);
     }
     $db_list = $orm->order_by(DB::expr('RAND()'))->limit($limit)->find_all();
     $keys = $db_list->as_array(NULL, 'id');
     $list = $db_list->as_array();
     $catalog_category = new Catalog_Category();
     $list_categories = $catalog_category->get_list();
     $this->template = View_Theme::factory('widgets/template/catalog/related', array('list' => $list, 'list_categories' => $list_categories));
 }
예제 #2
0
 public function __construct($config, $owner, $owner_id = NULL)
 {
     $this->load_config($config);
     $this->_owner = $owner;
     $this->_owner_id = $owner_id;
     $this->_types = Kohana::$config->load($this->_types);
     $this->_orm_helper = ORM_Helper::factory(self::ORM_NAME);
 }
예제 #3
0
파일: element.php 프로젝트: greor/satin-spb
 public function get_properties(array $list)
 {
     $result = array();
     $helper_orm = ORM_Helper::factory('Nomenclature');
     foreach ($list as $_orm) {
         $helper_orm->orm($_orm);
         $result[$_orm->id] = $helper_orm->property_list();
     }
     return $result;
 }
예제 #4
0
파일: front.php 프로젝트: greor/satin-spb
 protected function menu_parse_item($pages, $url)
 {
     $return = parent::menu_parse_item($pages, $url);
     $prop_name = Kohana::$config->load('_megamenu.page_property');
     $helper_property = ORM_Helper::factory('page')->property_helper();
     $sub = $helper_property->search(array($prop_name => 'true'), TRUE);
     $megamenu_pages = ORM::factory('page')->where('id', 'IN', $sub)->find_all()->as_array(NULL, 'id');
     $this->menu_megamenu($return, $megamenu_pages);
     return $return;
 }
예제 #5
0
파일: page.php 프로젝트: greor/kohana-cms
 public function action_static()
 {
     $orm_helper = ORM_Helper::factory('page');
     $orm_helper->orm()->where('id', '=', $this->page_id)->find();
     $orm = $orm_helper->orm();
     if (!$orm->loaded()) {
         throw new HTTP_Exception_404();
     }
     if ($orm->site_id != SITE_ID) {
         $this->canonical_url_main_site();
     }
     $properties = $orm_helper->property_list();
     $this->template->set_filename('page')->set('orm', $orm)->set('properties', $properties);
     $this->title = $orm->title;
 }
예제 #6
0
파일: news.php 프로젝트: greor/satin-spb
 public function action_detail()
 {
     $element_id = $this->request->param('element_id');
     $element_uri = $this->request->param('element_uri');
     $orm = ORM::factory('news')->where('id', '=', $element_id)->where('uri', '=', $element_uri)->find();
     if (!$orm->loaded()) {
         throw new HTTP_Exception_404();
     }
     $orm_helper = ORM_Helper::factory('news');
     $orm_helper->orm($orm);
     $properties = $orm_helper->property_list();
     $titlebar_title = Arr::path($properties, 'Title.value');
     if (empty($titlebar_title)) {
         $titlebar_title = $orm->title;
     }
     $this->template->set_filename('modules/news/detail')->set('orm', $orm)->set('properties', $properties)->set('titlebar_title', $titlebar_title);
 }
예제 #7
0
파일: support.php 프로젝트: greor/satin-spb
 public function delete($real_delete, array $where = NULL, $cascade_delete = TRUE, $is_slave_delete = FALSE)
 {
     $orm = $this->_orm;
     $helper_propery = $this->property_helper();
     $properties = $helper_propery->get_list();
     if (!empty($properties)) {
         $user_id = 0;
         if (array_key_exists('deleter_id', $orm->table_columns())) {
             $user_id = $orm->deleter_id;
         }
         $helper_propery->set_owner_id($orm->id);
         $helper_propery->set_user_id($user_id);
         foreach ($properties as $_name => $_v) {
             $helper_propery->remove($_name);
         }
         $this->property_cache_clear();
     }
     return parent::delete($real_delete, $where, $cascade_delete, $is_slave_delete);
 }
예제 #8
0
 private function _group_operation_move($operation, array $items, Model_Photo_Album $album_orm)
 {
     $directions = array('up' => ORM_Position::MOVE_PREV, 'down' => ORM_Position::MOVE_NEXT, 'first' => ORM_Position::MOVE_FIRST, 'last' => ORM_Position::MOVE_LAST);
     if (!isset($directions[$operation])) {
         throw new HTTP_Exception_404();
     }
     $direction = $directions[$operation];
     if ($operation === 'first' or $operation === 'down') {
         $items = array_reverse($items);
     }
     $orm_helper = ORM_Helper::factory('photo');
     foreach ($items as $_id) {
         $_orm = ORM::factory('photo')->where('owner', '=', $album_orm->object_name())->and_where('owner_id', '=', $album_orm->id)->and_where('id', '=', $_id)->find();
         if (!$_orm->loaded()) {
             continue;
         }
         $orm_helper->orm($_orm);
         $orm_helper->position_move('position', $direction);
     }
 }
예제 #9
0
 public function action_index()
 {
     $orm = ORM::factory('feedback')->where('page_id', '=', $this->page_id)->find();
     if (!$orm->loaded()) {
         throw new HTTP_Exception_404();
     }
     $orm_helper = ORM_Helper::factory('feedback');
     $orm_helper->orm($orm);
     $feedback_properties = $orm_helper->property_list();
     $form_orm = $orm->form;
     if ($form_orm->loaded()) {
         $helper_form = new Helper_Form();
         $form_fields = $helper_form->get_fields($form_orm);
         $this->template->set('form_fields', $form_fields);
     }
     $orm_helper = ORM_Helper::factory('page', $this->page_id);
     $properties = $orm_helper->property_list();
     $titlebar_title = Arr::path($properties, 'Title.value');
     if (empty($titlebar_title)) {
         $titlebar_title = __('Contacts');
     }
     $this->template->set_filename('modules/feedback/form')->set('orm', $orm)->set('feedback_properties', $feedback_properties)->set('form_orm', $form_orm)->set('properties', $properties)->set('titlebar_title', $titlebar_title);
 }
예제 #10
0
파일: list.php 프로젝트: greor/kohana-video
echo __('Title');
?>
</th>
				<th><?php 
echo __('Image');
?>
</th>
				<th><?php 
echo __('Actions');
?>
</th>
			</tr>
		</thead>
		<tbody>
<?php 
$orm_helper = ORM_Helper::factory('video');
foreach ($list as $_orm) {
    ?>
			<tr class="<?php 
    echo view_list_row_class($_orm, $hided_list);
    ?>
">
				<td><?php 
    echo $_orm->id;
    ?>
</td>
				<td>
<?php 
    if ((bool) $_orm->active) {
        echo '<i class="icon-eye-open"></i>&nbsp;';
    } else {
예제 #11
0
파일: pages.php 프로젝트: greor/satin-spb
 public function action_position()
 {
     $request = $this->request->current();
     $id = (int) $request->param('id');
     $mode = $request->query('mode');
     $errors = array();
     try {
         if ($mode !== 'fix') {
             $helper_orm = ORM_Helper::factory('page', $id);
             $orm = $helper_orm->orm();
             if (!$orm->loaded() or !$this->acl->is_allowed($this->user, $orm, 'edit')) {
                 throw new HTTP_Exception_404();
             }
             switch ($mode) {
                 case 'up':
                     $helper_orm->position_move('position', ORM_Position::MOVE_PREV);
                     break;
                 case 'down':
                     $helper_orm->position_move('position', ORM_Position::MOVE_NEXT);
                     break;
             }
         } else {
             $helper_orm = ORM_Helper::factory('page');
             $orm = $helper_orm->orm();
             if ($this->acl->is_allowed($this->user, $orm, 'fix_all')) {
                 $helper_orm->position_fix('position', ORM_Helper::POSITION_ALL);
             } elseif ($this->acl->is_allowed($this->user, $orm, 'fix_master')) {
                 $helper_orm->position_fix('position', ORM_Helper::POSITION_MASTER);
             } elseif ($this->acl->is_allowed($this->user, $orm, 'fix_slave')) {
                 $helper_orm->position_fix('position', ORM_Helper::POSITION_SLAVE);
             }
         }
         Helper_Page::clear_cache();
     } catch (ORM_Validation_Exception $e) {
         $errors = $e->errors(TRUE);
         $this->template->set_filename('layout/error')->set('errors', $errors)->set('title', __('Error'));
     }
     if (empty($errors)) {
         if (empty($this->back_url)) {
             $this->back_url = Route::url('admin', array('controller' => 'pages'));
         }
         $request->redirect($this->back_url);
     }
 }
예제 #12
0
 private function save_file($file_path, ORM $album_orm, $to_head)
 {
     $orm_helper = ORM_Helper::factory('photo');
     try {
         $orm_helper->save(array('owner' => $album_orm->object_name(), 'owner_id' => $album_orm->id, 'title' => Arr::path($_FILES, 'file.name', ''), 'image' => $file_path, 'active' => 1, 'creator_id' => $this->user->id));
         if ($to_head) {
             $config = Arr::get($orm_helper->position_fields(), 'position');
             $position = Session::instance()->get('multiupload_position', $config['step']);
             $orm_helper->position_set('position', $position);
             Session::instance()->set('multiupload_position', $position + $config['step']);
         }
     } catch (ORM_Validation_Exception $e) {
         return implode('. ', $e->errors(''));
     } catch (Exception $e) {
         Kohana::$log->add(Log::ERROR, 'Multiupload error. Exception occurred: :exception', array(':exception' => $e->getMessage()));
         return 'Save error';
     }
     return TRUE;
 }
예제 #13
0
파일: price.php 프로젝트: greor/satin-spb
<?php

defined('SYSPATH') or die('No direct script access.');
$thumb = NULL;
if (!empty($orm->image_1)) {
    $src = ORM_Helper::factory('catalog_Element')->file_uri('image_1', $orm->image_1);
    $thumb = Thumb::uri('list_80x80', $src);
    unset($src);
}
if (empty($thumb) and !empty($orm->image_2)) {
    $src = ORM_Helper::factory('catalog_Element')->file_uri('image_2', $orm->image_2);
    $thumb = Thumb::uri('list_80x80', $src);
    unset($src);
}
if (empty($thumb)) {
    $thumb = Thumb::uri('list_80x80_no_img', $NO_IMG);
}
$nom_item = reset($nomenclature);
$currency = 'руб.';
?>
	<section class="relative">
<?php 
echo HTML::anchor('#size-select', __('Choose size'), array('class' => 'button dark popup-with-size-select'));
?>
	
		<span class="product-price js-render-field">
<?php 
if (!empty($nom_item['price'])) {
    echo HTML::chars($nom_item['price'] . ' ' . $currency);
}
?>
예제 #14
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);
예제 #15
0
파일: list.php 프로젝트: greor/kohana-promo
echo __('Title');
?>
</th>
				<th><?php 
echo __('Image');
?>
</th>
				<th><?php 
echo __('Actions');
?>
</th>
			</tr>
		</thead>
		<tbody>
<?php 
$orm_helper = ORM_Helper::factory('promo');
foreach ($list as $_orm) {
    ?>
			<tr class="<?php 
    echo view_list_row_class($_orm, $hided_list);
    ?>
">
				<td><?php 
    echo $_orm->id;
    ?>
</td>
				<td>
<?php 
    if ((bool) $_orm->active) {
        echo '<i class="icon-eye-open"></i>&nbsp;';
    } else {
예제 #16
0
<?php

defined('SYSPATH') or die('No direct script access.');
?>

	<div class="mega">
		<div class="mega-container">
<?php 
$orm_helper = ORM_Helper::factory('megamenu_Column');
foreach ($megamenu as $_column) {
    switch ($_column['type']) {
        case 'text':
            $li_class = 'one-column';
            if ($_column['mobile_visibility'] == 'hide') {
                $li_class .= ' hidden-on-mobile';
            }
            if (empty($_column['link'])) {
                $_title = HTML::chars($_column['title']);
            } else {
                $_title = HTML::anchor($_column['link'], $_column['title']);
            }
            $_body = '
						<ul>
							<li><span class="mega-headline">' . $_title . '</span></li>
							<li class="hidden-on-mobile">' . $_column['text'] . '</li>
						</ul>
					';
            break;
        case 'list':
            $li_class = 'one-column';
            if ($_column['mobile_visibility'] == 'hide') {
예제 #17
0
파일: base.php 프로젝트: greor/satin-spb
 protected function site_properties($site_id)
 {
     return ORM_Helper::factory('site', $site_id)->property_list();
 }
예제 #18
0
파일: catalog.php 프로젝트: greor/satin-spb
 private function load_nomenclature(array $data, $product_id)
 {
     $result = NULL;
     $orm_helper = ORM_Helper::factory('nomenclature');
     $orm_helper->orm()->where('product_id', '=', $product_id)->where('code', '=', $data['code'])->find();
     $values = array('product_id' => $product_id, 'code' => $data['code'], 'title' => $data['title'], 'active' => '1', 'properties' => array('Size.Name' => $data['size.name'], 'Size.DuvetCover' => $this->make_size_value($data['size.duvet'], 'duvet_cover'), 'Size.Bedsheet' => $this->make_size_value($data['size.sheet'], 'bedsheet'), 'Size.Pillowslip' => $this->make_size_value($data['size.pillow'], 'pillowslip'), 'Price' => $data['price'], 'Provider.ProductName' => $data['external.product'], 'Provider.Article' => $data['external.article']));
     $log_action = '';
     if ($orm_helper->orm()->loaded()) {
         $values['updated'] = date('Y-m-d H:i:s');
         $values['updater_id'] = $this->config['user_id'];
         $log_action = 'обновлена';
     } else {
         $values['creator_id'] = $this->config['user_id'];
         $log_action = 'добавлена';
     }
     try {
         $orm_helper->save($values);
         $result = $orm_helper->orm();
         $this->log[] = date('Y-m-d H:i:s') . " номенлатура {$data['code']} " . $log_action;
     } catch (ORM_Validation_Exception $e) {
         $this->errors = TRUE;
         $errors = $this->errors_extract($e);
         foreach ($errors as $_f => $_m) {
             $this->log[] = date('Y-m-d H:i:s') . " <span class=\"err\">[error]</span> для номенлатуры {$data['code']}: " . $_m;
         }
     }
     return $result;
 }
예제 #19
0
<?php 
echo View_Theme::factory('layout/header/top');
// 				echo View_Theme::factory('layout/header/social');
?>
		
			</div>
		</div>
		<div class="clearfix"></div>

		<div class="container">
			<div class="tex columns logo-holder">
				<div id="logo">
					<h1>
<?php 
if (!empty($SITE['logo'])) {
    $orm_helper = ORM_Helper::factory('site');
    $logo_src = $orm_helper->file_uri('logo', $SITE['logo']);
    unset($orm_helper);
} else {
    $logo_src = $NULL_IMG;
}
echo HTML::anchor(URL::base(), HTML::image($logo_src, array('alt' => $SITE['name'])));
?>
					
					</h1>
				</div>
			</div>
			<div class="six columns">
<?php 
echo View_Theme::factory('layout/user/header');
?>
예제 #20
0
파일: helper.php 프로젝트: greor/satin-spb
 /**
  * Restore safe deleted records with file fields processing
  *
  * @param   array    $where Array of "WHERE" conditions
  * @param   boolean  $cascade_restore Execute cascade restore
  * @param   boolean  $is_slave_restore Execute restore of slave record
  * @return  void
  */
 public function restore(array $where = NULL, $cascade_restore = TRUE, $is_slave_restore = FALSE)
 {
     $model = $this->_orm;
     $table = $model->table_name();
     $primary_key = $model->primary_key();
     $deleted_field = $this->deleted_field();
     if (empty($deleted_field)) {
         throw new Kohana_Exception('Cannot restore :model model because it is not suport this action.', array(':model' => $model->object_name()));
     }
     if (empty($where) and !$model->loaded()) {
         throw new Kohana_Exception('Cannot restore :model model because it is not loaded.', array(':model' => $model->object_name()));
     }
     if (empty($where)) {
         // Restore current record only
         $where = array(array($primary_key, '=', $model->pk()));
     }
     // Safe restore
     if ($is_slave_restore) {
         $del_value = DB::expr("IF(`{$deleted_field}`>1, `{$deleted_field}`-2, `{$deleted_field}`)");
     } else {
         $del_value = DB::expr("IF(MOD(`{$deleted_field}`,2)>0, `{$deleted_field}`-1, `{$deleted_field}`)");
     }
     $builder = DB::update($table)->value($deleted_field, $del_value);
     foreach ($where as $condition) {
         $builder->where($condition[0], $condition[1], $condition[2]);
     }
     $builder->execute($this->_db);
     // Process file fields
     if (count($this->_file_fields)) {
         // Get all affected files
         $selected_fields = array_keys($this->_file_fields);
         $selected_fields[] = $primary_key;
         // Process only "active" records
         $builder = DB::select_array($selected_fields)->from($table)->where($deleted_field, '=', 0);
         foreach ($where as $condition) {
             $builder->where($condition[0], $condition[1], $condition[2]);
         }
         $builder;
         $rows = $builder->execute($this->_db)->as_array();
         foreach ($rows as $row) {
             $update = array();
             foreach ($this->_file_fields as $field => $field_config) {
                 $value = $row[$field];
                 if (empty($value)) {
                     continue;
                 }
                 $file_path = $this->file_path($field, $value);
                 if (!is_file($file_path)) {
                     // File not exists
                     Kohana::$log->add(Log::ERROR, 'File :file in the :field field of :model model with primary key :pk not exists', array(':file' => Debug::path($file_path), ':field' => $field, ':model' => $model->object_name(), ':pk' => $row[$primary_key]));
                     continue;
                 }
                 // Process file
                 switch ($field_config['on_delete']) {
                     case ORM_File::ON_DELETE_RENAME:
                         try {
                             $del_prefix = $field_config['deleted_prefix'];
                             $base_name = basename($value);
                             if (!empty($del_prefix) and strpos($base_name, $del_prefix) === 0) {
                                 $del_prefix_length = strlen($del_prefix) + 14;
                                 // strlen(uniqid().'_') === 14
                                 // Remove prefix
                                 $new_base_name = substr($base_name, $del_prefix_length);
                                 $new_path = dirname($file_path) . DIRECTORY_SEPARATOR . $new_base_name;
                                 rename($file_path, $new_path);
                                 $new_value = dirname($value) . DIRECTORY_SEPARATOR . $new_base_name;
                                 $update[$field] = ltrim(str_replace('\\', '/', $new_value), '/');
                             }
                         } catch (Exception $e) {
                             Kohana::$log->add(Log::ERROR, 'File :file in the :field field of :model model with primary key :pk cannot be renamed', array(':file' => Debug::path($file_path), ':field' => $field, ':model' => $model->object_name(), ':pk' => $row[$primary_key]));
                         }
                         break;
                 }
             }
             if (count($update)) {
                 // Save restored file names in the database
                 DB::update($table)->set($update)->where($primary_key, '=', $row[$primary_key])->execute();
             }
         }
     }
     // end process files
     if ($cascade_restore and !empty($this->_on_delete_cascade)) {
         $builder = DB::select($primary_key)->from($table);
         foreach ($where as $condition) {
             $builder->where($condition[0], $condition[1], $condition[2]);
         }
         $affected_ids = $builder->execute($this->_db)->as_array(NULL, $primary_key);
         if (!empty($affected_ids)) {
             $has_many = $model->has_many();
             $belongs_to = $model->belongs_to();
             $has_one = $model->has_one();
             // Execute cascade restore
             foreach ($this->_on_delete_cascade as $foreign_key => $column) {
                 $related_model_name = $column;
                 if (is_int($foreign_key)) {
                     $foreign_key = $model->object_name() . '_id';
                 }
                 if (isset($has_many[$column])) {
                     $related_model_name = $has_many[$column]['model'];
                     if (isset($has_many[$column]['through'])) {
                         // Dont process many to many
                         continue;
                     } else {
                         $related_model = ORM::factory($has_many[$column]['model']);
                         $orm_helper_class = 'ORM_Helper_' . ucfirst($related_model->object_name());
                         if (class_exists($orm_helper_class)) {
                             // Use wrapper for cascade processing
                             ORM_Helper::factory($related_model)->restore(array(array($has_many[$column]['foreign_key'], 'IN', $affected_ids)), TRUE);
                         }
                     }
                 } else {
                     if (isset($has_one[$column])) {
                         $related_model = ORM::factory($has_one[$column]['model']);
                         $orm_helper_class = 'ORM_Helper_' . ucfirst($related_model->object_name());
                         if (class_exists($orm_helper_class)) {
                             $has_one_ids = DB::select($has_one[$column]['foreign_key'])->from($table)->where($primary_key, 'IN', $affected_ids)->execute()->as_array(NULL, $has_one[$column]['foreign_key']);
                             // Use wrapper for cascade processing
                             ORM_Helper::factory($related_model)->restore(array(array($related_model->primary_key(), 'IN', $has_one_ids)), TRUE);
                         }
                     }
                 }
             }
         }
     }
     $this->_orm->reload();
 }
예제 #21
0
파일: list.php 프로젝트: greor/kohana-photo
echo __('Title');
?>
</th>
				<th><?php 
echo __('Image');
?>
</th>
				<th><?php 
echo __('Actions');
?>
</th>
			</tr>
		</thead>
		<tbody>
<?php 
$orm_helper = ORM_Helper::factory('photo');
foreach ($list as $_orm) {
    ?>
			<tr>
<?php 
    if ($acl_album_can_edit and $is_initial_request) {
        echo View_Admin::factory('modules/photo/element/group/checkbox', array('id' => $_orm->id));
    }
    ?>
	
				<td><?php 
    echo $_orm->id;
    ?>
</td>
				<td>
<?php 
예제 #22
0
파일: list.php 프로젝트: greor/satin-spb
<?php

defined('SYSPATH') or die('No direct script access.');
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));
}
$category_tpl = URL::base() . Page_Route::uri($PAGE_ID, 'news', array('category_uri' => '{uri}'));
$detail_tpl = URL::base() . Page_Route::uri($PAGE_ID, 'news', array('category_uri' => '{category_uri}', 'element_uri' => '{uri}', 'element_id' => '{id}'));
?>
	<div class="container">
		<div class="twelve columns">
			<div class="extra-padding">
<?php 
$orm_helper = ORM_Helper::factory('news');
foreach ($list as $_orm) {
    $cat_orm = Arr::get($categories, $_orm->category_id);
    if (empty($cat_orm)) {
        continue;
    }
    $_public_ts = strtotime($_orm->public_date);
    $_link = str_replace(array('{category_uri}', '{uri}', '{id}'), array($cat_orm->uri, $_orm->uri, $_orm->id), $detail_tpl);
    ?>
		
				<article class="post">
<?php 
    if (!empty($_orm->image)) {
        $_src = $orm_helper->file_uri('image', $_orm->image);
        $_thumb = Thumb::uri('news_860', $_src);
        ?>
예제 #23
0
파일: list.php 프로젝트: greor/satin-spb
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);
        unset($_src);
예제 #24
0
 public function action_delete()
 {
     $blog_orm = ORM::factory('blog')->where('group', '=', $this->group_key)->and_where('id', '=', $this->blog_id)->find();
     if (!$blog_orm->loaded()) {
         throw new HTTP_Exception_404();
     }
     $request = $this->request->current();
     $id = (int) $request->param('id');
     $helper_orm = ORM_Helper::factory('blog_Post');
     $orm = $helper_orm->orm();
     $orm->where('blog_id', '=', $this->blog_id)->and_where('id', '=', $id)->find();
     if (!$orm->loaded() or !$this->acl->is_allowed($this->user, $orm, 'edit')) {
         throw new HTTP_Exception_404();
     }
     if ($this->element_delete($helper_orm)) {
         if (empty($this->back_url)) {
             $query_array = array('group' => $this->group_key, 'blog' => $this->blog_id);
             $query_array = Paginator::query($request, $query_array);
             $this->back_url = Route::url('modules', array('controller' => $this->controller_name['element'], 'query' => Helper_Page::make_query_string($query_array)));
         }
         $request->redirect($this->back_url);
     }
 }
예제 #25
0
 public function __construct($model, $id = NULL)
 {
     parent::__construct($model, $id);
     $this->_file_fields['image']['allowed_src_dirs'][] = DOCROOT . 'upload' . DIRECTORY_SEPARATOR . 'multiupload';
 }
예제 #26
0
 public function action_position()
 {
     $album_orm = ORM::factory('photo_Album')->where('group', '=', $this->group_key)->and_where('id', '=', $this->album_id)->find();
     if (!$album_orm->loaded()) {
         throw new HTTP_Exception_404();
     }
     $request = $this->request->current();
     $id = (int) $request->param('id');
     $mode = $request->query('mode');
     $errors = array();
     $helper_orm = ORM_Helper::factory('photo');
     try {
         $this->element_position($helper_orm, $id, $mode);
     } catch (ORM_Validation_Exception $e) {
         $errors = $this->errors_extract($e);
     }
     if (empty($errors)) {
         if (empty($this->back_url)) {
             $query_array = array('group' => $this->group_key, 'album' => $this->album_id);
             if ($mode != 'fix') {
                 $query_array = Paginator::query($request, $query_array);
             }
             $this->back_url = Route::url('modules', array('controller' => $this->controller_name['element'], 'query' => Helper_Page::make_query_string($query_array)));
         }
         $request->redirect($this->back_url);
     }
 }
예제 #27
0
 public function action_position()
 {
     $request = $this->request->current();
     $id = (int) $request->param('id');
     $mode = $request->query('mode');
     $errors = array();
     $helper_orm = ORM_Helper::factory('news_Category');
     try {
         $this->element_position($helper_orm, $id, $mode);
     } catch (ORM_Validation_Exception $e) {
         $errors = $this->errors_extract($e);
     }
     if (empty($errors)) {
         if (empty($this->back_url)) {
             $query_array = array('page' => $this->module_page_id);
             if ($mode != 'fix') {
                 $query_array = Paginator::query($request, $query_array);
             }
             $this->back_url = Route::url('modules', array('controller' => $this->controller_name['category'], 'query' => Helper_Page::make_query_string($query_array)));
         }
         $request->redirect($this->back_url);
     }
 }
예제 #28
0
파일: sites.php 프로젝트: greor/satin-spb
 public function action_delete()
 {
     $request = $this->request->current();
     $id = (int) $request->param('id');
     $helper_orm = ORM_Helper::factory('site', $id);
     $orm = $helper_orm->orm();
     if (!$orm->loaded() or !$this->acl->is_allowed($this->user, $orm, 'edit')) {
         throw new HTTP_Exception_404();
     }
     if ($this->element_delete($helper_orm)) {
         if (empty($this->back_url)) {
             $query_array = Paginator::query($request);
             $this->back_url = Route::url('admin', array('controller' => 'sites', 'query' => Helper_Page::make_query_string($query_array)));
         }
         $request->redirect($this->back_url);
     }
 }
예제 #29
0
 public function action_view()
 {
     $request = $this->request->current();
     $id = (int) $request->param('id');
     $helper_orm = ORM_Helper::factory('video');
     $orm = $helper_orm->orm();
     $orm->where('id', '=', $id)->find();
     if (!$orm->loaded()) {
         throw new HTTP_Exception_404();
     }
     if (empty($this->back_url)) {
         $query_array = Paginator::query($request);
         $this->back_url = Route::url('modules', array('controller' => $this->controller_name['element'], 'query' => Helper_Page::make_query_string($query_array)));
     }
     $this->template->set_filename('modules/video/element/view')->set('helper_orm', $helper_orm);
     $this->title = __('Viewing');
     $this->left_menu_element_add();
 }
예제 #30
0
파일: list.php 프로젝트: greor/kohana-photo
echo __('Image');
?>
</th>
				<th><?php 
echo __('Date');
?>
</th>
				<th><?php 
echo __('Actions');
?>
</th>
			</tr>
		</thead>
		<tbody>
<?php 
$orm_helper = ORM_Helper::factory('photo_Album');
foreach ($list as $_orm) {
    ?>
			<tr class="<?php 
    echo view_list_row_class($_orm, $hided_list);
    ?>
">
				<td><?php 
    echo $_orm->id;
    ?>
</td>
				<td>
<?php 
    switch ($_orm->status) {
        case '2':
            echo '<i class="icon-eye-open"></i>&nbsp;';