function __construct()
 {
     parent::__construct();
     parent::init();
     acl_helper::acl_redirect(steamauth_helper::get_role(), 'admin');
     Display::instance()->set_template('template-admin');
 }
 /**
  * listener for error 404s
  *
  * @return void
  * @author Andy Bennett
  */
 function error_404_listener()
 {
     header('HTTP/1.1 404 File Not Found');
     Display::instance()->set_template('template-error');
     Display::instance()->add_data('page_id', 'page-not-found');
     View::factory('common/error_404')->render(true);
     die;
 }
 /**
  * render
  *
  * @return void
  * @author Andy Bennett
  */
 public static function render()
 {
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = '';
     $content['content']->copy = Event::$data;
     $container = Container::instance(1)->render($content, null);
     Display::instance()->display($container);
 }
 /**
  * render list of plugins
  *
  * @param string $copy 
  * @return void
  * @author Andy Bennett
  */
 function render($copy)
 {
     $admin_container = Kohana::config('containers.admin_container');
     $content = new stdClass();
     $content->header = 'Containers Admin';
     $content->sub_header = '';
     $content->copy = $copy;
     $page_content = Container::instance()->init($admin_container)->render($content);
     Display::instance()->display($page_content);
 }
 function __construct()
 {
     if (!User::instance()->id) {
         url::redirect('/auth/login');
     }
     Acl::instance()->redirect(User::instance()->get_role(), 'admin', null, '/auth/login');
     parent::__construct();
     $type = '-' . Input::instance()->get('type', '');
     Display::instance()->set_template($type == '-' ? 'template' : 'template' . $type);
 }
 public static function item_html_listener()
 {
     $pid = Event::$data['data']['row']->pid;
     $cid = Event::$data['data']['row']->container;
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = Event::$data['data']['row']->title;
     $content['content']->copy = View::factory('pages/' . Event::$data['view'], Event::$data['data'])->render();
     $container = Container::instance($cid)->render($content, false, $pid);
     Display::instance()->display($container);
 }
Exemplo n.º 7
0
 public static function add_map($data = array(), $args = null)
 {
     self::append_js();
     $map = new View('gmap');
     $map->set('result', $data);
     if (is_object($args)) {
         foreach ($args as $a => $v) {
             $map->{$a} = $v;
         }
     }
     $extraHeadContent = $map->render();
     Display::instance()->append_data('extraHeadContent', $extraHeadContent);
 }
 public static function item_html_listener()
 {
     $pid = Event::$data['data']['row']->pid;
     $cid = Event::$data['data']['row']->container;
     $content_template = Event::$data['data']['row']->content_template;
     $content_template = $content_template == '' ? 'template-0' : $content_template;
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = Event::$data['data']['row']->title;
     $content['content']->copy = View::factory('/containers/content_templates/' . $content_template, Event::$data['data'])->render();
     Display::instance()->add_data('page_version', Event::$data['data']['row']->version);
     $container = Container::instance($cid)->render($content, false, $pid);
     Display::instance()->display($container);
 }
Exemplo n.º 9
0
 /**
  * Get plugins and show
  *
  * @return void
  * @author Dan Chadwick
  */
 public function index()
 {
     Event::add('steamcore.aclcheck', array('acl_listeners', 'redirect'));
     $data = array('action' => 'admin', 'name' => null, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     Assets::instance()->add_css('admin');
     $view = View::factory('plugins_list');
     $view->plugins = PluginManager::instance()->getPluginObjects();
     $content = array('content' => new stdClass());
     $content['content']->title = 'Plugins Admin';
     $content['content']->copy = $view->render();
     Assets::instance()->add_css('/cache/css/display');
     Assets::instance()->add_javascript('/cache/js/display');
     Display::instance()->display(Container::instance('display')->render($content));
 }
Exemplo n.º 10
0
 /**
  * listing
  *
  * @return void
  * @author Andy Bennett
  */
 public function admin()
 {
     $data = array('action' => 'edit', 'name' => $this->name, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $blog = URI::instance()->segment(3, 1);
     $nodes = ORM::factory('blogpost')->where(array('lvl' => 1, 'blog_id' => $blog))->orderby(array('date_added' => 'DESC'))->find_all();
     $lvl = ORM::factory('blogpost')->level_column;
     $data = array('nodes' => $nodes, 'level_column' => $lvl, 'controller' => 'blogposts');
     $copy = View::factory('blog/postslist_admin', $data)->render();
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = 'Blog Posts';
     $content['content']->copy = $copy;
     $container = Container::instance(3)->render($content);
     Display::instance()->display($container);
 }
 /**
  * get content body
  *
  * @return void
  * @author Andy Bennett
  */
 function getContentBody()
 {
     $blog = Blog::factory();
     // var_dump($blog);exit;
     $data = array();
     if (count(Router::$arguments) > 1) {
         Display::instance()->add_data('pageclass', 'blog-subpage');
         $plugdata = array('content' => $blog->view(), 'comment' => $blog->comment(), 'p' => $this);
         $data['content'] = View::factory('blog/plugin-post', $plugdata)->render();
     } else {
         $plugdata = array('content' => $blog->blog(1), 'p' => $this);
         $data['content'] = View::factory('blog/plugin-posts', $plugdata)->render();
     }
     $data['comments'] = $blog->latest_comments(1, 5);
     $data['p'] = $this;
     return View::factory('blog/plugin-wrapper', $data)->render();
 }
Exemplo n.º 12
0
 public function admin()
 {
     $data = array('action' => 'edit', 'name' => $this->name, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $root = ORM::factory('pages_position')->where('lft', 0)->find();
     $xml = $root->render_descendants('pages', false)->render();
     $l = xsl::translate_string($xml, 'pages_admin', array(), array('pages_helper::check_acl'));
     $pages = pages_helper::get_pages($root = true);
     $move = View::factory('pageadmin/movepage', array('pagelist' => $pages))->render();
     $c = View::factory('pages/pages', array('list' => $l, 'controller' => 'pages', 'move' => $move))->render();
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = 'Pages';
     $content['content']->copy = $c;
     $container = Container::instance(3)->render($content);
     Display::instance()->display($container);
 }
Exemplo n.º 13
0
 /**
  * initialise the container
  *
  * @param string $container_id 
  * @param boolean $use_defaults 
  * @return void
  * @author Andy Bennett
  */
 function init($container_id, $use_defaults = true)
 {
     $this->container_id = $container_id;
     $details = $this->model->get_container($this->container_id);
     if (!is_object($details)) {
         throw new Kohana_User_Exception("Containers Error", "Container id " . $container_id . " cannot be found");
     }
     $this->title = $details->title;
     $this->template = $details->template;
     if ($use_defaults) {
         $this->add_block('left_column', array('column' => 'left-col'));
         $this->add_block('mid_column', array('column' => 'middle-col'));
         $this->add_block('right_column', array('column' => 'right-col'));
         $this->add_block('section_nav', array('column' => 'nav'));
     }
     Display::instance()->set_container(true);
     return $this;
 }
Exemplo n.º 14
0
 /**
  * display the tree
  *
  * @return void
  * @author Andy Bennett
  */
 public function index()
 {
     Display::instance()->add_css('app/admin');
     Display::instance()->add_css('app/apage');
     // $filepath = Kohana::find_file( 'xml', 'sitemap', true, 'xml');
     // $xml = simplexml_load_file( $filepath );
     $xml = Sitemap::instance()->get_sitemap();
     Display::instance()->add_css('/cache/css/tree');
     Display::instance()->add_javascript('global/core/effects');
     Display::instance()->add_javascript('global/core/dragdrop');
     Display::instance()->add_javascript('/cache/js/Tree');
     $js = new View('tree_js', array('struct' => tree_helper::create_struct($xml)), FALSE);
     Display::instance()->append_data('extraHeadContent', $js);
     $content = new stdClass();
     Display::instance()->add_data('header', 'Pages Admin');
     Display::instance()->add_data('sub_header', '');
     $tb = new View('tree_body');
     $content = $tb;
     Display::instance()->add_data('content', $content);
     Display::instance()->display();
 }
 /**
  * get list of comments
  *
  * @param string $post_id 
  * @return void
  * @author Andy Bennett
  */
 public function comments_list($post_id)
 {
     try {
         $node = ORM::factory('blogpost', $post_id);
         if ($node->has_children()) {
             $data = array();
             $data['post_title'] = $node->title;
             $data['nodes'] = $node->descendants()->find_all();
             $data['controller'] = 'blog_comments';
             $copy = View::factory('blog/post_comments_admin', $data)->render();
             $content = array();
             $content['content'] = new stdClass();
             $content['content']->title = 'Blog Post Comments';
             $content['content']->copy = $copy;
             $container = Container::instance(3)->render($content);
             Display::instance()->display($container);
         }
     } catch (Exception $e) {
         var_dump($e->getMessage());
         Kohana::log('debug', $e->getMessage());
     }
 }
Exemplo n.º 16
0
 /**
  * list the containers
  *
  * @return void
  * @author Andy Bennett
  */
 private function listing()
 {
     $containers = ORM::factory('container')->find_all();
     $content = array('content' => new stdClass());
     $content['content']->title = 'Containers Admin';
     $content['content']->copy = View::factory('containers_list', array('containers' => $containers))->render();
     Assets::instance()->add_css('/cache/css/display');
     Assets::instance()->add_javascript('/cache/js/display');
     Display::instance()->display(Container::instance('display')->render($content));
 }
Exemplo n.º 17
0
    ?>
		
			</div>
		</div>
	<?php 
}
?>

	<div id="middle-cols" class="column span-<?php 
echo $mid - 2;
?>
 prepend-1 append-1 surround">
		<div id="middle-cols-container">
			<div id="middle-cols-header" class="surround">
				<?php 
if (!Display::instance()->get_data('show_maincontent')) {
    ?>
					<h3 id="sub-header" class="sub-header">
						<?php 
    echo $content->title;
    ?>
					</h3>
			
					<div id="main-content">
						<div id="small">
							<?php 
    echo $content->copy;
    ?>
						</div>
					</div>
				<?php 
Exemplo n.º 18
0
 public function find()
 {
     Gmaps::add_map();
     $copy = View::factory('postcode_finder')->render();
     Display::instance()->display($copy);
 }
 /**
  * listener for showing item view
  *
  * @return void
  * @author Andy Bennett
  */
 public static function event_item_view()
 {
     Display::instance()->display(View::factory('pages/' . Event::$data['view'], Event::$data['data']));
 }
Exemplo n.º 20
0
 /**
  * undocumented function
  *
  * @param string $page_req 
  * @return void
  * @author Andy Bennett
  */
 public function video($page_req = false)
 {
     $data = array();
     $model = ORM::factory($this->setup['model'], $page_req);
     if (!$model->loaded) {
         Kohana::show_404($page_req, 'common/error_404');
     }
     $path = DATAPATH . 'uploads/';
     $file = $model->upload->file_name;
     if (!file_exists($path . $file)) {
         Kohana::show_404($file, 'common/error_404');
     }
     if ($model->status == 0 and !User::instance()->is_admin()) {
         throw new Kohana_403_Exception($file, 'common/error_403');
     }
     if (!copy($path . $file, DOCROOT . 'cache/' . $file)) {
         Kohana::show_404($file, 'common/error_404');
     }
     $data['id'] = $page_req;
     $data['path'] = url::base() . 'cache/';
     $data['name'] = $file;
     $data['dimensions'] = array('height' => $model->upload->image_height, 'width' => $model->upload->image_width);
     $data['picture'] = url::base() . 'gallery/crop/' . $model->upload->image_width . '/' . $model->upload->image_height . '/' . $model->upload->id . '.jpg';
     Assets::instance()->add_css('/cache/css/ffmpeg');
     $c = View::factory('videoplayer', $data)->render();
     Display::instance()->display($c);
 }
Exemplo n.º 21
0
 /**
  * returns the form html
  *
  * @return string
  * @author Andy Bennett
  */
 function render($form_name = 'form')
 {
     // include the pagination css / js if there is more than one page set
     if ($this->is_paginated()) {
         Display::instance()->append_data('cssfiles', 'global/fabtabulous');
         Display::instance()->append_data('jsfiles', 'global/fabtabulous');
     }
     $this->form_data['fc'] = $this;
     // set defaults
     $this->form_data['rownum'] = 0;
     $this->form_data['pagenum'] = 1;
     // set the form, action tags
     $this->form_data['tag'] = $this->is_file_uploads() ? 'open_multipart' : 'open';
     $this->form_data['action'] = (string) $this->form->action;
     // set the form class
     $this->form_data['form_class'] = isset($this->form->action['type']) ? (string) $this->form->action['type'] : '';
     // set some default hidden items
     $this->form_data['hidden'] = array('nohistory' => 1, 'form_action' => $this->setup->form_name);
     $u = isset($_GET['ajax']) ? '?ajax=true' : '';
     if (isset($_POST['current'])) {
         $this->form_data['hidden']['current'] = $_POST['current'] . $u;
     }
     $data = $this->form_data;
     $data['form'] = $this;
     $data['rows'] = $this->rows;
     return View::factory('parts/' . $form_name, $data)->render();
 }
 /**
  * event listener; show upload form
  *
  * @return void
  * @author Andy Bennett
  */
 public function show_upload_form()
 {
     Display::instance()->append_data('cssfiles', '/cache/css/swfupload/default');
     Display::instance()->append_data('jsfiles', '/cache/js/swfupload/swfupload');
     Display::instance()->append_data('jsfiles', '/cache/js/swfupload/swfupload.queue');
     Display::instance()->append_data('jsfiles', '/cache/js/swfupload/fileprogress');
     Display::instance()->append_data('jsfiles', '/cache/js/swfupload/handlers');
     $s = Kohana::instance()->uri->segment(1);
     Session::instance();
     $gal = Kohana::instance()->input->get('gallery_id');
     if (!is_numeric($gal)) {
         $gal = 0;
     }
     $u = isset($_GET['ajax']) ? '?ajax=true' : '';
     $config = array();
     $config['flash_url'] = "/cache/swf/swfupload/swfupload_f9.swf";
     $config['post_upload_url'] = "/" . $s . "/post_upload/" . $gal . $u;
     $config['upload_url'] = "/" . $s . "/process_upload" . $u;
     $config['session_id'] = session_id();
     $config['cat_id'] = $gal;
     Display::instance()->add_head_content(View::factory('upload_head_js', $config)->render());
     Display::instance()->display(View::factory('pages/' . $s . '_upload', array('gal' => $gal)));
 }
 public static function edit_complete_listener()
 {
     if (isset($_POST['current'])) {
         Session::instance()->set_flash('user_message', 'Item edited successfully');
         url::redirect($_POST['current']);
     } else {
         Display::instance()->display(View::factory('pages/block', array('block' => 'Item successfully edited')));
     }
 }
<?php

Display::instance()->add_javascript('/cache/js/inline_editor');
Display::instance()->add_javascript('global/tiny_mce/tiny_mce');
Display::instance()->add_css('/cache/css/inline_editor');
Display::instance()->append_data('extraHeadContent', '
	<script type="text/javascript" charset="utf-8">
		function init_inline()
		{
			loadInlineEditor("editable-content", "editablecontent");
			$$(".form form").each(
				function( f )
				{
					f.onsubmit = function()
					{
						if(!inlineEdit.saveToForm("' . $o->rp('name') . '")) {
							return false;
						}
					}
				}
			);
		}
		
		Event.observe(window, "load", init_inline, false);
	</script>');
?>

<div id='editable-content'><?php 
echo $o->rp('cval');
?>
</div>
Exemplo n.º 25
0
 /**
  * add display events
  *
  * @return void
  * @author Andy Bennett
  */
 private function form_appends()
 {
     if (isset($this->form->append_data)) {
         foreach ($this->form->append_data as $n) {
             foreach ($n as $k => $v) {
                 Display::instance()->append_data($k, $v);
             }
         }
     }
 }
Exemplo n.º 26
0
 /**
  * list the containers
  *
  * @return void
  * @author Andy Bennett
  */
 private function listing()
 {
     $data = array('action' => 'edit', 'name' => null, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $root = ORM::factory('pages_position')->where('lft', 0)->find();
     $xml = $root->render_descendants('pages', false)->render();
     $l = xsl::translate_string($xml, 'page_plugins_list', array(), array(''));
     $c = View::factory('pages/page_plugins_list', array('list' => $l, 'controller' => 'page_plugins'))->render();
     preg_match_all('/{pid=([0-9]+)}/', $c, $matches);
     $count = count($matches[0]);
     for ($i = 0; $i < $count; $i++) {
         $c = str_replace($matches[0][$i], plugins::page_plugins_admin($matches[1][$i]), $c);
     }
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = 'Page Plugins';
     $content['content']->copy = $c;
     Assets::instance()->add_css('/cache/css/display');
     Assets::instance()->add_javascript('/cache/js/display');
     $container = Container::instance('display')->render($content);
     Display::instance()->display($container);
 }
Exemplo n.º 27
0
 /**
  * show a list of the galleries
  *
  * @return void
  * @author Andy Bennett
  */
 function show_gallery_list()
 {
     $data = Event::$data;
     Display::instance()->display(View::factory('pages/' . $data['view'], $data));
 }
 public static function render($content, $container_id = false, $dir = "containers/", $additional = array())
 {
     $container_id = $container_id ? $container_id : self::get_container();
     $kohana = Kohana::instance();
     $c = new Container($container_id);
     $view = new View($dir . $c->get_template());
     $view->header = $content->header;
     $view->sub_header = $content->sub_header;
     $view->main_content = $content->copy;
     $view->section_nav = current(self::return_column($c, array('column' => 'nav')));
     $view->left_column = self::return_column($c, array('column' => 'left-col'));
     $view->mid_column = self::return_column($c, array('column' => 'middle-col'));
     $view->right_column = self::return_column($c, array('column' => 'right-col'));
     if (is_array($additional)) {
         foreach ($additional as $a => $v) {
             $view->{$a} = $v;
         }
     }
     Display::instance()->display($view);
 }