public function onBrowse($tpl = null) { AkeebaStrapper::addJSfile('media://com_akeeba/js/fsfilter.js'); $model = $this->getModel(); $task = $model->getState('browse_task', 'normal'); // Add custom submenus $toolbar = F0FToolbar::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 = Factory::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.Fsfilters.activeRootChanged();"'; $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; } // Get profile ID $profileid = Platform::getInstance()->get_active_profile(); $this->profileid = $profileid; // Get profile name $pmodel = F0FModel::getAnInstance('Profiles', 'AkeebaModel'); $pmodel->setId($profileid); $profile_data = $pmodel->getItem(); $this->profilename = $this->escape($profile_data->description); return true; }
public static function addSubmenu($vName) { if (!defined('F0F_INCLUDED')) { include_once JPATH_ADMINISTRATOR . '/components/com_j2store/fof/include.php'; } return F0FToolbar::getAnInstance('com_j2store')->j2storeHelperRenderSubmenu($vName); }
public function onBrowse($tpl = null) { AkeebaStrapper::addJSfile('media://com_akeeba/js/fsfilter.js'); AkeebaStrapper::addJSfile('media://com_akeeba/js/dbef.js'); $model = $this->getModel(); $task = $model->getState('browse_task', 'normal'); // Add custom submenus $toolbar = F0FToolbar::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->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.Dbfilters.activeRootChanged ();"'; $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 database data $model = $this->getModel(); $json = json_encode($model->make_listing($site_root)); $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; } // Get profile ID $profileid = Platform::getInstance()->get_active_profile(); $this->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->profilename = $this->escape($profile_data->description); return true; }
/** * 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 (!F0FPlatform::getInstance()->isCli()) { $toolbar = F0FToolbar::getAnInstance($this->input->getCmd('option', 'com_foobar'), $this->config); $toolbar->perms = $this->perms; $toolbar->renderToolbar($view, $task, $this->input); } if (F0FPlatform::getInstance()->isFrontend()) { if ($this->setFrontendPageTitle) { $this->setPageTitle(); } } $renderer = $this->getRenderer(); $renderer->preRender($view, $task, $this->input, $this->config); }
/** * 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 (!F0FPlatform::getInstance()->isCli()) { $toolbar = F0FToolbar::getAnInstance($this->input->getCmd('option', 'com_foobar'), $this->config); // Channel Restriction if (AUTOTWEETNG_FREE && ($view == 'channels' || $view == 'channel')) { $channels = F0FModel::getTmpInstance('Channels', 'AutoTweetModel'); $c = $channels->getTotal(); if ($c >= 2) { $this->perms->create = false; $toolbar->perms->create = false; } } if (!AUTOTWEETNG_JOOCIAL && ($view == 'feeds' || $view == 'feed')) { $feeds = F0FModel::getTmpInstance('Feeds', 'AutoTweetModel'); $c = $feeds->getTotal(); if ($c >= 2) { $this->perms->create = false; $toolbar->perms->create = false; } } // --- $toolbar->renderToolbar($view, $task, $this->input); } $renderer = $this->getRenderer(); if (!$renderer instanceof F0FRenderAbstract) { $this->renderLinkbar(); } else { $renderer->preRender($view, $task, $this->input, $this->config); } $freeFlavour = VersionHelper::isFreeFlavour(); $update_dlid = EParameter::getComponentParam(CAUTOTWEETNG, 'update_dlid'); $needsdlid = !$freeFlavour && empty($update_dlid); if ($needsdlid) { echo JText::sprintf('COM_AUTOTWEET_LBL_CPANEL_NEEDSDLID', VersionHelper::getFlavourName(), 'http://www.extly.com/live-update-your-download-id.html'); } }
/** * Renders the toolbar buttons * * @param string $view The active view name * @param string $task The current task * @param F0FInput $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 (F0FPlatform::getInstance()->isCli()) { return; } // Do not render buttons unless we are in the the frontend area and we are asked to do so $toolbar = F0FToolbar::getAnInstance($input->getCmd('option', 'com_foobar'), $config); $renderFrontendButtons = $toolbar->getRenderFrontendButtons(); if (F0FPlatform::getInstance()->isBackend() || !$renderFrontendButtons) { return; } // Load main backend language, in order to display toolbar strings // (JTOOLBAR_BACK, JTOOLBAR_PUBLISH etc etc) F0FPlatform::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="F0FHeaderHolder">', $bar_content, $title, '<div style="clear:both"></div>', '</div>'; }
/** * Renders the toolbar buttons * * @param string $view The active view name * @param string $task The current task * @param F0FInput $input The input object * @param array $config Extra configuration variables for the toolbar * * @return void */ protected function renderButtons($view, $task, $input, $config = array()) { if (F0FPlatform::getInstance()->isCli()) { return; } // Do not render buttons unless we are in the the frontend area and we are asked to do so $toolbar = F0FToolbar::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) F0FPlatform::getInstance()->loadTranslations('joomla'); if (F0FPlatform::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 (F0FHeaderHolder) //$html[] = '<div class="well" id="' . $bar->getName() . '">'; $html[] = '<div class="well" id="F0FHeaderHolder">'; $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); }
public function onWaftemplatesBrowse() { parent::onBrowse(); JToolBarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_admintools&view=waf'); }
public function onEmailtemplatesEdit() { parent::onEdit(); if (!isset($this->_isNew)) { JToolBarHelper::divider(); if (version_compare(JVERSION, '3.0', 'ge')) { $options['class'] = 'envelope'; } else { $options['class'] = 'preview'; } $options['a.task'] = 'testtemplate'; $options['a.href'] = '#'; $options['text'] = JText::_('COM_AKEEBASUBS_EMAILTEMPLATES_TESTTEMPLATE'); $this->addCustomBtn('test-template', $options); } }
/** * 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 F0F * include_once JPATH_LIBRARIES . '/fof/include.php'; * * if (!defined('F0F_INCLUDED')) * { * JError::raiseError('500', 'F0F is not installed'); * } * * if (version_compare(JVERSION, '3.0', 'ge')) * { * $strapper = new F0FRenderJoomla3; * } * else * { * $strapper = new F0FRenderJoomla; * } * * $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 (F0FPlatform::getInstance()->isCli()) { return; } // Do not render a category submenu unless we are in the the admin area if (!F0FPlatform::getInstance()->isBackend()) { return; } $toolbar = F0FToolbar::getAnInstance($extension, $config); $toolbar->renderSubmenu(); $this->renderLinkbarItems($toolbar); }
public function onProfilesAdd() { parent::onAdd(); JToolBarHelper::title(JText::_('AKEEBA') . ': <small>' . JText::_('PROFILE_PAGETITLE_NEW') . '</small>', 'akeeba'); }
/** * Append a link to the link bar * * @param string $name The text of the link * @param string|null $link The link to render; set to null to render a separator * @param boolean $active True if it's an active link * @param string|null $icon Icon class (used by some renderers, like the Bootstrap renderer) * @param string|null $parent The parent element (referenced by name)) Thsi will create a dropdown list * * @return void */ public function appendLink($name, $link = null, $active = false, $icon = null, $parent = '') { if (!$this->isBackend) { $link = JRoute::_($link); } parent::appendLink($name, $link, $active, $icon, $parent); }
/** * Renders the toolbar buttons * * @param string $view The active view name * @param string $task The current task * @param F0FInput $input The input object * @param array $config Extra configuration variables for the toolbar * * @return void */ protected function renderButtons($view, $task, $input, $config = array()) { if (F0FPlatform::getInstance()->isCli()) { return; } // Do not render buttons unless we are in the the frontend area and we are asked to do so $toolbar = F0FToolbar::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) F0FPlatform::getInstance()->loadTranslations('joomla'); if (F0FPlatform::getInstance()->isBackend() || !$renderFrontendButtons) { return; } $bar = JToolBar::getInstance('toolbar'); $items = $bar->getItems(); $substitutions = array('icon-32-new' => 'xticon xticon-plus', 'icon-32-publish' => 'xticon xticon-check-sign', 'icon-32-unpublish' => 'xticon xticon-times-circle', 'icon-32-delete' => 'xticon xticon-times', 'icon-32-edit' => 'xticon xticon-edit', 'icon-32-copy' => 'xticon xticon-copy', 'icon-32-cancel' => 'xticon xticon-times-circle', 'icon-32-back' => 'xticon xticon-times-circle', 'icon-32-apply' => 'xticon xticon-save', 'icon-32-save' => 'xticon xticon-edit', 'icon-32-save-new' => 'xticon xticon-plus', 'icon-32-process' => 'xticon xticon-cog'); $html = array(); $actions = array(); $html[] = '<div class="extly"><div id="F0FHeaderHolder" class="row-fluid"><div class="span12">'; $html[] = '<div class="buttonsHolder btn-toolbar pull-right">'; 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></div></div>'; echo implode("\n", $html); }
public function onCouponsEdit() { if (J2Store::isPro()) { $app = JFactory::getApplication(); parent::onEdit(); JToolBarHelper::divider(); $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'list', JText::_('J2STORE_COUPON_HISTORY'), 'index.php?option=com_j2store&view=coupon&task=history&coupon_id=' . $app->input->getInt('id')); } else { $this->noToolbar(); } }
public function onShippingMethodsBrowse() { $app = JFactory::getApplication(); $shippingTask = $app->input->getString('shippingTask'); if (!isset($shippingTask) && !($shippingTask == 'view' || $shippingTask == 'newMethod')) { parent::onBrowse(); } else { JToolbarHelper::apply(); JToolbarHelper::save(); JToolbarHelper::cancel(); } }
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 = F0FToolbar::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 = F0FModel::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 = <<<JS // This comment is intentionally put here to prevent badly written plugins from causing a Javascript error // due to missing trailing semicolon and/or newline in their code. 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} } JS; $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 onItemsBrowse() { parent::onBrowse(); JToolBarHelper::preferences('com_todo', 550, 875); }
function __construct($config = array()) { parent::__construct($config); $this->renderFrontendButtons = true; }