/**
  *
  * Ajax render to store in session
  */
 public function ajaxGetRender()
 {
     /** load libraries for the system rener **/
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     /** get url **/
     $render_url = JRequest::getVar('render_url', '');
     $urlRender = base64_decode($render_url);
     $session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
     if ($render_url == '') {
         $urlRender = JSNDatabase::getDefaultPage()->link;
     }
     $currUri = new JURI($urlRender);
     if (!$currUri->hasVar('Itemid')) {
         $currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
     }
     $urlString = $currUri->toString();
     $session->set('rawmode_render_url', base64_encode($urlString));
     $parts = JString::parse_url($urlString);
     if (!empty($parts['query'])) {
         parse_str($parts['query'], $params);
     } else {
         $params = array();
     }
     $jsntemplate = JSNFactory::getTemplate();
     $jsnrawmode = JSNRawmode::getInstance($params);
     $jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
     $jsnrawmode->renderAll();
     $session = JSession::getInstance('files', array('name' => 'jsnajaxgetrender'));
     $session->set('component', $jsnrawmode->getHTML('component'));
     $session->set('jsondata', $jsnrawmode->getScript('positions', 'JSON'));
     jexit('success');
 }
 /**
  *
  * Disable JT3 infomode
  *
  * @return: Save setting to file params.ini
  */
 public function disableInfoMode()
 {
     JSNFactory::localimport('libraries.joomlashine.database');
     $template = JSNDatabase::getDefaultTemplate();
     $client = JApplicationHelper::getClientInfo($template->client_id);
     $file = $client->path . '/templates/' . $template->element . '/params.ini';
     $data = JFile::read($file);
     $data = explode("\n", $data);
     $params = array();
     $needChange = false;
     foreach ($data as $val) {
         $spos = strpos($val, "=");
         $key = substr($val, 0, $spos);
         $value = substr($val, $spos + 1, strlen($val) - $spos);
         if ($key == 'infomode') {
             if ($value == '"1"') {
                 $value = '"0"';
                 $needChange = true;
             }
         }
         $params[$key] = $value;
     }
     if ($needChange) {
         $data = array();
         foreach ($params as $key => $val) {
             $data[] = $key . '=' . $val;
         }
         $data = implode("\n", $data);
         if (JFile::exists($file)) {
             @chmod($file, 0777);
         }
         JFile::write($file, $data);
     }
 }
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     $JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'styles.css');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-hotkeys/jquery.hotkeys.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstorage/jquery.jstorage.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.topzindex.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.submenu.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.mousecheck.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.tinyscrollbar.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.assignpages.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstree/jquery.jstree.js');
     $JSNMedia->addScriptDeclaration("var baseUrl = '" . JURI::root() . "';");
     //require helper
     JSNFactory::localimport('libraries.joomlashine.page.assignpages');
     $viewHelper = JSNAssignpages::getInstance();
     $menuTypes = $viewHelper->menuTypeDropDownList(false);
     $this->assign('menutypes', $menuTypes);
     $moduleid = JRequest::getVar('id', 0);
     $menuitems = $viewHelper->renderMenu($moduleid);
     $this->assign('menuitems', $menuitems);
     JSNFactory::localimport('libraries.joomlashine.modules');
     $assignType = JSNModules::checkAssign($moduleid);
     $this->assign('assignType', $assignType);
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $language = JFactory::getLanguage();
     $language->load('com_modules');
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.filter.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $language = JFactory::getLanguage();
     $language->load('com_menus');
     $model = $this->getModel();
     $this->assign('model', $model);
     $menutype = '';
     $menutypeid = JRequest::getVar("menutypeid", '');
     if ($menutypeid) {
         JSNFactory::localimport('models.menuitem');
         $paMenuModel = new PoweradminModelMenuitem();
         $menutype = $paMenuModel->getMenuType($menutypeid);
     }
     $parentid = JRequest::getVar("parentid", '');
     $customScript = "\n\t\t\tvar selectMenuType;\n            (function(\$){\n\t\t\t\t\$(window).ready(function(){\n\t\t\t\t  \t  selectMenuType =  \$.jsnFilter(\n\t\t\t\t  \t  {\n\t\t\t  \t  \t\t  frameElement: \$('.jsn-menu-type'),\n\t\t\t  \t  \t\t  category    : true,\n\t\t\t\t\t  \t  itemClass   : '.jsn-item-type',\n\t\t\t\t\t  \t  totalColumn : 3,\n\t\t\t\t\t  \t  itemWidth   : 220,\n\t\t\t\t\t  \t  itemHeight  : 30,\n\t\t\t\t\t  \t  mPosLeft    : 0,\n\t\t\t\t\t  \t  mPosTop     : 15,\n\t\t\t\t\t  \t  marginOffset: {\n\t\t\t\t\t  \t  \t  right : 15,\n\t\t\t\t\t  \t  \t  bottom: 20\n\t\t\t\t\t  \t  },\n\t\t\t\t\t  \t  eventClick: function(){\n\t\t\t\t\t  \t  \t var params = \$(this).attr('params');\n\t\t\t\t\t  \t  \t window.parent.JoomlaShine.jQuery.addNewMenuItem(params, '" . $menutype . "', '" . $menutypeid . "', '" . $parentid . "');\n\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  })(JoomlaShine.jQuery);\n\t\t";
     $JSNMedia->addScriptDeclaration($customScript);
     return parent::display();
 }
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     $JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'styles.css');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.cook.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.tinyscrollbar.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-hotkeys/jquery.hotkeys.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jstree/jstree.override.js');
     JSNHtmlAsset::addScript(JSN_FRAMEWORK_ASSETS . '/3rd-party/jquery-jstorage/jquery.jstorage.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'jquery.topzindex.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.submenu.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.mousecheck.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.assignpages.js');
     $JSNMedia->addScriptDeclaration("var baseUrl = '" . JURI::root() . "';");
     //require classes
     JSNFactory::localimport('libraries.joomlashine.modules');
     JSNFactory::localimport('libraries.joomlashine.page.assignpages');
     $viewHelper = JSNAssignpages::getInstance();
     $menuTypes = $viewHelper->menuTypeDropDownList(false);
     $this->assign('menutypes', $menuTypes);
     $app = JFactory::getApplication();
     $moduleid = $app->getUserState('com_poweradmin.assignpages.custompage.moduleid', JRequest::getVar('moduleid', array(), 'get', 'array'));
     if (count($moduleid) == 1) {
         $menuitems = $viewHelper->renderMenu($moduleid[0]);
         $assignType = JSNModules::checkAssign($moduleid[0]);
     } else {
         $menuitems = $viewHelper->renderMenu(0);
         $assignType = 3;
     }
     $this->assign('menuitems', $menuitems);
     $this->assign('assignType', $assignType);
     return parent::display();
 }
 /**
  *
  * Add an toolbar dropdown list
  *
  * @param String $text is text of parent
  * @param String $title is title of parent
  * @param String $icon is icon class prefix
  * @param String $childs is HTML
  * @param String $href is url of parent
  * @param String $action is action you want when click on parent
  */
 public static function dropdown($text = '', $title = '', $icon = 'jsn-parent', $childs = '', $href = '', $action = 'popup')
 {
     JSNFactory::localimport('helpers.html.toolbar.button.jsndropdown');
     $bar = JToolBar::getInstance('toolbar');
     // Add a standard button.
     $bar->appendButton('JSNDropdown', $text, $title, $icon, $childs, $href, $action);
 }
 /**
  *
  * Get ramode instanced
  *
  * @param Array $params
  */
 public static function getRawmode($params = array())
 {
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     if (!isset(self::$rawmode)) {
         self::$rawmode = JSNRawmode::getInstance($params);
     }
     return self::$rawmode;
 }
 /**
  * 
  * Rawmode load data json
  */
 public function loadModulesJsonData()
 {
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     $position = JRequest::getVar('position', '');
     $Itemid = JRequest::getVar('currItemid', 0);
     $jsnrawmode = JSNRawmode::getInstance();
     $jsnrawmode->setParam('Itemid', $Itemid);
     $jsnrawmode->renderPosition($position);
     echo $jsnrawmode->getScript('position', 'JSON', $position);
     jexit();
 }
 /**
  *
  * Ajax request set/get data
  */
 public function request()
 {
     $data = new JRegistry();
     $dataFromRequest = JRequest::getVar('data', '');
     $data->loadObject(json_decode($dataFromRequest));
     if ($data->get('requestTask', '') == 'brankNewData') {
         JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
         $jsnrawmode = JSNRawmode::getInstance($data->toArray());
         $jsnrawmode->renderComponent();
         echo $jsnrawmode->getHTML('component');
         jexit();
     }
     $params = $data->get('params', array());
     if (is_object($params)) {
         $params = (array) $params;
     }
     if ($data->get('prefix_params', false)) {
         $prefixId = 0;
         $_params = array();
         foreach ($params as $key => $val) {
             $suffixs = explode('_', $key);
             $number = (int) $suffixs[count($suffixs) - 1];
             if (!$prefixId) {
                 $prefixId = $number;
             }
             $_params[str_replace('_' . $number, '', $key)] = $val;
         }
         $params = $_params;
     }
     $jsnConfig = JSNFactory::getConfig();
     // Execute saveParams event if option is supported ext
     JSNPaExtensionsHelper::executeExtMethod(str_ireplace('com_', '', $data->get('option')), 'saveParams', array('data' => $data, 'jsnConfig' => $jsnConfig, 'params' => $params));
     switch ($data->get('requestType', 'only')) {
         case 'only':
             $jsnConfig->menuitem($data->get('Itemid', ''), $params);
             break;
         case 'globally':
             //Set global config
             $jsnConfig->extension($data->get('option', ''), $params);
             foreach ($params as $k => $param) {
                 $params[$k] = '';
             }
             //Set for menu article layout
             $allMenuitems = $this->getModel('menuitem')->getAllItems(array('option' => $data->get('option', $data->get('option')), 'view' => $data->get('view', 'article'), 'layout' => $data->get('layout', '')));
             foreach ($allMenuitems as $item) {
                 $jsnConfig->menuitem($item->id, $params);
             }
             break;
     }
     jexit('success');
 }
 public function display($tpl = null)
 {
     /** add toolbar buttons **/
     $this->addToolBar();
     /** add scripts and css **/
     $this->addMedia();
     $render_url = JRequest::getVar('render_url', '');
     $this->assign('render_url', $render_url);
     //load libraries for the system rener modules mene
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     $jsnmenuitems = JSNMenuitems::getInstance();
     $this->assign('jsnmenuitems', $jsnmenuitems);
     return parent::display();
 }
 public function display($tpl = null)
 {
     //load libraries for the system rener
     JSNFactory::localimport('libraries.joomlashine.mode.render');
     $url = base64_decode(JRequest::getVar('render_url', ''));
     if ($url == '') {
         $url = JURI::root() . 'index.php';
     }
     JRequest::setVar('layout', 'default');
     $jsnpwrender = JSNRender::getInstance($url, 'visualmode');
     $this->assign('jsnpwrender', $jsnpwrender);
     $this->addScripts();
     parent::display();
 }
 /**
  * Render menu
  */
 public function getMenuType()
 {
     $mid = trim(JRequest::getVar('mid', ''));
     //load libraries for the system rener modules mene
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     $menutype = $this->getModel('menuitem')->getMenuType($mid);
     if ($menutype) {
         $jsnmenuitems = JSNMenuitems::getInstance();
         $menutitle = $this->getModel('menuitem')->getMenuTitle($mid);
         echo $jsnmenuitems->renderMenuItem($mid, $menutype, $menutitle);
     } else {
         echo 'error';
     }
     jexit();
 }
 /**
  * Display function
  */
 public function display($tpl = null)
 {
     if (function_exists('error_reporting')) {
         error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT);
     }
     /** load libraries for the system rener **/
     JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
     JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
     /** Assignment variables **/
     $jsntemplate = JSNFactory::getTemplate();
     $jsnmenuitems = JSNMenuitems::getInstance();
     /** get url **/
     $render_url = JRequest::getVar('render_url', '');
     $session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
     if ($render_url == '' && $session->get('rawmode_render_url')) {
         $render_url = $session->get('rawmode_render_url');
     }
     $urlRender = base64_decode($render_url);
     if ($render_url == '') {
         $urlRender = JSNDatabase::getDefaultPage()->link;
     }
     $currUri = new JURI($urlRender);
     if (!$currUri->hasVar('Itemid')) {
         $currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
     }
     $urlString = $currUri->toString();
     $session->set('rawmode_render_url', base64_encode($urlString));
     $parts = JString::parse_url($urlString);
     if (!empty($parts['query'])) {
         parse_str($parts['query'], $params);
     } else {
         $params = array();
     }
     $jsnrawmode = JSNRawmode::getInstance($params);
     $jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
     $jsnrawmode->renderAll();
     $this->assign('component', $jsnrawmode->getHTML('component'));
     $this->assign('modules', $jsnrawmode->getHTML('positions'));
     $this->assign('jsnmenuitems', $jsnmenuitems);
     $this->assign('urlRender', $urlRender);
     /** add toolbar buttons **/
     $this->addToolBar();
     /** add scripts and css **/
     //$this->addMedia( $currUri->getVar('Itemid'), $urlString, array());//$jsnrawmode->getScript('positions', 'Array'));
     $this->addMedia($currUri->getVar('Itemid'), $urlString, $jsnrawmode->getScript('positions', 'Array'));
     return parent::display();
 }
 /**
  * 
  * Check module is assigned 
  * 
  * @param Number $itemid
  * @param Number $moduleid
  */
 public function getCheckboxAttributes($itemid, $moduleid)
 {
     $attrs = array('name' => 'assignpages[]', 'value' => $itemid);
     JSNFactory::localimport('libraries.joomlashine.modules');
     $assignmentType = JSNModules::getItemAssignmentType($moduleid, $itemid);
     if ($assignmentType == 'selected' || $assignmentType == 'all' || $assignmentType == 'except') {
         $attrs += array('checked' => "checked");
     }
     return $attrs;
 }
<?php

/**
 * @version    $Id$
 * @package    JSNPoweradmin
 * @subpackage helpers
 * @author     JoomlaShine Team <*****@*****.**>
 * @copyright  Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.joomlashine.com
 * Technical Support:  Feedback - http://www.joomlashine.com/contact-us/get-support.html
 */
// No direct access to this file.
defined('_JEXEC') || die('Restricted access');
JSNFactory::localimport('helpers.html.layouts.jsnlayouthelper');
/**
 * @package		Joomla.Administrator
 * @subpackage	com_poweradmin
 * @since		1.7
 */
abstract class JSNRenderHelper
{
    /**
     *
     * Get view information
     *
     * @param Array $vars
     */
    public function getInfoView($vars)
    {
<?php

/*------------------------------------------------------------------------
# JSN PowerAdmin
# ------------------------------------------------------------------------
# author    JoomlaShine.com Team
# copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
# Websites: http://www.joomlashine.com
# Technical Support:  Feedback - http://www.joomlashine.com/joomlashine/contact-us.html
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @version $Id: jsnjoomlaxtc.php 16006 2012-09-13 03:29:17Z hiepnv $
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
JSNFactory::localimport('libraries.joomlshine.libraries.template');
class JSNJoomlaXTCHelper
{
    private $_template;
    private $_document;
    private $_columns;
    /**
     * 
     * Constructure 
     */
    public function __construct($template, $document = null)
    {
        $this->_template = $template;
        $this->_document = $document;
        $this->makeArrayColumns();
    }
    public static function getInstance($template, $document = null)
    {
<?php

/**
 * @author    JoomlaShine.com
 * @copyright JoomlaShine.com
 * @link      http://joomlashine.com/
 * @package   JSN Poweradmin
 * @version   $Id: view.html.php 15407 2012-08-23 07:27:04Z hiepnv $
 * @license   GNU/GPL v2 http://www.gnu.org/licenses/gpl-2.0.html
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Import Joomla view library
jimport('joomla.application.component.view');
JSNFactory::localimport('libraries.joomlashine.html.pwgenerate');
/**
 * About view of JSN Poweradmin component
 */
class PoweradminViewAbout extends JViewLegacy
{
    /**
     * Display method
     *
     * @return	void
     */
    function display($tpl = null)
    {
        // Get config parameters
        $config = JSNConfigHelper::get();
        $this->_document = JFactory::getDocument();
        JToolBarHelper::title(JText::_('JSN_POWERADMIN_ABOUT_TITLE'), 'about');
 /**
  * 
  * Unassign all pages selected
  * @param Number $moduleid
  * @param Array $pages
  */
 public function unassignPages($moduleid, $pages)
 {
     JSNFactory::localimport('libraries.joomlashine.modules');
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $assignmentType = JSNModules::checkAssign($moduleid);
     if ($assignmentType == 0) {
         for ($i = 0; $i < count($pages); $i++) {
             $query->clear();
             $query->insert("#__modules_menu");
             $query->values($moduleid . ',-' . $pages[$i]);
             $db->setQuery($query);
             $db->query();
         }
     } else {
         if ($assignmentType === 1) {
             $this->removeAll($moduleid);
             $allItems = $this->getAllPages();
             for ($i = 0; $i < count($allItems); $i++) {
                 if (!in_array($allItems[$i]->id, $pages)) {
                     $query->clear();
                     $query->insert("#__modules_menu");
                     $query->values($moduleid . ',' . $allItems[$i]->id);
                     $db->setQuery($query);
                     $db->query();
                 }
             }
         } else {
             if ($assignmentType === 2) {
                 for ($i = 0; $i < count($pages); $i++) {
                     $query->clear();
                     $query->insert("#__modules_menu");
                     $query->values($moduleid . ',-' . $pages[$i]);
                     $db->setQuery($query);
                     $db->query();
                 }
             } else {
                 if ($assignmentType === 3) {
                     for ($i = 0; $i < count($pages); $i++) {
                         $query->clear();
                         $query->delete();
                         $query->from("#__modules_menu");
                         $query->where("menuid=" . $db->quote($pages[$i]) . ' AND moduleid = ' . $db->quote($moduleid));
                         $db->setQuery($query);
                         $db->query();
                     }
                 }
             }
         }
     }
 }
Beispiel #19
0
<?php

/*------------------------------------------------------------------------
# JSN PowerAdmin
# ------------------------------------------------------------------------
# author    JoomlaShine.com Team
# copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
# Websites: http://www.joomlashine.com
# Technical Support:  Feedback - http://www.joomlashine.com/joomlashine/contact-us.html
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @version $Id: view.html.php 16460 2012-09-26 09:52:25Z hiepnv $
-------------------------------------------------------------------------*/
// No direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.view');
JSNFactory::localimport('libraries.joomlashine.document.media');
class PoweradminViewSearch extends JViewLegacy
{
    /**
     * @var JApplication
     */
    protected $app;
    /**
     * @var JLanguage
     */
    protected $language;
    /**
     * @var JUser
     */
    protected $user;
    public function display($tpl = null)
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     JSNFactory::localimport('helpers.poweradmin');
     // Initialize variables.
     $options = array();
     //get predefined search coverages
     $options = PoweradminHelper::getSearchCoverages();
     return $options;
 }
 /** Constructor function **/
 function __construct(&$subject, $config)
 {
     // Check if JSN Framework installed & enabled.
     $jsnframework = JPluginHelper::getPlugin('system', 'jsnframework');
     if (!$jsnframework || !file_exists(JPATH_ROOT . '/plugins/system/jsnframework')) {
         return;
     }
     JSNFactory::import('plugins.system.jsnframework.libraries.joomlashine.config.helper', 'site');
     JSNFactory::import('plugins.system.jsnframework.libraries.joomlashine.utils.xml', 'site');
     $this->_params = JSNConfigHelper::get('com_poweradmin');
     $this->_application = JFactory::getApplication();
     $this->_user = JFactory::getUser();
     $this->_session = JFactory::getSession();
     $this->_preview = new JSNPowerAdminBarPreview();
     $this->loadLanguage('plg_system_jsnpoweradmin');
     $this->_removeAdminBarPlugin();
     $app = JFactory::getApplication();
     $input = $app->input;
     $poweradmin = $input->getCmd('poweradmin', 0);
     $showTemplatePosition = $input->getCmd('tp', 0);
     if ($app->isAdmin()) {
         $user = JFactory::getUser();
         if ($input->getVar('view', '') == 'jsnrender' && $user->id == 0) {
             jimport('joomla.application.component.controller');
             JController::setRedirect(JSN_VISUALMODE_PAGE_URL);
             JController::redirect();
         }
     }
     if ($poweradmin == 1) {
         /**
          * Auto-enable Preview Module Positions of template setting
          */
         if ($showTemplatePosition == 1) {
             $PreviewModulePositionsIsEnabled = JComponentHelper::getParams('com_content')->get('template_positions_display', 0) == 1 ? true : false;
             if (!$PreviewModulePositionsIsEnabled) {
                 /**
                  * Get config class
                  */
                 JSNFactory::localimport('libraries.joomlashine.config');
                 JSNConfig::extension('com_templates', array('template_positions_display' => 1));
             }
         }
         /** load JSNPOWERADMIN template library **/
         $template = JSNFactory::getTemplate();
         $this->_templateAuthor = $template->getAuthor();
         /*if T3 Framework*/
         if ($this->_templateAuthor == 'joomlart') {
             //check folder jat3 exists
             $t3FrameworkFolder = JPATH_ROOT . 'plugins/system/jat3';
             if (is_dir($t3FrameworkFolder)) {
                 if (!class_exists('T3Common')) {
                     jimport('joomla.html.parameter');
                     JSNFactory::import('plugins.system.jat3.jat3.core.common', 'site');
                 }
                 if (!class_exists('T3Framework')) {
                     JSNFactory::import('plugins.system.jat3.jat3.core.framework', 'site');
                     $jt3Plg = JPluginHelper::getPlugin('system', 'jat3');
                     T3Framework::t3_init($jt3Plg->params);
                 }
                 JSNFactory::import('plugins.system.jsnpoweradmin.libraries.jsnjoomlart', 'site');
             }
         } else {
             if ($this->_templateAuthor == 'yootheme') {
                 return;
             } else {
                 if ($this->_templateAuthor == 'gavick') {
                     JSNFactory::import('libraries.joomla.environment.browser', 'site');
                     $browser = JBrowser::getInstance();
                     $browser->setBrowser('JSNPoweradmin');
                 } else {
                     if ($this->_templateAuthor == 'joomlaxtc') {
                         JSNFactory::import('plugins.system.jsnpoweradmin.libraries.jsnjoomlaxtc', 'site');
                     }
                 }
             }
         }
         $this->_helper = JSNPLGHelper::getInstance();
     }
     parent::__construct($subject, $config);
 }
Beispiel #22
0
 /**
  *
  * Parse all queue to page
  *
  */
 public function addMedia()
 {
     $document = JFactory::getDocument();
     $docType = $document->getType();
     if ($this->_load_js_language) {
         JSNFactory::localimport('libraries.joomlashine.language.javascriptlanguages');
         $jsLang = JSNJavascriptLanguages::getInstance();
         $this->addScriptDeclaration($jsLang->loadLang());
     }
     if ($this->_docType == 'raw') {
         $medias = array();
         //Add all style file to page
         if (count($this->_styles)) {
             foreach ($this->_styles as $style) {
                 $medias[] = '<link  type="text/css" rel="stylesheet" href="' . $style . '" />';
             }
         }
         //Add all script file to page
         if (count($this->_scripts)) {
             foreach ($this->_scripts as $script) {
                 $medias[] = '<script type="text/javascript" src="' . $script . '"></script>';
             }
             if (!in_array(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'conflict.js'), $this->_scripts)) {
                 $medias[] = '<script type="text/javascript" src="' . PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.conflict.js') . '"></script>';
             }
         }
         //Add all custom tag to page
         if (count($this->_customs)) {
             foreach ($this->_customs as $custom) {
                 $medias[] = $custom;
             }
         }
         //Add all style declaration to page
         if (count($this->_styleDeclaration)) {
             $medias[] = '<style type="text/css">' . implode(PHP_EOL, $this->_styleDeclaration) . '</style>';
         }
         //Add all script declaration to page
         if (count($this->_scriptDeclaration)) {
             $medias[] = '<script type="text/javascript">' . implode(PHP_EOL, $this->_scriptDeclaration) . '</script>';
         }
         echo implode(PHP_EOL, $medias);
     } else {
         //behavior mootools
         JHtmlBehavior::framework();
         //behavior modal
         JHtml::_('behavior.modal');
         //behavior tooltip
         JHtml::_('behavior.tooltip');
         //behavior formvalidation
         JHtml::_('behavior.formvalidation');
         //behavior combobox
         JHtml::_('behavior.combobox');
         //Add all style file to page
         if (count($this->_styles)) {
             foreach ($this->_styles as $style) {
                 $document->addStyleSheet($style);
             }
         }
         $system_js = array();
         $user_js = array();
         $docScripts = $document->_scripts;
         if (count($docScripts)) {
             foreach ($docScripts as $key => $script) {
                 if (strpos($key, '/media/system/') !== false) {
                     $system_js[$key] = $script;
                 } else {
                     if (!is_jquery($key)) {
                         $user_js[$key] = $script;
                     }
                 }
             }
             $document->_scripts = array();
         }
         //Add all script file to page
         if (count($this->_scripts)) {
             foreach ($this->_scripts as $script) {
                 JSNHtmlAsset::addScript($script);
             }
             if (!in_array(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'conflict.js'), $this->_scripts)) {
                 JSNHtmlAsset::addScript(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.conflict.js'));
             }
         }
         $docScripts = $document->_scripts;
         $index = 0;
         $jsn_jquery = array();
         foreach ($docScripts as $key => $script) {
             if ($index < 2) {
                 $jsn_jquery[$key] = $script;
             } else {
                 $user_js[$key] = $script;
             }
             $index++;
         }
         $document->_scripts = $system_js + $jsn_jquery + $user_js;
         //Add all custom tag to page
         if (count($this->_customs)) {
             foreach ($this->_customs as $custom) {
                 $document->addCustomTag($custom);
             }
         }
         //Add all style declaration to page
         if (count($this->_styleDeclaration)) {
             $document->addStyleDeclaration(implode(PHP_EOL, $this->_styleDeclaration));
         }
         //Add all script declaration to page
         if (count($this->_scriptDeclaration)) {
             $document->addScriptDeclaration(implode(PHP_EOL, $this->_scriptDeclaration));
         }
     }
     $this->_dispatch = true;
     $this->__construct();
 }
 public function __construct()
 {
     /* require jsnhtml class */
     JSNFactory::localimport('libraries.joomlashine.html');
     $this->_document = JFactory::getDocument();
 }
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     // Check if this view is used for module editing page.
     $moduleEdit = JRequest::getCmd('moduleedit', '');
     $active_positions = array();
     $model = $this->getModel('changeposition');
     if (!$moduleEdit) {
         $moduleid = $app->getUserState('com_poweradmin.changeposition.moduleid');
     } else {
         $moduleid = array(JRequest::getCmd('moduleid', ''));
     }
     for ($i = 0; $i < count($moduleid); $i++) {
         $active_positions[] = "\$('#" . $model->getModulePosition($moduleid[$i]) . "-jsnposition').addClass('active-position').attr('title', 'Active position');";
     }
     JSNHtmlAsset::addScript(JURI::root(true) . '/media/jui/js/jquery.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.jquery.noconflict.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     //$document->addScript(JSN_POWERADMIN_LIB_JSNJS_URI. 'jsn.filter.visualmode.js');
     //Enable position filter.
     $this->setFilterable(true);
     $customScript = "\n\t\t\tvar baseUrl  = '" . JURI::root() . "';\n\t\t\tvar moduleid = new Array();\n\t\t\tmoduleid = [" . @implode(",", $moduleid) . "];\n\t\t\t(function (\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\t" . implode(PHP_EOL, $active_positions) . "\n\t\t\t\t});\n\t\t\t})(JoomlaShine.jQuery);\n \t\t";
     $this->addCustomScripts($customScript);
     //Callback after position clicked.
     if (!$moduleEdit) {
         $onPostionClick = "\n \t\t\tif ( !\$(this).hasClass('active-position') ){\n\t\t\t\tJoomlaShine.jQuery.setPosition(moduleid, \$(this).attr('id').replace('-jsnposition', ''));\n \t\t\t\tparent.JoomlaShine.jQuery('.ui-dialog-content').dialog('close');\n \t\t\t}\n \t\t\t";
     } else {
         $onPostionClick = "\n \t\t\tif ( !\$(this).hasClass('active-position') ){\n \t\t\t\tvar posName = \$(this).attr('id').replace('-jsnposition', '');\n \t\t\t\tparent.JoomlaShine.jQuery('#jform_position').val(posName);\n \t\t\t\tparent.modal.close();\n \t\t\t}\n \t\t\t";
     }
     $this->addPositionClickCallBack($onPostionClick);
     $template = JSNTemplateHelper::getInstance();
     $onPositionClick = '';
     $initFilter = '';
     $displayNotice = $app->input->getInt('notice');
     $bypassNotif = $app->input->getVar('bypassNotif', '');
     // Get template author.
     $templateAuthor = $template->getAuthor();
     JSNPositionsHelper::dispatchTemplateFramework($templateAuthor);
     $document->addStyleSheet(JSN_URL_ASSETS . '/joomlashine/css/jsn-positions.css');
     if (JSNVersion::isJoomlaCompatible('3.0')) {
         $document->addScript(JURI::root(true) . '/media/jui/js/jquery.js');
     } else {
         $document->addScript(JSN_URL_ASSETS . '/3rd-party/jquery/jquery-1.8.2.js');
     }
     if (isset($this->filterEnabled) and $this->filterEnabled) {
         $document->addScript(JSN_URL_ASSETS . '/joomlashine/js/positions.filter.js');
         $initFilter = 'changeposition = new JoomlaShine.jQuery.visualmodeFilter({});';
     }
     if (isset($this->customScripts)) {
         $document->addScriptDeclaration(implode('\\n', $this->customScripts));
     }
     $onPositionClick = isset($this->onPositionClickCallBack) ? implode('\\n', $this->onPositionClickCallBack) : '';
     // Get JSN Template Framework version
     $db = JFactory::getDbo();
     $q = $db->getQuery(true);
     $q->select('manifest_cache');
     $q->from('#__extensions');
     $q->where("element = 'jsntplframework'");
     $q->where("type = 'plugin'", 'AND');
     $q->where("folder = 'system'", 'AND');
     $db->setQuery($q);
     // Load dependency installation status.
     $res = $db->loadObject();
     $res = json_decode($res->manifest_cache);
     $jsnTplFwVersion = $res->version;
     $jsnTemplateCustomJs = '';
     if (version_compare($jsnTplFwVersion, '2.0.1', '<=')) {
         $jsnTemplateCustomJs = "\$('body').addClass('jsn-bootstrap');";
     }
     $_customScript = "\n\t\t\tvar changeposition;\n\t\t\t(function(\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\tvar posOutline\t= \$('.jsn-position');\n\t\t\t\t\tvar _idAlter\t= false;\n\t\t\t\t\tif (\$('.jsn-position').length == 0) {\n\t\t\t\t\t\tposOutline\t= \$('.mod-preview');\n\t\t\t\t\t\t_idAlter\t= true;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tposOutline.css({'z-index':'9999', 'position':'relative'});\n\t\t\t\t\t}\n\t\t\t\t\tposOutline.each(function(){\n\t\t\t\t\t\tif(_idAlter){\n\t\t\t\t\t\t\tpreviewInfo = \$(this).children('.mod-preview-info').text();\n\n\t\t\t\t\t\t\t_splitted = previewInfo.split('[');\n\t\t\t\t\t\t\tif(_splitted.length > 1){\n\t\t\t\t\t\t\t\tposname\t= _splitted[0];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t_splitted = posname.split(': ');\n\t\t\t\t\t\t\tif(_splitted.length > 1){\n\t\t\t\t\t\t\t\tposname\t= _splitted[1];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tposname = \$.trim(posname);\n\n\t\t\t\t\t\t\t\$(this).attr('id', posname + '-jsnposition');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\$(this)[0].oncontextmenu = function() {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.click(function () {\n\t\t\t\t\t\t" . $onPositionClick . "\n\t\t\t\t\t});\n\t\t\t\t\t" . $jsnTemplateCustomJs . "\n\t\t\t\t});\n\t\t\t\t" . $initFilter . "\n\t\t\t\t\n\t\t\t})(jQuery);\n\t\t";
     $document->addScriptDeclaration($_customScript);
     $previewModulePositionsIsEnabled = JComponentHelper::getParams('com_templates')->get('template_positions_display', 0);
     if (!$previewModulePositionsIsEnabled) {
         /**
          * Get config class
          */
         JSNFactory::localimport('libraries.joomlashine.config');
         JSNConfig::extension('com_templates', array('template_positions_display' => 1));
     }
     $config = JFactory::getConfig();
     $secret = $config->get('secret');
     $jsnrender = JSNPositionsRender::getInstance();
     $jsnrender->renderPage(JURI::root() . 'index.php?poweradmin=1&vsm_changeposition=1&tp=1&jsnpa_key=' . md5($secret), 'changePosition');
     $this->jsnrender = $jsnrender;
     parent::display($tpl);
 }
Beispiel #25
0
 /**
  * 
  * Render component
  * 
  * @return: HTML
  */
 public function renderComponent()
 {
     JSNFactory::localimport('helpers.html.jsnrenders');
     $params = array();
     foreach ($this->_params as $key => $value) {
         $params[$key] = $value;
     }
     //Set default option is Empty
     if (!key_exists('option', $params)) {
         $params['option'] = 'com_empty';
     }
     //Set default view is Empty
     if (!key_exists('view', $params)) {
         $params['view'] = 'Empty';
     }
     $this->_component = JSNRenderHelper::dispatch($params);
 }
 /**
  * Get featured items
  * 
  */
 public function getData($pk)
 {
     JSNFactory::localimport('libraries.joomlashine.config');
     $params = JSNConfig::getMenuParams($pk['Itemid']);
     JSNConfig::megreGlobalParams('com_content', $params);
     $this->setState('params', $params);
     $data = new stdClass();
     $data->params = $params;
     $activeAllParams = new JRegistry();
     if ($params instanceof JRegistry) {
         foreach ($params->toArray() as $key => $val) {
             if (strpos($key, 'show_') !== false && (int) $params->get($key) == 0) {
                 $activeAllParams->set($key, 1);
             } else {
                 $activeAllParams->set($key, $val);
             }
         }
     }
     $limit = (int) $params->def('num_leading_articles', 1) + (int) $params->get('num_intro_articles', 4) + (int) $params->def('num_links', 4);
     $this->setState('params', $activeAllParams);
     $this->setState('filter.published', 1);
     $this->setState('filter.access', '');
     $this->setState('list.start', 0);
     $this->setState('list.limit', $limit);
     $this->setState('list.direction', '');
     $this->setState('list.filter', '');
     // filter.subcategories indicates whether to include articles from subcategories in the list or blog
     $this->setState('list.links', $activeAllParams->get('num_links'));
     if ($activeAllParams->get('featured_categories') && implode(',', $activeAllParams->get('featured_categories')) == true) {
         $this->setState('filter.frontpage.categories', $activeAllParams->get('featured_categories'));
     }
     $this->setState('filter.frontpage', 1);
     $items = parent::getItems();
     // PREPARE THE DATA
     // Get the metrics for the structural page layout.
     $numLeading = $params->def('num_leading_articles', 1);
     $numIntro = $params->def('num_intro_articles', 4);
     $numLinks = $params->def('num_links', 4);
     // Compute the article slugs and prepare introtext (runs content plugins).
     foreach ($items as $i => &$item) {
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         // Ignore content plugins on links.
         if ($i < $numLeading + $numIntro) {
             $item->introtext = JHtml::_('content.prepare', $item->introtext);
         }
     }
     // Preprocess the breakdown of leading, intro and linked articles.
     // This makes it much easier for the designer to just interogate the arrays.
     $max = count($items);
     // The first group is the leading articles.
     $limit = $numLeading;
     for ($i = 0; $i < $limit && $i < $max; $i++) {
         $data->lead_items[$i] =& $items[$i];
     }
     // The second group is the intro articles.
     $limit = $numLeading + $numIntro;
     // Order articles across, then down (or single column mode)
     for ($i = $numLeading; $i < $limit && $i < $max; $i++) {
         $data->intro_items[$i] =& $items[$i];
     }
     $data->columns = max(1, $params->def('num_columns', 1));
     $order = $params->def('multi_column_order', 1);
     if ($order == 0 && $data->columns > 1) {
         // call order down helper
         $data->intro_items = ContentHelperQuery::orderDownColumns($data->intro_items, $data->columns);
     }
     // The remainder are the links.
     for ($i = $numLeading + $numIntro; $i < $max; $i++) {
         $data->link_items[$i] =& $items[$i];
     }
     $data->pagination = $this->getPagination();
     //Escape strings for HTML output
     $data->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     return $data;
 }
    /**
     *
     * Add an toolbar switch mode
     *
     * @param: String $icon suffix class
     * @param: String $text is string text of icon
     * @param: String $enmodeTitle is enmode title
     * @param: String $offmodeTitle is offmode title
     */
    public static function switchmode($icon = '', $text = '', $enmodeTitle = '', $offmodeTitle = '')
    {
        $params = JSNConfigHelper::get('com_poweradmin');
        $JSNMedia = JSNFactory::getMedia();
        JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jquery.context-help.js');
        $customScript = "\n\t\t(function(\$) {\n\t\t\tfunction getVisisblePosition () {\n\t\t\t\tvar listOffset = \$('#modules-list').offset();\n\t\t\t\tvar listScrollTop = \$('#modules-list').scrollTop();\n\n\t\t\t\tvar items = \$('.jsn-element-container_inner');\n\t\t\t\tvar minOffset = null;\n\t\t\t\tvar visibleItem = null;\n\n\t\t\t\titems.each(function () {\n\t\t\t\t\tvar element = \$(this);\n\t\t\t\t\tvar offsetTop = element.offset().top - listOffset.top;\n\n\t\t\t\t\tif (element.find('.poweradmin-module-item').size() == 0)\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\tif ((offsetTop > 0 && minOffset == null) || (offsetTop > 0 && minOffset > offsetTop)) {\n\t\t\t\t\t\tminOffset = offsetTop;\n\t\t\t\t\t\tvisibleItem = element;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn visibleItem;\n\t\t\t}\n\n\t\t\t\$(function () {\n\t\t\t\tvar helps =\n\t\t\t\t[{\n\t\t\t\t\t'element'\t: '#jsn-rawmode-leftcolumn .jsn-heading-panel-title:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_01', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '.jsn-menu-selector-container',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_02', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 130,\n\t\t\t\t\t'offset'\t: { left: 60, top: 65 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-leftcolumn .jsn-toggle-button:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_03', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 200,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-center .jsn-heading-panel-title:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_04', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 105,\n\t\t\t\t\t'offset'\t: { left: 20, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-rightcolumn .jsn-heading-panel-title:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_05', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-rightcolumn .jsn-toggle-button:eq(0)',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_06', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 85,\n\t\t\t\t\t'offset'\t: { left: 0, top: -37 }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-component-details',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_07', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 70,\n\t\t\t\t\t'offset'\t: { left: '50%', top: '40%' }\n\t\t\t\t}, {\n\t\t\t\t\t'element'\t: '#jsn-rawmode-center .jsn-toggle-button',\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_08', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'bottom',\n\t\t\t\t\t'width'\t\t: 300,\n\t\t\t\t\t'height'\t: 70,\n\t\t\t\t\t'offset'\t: { left: -5, top: -40 }\n\t\t\t\t}, {\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_09', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 250,\n\t\t\t\t\t'height'\t: 70,\n\t\t\t\t\t'refresh'\t: function (item) {\n\t\t\t\t\t\tvar visibleItem = getVisisblePosition();\n\t\t\t\t\t\tif (visibleItem == null)\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\titem.setLocation(visibleItem.offset().left + 220, visibleItem.offset().top + 5);\n\t\t\t\t\t}\n\t\t\t\t}, {\n\t\t\t\t\t'text'\t\t: '" . JText::_('JSN_POWERADMIN_CONTEXT_10', true) . "',\n\t\t\t\t\t'arrow'\t\t: 'top',\n\t\t\t\t\t'width'\t\t: 270,\n\t\t\t\t\t'height'\t: 160,\n\t\t\t\t\t'refresh'\t: function (item) {\n\t\t\t\t\t\tvar visibleItem = getVisisblePosition();\n\t\t\t\t\t\tif (visibleItem == null)\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\tvar elmOffset = null;\n\t\t\t\t\t\tvisibleItem.find('.poweradmin-module-item').each(function () {\n\t\t\t\t\t\t\tif (\$(this).css('display') != 'none') {\n\t\t\t\t\t\t\t\telmOffset = \$(this).offset();\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (elmOffset == null)\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\titem.setLocation(elmOffset.left + 100, elmOffset.top + 20);\n\t\t\t\t\t}\n\t\t\t\t}];\n\n\t\t\t\tvar contextHelp = new JSNContextHelp(helps, {});\n\t\t\t\tvar dismissHint = \$('<span/>', { 'id': 'dismiss-hint' }).appendTo(\$('#toolbar-switch-help-mode'));\n\t\t\t\tvar interval \t= null;\n\n\t\t\t\t\$('#toolbar-switch-help-mode')\n\t\t\t\t.unbind('turnoffmode')\n\t\t\t\t.bind('turnoffmode', function(){\n\t\t\t\t\tcontextHelp.hide();\n\t\t\t\t\tclearInterval(interval);\n\t\t\t\t})\n\t\t\t\t.unbind('turnonmode')\n\t\t\t\t.bind('turnonmode', function(){\n\t\t\t\t\tcontextHelp.show();\n\t\t\t\t\tinterval = setInterval(function () {\n\t\t\t\t\t\tif (\$('#toolbar-switch-help-mode').hasClass('turn-on') && \$('.ui-widget-overlay').size() > 0) {\n\t\t\t\t\t\t\t\$('#toolbar-switch-help-mode').click();\n\t\t\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 500);\n\t\t\t\t});\n\t\t\t});\n\t\t})(JoomlaShine.jQuery);\n\t\t";
        $JSNMedia->addScriptDeclaration($customScript);
        // Proceed first
        $_firstRunScript = '';
        if (intval(@$params->get('show_help_on_first_run', 1)) == 1) {
            $_firstRunScript = '
				if(!$.jStorage.get("sitemanager_run", false)){
					$.jStorage.set("sitemanager_show_help", true);
					_helpOff = true;
				}
			';
        }
        $JSNMedia->addScriptDeclaration('
			JoomlaShine.jQuery(function ($) {
				var _helpOff = false;
				' . $_firstRunScript . '
				if($.jStorage.get("sitemanager_show_help") ){
					var interval = setInterval(function () {
						if (jQuery(\'.ui-widget-overlay\').size() == 0) {
							jQuery(\'#toolbar-switch-help-mode\').click();
							clearInterval(interval);
						}
						if(_helpOff){
							$.jStorage.set("sitemanager_show_help", false);
						}
						$.jStorage.set("sitemanager_run", true);
					}, 500);
				}

			})
		');
        JSNFactory::localimport('helpers.html.toolbar.button.jsnswitchmode');
        $bar = JToolBar::getInstance('toolbar');
        // Add a standard button.
        $bar->appendButton('JSNSwitchmode', $icon, $text, $enmodeTitle, $offmodeTitle);
    }
 /**
  * This function to set an module to unpublish
  * 
  * @return: Change value in table of database
  */
 function unassign()
 {
     JSNFactory::localimport('libraries.joomlashine.modules');
     $moduleid = JRequest::getVar('moduleid', array(), 'post', 'array');
     $pages = JRequest::getVar('assignpages', array(), 'post', 'array');
     $unpublish_area = JRequest::getVar('unpublish_area', '');
     $count = count($moduleid);
     if ($count == 0) {
         JText::printf('MSG_AJAX_ERROR', JText::_('MSG_AJAX_MOVE_ERROR'));
         jexit();
     }
     $model = $this->getModel('assignpages');
     switch ($unpublish_area) {
         case 'all':
             for ($i = 0; $i < $count; $i++) {
                 $model->removeAll($moduleid[$i]);
             }
             if ($count == 1) {
                 JText::printf('MSG_AJAX_ASSIGNMENT_MODULE', '"' . JSNModules::getNameOfModule($moduleid) . '"', 'unassigned', 'from', 'All Pages');
             } else {
                 JText::printf('MSG_AJAX_MULTIPLE', $count, ' unassigned to all pages. ');
             }
             break;
         default:
         case 'one':
             for ($i = 0; $i < $count; $i++) {
                 $model->unassignPages($moduleid[$i], $pages);
             }
             if ($count == 1) {
                 JText::printf('MSG_AJAX_ASSIGNMENT_MODULE', '"' . JSNModules::getNameOfModule($moduleid[0]) . '"', 'unassigned', 'from', $model->getPageName($pages[0]));
             } else {
                 JText::printf('MSG_AJAX_MULTIPLE', $count, ' unassigned to this page. ');
             }
             break;
     }
     jexit();
 }
Beispiel #29
0
<?php

/*------------------------------------------------------------------------
# JSN PowerAdmin
# ------------------------------------------------------------------------
# author    JoomlaShine.com Team
# copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
# Websites: http://www.joomlashine.com
# Technical Support:  Feedback - http://www.joomlashine.com/joomlashine/contact-us.html
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @version $Id: module.php 15868 2012-09-06 09:35:41Z hiepnv $
-------------------------------------------------------------------------*/
//// no direct access
defined('_JEXEC') or die;
JSNFactory::import('components.com_modules.controllers.module');
JSNFactory::localimport('libraries.joomlashine.modules');
error_reporting(0);
class PoweradminControllerModule extends ModulesControllerModule
{
    /**
     * 
     * Redirect to edit module
     */
    public function edit()
    {
        $editId = JRequest::getVar('id', 0, 'int');
        $this->setRedirect('index.php?option=com_poweradmin&view=module&layout=edit&tmpl=component&id=' . $editId);
        $this->redirect();
    }
    /**
     * 
/**
 * @version     $Id$
 * @package     JSNPoweradmin
 * @subpackage  item
 * @author      JoomlaShine Team <*****@*****.**>
 * @copyright   Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
 * @license     GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.joomlashine.com
 * Technical Support:  Feedback - http://www.joomlashine.com/contact-us/get-support.html
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.menu');
JSNFactory::localimport('libraries.joomlashine.html');
JSNFactory::localimport('libraries.joomlashine.database');
/**
 * JSNMenuitems class
 *
 * @package		Joomla.Framework
 * @subpackage	com_poweradmin ( Power By JoomlaShine - joomlashine.com )
 * @since		1.6 - 1.7
 */
class JSNMenuitems extends JSNDatabase
{
    /** 
     * 
     * Array menu module
     * @param Array
     */
    protected $_menus = array();