Example #1
0
 /**
  * Constructor
  *
  * @param   array  $config  A named configuration array for object construction.
  */
 public function __construct($config = array())
 {
     // Display only the component output
     JFactory::getApplication()->input->def('tmpl', 'component');
     parent::__construct($config);
     // Load menu model
     $model = JSNBaseModel::getInstance('Menutypes', 'MenusModel');
     $this->setModel($model, true);
 }
Example #2
0
 /**
  * Constructor
  *
  * @param   array  $config  An array of configuration options.
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Load language manually
     $lang = JFactory::getLanguage();
     $lang->load('jsn_installer', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/joomlashine/installer');
     // Get application object
     $this->app = JFactory::getApplication();
     // Get input object
     $this->input = $this->app->input;
     // Get Joomla config
     $this->config = JFactory::getConfig();
 }
Example #3
0
 /**
  * Constructor
  *
  * @param   array  $config  A named configuration array for object construction.
  */
 public function __construct($config = array())
 {
     // Display only the component output
     JFactory::getApplication()->input->def('tmpl', 'component');
     parent::__construct($config);
     // Load category model
     $model = JSNBaseModel::getInstance('Categories', 'CategoriesModel');
     $this->setModel($model, true);
     // Include the component HTML helpers
     $this->addTemplatePath(dirname(__FILE__) . '/tmpl');
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
     // Load assets
     JSNBaseHelper::loadAssets();
     echo JSNHtmlAsset::loadScript('jsn/selectorFilter', array(), true);
 }
Example #4
0
 /**
  * Constructor
  *
  * @param   array  $config  An array of configuration options.
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Load language manually
     $lang = JFactory::getLanguage();
     $lang->load('jsn_installer', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/joomlashine/installer');
     // Get application object
     $this->app = JFactory::getApplication();
     // Get input object
     $this->input = $this->app->input;
     // Get Joomla config
     $this->config = JFactory::getConfig();
     require_once JPATH_COMPONENT_ADMINISTRATOR . "/helpers/uniform.php";
     JSNUniformHelper::convertTableSubmissions('update');
     JSNUniformHelper::convertTableSubmissionData('update');
 }
Example #5
0
 /**
  * Populate search and response results to client as json format
  * @return void
  */
 function json()
 {
     header("Cache-Control: no-cache, must-revalidate");
     // HTTP/1.1
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     $keyword = JRequest::getString('keyword');
     $coverages = array_map('trim', explode(',', JRequest::getString('coverages')));
     $dispatcher =& JDispatcher::getInstance();
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers/poweradmin.php';
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers/plugin.php';
     $params = JSNConfigHelper::get('com_poweradmin');
     $resultLimit = (int) $params->get('search_result_num', 10);
     //JRequest::setVar('limit', $resultLimit);
     // Load language
     JFactory::getLanguage()->load('plg_system_jsnpoweradmin');
     // Load model
     $model = JSNBaseModel::getInstance('Search', 'PowerAdminModel');
     $model->setState('search.keyword', $keyword);
     $model->setState('search.pagination', false);
     $installedComponents = PoweradminHelper::getInstalledComponents();
     $results = array();
     foreach ($coverages as $coverage) {
         if ($coverage == 'adminmenus') {
             continue;
         }
         $components = array();
         if ($coverage == 'components') {
             if (in_array('com_banners', $installedComponents)) {
                 $components['com_banners'] = array('com_banners', 'com_banners_categories', 'com_banners_clients');
             }
             if (in_array('com_contacts', $installedComponents)) {
                 $components['com_contacts'] = array('com_contacts', 'com_contacts_categories');
             }
             if (in_array('com_messages', $installedComponents)) {
                 $components['com_messages'] = array('com_messages');
             }
             if (in_array('com_newsfeeds', $installedComponents)) {
                 $components['com_newsfeeds'] = array('com_newsfeeds', 'com_newsfeeds_categories');
             }
             if (in_array('com_weblinks', $installedComponents)) {
                 $components['com_weblinks'] = array('com_weblinks', 'com_weblinks_categories');
             }
         }
         if (strpos($coverage, JSN_3RD_EXTENSION_STRING) !== false) {
             $_extName = explode(JSN_3RD_EXTENSION_STRING . "-", $coverage);
             $_extName = $_extName[1];
             if ($_extName && in_array('com_' . $_extName, $installedComponents)) {
                 JPluginHelper::importPlugin('jsnpoweradmin', $_extName);
                 $_range = $dispatcher->trigger('addSearchRange');
                 if (count($_range[0])) {
                     $components['com_' . strtolower($_extName)] = array();
                     foreach ($_range[0] as $key => $value) {
                         array_push($components['com_' . strtolower($_extName)], $key);
                     }
                 }
             } else {
                 continue;
             }
         }
         if (strpos($coverage, JSN_3RD_EXTENSION_NOT_INSTALLED_STRING) !== false) {
             $results[] = array('type' => 'notice', 'target' => 'index.php?option=com_poweradmin&view=configuration&s=maintainence&g=extensions', 'title' => JText::_('JSN_POWERADMIN_EXT_SPOTLIGHT_INSTALL_EXTENSION') . ' ' . str_ireplace(JSN_3RD_EXTENSION_NOT_INSTALLED_STRING . '-', 'com_', $coverage));
             continue;
         }
         if (strpos($coverage, JSN_3RD_EXTENSION_NOT_ENABLED_STRING) !== false) {
             $results[] = array('type' => 'notice', 'link' => 'index.php?option=com_poweradmin&view=configuration', 'title' => JText::_('JSN_POWERADMIN_EXT_SPOTLIGHT_ENABLE_EXTENSION') . ' ' . str_ireplace(JSN_3RD_EXTENSION_NOT_ENABLED_STRING . '-', 'com_', $coverage));
             continue;
         }
         if (!empty($components)) {
             foreach ($components as $key => $component) {
                 $componentResults = array();
                 $type = $component;
                 if (is_array($component)) {
                     $type = $key;
                     foreach ($component as $subsection) {
                         $model->setState('search.coverage', $subsection);
                         $componentResults = array_merge($componentResults, $model->getItems());
                     }
                 } else {
                     $model->setState('search.coverage', $component);
                     $componentResults = array_merge($componentResults, $model->getItems());
                 }
                 if (count($componentResults) > 0) {
                     $results[] = array('title' => JText::_('PLG_JSNADMINBAR_SEARCH_COVERAGE_' . strtoupper($type), true), 'description' => '', 'type' => $type, 'coverage' => $coverage);
                     $results = array_merge($results, $componentResults);
                 }
             }
             continue;
         }
         $model->setState('search.coverage', $coverage);
         $total = $model->getTotal();
         $items = $model->getItems();
         if (count($items) > 0) {
             $results[] = array('title' => JText::_('PLG_JSNADMINBAR_SEARCH_COVERAGE_' . strtoupper($coverage)), 'description' => '', 'type' => $coverage, 'coverage' => $coverage, 'hasMore' => $total - $resultLimit);
             $results = array_merge($results, $items);
         }
     }
     echo json_encode($results);
     jexit();
 }
Example #6
0
$framework = JTable::getInstance('Extension');
$framework->load(array('element' => 'jsnframework', 'type' => 'plugin', 'folder' => 'system'));
if ($framework->extension_id and !$framework->enabled) {
    try {
        // Enable our extension framework
        $framework->enabled = 1;
        $framework->store();
        // Execute handler for system event bypassed while our extension framework is disabled
        require_once JPATH_ROOT . '/plugins/system/jsnframework/jsnframework.php';
        $dispatcher = class_exists('JEventDispatcher', false) ? JEventDispatcher::getInstance() : JDispatcher::getInstance();
        $framework = new PlgSystemJSNFramework($dispatcher);
        $framework->onAfterInitialise();
    } catch (Exception $e) {
        JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
    }
}
// Get admin component directory
$path = dirname(__FILE__);
// Load constant definition file
require_once "{$path}/defines.pagebuilder.php";
// Import JoomlaShine base MVC classes
require_once "{$path}/libraries/joomlashine/base/model.php";
require_once "{$path}/libraries/joomlashine/base/view.php";
require_once "{$path}/libraries/joomlashine/base/controller.php";
// Setup necessary include paths
JTable::addIncludePath("{$path}/tables");
JSNBaseModel::addIncludePath("{$path}/models");
JSNBaseModel::addTablePath("{$path}/tables");
JHtml::addIncludePath("{$path}/elements/html");
// Load default language
!class_exists('JSNUtilsLanguage') or !method_exists('JSNUtilsLanguage', 'loadDefault') or JSNUtilsLanguage::loadDefault();
Example #7
0
 function getItems()
 {
     $params = $this->getState()->get('params');
     $limit = $this->getState('list.limit');
     if ($this->_articles === null && ($category = $this->getCategory())) {
         $model = JSNBaseModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
         $model->setState('params', $this->state->params);
         $model->setState('filter.category_id', $category->id);
         $model->setState('filter.published', $this->getState('filter.published'));
         $model->setState('filter.access', $this->getState('filter.access'));
         $model->setState('filter.language', $this->getState('filter.language'));
         $model->setState('list.ordering', $this->_buildContentOrderBy());
         $model->setState('list.start', $this->getState('list.start'));
         $model->setState('list.limit', $limit);
         $model->setState('list.direction', $this->getState('list.direction'));
         $model->setState('list.filter', $this->getState('list.filter'));
         // filter.subcategories indicates whether to include articles from subcategories in the list or blog
         $model->setState('filter.subcategories', $this->getState('filter.subcategories'));
         $model->setState('filter.max_category_levels', $this->setState('filter.max_category_levels'));
         $model->setState('list.links', $this->getState('list.links'));
         if ($limit >= 0) {
             $this->_articles = $model->getItems();
             if ($this->_articles === false) {
                 $this->setError($model->getError());
             }
         } else {
             $this->_articles = array();
         }
         $this->_pagination = $model->getPagination();
         $this->_data->pagination = $this->_pagination;
     }
     return $this->_articles;
 }
 public function __construct($config = array())
 {
     $this->app = JFactory::getApplication();
     parent::__construct($config);
 }