Esempio n. 1
1
 /**
  * Method to get an array of data items.
  *
  * @return  array  An array of data items
  *
  * @since   12.2
  */
 public function getItems()
 {
     jimport('joomla.filesystem.folder');
     $items = array();
     $files = JFolder::files(JDeveloperArchive::getArchiveDir());
     $store = $this->getStoreId('getItems');
     foreach ($files as $file) {
         if (preg_match('/(^pkg_).*(.zip$)/', $file)) {
             $item = new JObject();
             $item->set('id', $file);
             $item->set('name', $file);
             $item->set('created', date("Y M d - H:i:s", filemtime(JDeveloperArchive::getArchiveDir() . DS . $file)));
             $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("pkg_", $item->name, $item->get("version", "1.0.0"));
             $content = array();
             if (!($zip = zip_open(JDeveloperArchive::getArchiveDir() . DS . $file))) {
                 throw new Exception("Failed to open {$file}");
             }
             while ($zip_entry = zip_read($zip)) {
                 if (preg_match('/.zip$/', zip_entry_name($zip_entry))) {
                     $content[] = zip_entry_name($zip_entry);
                 }
             }
             $item->set('content', implode('<br>', $content));
             $items[] = $item;
         }
     }
     // Add the items to the internal cache.
     $this->cache['packages'] = $items;
     return $this->cache['packages'];
 }
Esempio n. 2
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $input = JFactory::getApplication()->input;
     $input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'list menu');
     // If a new item, can save the item.  Allow users with edit permissions to apply changes to prevent returning to grid.
     if ($isNew && $this->canDo->get('core.create')) {
         if ($this->canDo->get('core.edit')) {
             JToolbarHelper::apply('menu.apply');
         }
         JToolbarHelper::save('menu.save');
     }
     // If user can edit, can save the item.
     if (!$isNew && $this->canDo->get('core.edit')) {
         JToolbarHelper::apply('menu.apply');
         JToolbarHelper::save('menu.save');
     }
     // If the user can create new items, allow them to see Save & New
     if ($this->canDo->get('core.create')) {
         JToolbarHelper::save2new('menu.save2new');
     }
     if ($isNew) {
         JToolbarHelper::cancel('menu.cancel');
     } else {
         JToolbarHelper::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER_EDIT');
 }
Esempio n. 3
0
 /**
  * Get property state value escaped.
  *
  * @param string $name property name
  * @return mized
  */
 public function getState($name)
 {
     if (isset($this->state)) {
         return $this->escape($this->state->get($this->getStateName($name)));
     }
     return null;
 }
Esempio n. 4
0
	/**
	 * @todo Implement test__toString().
	 */
	public function test__construct() {
		$this->object = new JObject(array('property1' => 'value1', 'property2' => 5));
		$this->assertThat(
			$this->object->get('property1'),
			$this->equalTo('value1')
		);
	}
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     $input = JFactory::getApplication()->input;
     $input->set('hidemainmenu', 1);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     JToolbarHelper::title(JText::_('COM_USERS_NOTES'), 'users user');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) {
         JToolbarHelper::apply('note.apply');
         JToolbarHelper::save('note.save');
     }
     if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) {
         JToolbarHelper::save2new('note.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count($user->getAuthorisedCategories('com_users', 'core.create')) > 0) {
         JToolbarHelper::save2copy('note.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('note.cancel');
     } else {
         if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
             JToolbarHelper::versions('com_users.note', $this->item->id);
         }
         JToolbarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_USERS_USER_NOTES_EDIT');
 }
Esempio n. 6
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->modules = $this->get('Modules');
     $this->levels = $this->get('ViewLevels');
     $this->state = $this->get('State');
     $this->canDo = JHelperContent::getActions('com_menus', 'menu', (int) $this->state->get('item.menutypeid'));
     // Check if we're allowed to edit this item
     // No need to check for create, because then the moduletype select is empty
     if (!empty($this->item->id) && !$this->canDo->get('core.edit')) {
         throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     if ($this->getLayout() == 'modal') {
         // If we are forcing a language in modal (used for associations).
         if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) {
             // Set the language field to the forcedLanguage and disable changing it.
             $this->form->setValue('language', null, $forcedLanguage);
             $this->form->setFieldAttribute('language', 'readonly', 'true');
             // Only allow to select categories with All language or with the forced language.
             $this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage);
         }
     } elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() && count($this->item->associations) > 0) {
         $this->form->setFieldAttribute('language', 'readonly', 'true');
     }
     parent::display($tpl);
     $this->addToolbar();
 }
Esempio n. 7
0
 protected function addToolbar()
 {
     $state = $this->get('State');
     JToolBarHelper::title(JText::_('COM_XMAP_SITEMAPS_TITLE'), 'list');
     $canDo = JHelperContent::getActions('com_xmap', 'sitemap');
     JToolBarHelper::addNew('sitemap.add');
     JToolbarHelper::editList('sitemap.edit');
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::publish('sitemaps.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('sitemaps.unpublish', 'JTOOLBAR_UNPUBLISH', true);
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'sitemaps.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('sitemaps.trash');
     }
     if ($canDo->get('core.manage')) {
         JToolbarHelper::custom('sitemaps.ping', 'heart', 'heart', JText::_('COM_XMAP_TOOLBAR_PING'));
     }
     if (JFactory::getUser()->authorise('core.admin')) {
         JToolbarHelper::preferences('com_xmap');
     }
     if (JHelperContent::getActions('com_plugins')->get('core.edit.state')) {
         JToolbarHelper::custom('sitemaps.plugins', 'power-cord', 'power-cord', JText::_('COM_XMAP_TOOLBAR_PLUGINS'), false);
     }
     JHtmlSidebar::setAction('index.php?option=com_xmap&view=sitemaps');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', XmapHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
     $this->sidebar = JHtmlSidebar::render();
 }
Esempio n. 8
0
 /**
  * @param null $tpl
  *
  * @return bool
  * @throws Exception
  */
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     $this->item = $this->get('Item');
     $this->items = $this->get('Items');
     $this->sitemapItems = $this->get('SitemapItems');
     $this->extensions = $this->get('Extensions');
     $input = JFactory::getApplication()->input;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $app = JFactory::getApplication();
     $app->clearHeaders();
     $app->setHeader('Content-Type', 'application/xml; charset=UTF-8');
     $app->sendHeaders();
     $this->displayer = new XmapDisplayerXml($this->item, $this->items, $this->extensions);
     $this->displayer->displayAsNews($input->getBool('news'));
     $this->displayer->displayAsImages($input->getBool('images'));
     $this->displayer->displayAsVideos($input->getBool('videos'));
     $this->displayer->displayAsMobile($input->getBool('mobile'));
     $this->displayer->setSitemapItems($this->sitemapItems);
     parent::display($tpl);
     $this->getModel()->hit($this->displayer->getCount());
     $app->close();
 }
Esempio n. 9
0
    protected function addSidebar() {
        JHtmlSidebar::setAction('index.php?option=com_prp&view=tables');

        JHtmlSidebar::addFilter(
            JText::_('JOPTION_SELECT_AUTHOR'),
            'filter_user', 
            JHtml::_(
                'select.options', 
                $this->get('Users'), 
                'value', 
                'text', 
                $this->state->get('filter.user'), 
                false
            )
        );

        JHtmlSidebar::addFilter(
            JText::_('JOPTION_SELECT_PUBLISHED'),
            'filter_state', 
            JHtml::_(
                'select.options', 
                JHtml::_('jgrid.publishedOptions'), 
                'value', 
                'text', 
                $this->state->get('filter.state'), 
                true
            )
        );
        
        return JHtmlSidebar::render();
    }
Esempio n. 10
0
 /**
  * Complet access to edit. Can edit/can edit own/isn't checked.
  *
  * @param JObject $document has to contain id, created_by and checked_out paramters
  * @return boolean
  */
 public static function canEdit(&$document)
 {
     $canEdit = JoomDOCAccessDocument::edit($document->get('id'));
     $canEditOwn = JoomDOCAccessDocument::editOwn($document->get('id'), $document->get('created_by'));
     // document isn't checked or is checked by current user
     $isNotChecked = $document->get('checked_out') == 0 || $document->get('checked_out') == JFactory::getUser()->id;
     return ($canEdit || $canEditOwn) && $isNotChecked;
 }
Esempio n. 11
0
 /**
  * {@inheritdoc}
  *
  * @param   mixed $data              Field data
  * @param   bool  $loadExtraData     Load extra data flag
  * @param   bool  $loadParent        Load parent flag
  * @param   bool  $fetchTranslations If the translation have to be loaded
  */
 public function __construct($data, $loadExtraData = true, $loadParent = false, $fetchTranslations = false)
 {
     parent::__construct($data);
     $data = new JObject($data);
     if ($loadParent) {
         $this->table = $data->get('table') == null ? NenoContentElementTable::load($data->get('tableId'), $loadExtraData, $loadParent) : $data->get('table');
     }
     $this->translations = null;
     if (!$this->isNew() && $loadExtraData) {
         $this->getWordCount();
     }
 }
Esempio n. 12
0
 /**
  * Display page with licenses browse table.
  *
  * @param $tpl used template
  * @return void
  */
 public function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JAdministrator */
     $this->getModel()->setState(JOOMDOC_FILTER_KEYWORDS, $mainframe->getUserStateFromRequest('joomdoc_licenses_filter', 'filter', '', 'string'));
     $this->licenses = $this->get('items');
     $this->state = $this->get('state');
     $this->filter = $this->state->get('filter');
     $this->pagination = new JPagination($this->get('total'), $this->state->get(JOOMDOC_FILTER_START), $this->state->get(JOOMDOC_FILTER_LIMIT));
     $this->addToolbar();
     JoomDOCHelper::setSubmenu(JOOMDOC_LICENSES);
     parent::display($tpl);
 }
Esempio n. 13
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JToolbarHelper::title(JText::sprintf('COM_USERS_VIEW_DEBUG_GROUP_TITLE', $this->group->id, $this->group->title), 'users groups');
     JToolbarHelper::help('JHELP_USERS_DEBUG_GROUPS');
     JHtmlSidebar::setAction('index.php?option=com_users&view=debuggroup&user_id=' . (int) $this->state->get('filter.user_id'));
     $option = '';
     if (!empty($this->components)) {
         $option = JHtml::_('select.options', $this->components, 'value', 'text', $this->state->get('filter.component'));
     }
     JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_SELECT_COMPONENT'), 'filter_component', $option);
     JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_SELECT_LEVEL_START'), 'filter_level_start', JHtml::_('select.options', $this->levels, 'value', 'text', $this->state->get('filter.level_start')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_SELECT_LEVEL_END'), 'filter_level_end', JHtml::_('select.options', $this->levels, 'value', 'text', $this->state->get('filter.level_end')));
 }
Esempio n. 14
0
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     JToolBarHelper::title(JText::_('COM_USERS_VIEW_NOTES_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('note.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('note.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('notes.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('notes.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('notes.archive');
         JToolBarHelper::checkin('notes.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('notes.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_users');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_USERS_USER_NOTES');
 }
Esempio n. 15
0
 /**
  * Get the alternate title for the module
  *
  * @param   JObject  $params  The module parameters.
  *
  * @return  string	The alternate title for the module.
  */
 public static function getTitle($params)
 {
     $who = $params->get('user_id');
     $catid = (int) $params->get('catid');
     if ($catid) {
         $category = JCategories::getInstance('Content')->get($catid);
         if ($category) {
             $title = $category->title;
         } else {
             $title = JText::_('MOD_POPULAR_UNEXISTING');
         }
     } else {
         $title = '';
     }
     return JText::plural('MOD_POPULAR_TITLE' . ($catid ? "_CATEGORY" : '') . ($who != '0' ? "_{$who}" : ''), (int) $params->get('count'), $title);
 }
Esempio n. 16
0
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     $canDo = JHelperContent::getActions('com_users', 'category', $this->state->get('filter.category_id'));
     JToolbarHelper::title(JText::_('COM_USERS_VIEW_NOTES_TITLE'), 'users user');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('note.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('note.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::divider();
         JToolbarHelper::publish('notes.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('notes.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolbarHelper::divider();
         JToolbarHelper::archiveList('notes.archive');
         JToolbarHelper::checkin('notes.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolbarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('notes.trash');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_users');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_USERS_USER_NOTES');
     JHtmlSidebar::setAction('index.php?option=com_users&view=notes');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_users'), 'value', 'text', $this->state->get('filter.category_id')));
 }
Esempio n. 17
0
 /**
  * Display page with folder content.
  *
  * @param $tpl used template
  * @return void
  */
 public function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JAdministrator */
     $config = JoomDOCConfig::getInstance();
     /* @var $config JoomDOCConfig */
     $model = $this->getModel();
     /* @var $model JoomDOCModelDocuments */
     $document = JFactory::getDocument();
     /* @var $document JDocumentHTML */
     if ($this->getLayout() != 'modal') {
         //$mainframe->enqueueMessage(JText::_('JOOMDOC_KEEP_FLAT'));
     }
     // relative path from request or user session
     $path = JoomDOCRequest::getPath();
     if ($path == JText::_('JOOMDOC_ROOT')) {
         $path = '';
     }
     // convert to absolute path
     $path = JoomDOCFileSystem::getFullPath($path);
     //if folder not exists (e.g. was renamed), fallback to root
     if (!JFolder::exists($path)) {
         $path = JoomDOCFileSystem::getFullPath('');
     }
     $this->filter = $mainframe->getUserStateFromRequest(JoomDOCRequest::getSessionPrefix() . 'filter', 'filter', '', 'string');
     $this->root = JoomDOCFileSystem::getFolderContent($path, '');
     // control if select folder is subfolder of docroot
     if ((!JoomDOCFileSystem::isSubFolder($path, $config->docroot) || $this->root === false) && $config->docroot !== false) {
         JError::raiseError(403, JText::_('JOOMDOC_UNABLE_ACCESS_FOLDER'));
     }
     // search filter setting
     $this->search = new JObject();
     $this->search->keywords = $this->filter;
     // search areas (search everywhere - don't use frontend detail setting)
     $this->search->areaTitle = $this->search->areaText = $this->search->areaFull = true;
     $this->search->areaMeta = false;
     // looking for any word
     $this->search->type = JOOMDOC_SEARCH_ANYKEY;
     $model->setState(JoomDOCView::getStateName(JOOMDOC_FILTER_PATHS), $this->root->getPaths());
     $model->setState(JoomDOCView::getStateName(JOOMDOC_FILTER_SEARCH), $this->search);
     $model->setState(JOOMDOC_FILTER_STATE, $mainframe->getUserStateFromRequest(JoomDOCRequest::getSessionPrefix() . 'state', 'state', JOOMDOC_STATE_PUBLISHED, 'int'));
     $this->documents = $model->getItems();
     $this->state = $model->getState();
     $this->pagination = new JPagination($model->getTotal(), $this->state->get(JOOMDOC_FILTER_START), $this->state->get(JOOMDOC_FILTER_LIMIT));
     $this->access = new JoomDOCAccessHelper($this->root);
     $this->root->setDocuments($this->documents);
     $this->root->reorder($this->state->get(JOOMDOC_FILTER_ORDERING), $this->state->get(JOOMDOC_FILTER_ORDERING), $this->state->get(JOOMDOC_FILTER_DIRECTION), $this->pagination->limitstart, $this->pagination->limit, $this->pagination->total, $config->foldersFirstAdmin);
     // control permissions to access folder
     if (!$this->access->canEnterFolder) {
         $mainframe->setUserState('joomdoc_documents_path', null);
         JError::raiseError(403, JText::_('JOOMDOC_UNABLE_ACCESS_FOLDER'));
     }
     $this->addToolbar();
     JoomDOCHelper::setSubmenu(JOOMDOC_DOCUMENTS, true);
     JoomDOCHelper::clipboardInfo();
     JoomDOCHelper::folderInfo($this->access->absolutePath);
     parent::display($tpl);
 }
Esempio n. 18
0
 /**
  * Get the alternate title for the module
  *
  * @param   JObject  $params  The module parameters.
  * @param   JObject  $module  The module.
  *
  * @return  string	The alternate title for the module.
  */
 public static function getTitle($params, $module)
 {
     $key = $params->get('context', 'mod_quickicon') . '_title';
     if (JFactory::getLanguage()->hasKey($key)) {
         return JText::_($key);
     } else {
         return $module->title;
     }
 }
Esempio n. 19
0
 function _imgButton()
 {
     $link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name=pvi';
     JHTML::_('behavior.modal');
     $button = new JObject();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', JText::_('Image'));
     $button->set('name', 'image');
     $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
     $modal = $button->get('modal') ? 'class="modal-button"' : null;
     $href = $button->get('link') ? 'href="' . $button->get('link') . '"' : null;
     $onclick = $button->get('onclick') ? 'onclick="' . $button->get('onclick') . '"' : null;
     return "<div class=\"button2-left\"><div class=\"" . $button->get('name') . "\"><a " . $modal . " title=\"" . $button->get('text') . "\" " . $href . " " . $onclick . " rel=\"" . $button->get('options') . "\">" . $button->get('text') . "</a></div></div>\n";
 }
Esempio n. 20
0
 /**
  * Method to get model state variables
  *
  * @param   string  $property  Optional parameter name
  * @param   mixed   $default   Optional default value
  *
  * @return  mixed  The property where specified, the state object where omitted
  *
  * @since   12.2
  */
 public function getState($property = null, $default = null)
 {
     if (!$this->__state_set) {
         // Protected method to auto-populate the model state.
         $this->populateState();
         // Set the model state set flag to true.
         $this->__state_set = true;
     }
     return $property === null ? $this->state : $this->state->get($property, $default);
 }
Esempio n. 21
0
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     JToolBarHelper::title(JText::_('COM_XMAP_PAGE_' . ($isNew ? 'ADD_SITEMAP' : 'EDIT_SITEMAP')), 'list');
     if ($isNew && $this->canDo->get('core.create')) {
         JToolBarHelper::apply('sitemap.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('sitemap.save', 'JTOOLBAR_SAVE');
         JToolBarHelper::save2new('sitemap.save2new');
     } else {
         if ($this->canDo->get('core.edit') || $this->canDo->get('core.edit.own')) {
             JToolBarHelper::apply('sitemap.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('sitemap.save', 'JTOOLBAR_SAVE');
         }
     }
     if ($this->canDo->get('core.create')) {
         JToolBarHelper::save2copy('sitemap.save2copy');
     }
     JToolBarHelper::cancel('sitemap.cancel', 'JTOOLBAR_CLOSE');
 }
Esempio n. 22
0
 /**
  * @param null $tpl
  *
  * @return bool
  */
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     $this->item = $this->get('Item');
     $this->items = $this->get('Items');
     $this->extensions = $this->get('Extensions');
     $this->canEdit = JFactory::getUser()->authorise('core.edit', 'com_xmap.sitemap.' . $this->item->id);
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->displayer = new XmapDisplayerHtml($this->item, $this->items, $this->extensions);
     $this->displayer->setCanEdit($this->canEdit);
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     parent::display($tpl);
     $this->getModel()->hit($this->displayer->getCount());
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $menutypeId = (int) $this->state->get('menutypeid');
     $canDo = JHelperContent::getActions('com_menus', 'menu', (int) $menutypeId);
     $user = JFactory::getUser();
     // Get the menu title
     $menuTypeTitle = $this->get('State')->get('menutypetitle');
     // Get the toolbar object instance
     $bar = JToolbar::getInstance('toolbar');
     if ($menuTypeTitle) {
         JToolbarHelper::title(JText::sprintf('COM_MENUS_VIEW_ITEMS_MENU_TITLE', $menuTypeTitle), 'list menumgr');
     } else {
         JToolbarHelper::title(JText::_('COM_MENUS_VIEW_ITEMS_ALL_TITLE'), 'list menumgr');
     }
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('item.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('item.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::publish('items.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('items.unpublish', 'JTOOLBAR_UNPUBLISH', true);
     }
     if (JFactory::getUser()->authorise('core.admin')) {
         JToolbarHelper::checkin('items.checkin', 'JTOOLBAR_CHECKIN', true);
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::makeDefault('items.setDefault', 'COM_MENUS_TOOLBAR_SET_HOME');
     }
     if (JFactory::getUser()->authorise('core.admin')) {
         JToolbarHelper::custom('items.rebuild', 'refresh.png', 'refresh_f2.png', 'JToolbar_Rebuild', false);
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_menus') && $user->authorise('core.edit', 'com_menus') && $user->authorise('core.edit.state', 'com_menus')) {
         $title = JText::_('JTOOLBAR_BATCH');
         // Instantiate a new JLayoutFile instance and render the batch button
         $layout = new JLayoutFile('joomla.toolbar.batch');
         $dhtml = $layout->render(array('title' => $title));
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'items.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('items.trash');
     }
     if ($canDo->get('core.admin') || $canDo->get('core.options')) {
         JToolbarHelper::divider();
         JToolbarHelper::preferences('com_menus');
     }
     JToolbarHelper::help('JHELP_MENUS_MENU_ITEM_MANAGER');
 }
Esempio n. 24
0
    public function display($tpl = null) {

        switch ($this->getLayout()) {
            case 'export':
                $this->item = $this->get('Item');
                $this->loadExportData($this->item->get('table'));
                $this->addToolbar('export');
                break;
            default:
                $this->item = $this->get('Item');
                $this->form = $this->get('Form');
                $this->addToolbar();
                break;
        }

        if (count($errors = $this->get('Errors'))) {
            JError::raiseError(500, implode("\n", $errors));
            return false;
        }

        parent::display($tpl);
    }
Esempio n. 25
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->modules = $this->get('Modules');
     $this->levels = $this->get('ViewLevels');
     $this->state = $this->get('State');
     $this->canDo = JHelperContent::getActions('com_menus', 'menu', (int) $this->state->get('item.menutypeid'));
     // Check if we're allowed to edit this item
     // No need to check for create, because then the moduletype select is empty
     if (!empty($this->item->id) && !$this->canDo->get('core.edit')) {
         throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     parent::display($tpl);
     $this->addToolbar();
 }
Esempio n. 26
0
 function install()
 {
     // Component installed successfully
     LinkrInstaller::msg('Installing Linkr component... Done!', 'green');
     // Get installer object
     $i =& $GLOBALS['LINKR_INSTALLER'];
     if (!is_object($i)) {
         LinkrInstaller::msg('Could not find Installer object...', 'blue');
         LinkrInstaller::dlMsg('the button and plugin');
         return LinkrInstaller::printInMsg(true);
     }
     // Get manifest file details
     $c = new JObject();
     $c->set('path.source', $i->parent->getPath('source'));
     $c->set('path.manifest', $i->parent->getPath('manifest'));
     $c->set('path.root', $i->parent->getPath('extension_root'));
     $c->set('path.site', $i->parent->getPath('extension_site'));
     $c->set('path.admin', $i->parent->getPath('extension_administrator'));
     // Install button
     $base = $i->parent->getPath('source');
     $source = $base . DS . 'plg.linkr_button';
     LinkrInstaller::iPlugin($i->parent, $source, 'linkr_button', 'editors-xtd', 'Linkr button');
     // Install plugin
     $source = $base . DS . 'plg.linkr_content';
     LinkrInstaller::iPlugin($i->parent, $source, 'linkr_content', 'content', 'Linkr plugin');
     // Default CSS
     LinkrInstaller::setDefaultCSS($i);
     // Reset manifest file
     $i->parent->set('message', '');
     $i->parent->setPath('source', $c->get('path.source'));
     $i->parent->setPath('manifest', $c->get('path.manifest'));
     $i->parent->setPath('extension_root', $c->get('path.root'));
     $i->parent->setPath('extension_site', $c->get('path.site'));
     $i->parent->setPath('extension_administrator', $c->get('path.admin'));
     // Installation complete
     return LinkrInstaller::printInMsg(true);
 }
Esempio n. 27
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = JHelperContent::getActions('com_newsfeeds', 'category', $state->get('filter.category_id'));
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'feed newsfeeds');
     if (count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
         JToolbarHelper::addNew('newsfeed.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('newsfeed.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::publish('newsfeeds.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('newsfeeds.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolbarHelper::archiveList('newsfeeds.archive');
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::checkin('newsfeeds.checkin');
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_newsfeeds') && $user->authorise('core.edit', 'com_newsfeeds') && $user->authorise('core.edit.state', 'com_newsfeeds')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         // Instantiate a new JLayoutFile instance and render the batch button
         $layout = new JLayoutFile('joomla.toolbar.batch');
         $dhtml = $layout->render(array('title' => $title));
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('newsfeeds.trash');
     }
     if ($user->authorise('core.admin', 'com_newsfeeds')) {
         JToolbarHelper::preferences('com_newsfeeds');
     }
     JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
     JHtmlSidebar::setAction('index.php?option=com_newsfeeds&view=newsfeeds');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_newsfeeds'), 'value', 'text', $this->state->get('filter.category_id')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_TAG'), 'filter_tag', JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')));
 }
Esempio n. 28
0
 /**
  * Builds the XML structure to export.
  *
  * @return  array  An array of XML lines (strings).
  *
  * @since   11.1
  * @throws  Exception if an error occurs.
  */
 protected function buildXmlStructure()
 {
     $buffer = array();
     $query = $this->db->getQuery(true);
     foreach ($this->from as $table) {
         // Replace the magic prefix if found.
         $table = $this->getGenericTableName($table);
         /*
          * Table structure
          */
         // Get the details columns information.
         $fields = $this->db->getTableColumns($table, false);
         $keys = $this->db->getTableKeys($table);
         $buffer[] = '  <table_structure name="' . $table . '">';
         foreach ($fields as $field) {
             $buffer[] = '   <field' . ' Field="' . $field->Field . '"' . ' Type="' . $field->Type . '"' . ' Null="' . $field->Null . '"' . ' Key="' . $field->Key . '"' . (isset($field->Default) ? ' Default="' . $field->Default . '"' : '') . ' Extra="' . $field->Extra . '"' . ' Comment="' . htmlspecialchars($field->Comment) . '"' . ' />';
         }
         foreach ($keys as $key) {
             $buffer[] = '   <key' . ' Table="' . $table . '"' . ' Non_unique="' . $key->Non_unique . '"' . ' Key_name="' . $key->Key_name . '"' . ' Seq_in_index="' . $key->Seq_in_index . '"' . ' Column_name="' . $key->Column_name . '"' . ' Collation="' . $key->Collation . '"' . ' Null="' . $key->Null . '"' . ' Index_type="' . $key->Index_type . '"' . ' Comment="' . htmlspecialchars($key->Comment) . '"' . ' />';
         }
         $buffer[] = '  </table_structure>';
         /*
          * Table data
          */
         if (!$this->options->get('with-data')) {
             continue;
         }
         $query->clear()->from($this->db->quoteName($table))->select('*');
         $rows = $this->db->setQuery($query)->loadObjectList();
         $buffer[] = '  <table_data name="' . $table . '">';
         foreach ($rows as $row) {
             $buffer[] = '    <row>';
             foreach ($row as $fieldName => $fieldValue) {
                 $buffer[] = '      <field' . ' name="' . $fieldName . '">' . htmlspecialchars($fieldValue) . '</field>';
             }
             $buffer[] = '    </row>';
         }
         $buffer[] = '  </table_data>';
     }
     return $buffer;
 }
Esempio n. 29
0
 function _setData()
 {
     $mainframe =& JFactory::getApplication();
     if ($mainframe->isSite()) {
         $params = $mainframe->getParams('com_rsticketspro');
     } else {
         $params = new JObject();
     }
     $post = JRequest::get('post');
     if (RSTicketsProHelper::getConfig('allow_rich_editor')) {
         $post['message'] = JRequest::getVar('message', '', 'post', 'none', JREQUEST_ALLOWHTML);
     } else {
         $post['message'] = JRequest::getVar('message', '', 'post', 'none', JREQUEST_ALLOWRAW);
     }
     $post['department_id'] = JRequest::getInt('department_id', $params->get('department_id', 0));
     if (!empty($post['department_id']) && empty($post['priority_id'])) {
         $this->_db->setQuery("SELECT priority_id FROM #__rsticketspro_departments WHERE id='" . (int) $post['department_id'] . "'");
         $post['priority_id'] = $this->_db->loadResult();
     }
     $this->_data = $post;
 }
Esempio n. 30
0
 /**
  * Method to get data from a registered model or a property of the view
  *
  * @param   string  $property  The name of the method to call on the model or the property to get
  * @param   string  $default   The name of the model to reference or the default value [optional]
  *
  * @return  mixed  The return value of the method
  *
  * @since   12.2
  */
 public function get($property, $default = null)
 {
     // If $model is null we use the default model
     if (is_null($default)) {
         $model = $this->_defaultModel;
     } else {
         $model = strtolower($default);
     }
     // First check to make sure the model requested exists
     if (isset($this->_models[$model])) {
         // Model exists, let's build the method name
         $method = 'get' . ucfirst($property);
         // Does the method exist?
         if (method_exists($this->_models[$model], $method)) {
             // The method exists, let's call it and return what we get
             $result = $this->_models[$model]->{$method}();
             return $result;
         }
     }
     // Degrade to JObject::get
     $result = parent::get($property, $default);
     return $result;
 }