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(); }
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); }
<?php 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>';
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); } }
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); } }
public function action_mark() { $request = $this->request->current(); $id = (int) Request::current()->param('id'); $orm = ORM::factory('form_Response', $id); if (!$orm->loaded()) { throw new HTTP_Exception_404(); } $orm_form = $orm->form; if (!$orm_form->loaded()) { throw new HTTP_Exception_404(); } if (empty($this->back_url)) { $query_array = array('owner' => $this->owner); $query_array = Paginator::query($request, $query_array); $this->back_url = Route::url('admin', array('controller' => $this->controller_name['responses'], 'action' => 'form', 'id' => $orm_form->id, 'query' => Helper_Page::make_query_string($query_array))); } try { $orm->new = 0; $orm->save(); } catch (ORM_Validation_Exception $e) { } $request->redirect($this->back_url); }
public function action_delete() { $request = $this->request->current(); $id = (int) $request->param('id'); $helper_orm = ORM_Helper::factory('form'); $orm = $helper_orm->orm(); $orm->and_where('id', '=', $id)->find(); if (!$orm->loaded() or !$this->acl->is_allowed($this->user, $orm, 'edit')) { throw new HTTP_Exception_404(); } if (in_array($orm->owner, $this->not_deleted_owner)) { throw new HTTP_Exception_404(); } if ($this->element_delete($helper_orm)) { if (empty($this->back_url)) { $query_array = array('owner' => $this->owner); $query_array = Paginator::query($request, $query_array); $this->back_url = Route::url('modules', array('controller' => $this->controller_name['structure'], 'query' => Helper_Page::make_query_string($query_array))); } $request->redirect($this->back_url); } }