/** * Renders the submenu (toolbar links) for all detected views of this component * * @return void */ public function renderSubmenu() { parent::renderSubmenu(); $activeView = $this->input->getCmd('extension', ''); $this->appendLink(JText::_('COM_BABIOONEVENT_CATEGORIES'), 'index.php?option=com_categories&extension=com_babioonevent', 'com_babioonevent' == $activeView); $activeView = $this->input->getCmd('view', 'cpanel'); $this->appendLink(JText::_('COM_BABIOONEVENT_LIVEUPDATE'), 'index.php?option=com_babioonevent&view=liveupdate', 'liveupdate' == $activeView); }
public function onBrowse($tpl = null) { $model = $this->getModel(); $task = $model->getState('browse_task', 'normal'); // Add custom submenus $toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config); $toolbar->appendLink(JText::_('FILTERS_LABEL_NORMALVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=dbef&task=normal', $task == 'normal'); $toolbar->appendLink(JText::_('FILTERS_LABEL_TABULARVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=dbef&task=tabular', $task == 'tabular'); $media_folder = JURI::base() . '../media/com_akeeba/'; // Get the root URI for media files $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/')); // Get a JSON representation of the available roots $model = $this->getModel(); $root_info = $model->get_roots(); $roots = array(); if (!empty($root_info)) { // Loop all dir definitions foreach ($root_info as $def) { $roots[] = $def->value; $options[] = JHTML::_('select.option', $def->value, $def->text); } } $site_root = '[SITEDB]'; $attribs = 'onchange="akeeba_active_root_changed();"'; $this->assign('root_select', JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root')); $this->assign('roots', $roots); switch ($task) { case 'normal': default: $this->setLayout('default'); // Get a JSON representation of the database data $model = $this->getModel(); $json = json_encode($model->make_listing($site_root)); $this->assignRef('json', $json); break; case 'tabular': $this->setLayout('tabular'); // Get a JSON representation of the tabular filter data $model = $this->getModel(); $json = json_encode($model->get_filters($site_root)); $this->assignRef('json', $json); break; } // Add live help AkeebaHelperIncludes::addHelp('dbef'); // Get profile ID $profileid = AEPlatform::getInstance()->get_active_profile(); $this->assign('profileid', $profileid); // Get profile name if (!class_exists('AkeebaModelProfiles')) { JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR); } $model = new AkeebaModelProfiles(); $model->setId($profileid); $profile_data = $model->getProfile(); $this->assign('profilename', $profile_data->description); return true; }
public function renderSubmenu($vName = null) { if (is_null($vName)) { $vName = $this->input->getCmd('view', 'cpanel'); } $this->input->set('view', $vName); parent::renderSubmenu(); $toolbar = FOFToolbar::getAnInstance($this->input->getCmd('option', 'com_db8locate'), $this->config); $toolbar->appendLink(Jtext::_('COM_DB8LOCATE_SUBMENU_CATEGORIES'), 'index.php?option=com_categories&extension=com_db8locate', $vName == 'categories'); }
/** * Runs before rendering the view template, echoing HTML to put before the * view template's generated HTML * * @return void */ protected function preRender() { $view = $this->input->getCmd('view', 'cpanel'); $task = $this->getModel()->getState('task', 'browse'); // Don't load the toolbar on CLI if (!FOFPlatform::getInstance()->isCli()) { $toolbar = FOFToolbar::getAnInstance($this->input->getCmd('option', 'com_foobar'), $this->config); $toolbar->perms = $this->perms; $toolbar->renderToolbar($view, $task, $this->input); } $renderer = $this->getRenderer(); $renderer->preRender($view, $task, $this->input, $this->config); }
public function onDisplay($tpl = null) { $model = $this->getModel(); $task = $model->getState('task', 'components'); // Add submenus (those nifty text links below the toolbar!) $toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config); $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=components'; $toolbar->appendLink(JText::_('EXTFILTER_COMPONENTS'), $link, $task == 'components'); $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=modules'; $toolbar->appendLink(JText::_('EXTFILTER_MODULES'), $link, $task == 'modules'); $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=plugins'; $toolbar->appendLink(JText::_('EXTFILTER_PLUGINS'), $link, $task == 'plugins'); $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=languages'; $toolbar->appendLink(JText::_('EXTFILTER_LANGUAGES'), $link, $task == 'languages'); $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=templates'; $toolbar->appendLink(JText::_('EXTFILTER_TEMPLATES'), $link, $task == 'templates'); switch ($task) { case 'components': // Pass along the list of components $this->components = $model->getComponents(); break; case 'modules': // Pass along the list of components $this->modules = $model->getModules(); break; case 'plugins': // Pass along the list of components $this->plugins = $model->getPlugins(); break; case 'templates': // Pass along the list of components $this->templates = $model->getTemplates(); break; case 'languages': // Pass along the list of components $this->languages = $model->getLanguages(); break; } $this->setLayout($task); // Add live help AkeebaHelperIncludes::addHelp('extfilter'); // Get profile ID $profileid = AEPlatform::getInstance()->get_active_profile(); $this->profileid = $profileid; // Get profile name $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel'); $pmodel->setId($profileid); $profile_data = $pmodel->getItem(); $this->profilename = $profile_data->description; return true; }
/** * Displays the view * * @param string $tpl The template to use * * @return boolean|null False if we can't render anything */ public function display($tpl = null) { $model = $this->getModel(); // Get the form $this->form = $this->getModel()->getForm(); $this->form->setModel($model); $this->form->setView($this); // Get some useful information list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin(); // Get the task set in the model $task = $model->getState('task', 'browse'); // Call the relevant method $method_name = 'on' . ucfirst($task); if (method_exists($this, $method_name)) { $result = $this->{$method_name}($tpl); } else { $result = $this->onDisplay(); } // Bail out if we're told not to render anything if ($result === false) { return; } // Render the toolbar $toolbar = FOFToolbar::getAnInstance($this->input->getCmd('option', 'com_foobar'), $this->config); $toolbar->perms = $this->perms; $toolbar->renderToolbar($this->input->getCmd('view', 'cpanel'), $task, $this->input); // Show the view // -- Output HTML before the view template $this->preRender(); // -- Try to load a view template; if not exists render the form directly $basePath = $isAdmin ? 'admin:' : 'site:'; $basePath .= $this->config['option'] . '/'; $basePath .= $this->config['view'] . '/'; $path = $basePath . $this->getLayout(); if ($tpl) { $path .= '_' . $tpl; } $viewTemplate = $this->loadAnyTemplate($path); // If there was no template file found, display the form if ($viewTemplate instanceof Exception) { $viewTemplate = $this->getRenderedForm(); } // -- Output the view template echo $viewTemplate; // -- Output HTML after the view template $this->postRender(); }
/** * Renders the toolbar buttons * * @param string $view The active view name * @param string $task The current task * @param FOFInput $input The input object * @param array $config Extra configuration variables for the toolbar * * @return void */ protected function renderButtons($view, $task, $input, $config = array()) { if (FOFPlatform::getInstance()->isCli()) { return; } // Do not render buttons unless we are in the the frontend area and we are asked to do so $toolbar = FOFToolbar::getAnInstance($input->getCmd('option', 'com_foobar'), $config); $renderFrontendButtons = $toolbar->getRenderFrontendButtons(); if (FOFPlatform::getInstance()->isBackend() || !$renderFrontendButtons) { return; } $bar = JToolBar::getInstance('toolbar'); $items = $bar->getItems(); $substitutions = array('icon-32-new' => 'icon-plus', 'icon-32-publish' => 'icon-eye-open', 'icon-32-unpublish' => 'icon-eye-close', 'icon-32-delete' => 'icon-trash', 'icon-32-edit' => 'icon-edit', 'icon-32-copy' => 'icon-th-large', 'icon-32-cancel' => 'icon-remove', 'icon-32-back' => 'icon-circle-arrow-left', 'icon-32-apply' => 'icon-ok', 'icon-32-save' => 'icon-hdd', 'icon-32-save-new' => 'icon-repeat'); $html = array(); $html[] = '<div class="well" id="' . $bar->getName() . '">'; foreach ($items as $node) { $type = $node[0]; $button = $bar->loadButtonType($type); if ($button !== false) { if (method_exists($button, 'fetchId')) { $id = call_user_func_array(array(&$button, 'fetchId'), $node); } else { $id = null; } $action = call_user_func_array(array(&$button, 'fetchButton'), $node); $action = str_replace('class="toolbar"', 'class="toolbar btn"', $action); $action = str_replace('<span ', '<i ', $action); $action = str_replace('</span>', '</i>', $action); $action = str_replace(array_keys($substitutions), array_values($substitutions), $action); $html[] = $action; } } $html[] = '</div>'; echo implode("\n", $html); }
/** * Renders the toolbar buttons * * @param string $view The active view name * @param string $task The current task * @param FOFInput $input The input object * @param array $config Extra configuration variables for the toolbar * * @return void */ protected function renderButtons($view, $task, $input, $config = array()) { // On command line don't do anything if (FOFPlatform::getInstance()->isCli()) { return; } // Do not render buttons unless we are in the the frontend area and we are asked to do so $toolbar = FOFToolbar::getAnInstance($input->getCmd('option', 'com_foobar'), $config); $renderFrontendButtons = $toolbar->getRenderFrontendButtons(); if (FOFPlatform::getInstance()->isBackend() || !$renderFrontendButtons) { return; } // Load main backend language, in order to display toolbar strings // (JTOOLBAR_BACK, JTOOLBAR_PUBLISH etc etc) FOFPlatform::getInstance()->loadTranslations('joomla'); $title = JFactory::getApplication()->get('JComponentTitle'); $bar = JToolBar::getInstance('toolbar'); // Delete faux links, since if SEF is on, Joomla will follow the link instead of submitting the form $bar_content = str_replace('href="#"', '', $bar->render()); echo '<div id="FOFHeaderHolder">', $bar_content, $title, '<div style="clear:both"></div>', '</div>'; }
/** * Renders the submenu (link bar) for a category view when it is used in a * extension * * Note: this function has to be called from the addSubmenu function in * the ExtensionNameHelper class located in * administrator/components/com_ExtensionName/helpers/Extensionname.php * * Example Code: * * class ExtensionNameHelper * { * public static function addSubmenu($vName) * { * // Load FOF * include_once JPATH_LIBRARIES . '/fof/include.php'; * * if (!defined('FOF_INCLUDED')) * { * JError::raiseError('500', 'FOF is not installed'); * } * * if (version_compare(JVERSION, '3.0', 'ge')) * { * $strapper = new FOFRenderJoomla3; * } * else * { * $strapper = new FOFRenderJoomla; * } * * $strapper->renderCategoryLinkbar('com_babioonevent'); * } * } * * @param string $extension The name of the extension * @param array $config Extra configuration variables for the toolbar * * @return void */ public function renderCategoryLinkbar($extension, $config = array()) { // On command line don't do anything if (FOFPlatform::getInstance()->isCli()) { return; } // Do not render a category submenu unless we are in the the admin area if (!FOFPlatform::getInstance()->isBackend()) { return; } $toolbar = FOFToolbar::getAnInstance($extension, $config); $toolbar->renderSubmenu(); $this->renderLinkbarItems($toolbar); }
/** * Renders the toolbar buttons * * @param string $view The active view name * @param string $task The current task * @param FOFInput $input The input object * @param array $config Extra configuration variables for the toolbar * * @return void */ protected function renderButtons($view, $task, $input, $config = array()) { if (FOFPlatform::getInstance()->isCli()) { return; } // Do not render buttons unless we are in the the frontend area and we are asked to do so $toolbar = FOFToolbar::getAnInstance($input->getCmd('option', 'com_foobar'), $config); $renderFrontendButtons = $toolbar->getRenderFrontendButtons(); // Load main backend language, in order to display toolbar strings // (JTOOLBAR_BACK, JTOOLBAR_PUBLISH etc etc) FOFPlatform::getInstance()->loadTranslations('joomla'); if (FOFPlatform::getInstance()->isBackend() || !$renderFrontendButtons) { return; } $bar = JToolBar::getInstance('toolbar'); $items = $bar->getItems(); $substitutions = array('icon-32-new' => 'icon-plus', 'icon-32-publish' => 'icon-eye-open', 'icon-32-unpublish' => 'icon-eye-close', 'icon-32-delete' => 'icon-trash', 'icon-32-edit' => 'icon-edit', 'icon-32-copy' => 'icon-th-large', 'icon-32-cancel' => 'icon-remove', 'icon-32-back' => 'icon-circle-arrow-left', 'icon-32-apply' => 'icon-ok', 'icon-32-save' => 'icon-hdd', 'icon-32-save-new' => 'icon-repeat'); if (isset(JFactory::getApplication()->JComponentTitle)) { $title = JFactory::getApplication()->JComponentTitle; } else { $title = ''; } $html = array(); $actions = array(); // For BC we have to use the same id we're using inside other renderers (FOFHeaderHolder) //$html[] = '<div class="well" id="' . $bar->getName() . '">'; $html[] = '<div class="well" id="FOFHeaderHolder">'; $html[] = '<div class="titleHolder">' . $title . '</div>'; $html[] = '<div class="buttonsHolder">'; foreach ($items as $node) { $type = $node[0]; $button = $bar->loadButtonType($type); if ($button !== false) { if (method_exists($button, 'fetchId')) { $id = call_user_func_array(array(&$button, 'fetchId'), $node); } else { $id = null; } $action = call_user_func_array(array(&$button, 'fetchButton'), $node); $action = str_replace('class="toolbar"', 'class="toolbar btn"', $action); $action = str_replace('<span ', '<i ', $action); $action = str_replace('</span>', '</i>', $action); $action = str_replace(array_keys($substitutions), array_values($substitutions), $action); $actions[] = $action; } } $html = array_merge($html, $actions); $html[] = '</div>'; $html[] = '</div>'; echo implode("\n", $html); }
/** * Renders the link bar (submenu) using Joomla!'s default * JSubMenuHelper::addEntry method */ private function renderLinkbar() { // Do not render a submenu unless we are in the the admin area list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin(); if (!$isAdmin || $isCli) { return; } $toolbar = FOFToolbar::getAnInstance($this->input->getCmd('option', 'com_foobar'), $this->config); $links = $toolbar->getLinks(); if (!empty($links)) { foreach ($links as $link) { JSubMenuHelper::addEntry($link['name'], $link['link'], $link['active']); } } }
public function onBrowse($tpl = null) { $session = JFactory::getSession(); $task = $session->get('buadmin.task', 'default', 'akeeba'); if ($task != 'restorepoint') { $task = 'default'; } $aeconfig = AEFactory::getConfiguration(); // Add custom submenus if (AKEEBA_PRO) { $toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config); $toolbar->appendLink(JText::_('BUADMIN_LABEL_BACKUPS'), JURI::base() . 'index.php?option=com_akeeba&view=buadmin&task=browse', $task == 'default'); $toolbar->appendLink(JText::_('BUADMIN_LABEL_SRP'), JURI::base() . 'index.php?option=com_akeeba&view=buadmin&task=restorepoint', $task == 'restorepoint'); } if (AKEEBA_PRO && $task == 'default') { $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'restore', JText::_('DISCOVER'), 'index.php?option=com_akeeba&view=discover'); JToolBarHelper::publish('restore', JText::_('STATS_LABEL_RESTORE')); } if ($task == 'default') { JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_EDITCOMMENT')); $pModel = FOFModel::getTmpInstance('Profiles', 'AkeebaModel'); $enginesPerPprofile = $pModel->getPostProcessingEnginePerProfile(); $this->enginesPerProfile = $enginesPerPprofile; } JToolBarHelper::spacer(); // "Show warning first" download button. Joomlantastic! $confirmationText = AkeebaHelperEscape::escapeJS(JText::_('STATS_LOG_DOWNLOAD_CONFIRM'), "'\n"); $baseURI = JURI::base(); $js = <<<ENDSCRIPT function confirmDownloadButton() { \tvar answer = confirm('{$confirmationText}'); \tif(answer) submitbutton('download'); } function confirmDownload(id, part) { \tvar answer = confirm('{$confirmationText}'); \tvar newURL = '{$baseURI}'; \tif(answer) { \t\tnewURL += 'index.php?option=com_akeeba&view=buadmin&task=download&id='+id; \t\tif( part != '' ) newURL += '&part=' + part \t\twindow.location = newURL; \t} } ENDSCRIPT; $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $hash = 'akeebabuadmin'; // ...ordering $app = JFactory::getApplication(); $this->lists->set('order', $app->getUserStateFromRequest($hash . 'filter_order', 'filter_order', 'backupstart')); $this->lists->set('order_Dir', $app->getUserStateFromRequest($hash . 'filter_order_Dir', 'filter_order_Dir', 'DESC')); // ...filter state $this->lists->set('fltDescription', $app->getUserStateFromRequest($hash . 'filter_description', 'description', null)); $this->lists->set('fltFrom', $app->getUserStateFromRequest($hash . 'filter_from', 'from', null)); $this->lists->set('fltTo', $app->getUserStateFromRequest($hash . 'filter_to', 'to', null)); $this->lists->set('fltOrigin', $app->getUserStateFromRequest($hash . 'filter_origin', 'origin', null)); $this->lists->set('fltProfile', $app->getUserStateFromRequest($hash . 'filter_profile', 'profile', null)); $filters = $this->_getFilters(); $ordering = $this->_getOrdering(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/statistics.php'; $model = new AkeebaModelStatistics(); $list = $model->getStatisticsListWithMeta(false, $filters, $ordering); // Assign data to the view $this->lists = $this->lists; // Filter lists $this->list = $list; // Data $this->pagination = $model->getPagination($filters); // Pagination object // Add live help if ($task == 'restorepoint') { $this->setLayout('restorepoint'); AkeebaHelperIncludes::addHelp('restorepoint'); } else { AkeebaHelperIncludes::addHelp('buadmin'); } return true; }
public function onProfilesAdd() { parent::onAdd(); JToolBarHelper::title(JText::_('AKEEBA') . ': <small>' . JText::_('PROFILE_PAGETITLE_NEW') . '</small>', 'akeeba'); }
function onBrowse() { JToolBarHelper::preferences('com_spsimpleportfolio'); parent::onBrowse(); }
public function onBrowse($tpl = null) { $model = $this->getModel(); $task = $model->getState('browse_task', 'normal'); // Add custom submenus $toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config); $toolbar->appendLink(JText::_('FILTERS_LABEL_NORMALVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=fsfilter&task=normal', $task == 'normal'); $toolbar->appendLink(JText::_('FILTERS_LABEL_TABULARVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=fsfilter&task=tabular', $task == 'tabular'); $media_folder = JURI::base() . '../media/com_akeeba/'; // Get the root URI for media files $this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/'); // Get a JSON representation of the available roots $filters = AEFactory::getFilters(); $root_info = $filters->getInclusions('dir'); $roots = array(); $options = array(); if (!empty($root_info)) { // Loop all dir definitions foreach ($root_info as $dir_definition) { if (is_null($dir_definition[1])) { // Site root definition has a null element 1. It is always pushed on top of the stack. array_unshift($roots, $dir_definition[0]); } else { $roots[] = $dir_definition[0]; } $options[] = JHTML::_('select.option', $dir_definition[0], $dir_definition[0]); } } $site_root = $roots[0]; $attribs = 'onchange="akeeba_active_root_changed();"'; $this->root_select = JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root'); $this->roots = $roots; switch ($task) { case 'normal': default: $this->setLayout('default'); // Get a JSON representation of the directory data $model = $this->getModel(); $json = json_encode($model->make_listing($site_root, array(), '')); $this->json = $json; break; case 'tabular': $this->setLayout('tabular'); // Get a JSON representation of the tabular filter data $model = $this->getModel(); $json = json_encode($model->get_filters($site_root)); $this->json = $json; break; } // Add live help AkeebaHelperIncludes::addHelp('fsfilter'); // Get profile ID $profileid = AEPlatform::getInstance()->get_active_profile(); $this->profileid = $profileid; // Get profile name $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel'); $pmodel->setId($profileid); $profile_data = $pmodel->getItem(); $this->profilename = $profile_data->description; return true; }
function onBrowse() { JToolBarHelper::preferences('com_sppoll'); parent::onBrowse(); }
function __construct($config = array()) { parent::__construct($config); $this->renderFrontendButtons = true; }