function onAfterRoute() { /* Do nothing on back end or if format is not html */ if ($this->_app->isAdmin() || $this->_view != 'html') { return true; } /* Get active menu id */ $menuActive = $this->_app->getMenu()->getActive(); if (!$menuActive) { return; } $id = $menuActive->id; if ($id) { /* Load RSTBox Helper class */ JLoader::register('RstboxHelper', JPATH_ADMINISTRATOR . '/components/com_rstbox/helpers/rstbox.php'); $user = JFactory::getUser(); /* Get all boxes based on active menu id & user authorised view levels */ $boxes = RstboxHelper::getBoxes($id, $user->getAuthorisedViewLevels()); /* Check if is there at least one box and then load css and js files */ if ($boxes) { if (!$this->_params->get("forceloadmedia", false)) { RstboxHelper::loadassets_front(); } /* Prepare HTML */ $html = RstboxHelper::renderLayout("rstbox", $boxes); self::$boxesHTML = $html; } } }
public function delete() { $cid = JRequest::getVar('cid', array(), '', 'array'); $model = $this->getModel(); if ($model->delete($cid)) { $pks = implode(",", $cid); RstboxHelper::del("rstbox_menu", "boxid IN ({$pks})"); } $this->setRedirect('index.php?option=com_rstbox'); }
public function postSaveHook($model, $data) { $item = $model->getItem(); $id = $item->get('id'); $values = array(); /* Check if box is assigned to all pages */ $assignToAllMenus = $data["prm_allmenus"] == "1" ? true : false; if ($assignToAllMenus) { array_push($values, "({$id},-1)"); } /* Prepare Relation between boxes & menu items */ foreach ($data["menuitems"] as $menuitem) { array_push($values, "({$id},{$menuitem})"); } $values_prepared = implode(",", $values); $sql_for_menu_items = "INSERT INTO #__rstbox_menu (boxid, menuid) VALUES {$values_prepared}"; RstboxHelper::del("rstbox_menu", "boxid={$id}"); RstboxHelper::runquery($sql_for_menu_items); }
<?php if ($box->params->showtitle) { ?> <div class="rstbox-header"> <div class="rstbox-heading"><?php echo $box->name; ?> </div> </div> <?php } ?> <div class="rstbox-content"><?php echo RstboxHelper::boxRender($box); ?> </div> </div> <?php if (isset($box->params->customcode)) { echo $box->params->customcode; } ?> </div> <?php } ?>
<?php /** * @package Responsive Scroll Triggered Box * @author Tassos Marinos <*****@*****.**> * @link http://www.tassos.gr * @copyright Copyright © 2015 TM Extensions All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die('Restricted access'); if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } // import joomla controller library jimport('joomla.application.component.controller'); // require helper file JLoader::register('RstboxHelper', dirname(__FILE__) . DS . 'helpers' . DS . 'rstbox.php'); // Get an instance of the controller prefixed by RSTBox $controller = JControllerLegacy::getInstance('Rstbox'); // Check for Plugin $plugin = JPluginHelper::isEnabled("system", "rstbox"); if (!$plugin && !RstboxHelper::enableRenderPlugin()) { JError::raiseError(403, "Please enable \"Responsive Scroll Triggered Box Render\" Plugin"); } // Perform the Request task $input = JFactory::getApplication()->input; $controller->execute($input->getCmd('task')); RstboxHelper::loadassets(); // Redirect if set by the controller $controller->redirect();
</div> </td> <td class="center"><?php echo $item->accessleveltitle; ?> </td> <td class="center"><?php echo RstboxHelper::pretty($item->position); ?> </td> <td class="center"><?php echo RstboxHelper::pretty($item->triggermethod); ?> </td> <td class="center"><?php echo RstboxHelper::pretty($item->animation); ?> </td> <td class="center"><?php echo $item->cookie; ?> </td> <td class="center"><?php echo $item->id; ?> </td> </tr> <?php } ?>
if (RstboxHelper::jVer() == "3") { echo JHtml::_('bootstrap.endTab'); } ?> <div class="clr"></div> <input type="hidden" name="task" value="item.edit" /> <?php echo JHtml::_('form.token'); ?> <?php if (RstboxHelper::jVer() == "3") { ?> <?php echo JHtml::_('bootstrap.endTabSet'); ?> <?php } else { ?> <?php echo JHtml::_('tabs.end'); ?> <?php
/** * Method to save the form data. * * @param array The form data. * * @return boolean True on success. * @since 1.6 */ public function save($data) { $assignToAllMenus = $data["prm_allmenus"] == "1" ? true : false; if (!$data["menuitems"] && !$assignToAllMenus) { $this->setError(JText::_('COM_RSTBOX_WRONG_MENU_ASSIGNMENT')); return false; } $data["settings"] = json_encode(RstboxHelper::searchFields($data, "bx_")); $data["params"] = json_encode(RstboxHelper::searchFields($data, "prm_")); switch ($data["boxtype"]) { case 'emailform': if (!filter_var($data["bx_mc_url"], FILTER_VALIDATE_URL)) { $this->setError(JText::_('COM_RSTBOX_WRONG_SUBMIT_URL')); return false; } break; case 'module': if (!$data["bx_moduleid"]) { $this->setError(JText::_('COM_RSTBOX_ERROR_MODULEID')); return false; } break; case 'custom': if (!$data["customhtml"]) { $this->setError(JText::_('COM_RSTBOX_ERROR_CUSTOM_HTML')); return false; } break; } switch ($data["triggermethod"]) { case "element": $prm = $data["prm_triggerelement"]; if (!$prm) { $this->setError(JTEXT::_('COM_RSTBOX_ERROR_TRIGGER_ELEMENT')); return false; } break; } if (parent::save($data)) { return true; } }