/** * show map * * @param string $id * @return void * @author Andy Bennett */ public function index($id = 1) { $db = new Database(); $m = ORM::factory('imagemap', $id); if (!$m->loaded) { Kohana::show_404('Imagemap ' . $id, 'common/error_404'); return; } Assets::instance()->add_javascript('/cache/js/photonotes'); Assets::instance()->add_css('/cache/css/photonotes'); Assets::instance()->add_css('/cache/css/photonotes_client'); $pages_array = strstr(APPPATH, 'backend_') === FALSE ? array() : imagemap_helper::get_pages(); $pages = json_encode($pages_array); // Build the Image object $image = array(); $image['img'] = $m->upload->id . $m->upload->file_ext; $image['alt'] = $m->title; // Load the view as an object $view = new View('imagemap'); // Add variable data to the view $view->image = $image; $view->notes = $m->imagenotes; $view->admin = true; //APPENV == 'backend'; // Are the image maps editable? $view->id = $id; // Needed for reporting changes back to the backend via ajax $view->pages = $pages; // Send the array of pages through to the view // Render the View $view->render(TRUE); }
/** * show upload form * * @return void * @author Andy Bennett */ public static function upload_form() { Assets::instance()->add_css('/cache/css/swfupload/default'); Assets::instance()->add_javascript('/cache/js/swfupload/swfupload'); Assets::instance()->add_javascript('/cache/js/swfupload/swfupload.swfobject'); Assets::instance()->add_javascript('/cache/js/swfupload/swfupload.queue'); Assets::instance()->add_javascript('/cache/js/swfupload/fileprogress'); Assets::instance()->add_javascript('/cache/js/swfupload/handlers'); $s = URI::instance()->segment(1); Session::instance(); $gal = Input::instance()->get('gallery_id'); if (!is_numeric($gal)) { $gal = 0; } $u = isset($_GET['ajax']) ? '?ajax=true' : ''; $config = array(); $config['flash_url'] = url::site() . "cache/swf/swfupload/swfupload.swf"; $config['post_upload_url'] = url::site() . $s . "/post_upload/" . $gal . $u; $config['upload_url'] = url::site() . $s . "/process_upload" . $u; $config['session_id'] = session_id(); $config['postname'] = gallery_helper::get_upload_config()->upload_name; $config['filetypes'] = '*.' . implode(';*.', gallery_helper::get_upload_config()->extension_whitelist); $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))); }
/** * * @link http://hpneo.github.io/gmaps/examples.html */ public static function geocode(array $params = []) { Assets::instance()->add_scripts(['http://maps.google.com/maps/api/js?sensor=true', 'vendor/gmaps/gmaps.js']); $init = ['id' => 'map', 'class' => 'map', 'lat' => '-19.258078', 'lng' => '146.813046', 'zoom' => 16, 'zoomControl' => 'true', 'zoomControlOpt' => 'LEFT_CENTER', 'scrollwheel' => 'false', 'streetViewControl' => 'false', 'address' => 'Australia, Sydney']; $params = array_merge($init, $params); // Inline JS // Assets::instance()->add_inlineJS("\n\t\t\tvar " . $params['id'] . ";\n\t\t\t\$(document).ready(function(){\n\t\t\t\tmap = new GMaps({\n\t\t\t\t\tel : '#" . $params['id'] . "',\n\t\t\t\t\tlat : " . $params['lat'] . ",\n\t\t\t\t\tlng : " . $params['lng'] . ",\n\t\t\t\t\tzoom : " . $params['zoom'] . ",\n\t\t\t\t\tzoomControl : " . $params['zoomControl'] . ",\n\t\t\t\t\tzoomControlOpt :\n\t\t\t\t\t{\n\t\t\t\t\t\tposition : '" . $params['zoomControlOpt'] . "'\n\t\t\t\t\t},\n\t\t\t\t\tscrollwheel : " . $params['scrollwheel'] . ",\n\t\t\t\t\tstreetViewControl : " . $params['streetViewControl'] . "\n\t\t\t\t});\n\t\t\t\tGMaps.geocode({\n\t\t\t\t\taddress: '" . $params['address'] . "',\n\t\t\t\t\tcallback: function(results, status){\n\t\t\t\t\t\tif(status=='OK'){\n\t\t\t\t\t\t\tvar latlng = results[0].geometry.location;\n\t\t\t\t\t\t\tmap.setCenter(latlng.lat(), latlng.lng());\n\t\t\t\t\t\t\tmap.addMarker({\n\t\t\t\t\t\t\t\tlat: latlng.lat(),\n\t\t\t\t\t\t\t\tlng: latlng.lng(),\n\t\t\t\t\t\t\t\ttitle: '" . $params['address'] . "',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t"); return '<div id="' . $params['id'] . '" class="' . $params['class'] . '"></div>'; }
/** * Return view ordering tree * @return string * @throws Exception */ public function v_nestable() { Assets::instance()->add_styles(['vendor/nestable/nestable.css']); Assets::instance()->add_scripts(['vendor/nestable/nestable.js']); $url = Route::url('ajax', ['module' => $this->_module, 'controller' => Request::get('controller'), 'action' => 'order']); Assets::instance()->add_inlineJS("\n\t\t \$('#nestable')\n\t\t .nestable({\n\t\t maxDepth: {$this->_max_nested}\n\t\t })\n\t\t .change(function() {\n\t\t APP.nestableSorter('{$url}', \$('#nestable'));\n\t\t });\n\t\t"); $arr = DB::select('id', 'parent_id', $this->_display_field)->from($this->_table_name)->order_by('position')->execute()->as_array('id'); ob_start(); $this->echo_ol(Tree::flat2nested($arr)); return '<div class="dd" id="nestable">' . ob_get_clean() . '</div>'; }
/** * constructor; check acl, set display * * @author Andy Bennett */ public function __construct() { parent::__construct(); $this->setup['status_states'] = 2; if (!User::instance()->id) { url::redirect('/auth/login'); } Acl::instance()->redirect(User::instance()->get_role(), 'admin', null, '/auth/login'); $tpl = (request::is_ajax() or isset($_GET['ajax'])) ? 'template-ajax' : 'template-admin'; Display::instance()->set_template($tpl); Assets::instance()->add_css('admin'); }
/** * Before action */ public function before() { parent::before(); Assets::instance()->add_styles(['vendor/bootstrap/css/bootstrap.min.css', 'vendor/awesome/css/font-awesome.min.css', 'css/style.css'])->add_scripts(['vendor/jquery-1.11.3.min.js', 'vendor/bootstrap/js/bootstrap.min.js', 'js/app.js']); $this->cms_modules = Module::get_modules(); if (Module::is_on('cms_shop')) { $this->cart = new Cart(); $this->template->set_global('cart', $this->cart); Assets::instance()->add_styles(['vendor/bootstrap/css/bootstrap-select.min.css', 'vendor/slick/slick.css', 'vendor/slick/slick-theme.css'])->add_scripts(['vendor/jquery.maskedinput.js', 'vendor/bootstrap/js/bootstrap-select.min.js', 'vendor/slick/slick.min.js', 'js/cart.js']); } $this->template->v_footer = View::factory('frontend/v_footer'); $this->template->v_header = View::factory('frontend/v_header'); }
/** * Before action */ public function before() { parent::before(); // If not admin if (!$this->is_admin) { HTTP::redirect(Route::url('b_auth', ['action' => 'login'])); } $this->cms_modules = Module::get_modules(); $this->curr_module = $this->config_mod['cms_module']; $this->settings_mod = $this->config_mod['settings']; $this->template->bind_global('settings_mod', $this->settings_mod); Assets::instance()->add_styles(['css/style.min.css'])->add_scripts(['vendor/jquery-1.11.3.min.js', 'vendor/jquery.extends.js', 'vendor/bootstrap/js/bootstrap.min.js', 'vendor/bootstrap-notify/notify.js', 'js/app.js']); }
/** * 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)); }
public function run() { Util\Template::init(); Util\TemplateTags::init(); Util\Images::init(); Util\Shortcodes::init(); Util\BootstrapNavMenu::init(); Util\BootstrapGallery::init(); Assets::instance()->run(); Customizer::instance()->run(); AJAX::instance()->run(); PluginCompat::instance()->run(); add_action('after_setup_theme', array($this, 'after_setup_theme')); add_action('widgets_init', array($this, 'widgets_init')); }
/** * constructor; add js / css; set up listener * * @author Andy Bennett */ function __construct() { //parent::__construct(); Assets::instance()->add_css('/cache/css/forum'); Assets::instance()->add_javascript('/cache/js/forum'); Event::add('forum.render', array('steamforum_listeners', 'render')); $this->argv = Router::$arguments; $this->current_page = "forum"; // Remove the first argument which is always the name of the current page if (is_array($this->argv)) { $this->current_page = array_shift($this->argv); } else { $this->argv = array(); } // Work out the base url for links - TODO: This needs to be generalised as its currently itim specific $this->base_url = sitemap_helper::get_base() . "/" . $this->current_page; }
/** * Loads URI, and Input into this controller. * * @return void */ public function __construct() { $session = Session::instance(); $site_config = yaml::parse($_SESSION['site_name'], 'site_config'); foreach ($site_config as $key => $value) { $this->{$key} = $value; } // --- Setup our required library instances --- // -------------------------------------------- # Auth Instance for editing site capability $this->client = new Auth($this->claimed); # Account Instance for user account tool. $this->account_user = new Account(); # assets instance to fetch datapath urls. $this->assets = Assets::instance($this->site_name, $this->theme); # URI should always be available $this->uri = URI::instance(); # Input should always be available $this->input = Input::instance(); if (Kohana::$instance == NULL) { # Set the instance to the first controller loaded Kohana::$instance = $this; } }
/** * Anchors of actions in list table * * @param string $name route name * @param array $params route url params * @param string $title title for display * * @return string */ public static function act($name, array $params, $title = '') { if (Arr::get($params, 'action') == 'add') { return HTML::anchor(Route::url($name, $params), '<i class="fa fa-plus fa-lg fa-fw"></i>', ['data-toggle' => 'tooltip', 'title' => $title ? $title : __('settings.act_add')]); } elseif (Arr::get($params, 'action') == 'edit') { return HTML::anchor(Route::url($name, $params), $title ? $title : '<i class="fa fa-pencil fa-lg fa-fw"></i>', ['data-toggle' => 'tooltip', 'title' => __('settings.act_edit')]); } elseif (Arr::get($params, 'action') == 'filter') { return HTML::anchor(Route::url($name, $params), $title, ['data-toggle' => 'tooltip', 'title' => __('settings.act_filter')]); } elseif (Arr::get($params, 'action') == 'delete') { $title = $title ? $title : __('settings.act_delete'); if (self::$is_running_delete === false) { Assets::instance()->add_inlineJS("\n\t\t\t\t\t\$('.delete').click(function(e){\n\t\t\t\t\t\tif ( ! confirm('{$title}')) { return false; }\n\t\t\t\t\t});\n\t\t\t\t"); self::$is_running_delete = true; } return HTML::anchor(Route::url($name, $params), '<i class="fa fa-trash-o fa-lg fa-fw text-danger"></i>', ['class' => 'delete', 'data-toggle' => 'tooltip', 'title' => __('settings.act_delete')]); } elseif (Arr::get($params, 'action') == 'undelete') { $title = $title ? $title : __('settings.act_delete'); if (self::$is_running_delete === false) { Assets::instance()->add_inlineJS("\n\t\t\t\t\t\$('.delete').click(function(e){\n\t\t\t\t\t\tif ( ! confirm('{$title}')) { return false; }\n\t\t\t\t\t});\n\t\t\t\t"); self::$is_running_delete = true; } return HTML::anchor(Route::url($name, $params), '<i class="fa fa-arrow-up fa-lg fa-fw text-success"></i>', ['class' => 'delete', 'data-toggle' => 'tooltip', 'title' => __('settings.act_undelete')]); } elseif (Arr::get($params, 'slug')) { return HTML::anchor(Route::url($name, $params), $title ? $title : '<i class="fa fa-eye fa-fw"></i>', ['target' => '_blank', 'data-toggle' => 'tooltip', 'title' => __('settings.act_view_link')]); } return ''; }
</div> <div class="form-group" id="city_link"> <label class="col-sm-2 control-label"></label> <div class="col-sm-10"> <p class="form-control-static"> <?php echo HTML::anchor('', '', ['id' => 'a_city', 'target' => '_blank']); ?> </p> </div> </div> <?php Assets::instance()->add_inlineJS(' $(function () { $("#np_city_ref").selectpicker({ size: 5 }); function showLinkToCity() { var cityRef = $("#np_city_ref").val(); if (cityRef) { $("#div_address").show(); $("#a_city").attr("href", "http://novaposhta.ua/office/list?city=" + $("#np_city_ref option:selected").text()); $("#a_city").empty().append(\'Смотреть отделения на сайте Новой Почты <i class="fa fa-external-link"></i>\'); $.post("/ajax/cart/warehouses", { city_ref : cityRef
<?php Assets::instance()->add_javascript('/cache/jeremycal/prototype-date-extensions'); Assets::instance()->add_javascript('/cache/jeremycal/datepicker'); Assets::instance()->add_css('/cache/jeremycal/datepicker'); ?> <p> <?php echo form::input($o->form_name . '_datetime' . $o->group_id, date("Y-m-d H:i", strtotime($o->cval))); ?> <script type="text/javascript"> //<![CDATA[ new Control.DatePicker('<?php echo $o->form_name . '_datetime' . $o->group_id; ?> ', {icon: '/cache/jeremycal/calendar.png', timePicker: true, timePickerAdjacent: true, locale: 'en_iso8601'}); //]]> </script> </p> <?php echo $o->get_error($o->name);
echo Form::open(null, ['class' => 'form-signin']); ?> <?php echo Message::get(false); ?> <?php echo $content; ?> <i class="fa fa-home fa-fw"></i> <?php echo HTML::anchor(Route::url('f_home'), __('settings.go_to_home_page')); ?> <?php echo Form::close(); ?> </div> <?php Assets::instance()->render(Assets::SCRIPTS); ?> <?php echo $v_profiler; ?> </body> </html>
/** * constructor; add css / js * * @author Andy Bennett */ function __construct() { parent::__construct(); Assets::instance()->add_css('/cache/blog/css/blog'); Assets::instance()->add_javascript('/cache/blog/js/blog'); }
/** * Before action (required) */ public function before() { parent::before(); $this->panel_name = ''; Assets::instance()->add_styles(['vendor/bootstrap/css/bootstrap.min.css', 'vendor/awesome/css/font-awesome.min.css', 'css/auth.css'])->add_scripts(['vendor/jquery-1.11.2.min.js', 'vendor/bootstrap/js/bootstrap.min.js']); }
/** * 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); }
/** * 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)); }
echo Breadcrumb::run($breadcrumbs); ?> <?php echo Message::get(false); ?> <?php echo $content; ?> </div> </div> </div> </div> <?php echo $v_footer; ?> <?php Assets::instance()->render(Assets::SCRIPTS); Assets::instance()->render(Assets::INLINEJS); ?> <?php echo $v_profiler; ?> </body> </html>
<?php defined('SYSPATH') or die('No direct script access.'); ?> <?php if ($is_js) { ?> <?php Assets::instance()->add_inlineJS("APP.alert('{$text}', '{$type}');"); } else { ?> <div class="alert alert-<?php echo $type; ?> alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> <?php echo $text; ?> </div> <?php }
public function setup() { Assets::instance()->add_javascript('/cache/global/ckeditor/ckeditor'); Assets::instance()->add_javascript('/cache/template_editor/js/template_editor'); Assets::instance()->add_css('/cache/template_editor/css/template_editor'); }
/** * handle <head> template tag * @param $node * @return mixed */ public static function renderBodyTag(array $node) { // static build is enough to insert a marker $that = \Assets::instance(); return $that->_body($node); }
<?php /** * Default Page Template */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php echo Assets::instance()->render(); ?> <title>Default Theme - <?php echo $title; ?> </title> </head> <body> <div class="container_16" id="main_frame"> <!-- BEGIN SECTION --> <div class="grid_16 section header"> <?php echo html::image('yurikocms/themes/default/media/images/yuriko_logo.png', array('alt' => 'YurikoCMS')); ?> </div> <!-- END SECTION --> <div class="grid_16"> <?php echo isset($content) ? $content : NULL; ?>
/** * 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); }
/** * returns the form html * * @return string * @author Andy Bennett */ public function render($form_name = 'form') { Assets::instance()->add_css('/cache/xform/css/xform'); Assets::instance()->add_javascript('/xform-' . XformJS::instance()->get_id()); $form_data = array(); // include the pagination css / js if there is more than one page set if ($this->is_paginated()) { Assets::instance()->add_css('global/fabtabulous'); Assets::instance()->add_javascript('global/fabtabulous'); if ($form_name == 'form') { $form_name = 'paginated_form'; } } // set defaults $form_data['rownum'] = 0; $form_data['pagenum'] = 1; // set the form, action tags $form_data['tag'] = $this->is_file_uploads() ? 'open_multipart' : 'open'; $form_data['action'] = (string) $this->form['action']; // set the form class $form_data['form_class'] = isset($this->form->action['type']) ? (string) $this->form->action['type'] : ''; // set some default hidden items $form_data['hidden'] = array('nohistory' => 1, 'form_action' => $this->name); if ($this->data->update !== false) { $form_data['hidden']['form_id'] = $this->data->update; } $u = isset($_GET['ajax']) ? '?ajax=true' : ''; if (isset($_POST['current'])) { $form_data['hidden']['current'] = $_POST['current'] . $u; } $form_data['form'] = $this; $form_data['rows'] = $this->rows; return View::factory('xform/' . $form_name, $form_data)->render(); }
/** * Images */ public function action_order() { Assets::instance()->add_styles(['vendor/jquery-ui-1.10.3.custom.css'])->add_scripts(['vendor/jquery-ui.js']); $this->title = __('Images'); $o_product = ORM::factory('Shop_Product', $this->request->param('id')); $o_images = ORM::factory('Shop_Products_Images')->where('product_id', '=', $this->request->param('id'))->order_by('order_id')->find_all(); $this->content = View::factory('backend/v_images_order', array('o_product' => $o_product, 'o_images' => $o_images, 'url_images' => 'shop/products/images/')); }