public function _loadAssets() { if (!self::$css_loaded) { $type = strtolower($this->type); /** @var $header RokCommon_IHeader */ $header = $this->container->getService('header'); $header->addStyle(RokCommon_Composite::get($this->assets_content . '.' . $type . '.css')->getUrl($type . '.css')); self::$css_loaded = true; } }
/** * Called to render headers that should be included only once per Layout type used */ public function renderLayoutHeaders() { if (!self::$instanceHeadersRendered) { $root_assets = RokCommon_Composite::get($this->basePackage . '.assets.js'); RokCommon_Header::addScript($root_assets->getUrl('moofx.js')); $instance = array(); $instance[] = "window.addEvent('domready', function(){"; $instance[] = "\t\tRokSprocket.instances.sliders = new RokSprocket.Sliders();"; $instance[] = "});"; RokCommon_Header::addInlineScript(implode("\n", $instance) . "\n"); self::$instanceHeadersRendered = true; } }
/** * @param RokSprocket_ItemCollection $items * @param RokCommon_Registry $parameters */ public function initialize(RokSprocket_ItemCollection $items, RokCommon_Registry $parameters) { $this->setItems($items); $this->setParameters($parameters); $this->layoutPackage = sprintf('roksprocket_layout_%s', $this->name); // setup the theme packages and content and info $this->theme = $this->parameters->get($this->name . '_themes', 'default'); $this->themePackage = sprintf('%s_%s', $this->layoutPackage, $this->theme); $paths = $this->container[sprintf('roksprocket.layouts.%s.paths', $this->name)]; foreach ($paths as $order => $path) { RokCommon_Composite::addPackagePath($this->layoutPackage, $path, $order); RokCommon_Composite::addPackagePath($this->themePackage, $path . '/themes/' . $this->theme, $order); } $this->theme_context = RokCommon_Composite::get($this->themePackage); $this->cleanItemParams(); }
/** * Get the full list of jobs * <code> * { * 'orberby': 'xxxx-x-x-x-x-x-x' * } * </code> * @param $params * @return RokCommon_Ajax_Result */ public function get($params) { $result = new RokCommon_Ajax_Result(); try { $q = Doctrine_Query::create()->select('j.*')->from('RokGallery_Model_Job j')->orderBy('j.created_at DESC'); $jobs = $q->execute(array(), Doctrine_Core::HYDRATE_RECORD); $outjobs = array(); foreach ($jobs as $job) { unset($job->properties); unset($job->sm); $outjobs[] = $job->toJsonableArray(); } $html = RokCommon_Composite::get('com_rokgallery.jobs')->load('default.php', array('jobs' => $jobs)); $result->setPayload(array('jobs' => $outjobs, 'html' => $html)); } catch (Exception $e) { throw $e; } return $result; }
/** * Get the basic file info and supporting slices/tags * $params object should be a json like * <code> * { * } * </code> * * @param $params * @return RokCommon_Ajax_Result */ public function get($params) { $result = new RokCommon_Ajax_Result(); try { $q = Doctrine_Query::create()->select('j.*')->from('RokGallery_Model_Gallery j')->orderBy('j.name DESC'); /** @var Doctrine_Collection $galleries */ $galleries = $q->execute(array(), Doctrine_Core::HYDRATE_RECORD); $outgalleries = array(); foreach ($galleries as $gallery) { /** @var RokGallery_Model_Gallery $gallery */ $outgalleries[] = $gallery->toJsonableArray(); } $html = RokCommon_Composite::get('com_rokgallery.galleries')->load('default.php', array('galleries' => $galleries)); $result->setPayload(array('galleries' => $outgalleries, 'html' => $html, 'delete_slices' => RokGallery_Config::getOption(RokGallery_Config::OPTION_GALLERY_REMOVE_SLICES, 0))); } catch (Exception $e) { throw $e; } return $result; }
/** * @return RokCommon_XMLElement * @throws RokCommon_Config_Exception */ public function getXml() { $context = RokCommon_Composite::get(self::CONTEXT_PREFIX . $this->identifier); if ($context) { if ($this->searchMode == self::SEARCH_MODE_BASEDIRS) { $ret = $context->getAll($this->filename); } elseif ($this->searchMode == self::SEARCH_MODE_CHILDIRS) { $ret = $context->getAllSubFiles($this->filename); } else { throw new RokCommon_Config_Exception(rc__('Unknown mode of %s on config', $this->searchMode)); } ksort($ret, SORT_NUMERIC); foreach ($ret as $priority => $files) { foreach ($files as $file) { $file_xml = RokCommon_Utils_XMLHelper::getXML($file, true); RokCommon_Options::mergeNodes($this->xml, $file_xml); } } } return $this->xml; }
/** * Get the basic gallery info and supporting slices/tags * $params object should be a json like * <code> * { * 'id': 1 * } * </code> * * @param $params * @return RokCommon_Ajax_Result */ public function get($params) { $result = new RokCommon_Ajax_Result(); try { $gallery = RokGallery_Model_GalleryTable::getSingle($params->id); foreach ($gallery->Slices as &$slice) { $slice->populateFilterInfo(); $slice->manipulations = RokGallery_Manipulation_Helper::prepSerializedForJson($slice->manipulations); $slice->clearRelated('File'); $slice->Tags; $slice->FileTags; } $sortable_slices = $gallery->Slices->getData(); usort($sortable_slices, array('RokGalleryAdminAjaxModelGallery', 'slice_ordering_sort')); $html = RokCommon_Composite::get('com_rokgallery.galleryorder')->load('default.php', array('slices' => $sortable_slices)); $result->setPayload(array('gallery' => $gallery->toJsonableArray(), 'html' => $html)); } catch (Exception $e) { throw $e; } return $result; }
/** * Method to get the field options for the list of installed editors. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { $container = RokCommon_Service::getContainer(); $fieldname = $this->element['name']; $configkey = (string) $this->element['configkey']; $options = array(); $params = $container[$configkey]; $params = get_object_vars($params); ksort($params); foreach ($params as $id => $info) { if (!in_array($id, self::$loaded_icons)) { $layout_composite_path = 'roksprocket_layout_' . $id; $priority = 0; foreach ($info->paths as $path) { RokCommon_Composite::addPackagePath($layout_composite_path, $path, $priority); $priority++; } $iconurl = RokCommon_Composite::get($layout_composite_path)->getUrl($info->icon); if (empty($iconurl)) { $iconurl = "components/com_roksprocket/assets/images/default_layout_icon.png"; } $css = sprintf('#module-form i.layout.%s {background-image: url(%s);background-position: 0 0;}', $id, $iconurl); RokCommon_Header::addInlineStyle($css); self::$loaded_icons[] = $id; } if ($this->value == $id) { $selected = ' selected="selected"'; } else { $selected = ""; } $tmp = JHtml::_('select.option', $id, $info->displayname); // Set some option attributes. $tmp->attr = array('class' => $id, 'rel' => $fieldname . '_' . $id); $tmp->icon = $fieldname . ' ' . $id; $options[] = $tmp; } reset($options); return $options; }
public function renderGlobalHeaders() { if (!self::$globalHeadersRendered) { RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('mootools-mobile.js')); RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('rokmediaqueries.js')); RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('roksprocket.js')); $app = JFactory::getApplication(); $menus = $app->getMenu('site'); $active = $menus->getActive(); if ($active === null) { $active = $menus->getDefault(); } $ns = array(); $ns[] = "if (typeof RokSprocket == 'undefined') RokSprocket = {};"; $ns[] = "Object.merge(RokSprocket, {"; $ns[] = "\tSiteURL: '" . str_replace('&', '&', JRoute::_(JURI::root(true), true)) . "',"; $ns[] = "\tCurrentURL: '" . str_replace('&', '&', JRoute::_(JURI::current(true), true)) . "',"; $ns[] = "\tAjaxURL: '" . str_replace('&', '&', JRoute::_(JURI::root(true) . '/index.php?option=com_roksprocket&task=ajax&format=raw&ItemId=' . $active->id)) . "'"; $ns[] = "});"; RokCommon_Header::addInlineScript(implode("\n", $ns) . "\n"); self::$globalHeadersRendered = true; } }
<?php /** * @version $Id: default.php 39617 2011-07-06 23:37:00Z btowles $ * @author RocketTheme http://www.rockettheme.com * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ defined('_JEXEC') or die('Restricted access'); echo RokCommon_Composite::get($passed_params->layout_context)->load('default.php', array('passed_params' => $passed_params));
<?php /** * @version $Id$ * @author RocketTheme http://www.rockettheme.com * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ if (RokCommon_Browser::getShortName() == 'ie7') { RokCommon_Header::addStyle(RokCommon_Composite::get($that->context)->getUrl('rokgallery-ie7.css')); } RokCommon_Header::addScript(RokCommon_Composite::get($that->context)->getUrl('loves' . RokGallery_Helper::getJSVersion() . '.js'));
/** * @param null $ajax_path */ public function renderGlobalHeaders($ajax_path = null) { if (!self::$globalHeadersRendered) { if (defined('_JEXEC')) { JHtml::_('behavior.framework'); } RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('mootools-mobile.js')); RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('rokmediaqueries.js')); RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('roksprocket.js')); /** @var $platforminfo RokCommon_IPlatformInfo */ $platforminfo = $this->container->getService('platforminfo'); $ns = array(); $ns[] = "if (typeof RokSprocket == 'undefined') RokSprocket = {};"; $ns[] = "Object.merge(RokSprocket, {"; $ns[] = "\tSiteURL: '" . str_replace('&', '&', $platforminfo->getSEOUrl($platforminfo->getRootUrl(), true)) . "',"; $ns[] = "\tCurrentURL: '" . str_replace('&', '&', $platforminfo->getSEOUrl($platforminfo->getRootUrl(), true)) . "',"; $ns[] = "\tAjaxURL: '" . str_replace('&', '&', $platforminfo->getSEOUrl($platforminfo->getRootUrl() . $ajax_path)) . "'"; $ns[] = "});"; RokCommon_Header::addInlineScript(implode("\n", $ns) . "\n"); self::$globalHeadersRendered = true; } }
/** * Returns the preview of an article * $params object should be a json like * <code> * { * "id":"joomla-71" * } * </code> * * @param $params * * @throws Exception * @return \RokCommon_Ajax_Result */ public function getPreview($params) { $result = new RokCommon_Ajax_Result(); try { $html = ''; list($provider_type, $id) = explode('-', $params->id); $container = RokCommon_Service::getContainer(); //$provider_type = $params->provider; /** @var $provider RokSprocket_IProvider */ $provider_service = $container['roksprocket.providers.registered.' . $provider_type . '.service']; $provider = $container->{$provider_service}; if (isset($params->extras)) { $extras = new RokCommon_Registry($params->extras); $provider->setParams($extras); } $article = $provider->getArticlePreview($id); ob_start(); echo RokCommon_Composite::get('roksprocket.module.edit')->load('edit_article_preview.php', array('article' => $article)); $html .= ob_get_clean(); $result->setPayload(array('html' => $html)); } catch (Exception $e) { throw $e; } return $result; }
<?php if ($that->show_page_heading) { ?> <h1><?php echo $that->page_heading; ?> </h1> <?php } ?> <div class="rg-grid-view-container<?php echo $that->pageclass_sfx; ?> "> <?php echo RokCommon_Composite::get($that->context)->load('header.php', array('that' => $that)); ?> <div class="rg-grid-view rg-col3"> <?php foreach ($that->images as $that->image) { $that->slice = $that->slices[$that->image->id]; echo RokCommon_Composite::get($that->context)->load('default_row.php', array('that' => $that)); $that->item_number++; } ?> </div> </div> <?php echo RokCommon_Composite::get($that->context)->load('pagination.php', array('that' => $that));
if (!$that->gallery_id) { foreach ($that->galleries as $that->gallery) { echo RokCommon_Composite::get('com_rokgallery.gallerypicker')->load('default_gallery.php', array('that' => $that)); } } else { foreach ($that->galleries->Slices as $that->slice) { echo RokCommon_Composite::get('com_rokgallery.gallerypicker')->load('default_slices_view.php', array('that' => $that)); } } ?> </ul> <div class="clr"></div> </div> <?php if ($that->show_menuitems) { ?> <div class="panel menuitems"> <?php echo RokCommon_Composite::get('com_rokgallery.gallerypicker')->load('default_menuitems.php', array('that' => $that)); ?> <div class="clr"></div> </div> <?php } ?> </div> </div> <div class="clr"></div>
/** * @param RokCommon_Service_Container $container */ protected function loadLayouts(RokCommon_Service_Container &$container) { /** @var $platforminfo RokCommon_PlatformInfo */ $platforminfo = $container->platforminfo; RokCommon_Composite::addPackagePath('roksprocket_layouts', JPATH_SITE . '/components/com_roksprocket/layouts', 10); RokCommon_Composite::addPackagePath('roksprocket_layouts', $container['roksprocket.template.override.path'] . '/layouts', 20); JForm::addFieldPath($container['template.path'] . '/admin/forms/fields'); $context = RokCommon_Composite::get('roksprocket_layouts'); $priority_files = $context->getAllSubFiles('meta.xml'); ksort($priority_files, true); foreach ($priority_files as $priority => $files) { foreach ($files as $file) { RokCommon_Service::addConfigFile($file); } } }
<?php /** * @version $Id: default.php 39778 2011-07-08 00:02:29Z djamil $ * @author RocketTheme http://www.rockettheme.com * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ defined('_JEXEC') or die('Restricted access'); JToolBarHelper::title(JText::_('RokGallery'), 'generic.png'); //JToolBarHelper::preferences('com_rokgallery'); //JToolBarHelper::custom('', '', '', 'custom'); JHTML::_('behavior.modal'); $this->_replaceMooTools(); $toolbar = JToolBar::getInstance('toolbar'); $toolbar->addButtonPath(JPATH_COMPONENT . DS . 'buttons'); $toolbar->appendButton('rokgallery', 'publish'); $toolbar->appendButton('rokgallery', 'unpublish'); $toolbar->appendButton('rokgallery', 'tag'); $toolbar->appendButton('rokgallery', 'delete'); $toolbar->appendButton('Separator'); $toolbar->appendButton('rokgallery', 'jobs'); $toolbar->appendButton('rokgallery', 'galleries'); $toolbar->appendButton('rokgallery', 'settings', 'index.php?option=com_config&view=component&layout=modal&component=com_rokgallery&tmpl=component&path=', '', "{handler: 'iframe', size: {x: 570, y: 300}}", 'modal'); $toolbar->appendButton('rokgallery', 'upload', '#', 'ok'); echo RokCommon_Composite::get('com_rokgallery.default')->load('default.php', array('that' => $this));
<?php /** * @version $Id$ * @author RocketTheme http://www.rockettheme.com * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ RokCommon_Header::addStyle(RokCommon_Composite::get($that->context)->getUrl('gallerymanager.css') . '?version=2.0'); RokCommon_Header::addScript(RokCommon_Composite::get($that->context)->getUrl('../../assets/application/Scrollbar.js') . '?version=2.0'); RokCommon_Header::addScript(RokCommon_Composite::get($that->context)->getUrl('gallerymanager.js') . '?version=2.0'); RokCommon_Header::addInlineScript(RokCommon_Composite::get($that->context)->load('javascript.php', array('that' => $that)));
echo JText::_("ROKSPROCKET_INSTRUCTIONS_TEXT"); ?> </p> <p><img src="<?php echo JURI::base(true); ?> /components/com_roksprocket/assets/images/sample.png" class="sample" /></p> </div> </div> <?php $order = 0; /** @var $article RokSprocket_Item */ foreach ($that->articles as $article) { /** @var $per_item_form RokCommon_Config_Form */ $per_item_form = $that->perItemForm; $per_item_form->setFormControl(sprintf('items[%s]', $article->getArticleId())); $per_item_form->bind(array('params' => $article->getParams())); $limit = $that->form->getField('display_limit', 'params')->value; ?> <?php echo RokCommon_Composite::get('roksprocket.module.edit')->load('edit_article.php', array('itemform' => $per_item_form, 'article' => $article, 'order' => $order, 'limit' => $limit)); ?> <?php $order++; } ?> </div> <div class="load-more btn hide-load-more"> <span><span class="text">load more</span><span class="info">HOLD <strong>SHIFT</strong> KEY TO LOAD ALL</span></span> </div>
<?php /** * @package Joomla.Administrator * @subpackage com_modules * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0', '>=')) { echo RokCommon_Composite::get('roksprocket.module.edit')->load('edit_assignment_30.php', array('that' => $that)); } else { echo RokCommon_Composite::get('roksprocket.module.edit')->load('edit_assignment_25.php', array('that' => $that)); }
foreach ($that->container['roksprocket.layouts'] as $layout_id => $layout_info) { ?> <?php $active = $that->layout == $layout_id; if ($active) { $layout = $layout_id; } $layout_composite_path = 'roksprocket_layout_' . $layout_id; $priority = 0; foreach ($layout_info->paths as $path) { RokCommon_Composite::addPackagePath($layout_composite_path, $path, $priority); $priority++; } $recommended = !isset($layout_info->recommended) ? false : $layout_info->recommended; $recommended = htmlspecialchars(json_encode(!isset($layout_info->recommended) ? false : $layout_info->recommended), ENT_QUOTES, 'UTF-8'); $iconurl = RokCommon_Composite::get($layout_composite_path)->getUrl($layout_info->icon); if (empty($iconurl)) { $iconurl = "components/com_roksprocket/assets/images/default_layout_icon.png"; } $css[] = sprintf('#module-form i.layout.%s {background-image: url(%s);background-position: 0 0;}', $layout_id, $iconurl); $style = sprintf('background-image: url(%s);background-position: 0 0;', $iconurl); ?> <li<?php echo $active ? ' class="active"' : ''; ?> data-sprocket-layout="<?php echo $layout_id; ?> " data-sprocket-recommended="<?php echo $recommended; ?>
?> </span></div> <div class="button wipeall"><span><?php rc_e('ROKGALLERY_WIPEALL'); ?> </span></div> </div> </div> <div class="clr"></div> <div class="jobs-wrapper" style="max-height: 205px; overflow: hidden; position: relative;"> <div class="jobs-list"> <?php foreach ($jobs as &$job) { echo RokCommon_Composite::get('com_rokgallery.jobs')->load('default_single.php', array('job' => $job)); } ?> </div> </div> <div class="clr"></div> <div id="jobs-wipe-warning"> <p>The "Wipe All" operation is going to remove all the existing jobs from your database. All running Jobs will be terminated and deleted.</p> <p>Are you sure you want to continue? <div class="button wipe-yes ok" style="margin: 0 5px 0 0"><span><?php rc_e('ROKGALLERY_YES'); ?> </span></div> <div class="button wipe-no" style="margin: 0 5px 0 0"><span><?php rc_e('ROKGALLERY_NO'); ?>
$iconURL = RokCommon_Composite::get($composite)->getUrl($container->icon); if (empty($iconURL)) { $iconURL = "components/com_roksprocket/assets/images/default_layout_icon.png"; } $css[] = sprintf('#module-form i.layout.%s {background-image: url(%s);background-position: 0 0;}', $that->layout, $iconURL); ?> <style><?php echo implode("\n", $css); ?> </style> <div class="panel-left"> <div class="panel-left-wrapper"> <?php echo RokCommon_Composite::get('roksprocket.module.edit')->load('edit_articles.php', array('that' => $that)); ?> </div> </div> <div class="panel-right"> <ul> <?php foreach ($fieldSet as $field) { foreach (array('group_open', 'group_bit', 'group_close', 'group_class') as $group) { ${$group} = $that->form->getFieldAttribute($field->fieldname, $group, false, 'params'); } ?> <?php if (!$field->hidden) { ?> <?php
$passed_params->showcase_autoplay_delay = $params->get('showcase_autoplay_delay', 7) * 1000; $passed_params->showcase_captionsanimation = $params->get('showcase_captionsanimation', 'crossfade'); $passed_params->moduleid = $module->id; $passed_params->layout_context = 'mod_rokgallery.' . $passed_params->layout; $passed_params->style_context = $passed_params->layout_context . '.' . $passed_params->style; $request_var_root = 'mod_rokgallery.' . $passed_params->layout; $request_var_css = $request_var_root . '.css'; $request_var_js = $request_var_root . '.js'; if (!RokCommon_Request::get($request_var_css, false)) { $doc =& JFactory::getDocument(); if (file_exists(RokCommon_Composite::get($passed_params->layout_context)->get($passed_params->layout . '.css'))) { $doc->addStyleSheet(RokCommon_Composite::get($passed_params->layout_context)->getURL($passed_params->layout . '.css')); } if (file_exists(RokCommon_Composite::get($passed_params->style_context)->get('style.css'))) { $doc->addStyleSheet(RokCommon_Composite::get($passed_params->style_context)->getURL('style.css')); } RokCommon_Request::set($request_var_css, true); } if (!RokCommon_Request::get($request_var_js, false)) { $doc =& JFactory::getDocument(); if (file_exists(RokCommon_Composite::get($passed_params->layout_context)->get($passed_params->layout . RokGallery_Helper::getJSVersion() . '.js'))) { $doc->addScript(RokCommon_Composite::get($passed_params->layout_context)->getURL($passed_params->layout . RokGallery_Helper::getJSVersion() . '.js')); } RokCommon_Request::set($request_var_js, true); } if (file_exists(RokCommon_Composite::get($passed_params->layout_context)->get('javascript.php'))) { $doc->addScriptDeclaration(RokCommon_Composite::get($passed_params->layout_context)->load('javascript.php', array('passed_params' => $passed_params))); } $rokgallerymodule = new RokGalleryModule(); $passed_params->slices = $rokgallerymodule->getSlices($params); require JModuleHelper::getLayoutPath('mod_rokgallery');
/** * Method to load the form description from an XML file. * * The reset option works on a group basis. If the XML file references * groups that have already been created they will be replaced with the * fields in the new XML file unless the $reset parameter has been set * to false. * * @param string $file The filesystem path of an XML file. * @param string $reset Flag to toggle whether form fields should be replaced if a field * already exists with the same group/name. * @param string $xpath An optional xpath to search for the fields. * * @return boolean True on success, false otherwise. * * @since 11.1 */ public function loadFile($file, $reset = true, $xpath = false) { // Check to see if the path is an absolute path. if (!is_file($file)) { $file = RokCommon_Composite::get(self::FORM_PATH_PACKAGE)->get($file . '.xml'); // If unable to find the file return false. if (!$file) { return false; } } // Attempt to load the XML file. $xml = RokCommon_Utils_XMLHelper::getXML($file, true); return $this->load($xml, $reset, $xpath); }
/** * Delete the file and all associated rows (done by foreign keys) and files * $params object should be a json like * <code> * { * "page": 3, * "items_per_page":6 * "filters": [{ type: "title", operator: "is not", query: "example"},{ type: "title", operator: "is not", query: "example"}] * "get_remaining": true * } * </code> * * @param $params * @return RokCommon_Ajax_Result */ public function getPage($params) { $result = new RokCommon_Ajax_Result(); try { $html = ''; $filters = array(); foreach ($params->filters as $filter) { $filters[] = RokGallery_Filter_Item::createFromJson($filter); } $model = new RokGallery_Admin_MainPage(); $order_by = isset($params->order->order_by) ? $params->order->order_by : null; $order_direction = isset($params->order->order_direction) ? $params->order->order_direction : null; $files = $model->getFiles($params->page, $params->items_per_page, $filters, $order_by, $order_direction); $pager = $model->getPager($params->page, $params->items_per_page, $filters, $order_by, $order_direction); $model->clearPager(); $total_items_count = $pager->getResultsInPage(); $current_page = $params->page; $next_page = $current_page == 1 ? 3 : $current_page + 1; $next_page = $current_page == $pager->getLastPage() ? false : $next_page; $remaining_pages = $next_page ? $pager->getLastPage() - $current_page : 0; $items_per_page = RokGallery_Config::getOption(RokGallery_Config::OPTION_ADMIN_ITEMS_PER_PAGE, 6); $passed_items_per_page = $items_per_page; $items_per_page = $current_page == 1 ? $items_per_page * 2 : $items_per_page; $items_per_row = RokGallery_Config::getOption(RokGallery_Config::OPTION_ADMIN_ITEMS_PER_ROW, 3); $that->files =& $files; $that->items_per_page = $items_per_page; $that->items_per_row = $items_per_row; ob_start(); $that->row_entry_number = 0; $that->item_number = 1; $that->items_to_be_rendered = $pager->getResultsInPage(); foreach ($that->files as $that->file) { if (!isset($params->composite) || !isset($params->composite->context) || !isset($params->composite->layout)) { echo RokCommon_Composite::get('com_rokgallery.default')->load('default_row.php', array('that' => $that)); } else { echo RokCommon_Composite::get($params->composite->context)->load($params->composite->layout . '.php', array('that' => $that)); } $that->row_entry_number++; $that->item_number++; } $html .= ob_get_clean(); if (isset($params->get_remaining) && $params->get_remaining) { for ($params->page++; $params->page <= $pager->getLastPage(); $params->page++) { $more_files = $model->getFiles($params->page, $params->items_per_page, $filters, $order_by, $order_direction); $pager = $model->getPager($params->page, $params->items_per_page, $filters, $order_by, $order_direction); $model->clearPager(); $total_items_count = $total_items_count + $pager->getResultsInPage(); $current_page = $params->page; $next_page = $current_page == 1 ? 3 : $current_page + 1; $next_page = $current_page == $pager->getLastPage() ? false : $next_page; $remaining_pages = $next_page ? $pager->getLastPage() - $current_page : 0; $items_per_page = RokGallery_Config::getOption(RokGallery_Config::OPTION_ADMIN_ITEMS_PER_PAGE, 6); $passed_items_per_page = $items_per_page; $items_per_page = $current_page == 1 ? $items_per_page * 2 : $items_per_page; $items_per_row = RokGallery_Config::getOption(RokGallery_Config::OPTION_ADMIN_ITEMS_PER_ROW, 3); $that->files =& $more_files; $that->items_per_page = $items_per_page; $that->items_per_row = $items_per_row; ob_start(); $that->row_entry_number = 0; $that->item_number = 1; $that->items_to_be_rendered = $pager->getResultsInPage(); foreach ($that->files as $that->file) { if (!isset($params->composite) || !isset($params->composite->context) || !isset($params->composite->layout)) { echo RokCommon_Composite::get('com_rokgallery.default')->load('default_row.php', array('that' => $that)); } else { echo RokCommon_Composite::get($params->composite->context)->load($params->composite->layout . '.php', array('that' => $that)); } $that->row_entry_number++; $that->item_number++; } $html .= ob_get_clean(); } } $result->setPayload(array('next_page' => $next_page, 'last_page' => $pager->getLastPage(), 'items_per_page' => $passed_items_per_page, 'items_returned' => $total_items_count, 'more_pages' => $next_page == false ? false : true, 'remaining_pages' => $remaining_pages, 'total_items_in_filter' => $pager->getNumResults(), 'total_items_shown' => $pager->getLastIndice(), 'total_items' => RokGallery_Model_FileTable::getTotalFileCount(), 'html' => $html)); } catch (Exception $e) { throw $e; } return $result; }
/** * Called to render headers that should be included only once per Layout type used */ public function renderLayoutHeaders() { $rendered = self::$instanceHeadersRenderedTheme; if (!isset($rendered[$this->theme]) || !$rendered[$this->theme]) { $instance = array(); $instance[] = "window.addEvent('domready', function(){"; $instance[] = "\t\tRokSprocket.instances." . $this->theme . " = new RokSprocket." . ucfirst($this->theme) . "();"; $instance[] = "});"; RokCommon_Header::addInlineScript(implode("\n", $instance) . "\n"); self::$instanceHeadersRenderedTheme[$this->theme] = true; } if (!self::$instanceHeadersRendered) { $root_assets = RokCommon_Composite::get($this->basePackage . '.assets.js'); $layout_assets = RokCommon_Composite::get($this->layoutPackage . '.assets.js'); RokCommon_Header::addScript($root_assets->getUrl('moofx.js')); RokCommon_Header::addScript($layout_assets->getUrl('features.js')); self::$instanceHeadersRendered = true; } }
<?php /** * @version $Id: default_row.php 39491 2011-07-05 07:26:40Z djamil $ * @author RocketTheme http://www.rockettheme.com * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ $that->row_number = (int) ($that->item_number / $that->items_per_row) + 1; $that->row_odd_even = $that->row_number % 2 == 0 ? 'even' : 'odd'; $that->first_item_in_row = $that->item_number % $that->items_per_row == ($that->items_per_row - ($that->items_per_row - 1)) % $that->items_per_row ? true : false; $that->last_item_in_row = $that->item_number % $that->items_per_row == 0 || $that->total_items == $that->item_number || (int) $that->total_items == $that->item_number ? true : false; if ($that->first_item_in_row) { ?> <div class="list-row row<?php echo $that->row_number; ?> <?php echo $that->row_odd_even; ?> "> <?php } echo RokCommon_Composite::get($that->context)->load('default_item.php', array('that' => $that)); if ($that->last_item_in_row) { ?> </div> <?php }
/** * @param \RokCommon_XMLElement $xml_node * * @throws \RokCommon_Config_Exception */ protected function initialize(RokCommon_XMLElement $xml_node) { $this->xml_node = $xml_node; // get the name of the entry if (!isset($this->xml_node['name'])) { throw new RokCommon_Config_Exception(rc__('Meta Config entry in %s does not have a name', $this->parent_identifier)); } $this->name = (string) $this->xml_node['name']; // set the identifier name $id_parts = explode(self::ENTRY_SEPERATOR, $this->parent_identifier); $id_parts[] = $this->name; $this->identifier = implode(self::ENTRY_SEPERATOR, $id_parts); // get the filename of the entry if (!isset($this->xml_node['filename'])) { throw new RokCommon_Config_Exception(rc__('Meta Config entry %s does not have a filename', $this->identifier)); } $this->filename = (string) $this->xml_node['filename']; // get the mode if (isset($this->xml_node['mode'])) { $this->mode = (string) $this->xml_node['mode']; } // get the jointype if (isset($this->xml_node['jointype'])) { $this->jointype = (string) $this->xml_node['jointype']; } // see if there is a library and add it to the lib path $library_paths = $xml_node->xpath('libraries/library'); if ($library_paths) { foreach ($library_paths as $library_path) { $resolved_lib_path = RokCommon_Config::replaceTokens((string) $library_path, dirname($this->root_file)); if (is_dir($resolved_lib_path)) { RokCommon_ClassLoader::addPath($resolved_lib_path); } } } // get the paths for the config $paths = $xml_node->xpath('paths/path'); if (!$paths) { throw new RokCommon_Config_Exception(rc__('Meta Config entry %s must have at least one path.', $this->identifier)); } foreach ($paths as $path_entry) { $priority = RokCommon_Composite::DEFAULT_PRIORITY; if (isset($path_entry['priority'])) { $priority = (string) $path_entry['priority']; } $path = RokCommon_Config::replaceTokens((string) $path_entry, dirname($this->root_file)); if (is_dir($path)) { // see if there is a testservice entry if (isset($path_entry['testservice'])) { // see if the testservice extists $testservice_name = (string) $path_entry['testservice']; $container = RokCommon_Service::getContainer(); /** @var $testservice RokCommon_Config_PathTest */ $testservice = $container->{$testservice_name}; if (!$container->hasService($testservice_name)) { throw new RokCommon_Config_Exception(rc__('Path test service %s does not exist', $testservice_name)); } // see if we can add the if ($testservice->isPathAvailable()) { $this->addPath($path, $priority); } } else { // add the path if there is no testclass $this->addPath($path, $priority); } } else { // TODO log unable to find path } } // add any subconfigs $subconfigs = $xml_node->xpath('subconfigs/subconfig'); if ($subconfigs) { foreach ($subconfigs as $subconfig_entry) { $subconfig = new self($this->identifier, $this->root_file, $subconfig_entry); $this->subentries[$subconfig->getName()] = $subconfig; } } $this->context = RokCommon_Composite::get($this->identifier); }
<?php /** * @version $Id$ * @author RocketTheme http://www.rockettheme.com * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ RokCommon_Header::addStyle(RokCommon_Composite::get($that->context)->getUrl('detail.css')); RokCommon_Header::addStyle(RokCommon_Composite::get($that->style_context)->getUrl('style.css')); RokCommon_Header::addInlineScript(RokCommon_Composite::get($that->style_context)->load('js-settings.php', array('that' => $that)));