本文整理汇总了PHP中BannersHelper类的典型用法代码示例。如果您正苦于以下问题:PHP BannersHelper类的具体用法?PHP BannersHelper怎么用?PHP BannersHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BannersHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/banners.php';
BannersHelper::updateReset();
// Load the submenu.
BannersHelper::addSubmenu(JRequest::getCmd('view', 'banners'));
$view = JRequest::getCmd('view', 'banners');
$layout = JRequest::getCmd('layout', 'default');
$id = JRequest::getInt('id');
// Check for edit form.
if ($view == 'banner' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.banner', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_banners&view=banners', false));
return false;
} elseif ($view == 'client' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.client', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_banners&view=clients', false));
return false;
}
parent::display();
return $this;
}
示例2: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = BannersHelper::getActions();
JToolBarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_CLIENT_NEW') : JText::_('COM_BANNERS_MANAGER_CLIENT_EDIT'), 'banners-clients.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('client.apply');
JToolBarHelper::save('client.save');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolBarHelper::save2new('client.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::save2copy('client.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('client.cancel');
} else {
JToolBarHelper::cancel('client.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS_EDIT');
}
示例3: _setToolbar
/**
* Setup the Toolbar
*
* @since 1.6
*/
protected function _setToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = BannersHelper::getActions($this->state->get('filter.category_id'));
JToolBarHelper::title($isNew ? JText::_('Banners_Manager_Banner_New') : JText::_('Banners_Manager_Banner_Edit'));
// If not checked out, can save the item.
if (!$checkedOut && $canDo->get('core.edit')) {
JToolBarHelper::apply('banner.apply', 'JToolbar_Apply');
JToolBarHelper::save('banner.save', 'JToolbar_Save');
JToolBarHelper::addNew('banner.save2new', 'JToolbar_Save_and_new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('banner.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JToolbar_Save_as_Copy', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('banner.cancel');
} else {
JToolBarHelper::cancel('banner.cancel', 'JToolbar_Close');
}
JToolBarHelper::divider();
JToolBarHelper::help('screen.banners.banner');
}
示例4: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$userId = $user->get('id');
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
$canDo = BannersHelper::getActions($this->state->get('filter.category_id'));
JToolBarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_BANNER_NEW') : JText::_('COM_BANNERS_MANAGER_BANNER_EDIT'), 'banners.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('banner.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('banner.save', 'JTOOLBAR_SAVE');
if ($canDo->get('core.create')) {
JToolBarHelper::custom('banner.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('banner.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('banner.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('banner.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT');
}
示例5: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/banners.php';
$canDo = BannersHelper::getActions();
JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_CLIENTS'), 'banners-clients.png');
if ($canDo->get('core.create')) {
JToolbarHelper::addNew('client.add');
}
if ($canDo->get('core.edit')) {
JToolbarHelper::editList('client.edit');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publish('clients.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('clients.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::archiveList('clients.archive');
JToolbarHelper::checkin('clients.checkin');
}
if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'clients.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::trash('clients.trash');
}
if ($canDo->get('core.admin')) {
JToolbarHelper::preferences('com_banners');
}
JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS');
JHtmlSidebar::setAction('index.php?option=com_banners&view=clients');
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true));
}
示例6: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/banners.php';
$canDo = BannersHelper::getActions();
JToolBarHelper::title(JText::_('COM_BANNERS_MANAGER_CLIENTS'), 'banners-clients.png');
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('client.add', 'JTOOLBAR_NEW');
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('client.edit', 'JTOOLBAR_EDIT');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::custom('clients.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('clients.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::divider();
JToolBarHelper::archiveList('clients.archive', 'JTOOLBAR_ARCHIVE');
JToolBarHelper::custom('clients.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('clients.trash', 'JTOOLBAR_TRASH');
}
if ($canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'clients.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_banners');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS');
}
示例7: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$userId = $user->get('id');
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
// Since we don't track these assets at the item level, use the category id.
$canDo = BannersHelper::getActions($this->item->catid, 0);
JToolBarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_BANNER_NEW') : JText::_('COM_BANNERS_MANAGER_BANNER_EDIT'), 'banners.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)) {
JToolBarHelper::apply('banner.apply');
JToolBarHelper::save('banner.save');
if ($canDo->get('core.create')) {
JToolBarHelper::save2new('banner.save2new');
}
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::save2copy('banner.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('banner.cancel');
} else {
JToolBarHelper::cancel('banner.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT');
}
示例8: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT.'/helpers/banners.php';
$canDo = BannersHelper::getActions($this->state->get('filter.category_id'));
$user = JFactory::getUser();
JToolBarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'banners.png');
if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0) {
JToolBarHelper::addNew('banner.add');
}
if (($canDo->get('core.edit'))) {
JToolBarHelper::editList('banner.edit');
}
if ($canDo->get('core.edit.state')) {
if ($this->state->get('filter.state') != 2){
JToolBarHelper::divider();
JToolBarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if ($this->state->get('filter.state') != -1 ) {
JToolBarHelper::divider();
if ($this->state->get('filter.state') != 2) {
JToolBarHelper::archiveList('banners.archive');
}
else if ($this->state->get('filter.state') == 2) {
JToolBarHelper::unarchiveList('banners.publish');
}
}
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::checkin('banners.checkin');
}
if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
} else if ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('banners.trash');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_banners');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS');
}
示例9: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
BannersHelper::addSubmenu('clients');
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
return parent::display($tpl);
}
示例10: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/banners.php';
$canDo = BannersHelper::getActions($this->state->get('filter.category_id'));
JToolBarHelper::title(JText::_('COM_BANNERS_MANAGER_TRACKS'), 'banners-tracks.png');
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton('Popup', 'export', 'JTOOLBAR_EXPORT', 'index.php?option=com_banners&view=download&tmpl=component', 600, 300);
$document = JFactory::getDocument();
$app = JFactory::getApplication();
if ($canDo->get('core.delete')) {
$bar->appendButton('Confirm', 'COM_BANNERS_DELETE_MSG', 'delete', 'COM_BANNERS_TRACKS_DELETE', 'tracks.delete', false);
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_banners');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_TRACKS');
}
示例11: addToolbar
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_banners', 'category', $this->state->get('filter.category_id'));
JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_TRACKS'), 'bookmark banners-tracks');
$bar = JToolbar::getInstance('toolbar');
$bar->appendButton('Popup', 'download', 'JTOOLBAR_EXPORT', 'index.php?option=com_banners&view=download&tmpl=component', 600, 300);
if ($canDo->get('core.delete')) {
$bar->appendButton('Confirm', 'COM_BANNERS_DELETE_MSG', 'delete', 'COM_BANNERS_TRACKS_DELETE', 'tracks.delete', false);
JToolbarHelper::divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
JToolbarHelper::preferences('com_banners');
JToolbarHelper::divider();
}
JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_TRACKS');
JHtmlSidebar::setAction('index.php?option=com_banners&view=tracks');
JHtmlSidebar::addFilter(JText::_('COM_BANNERS_SELECT_CLIENT'), 'filter_client_id', JHtml::_('select.options', BannersHelper::getClientOptions(), 'value', 'text', $this->state->get('filter.client_id')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_banners'), 'value', 'text', $this->state->get('filter.category_id')));
JHtmlSidebar::addFilter(JText::_('COM_BANNERS_SELECT_TYPE'), 'filter_type', JHtml::_('select.options', array(JHtml::_('select.option', 1, JText::_('COM_BANNERS_IMPRESSION')), JHtml::_('select.option', 2, JText::_('COM_BANNERS_CLICK'))), 'value', 'text', $this->state->get('filter.type')));
}
示例12: display
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return BannersController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = array())
{
BannersHelper::updateReset();
$view = $this->input->get('view', 'banners');
$layout = $this->input->get('layout', 'default');
$id = $this->input->getInt('id');
// Check for edit form.
if ($view == 'banner' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.banner', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_banners&view=banners', false));
return false;
} elseif ($view == 'client' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.client', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_banners&view=clients', false));
return false;
}
return parent::display();
}
示例13: display
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 1.6
*/
public function display($tpl = null)
{
$this->categories = $this->get('CategoryOrders');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
BannersHelper::addSubmenu('banners');
$this->addToolbar();
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$this->sidebar = JHtmlSidebar::render();
return parent::display($tpl);
}
示例14: display
/**
* Method to display a view.
*/
public function display()
{
require_once JPATH_COMPONENT . '/helpers/banners.php';
BannersHelper::updateReset();
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = JRequest::getWord('view', 'banners');
$vFormat = $document->getType();
$lName = JRequest::getWord('layout', 'default');
// Get and render the view.
if ($view =& $this->getView($vName, $vFormat)) {
// Get the model for the view.
$model =& $this->getModel($vName);
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->assignRef('document', $document);
$view->display();
// Load the submenu.
BannersHelper::addSubmenu($vName);
}
}
示例15: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
public function getOptions()
{
return BannersHelper::getClientOptions();
}