public function hook_callback($content, $orm) { $request = $this->request; $back_url = $request->url(); $query_array = $request->query(); if (!empty($query_array)) { $back_url .= '?' . http_build_query($query_array); } $back_url .= '#tab-' . $this->tab_code; unset($query_array); $query_array = array('group' => $this->blog_group, 'blog' => $orm->blog_id, 'back_url' => $back_url, 'content_only' => TRUE); $query_array = Paginator::query($request, $query_array); $link = Route::url('modules', array('controller' => $this->controller_name, 'query' => Helper_Page::make_query_string($query_array))); $html_blog = Request::factory($link)->execute()->body(); $tab_nav_html = View_Admin::factory('layout/tab/nav', array('code' => $this->tab_code, 'title' => '<b>' . __('Blog') . '</b>')); $tab_pane_html = View_Admin::factory('layout/tab/pane', array('code' => $this->tab_code, 'content' => $html_blog)); return str_replace(array('<!-- #tab-nav-insert# -->', '<!-- #tab-pane-insert# -->'), array($tab_nav_html . '<!-- #tab-nav-insert# -->', $tab_pane_html . '<!-- #tab-pane-insert# -->'), $content); }
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(); }
<?php defined('SYSPATH') or die('No direct access allowed.'); echo View_Admin::factory('layout/breadcrumbs', array('breadcrumbs' => $breadcrumbs)); $query_array = array('group' => $GROUP_KEY, 'album' => $ALBUM_ID); $action = Route::url('modules', array('controller' => $CONTROLLER_NAME['multiupload'], 'action' => 'upload', 'query' => Helper_Page::make_query_string($query_array))); ?> <div class="row"> <div class="span4"> <div class="form-inline"> <label for="js-album"><?php echo __('Album'); ?> :</label> <?php echo Form::select('album_id', array('' => '') + $albums, FALSE, array('id' => 'js-album')); ?> </div> </div> <div class="span5"> <div class="form-inline pull-right" style="padding-top: 5px;"> <label for="js-to-head" class="checkbox-label"><?php echo __('Add to head'); ?> </label> <?php echo Form::checkbox('to_head', 1, FALSE, array('id' => 'js-to-head', 'style' => 'margin: -1px 0 0 5px')); ?> </div> </div>
public function action_visibility() { $request = $this->request->current(); $id = (int) $request->param('id'); $mode = $request->query('mode'); $orm = ORM::factory('news_Category')->where('page_id', '=', $this->module_page_id)->and_where('id', '=', $id)->find(); if (!$orm->loaded() or !$this->acl->is_allowed($this->user, $orm, 'hide')) { throw new HTTP_Exception_404(); } if (in_array($orm->code, $this->not_deleted_categories)) { throw new HTTP_Exception_404(); } if ($mode == 'hide') { $this->element_hide($orm->object_name(), $orm->id); } elseif ($mode == 'show') { $this->element_show($orm->object_name(), $orm->id); } if (empty($this->back_url)) { $query_array = array('page' => $this->module_page_id); $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); }
defined('SYSPATH') or die('No direct access allowed.'); echo View_Admin::factory('layout/breadcrumbs', array('breadcrumbs' => $breadcrumbs)); $orm = $helper_orm->orm(); $labels = $orm->labels(); $required = $orm->required_fields(); $query_array = array('group' => $GROUP_KEY, 'blog' => $BLOG_ID); if (!empty($BACK_URL)) { $query_array['back_url'] = $BACK_URL; } if ($orm->loaded()) { $query_array = Paginator::query(Request::current(), $query_array); $action = Route::url('modules', array('controller' => $CONTROLLER_NAME['element'], 'action' => 'edit', 'id' => $orm->id, 'query' => Helper_Page::make_query_string($query_array))); $_link = Route::url('preview', array('directory' => 'modules', 'controller' => 'blog', 'query' => Helper_Page::make_query_string(array('id' => $orm->id, 'token' => Route::get_preview_token($orm->id)))), NULL, $SITE['code']); $preview_link = HTML::anchor($_link, __('Preview link'), array('class' => 'item-preview-link', 'target' => '_blank')); } else { $action = Route::url('modules', array('controller' => $CONTROLLER_NAME['element'], 'action' => 'edit', 'query' => Helper_Page::make_query_string($query_array))); $preview_link = ''; } echo View_Admin::factory('layout/error')->bind('errors', $errors); ?> <form method="post" action="<?php echo $action; ?> " enctype="multipart/form-data" class="form-horizontal" > <div class="tabbable"> <ul class="nav nav-tabs kr-nav-tsbs"> <?php echo '<li class="active">', HTML::anchor('#tab-main', __('Main'), array('data-toggle' => 'tab')), '</li>'; echo '<li>', HTML::anchor('#tab-description', __('Description'), array('data-toggle' => 'tab')), '</li>'; if (!empty($properties)) {
protected function _get_breadcrumbs() { $query_array = array('group' => $this->group_key); return array(array('title' => __('Blogs'), 'link' => Route::url('modules', array('controller' => $this->controller_name['entity'], 'query' => Helper_Page::make_query_string($query_array))))); }
echo '<ul class="dropdown-menu">'; echo '<li>', HTML::anchor(str_replace('{id}', $_orm->id, $edit_tpl), '<i class="icon-edit"></i> ' . __('Edit'), array('title' => __('Edit'))), '</li>'; if (!in_array($_orm->code, $not_deleted_albums)) { echo '<li>', HTML::anchor(str_replace('{id}', $_orm->id, $delete_tpl), '<i class="icon-remove"></i> ' . __('Delete'), array('class' => 'delete_button', 'title' => __('Delete'))), '</li>'; } echo '</ul>'; } echo '</div>'; ?> </td> </tr> <?php } ?> </tbody> </table> <?php if (empty($BACK_URL)) { $query_array = array('group' => $GROUP_KEY); $filter_query = Request::current()->query('filter'); if (!empty($filter_query)) { $query_array['filter'] = $filter_query; } if (!empty($BACK_URL)) { $query_array['back_url'] = $BACK_URL; } $link = Route::url('modules', array('controller' => $CONTROLLER_NAME['album'], 'query' => Helper_Page::make_query_string($query_array))); } else { $link = $BACK_URL; } echo $paginator->render($link);
protected function _get_breadcrumbs() { $breadcrumbs = parent::_get_breadcrumbs(); $query_array = array('group' => $this->group_key, 'blog' => $this->blog_id); $category_orm = ORM::factory('blog')->and_where('id', '=', $this->blog_id)->find(); if ($category_orm->loaded()) { $breadcrumbs[] = array('title' => $category_orm->title, 'link' => Route::url('modules', array('controller' => $this->controller_name['element'], 'query' => Helper_Page::make_query_string($query_array)))); } $action = $this->request->current()->action(); if (in_array($action, array('edit', 'view'))) { $id = (int) $this->request->current()->param('id'); $element_orm = ORM::factory('blog_Post')->where('id', '=', $id)->find(); if ($element_orm->loaded()) { switch ($action) { case 'edit': $_str = ' [' . __('edition') . ']'; break; case 'view': $_str = ' [' . __('viewing') . ']'; break; default: $_str = ''; } $breadcrumbs[] = array('title' => $element_orm->title . $_str); } else { $breadcrumbs[] = array('title' => ' [' . __('new post') . ']'); } } return $breadcrumbs; }
echo HTML::anchor(str_replace('{id}', $_orm->id, $edit_tpl), '<i class="icon-edit"></i> ' . __('Edit'), array('class' => 'btn', 'title' => __('Edit'))); if ($ACL->is_allowed($USER, $_orm, 'edit') and !in_array($_orm->owner, $NOT_DELETED_OWNER)) { echo '<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>'; echo '<ul class="dropdown-menu">'; echo '<li>', HTML::anchor(str_replace('{id}', $_orm->id, $delete_tpl), '<i class="icon-remove"></i> ' . __('Delete'), array('class' => 'delete_button', 'title' => __('Delete'))), '</li>'; echo '</ul>'; } echo '</div>'; ?> </td> </tr> <?php } ?> </tbody> </table> <?php if (empty($BACK_URL)) { $query_array = array('owner' => $OWNER); $filter_query = Request::current()->query('filter'); if (!empty($filter_query)) { $query_array['filter'] = $filter_query; } if (!empty($BACK_URL)) { $query_array['back_url'] = $BACK_URL; } $link = Route::url('admin', array('controller' => $CONTROLLER_NAME['structure'], 'query' => Helper_Page::make_query_string($query_array))); } else { $link = $BACK_URL; } echo $paginator->render($link);
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); } }
</td> <td> <?php echo '<div class="btn-group">'; echo HTML::anchor(str_replace('{id}', $_orm->id, $view_tpl), '<i class="icon-file"></i> ' . __('View'), array('class' => 'btn', 'title' => __('View'))); if ($_orm->new) { echo '<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>'; echo '<ul class="dropdown-menu">'; echo '<li>', HTML::anchor(str_replace('{id}', $_orm->id, $mark_tpl), '<i class="icon-ok"></i> ' . __('Mark as read'), array('title' => __('Mark as read'))), '</li>'; echo '</ul>'; } echo '</div>'; ?> </td> </tr> <?php } ?> </tbody> </table> <?php $query_array = array('owner' => $OWNER); $filter_query = Request::current()->query('filter'); if (!empty($filter_query)) { $query_array['filter'] = $filter_query; } if (!empty($BACK_URL)) { $query_array['back_url'] = $BACK_URL; } $link = Route::url('admin', array('controller' => $CONTROLLER_NAME['structure'], 'action' => 'form', 'id' => $orm_form->id, 'query' => Helper_Page::make_query_string($query_array))); echo $paginator->render($link);
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 }
protected function _get_breadcrumbs() { $query_array = array('owner' => $this->owner); $breadcrumbs = array(array('title' => __('Forms (Responses)'), 'link' => Route::url('admin', array('controller' => $this->controller_name['responses'], 'query' => Helper_Page::make_query_string($query_array))))); return array_merge($breadcrumbs, $this->breadcrumbs); }
protected function _get_breadcrumbs() { $query_array = array('page' => $this->module_page_id); return array(array('title' => __('Categories'), 'link' => Route::url('modules', array('controller' => $this->controller_name['category'], 'query' => Helper_Page::make_query_string($query_array))))); }
private function _get_nomenclature($orm) { $nomenclature_element = new Nomenclature_Element(); $nom_list = $nomenclature_element->get_list($orm->id); $nom_properties = $nomenclature_element->get_properties($nom_list); $request = $this->request->current(); $query_array = array_intersect_key($request->query(), array_filter(array('no_cache' => TRUE, 'p' => FALSE))); $query_string = Helper_Page::make_query_string($query_array); $query_string = empty($query_string) ? '' : '?' . $query_string; $link_tpl = $request->url() . $query_string . '#item-'; $result = array(); foreach ($nom_list as $_orm) { $_props = Arr::get($nom_properties, $_orm->id, array()); $_size_name = Arr::path($_props, 'Size.value.Name.value'); $_duvet_cover = Arr::path($_props, 'Size.value.DuvetCover.value'); $_bedsheet = Arr::path($_props, 'Size.value.Bedsheet.value'); $_pillowslip = Arr::path($_props, 'Size.value.Pillowslip.value'); $_price = Arr::path($_props, 'Price.value'); $_discount = Arr::path($_props, 'Discount.value'); $result[] = array('id' => $_orm->id, 'name' => "{$orm->title} ({$_size_name})", 'link' => $link_tpl . $_orm->id, 'price' => $_price, 'discount' => $_discount, 'size' => array('name' => $_size_name, 'duvet_cover' => implode(', ', Arr::pluck($_duvet_cover, 'value')), 'bedsheet' => implode(', ', Arr::pluck($_bedsheet, 'value')), 'pillowslip' => implode(', ', Arr::pluck($_pillowslip, 'value')))); } usort($result, function ($elm_1, $elm_2) { if ($elm_1['price'] == $elm_2['price']) { return 0; } return $elm_1['price'] > $elm_2['price'] ? -1 : 1; }); return $result; }