本文整理汇总了PHP中JToolbar::setToolBar方法的典型用法代码示例。如果您正苦于以下问题:PHP JToolbar::setToolBar方法的具体用法?PHP JToolbar::setToolBar怎么用?PHP JToolbar::setToolBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JToolbar
的用法示例。
在下文中一共展示了JToolbar::setToolBar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
function _initToolbar()
{
// if (!class_exists('JToolBar')) {
// JLoader::register('JToolBar', JPATH_ADMINISTRATOR.'/libraries/joomla/html/toolbar.php');
// jimport('joomla.html.toolbar');
// }
//require_once('rttoolbar.class.php');
$bar = JToolBar::getInstance('toolbar');
$buttons = $bar->getItems();
//Toolbar is empty, attempt to see if it's a koowa toolbar
//if it's not, then continue like always - TODO: find generic solution
if (!$buttons && class_exists('KToolbarAbstract', false)) {
$doc =& JFactory::getDocument();
$buffer = $doc->getBuffer();
if (is_array($buffer) && isset($buffer['modules']['toolbar'])) {
$toolbar_buffer = $buffer['modules']['toolbar'];
//use phpQuery to get the bits out
if (!class_exists('phpQuery')) {
require_once dirname(__FILE__) . "/phpQuery.php";
}
$pq = phpQuery::newDocument($toolbar_buffer);
$bits = pq('table')->find('a');
$bar->addButtonPath($this->templatePath . DS . 'lib' . DS . 'buttons');
foreach ($bits as $alink) {
$href = pq($alink)->attr('href');
$data = pq($alink)->attr('data');
$onclick = pq($alink)->attr('onclick');
$class = pq($alink)->attr('class');
$title = pq($alink)->find('span')->attr('title');
$bar->appendButton('koowa', $title, $href, $onclick, $data, $class);
}
$buttons = $bar->getItems();
}
}
$newbar = array();
$newhelp = array();
$actions = array();
$first = array();
foreach ($buttons as $button) {
if (strtolower($button[0]) == 'help') {
$newhelp[] = $button;
} elseif (isset($button[1]) && (strtolower($button[1]) == 'unarchive' or strtolower($button[1]) == 'archive' or strtolower($button[1]) == 'publish' or strtolower($button[1]) == 'unpublish' or strtolower($button[1]) == 'move' or strtolower($button[1]) == 'copy' or strtolower($button[1]) == 'trash' or strtolower($button[1]) == 'delete' or strtolower($button[1]) == 'tag')) {
$actions[] = $button;
} else {
if (isset($button[1]) && (strtolower($button[1]) == 'new' or strtolower($button[1]) == 'apply' or strtolower($button[1]) == 'save')) {
$first[] = $button;
} else {
$newbar[] = $button;
}
}
}
//create new toolbar object
$toolbar = new JToolbar('toolbar');
//$toolbar->_buttonPath[0] = $this->basePath.DS.'libraries'.DS.'joomla'.DS.'html'.DS.'toolbar'.DS.'button';
$toolbar->setToolBar($newbar);
//$toolbar->_bar = $newbar;
$toolbar->setButtonPath($bar->getButtonPath());
$toolbar->_actions = $actions;
$toolbar->_first = $first;
$this->toolbar = $toolbar;
$this->actions = $actions;
$this->first = $first;
//new help button
$helpbar = new JToolbar('help');
//$helpbar->_buttonPath[0] = $this->basePath.DS.'libraries'.DS.'joomla'.DS.'html'.DS.'toolbar'.DS.'button';
$helpbar->setToolbar($newhelp);
$this->help = $helpbar;
}
示例2: JToolbar
function _initToolbar()
{
$bar = JToolBar::getInstance('toolbar');
$buttons = $bar->getItems();
$buffer = $this->document->getBuffer();
//Toolbar is empty, attempt to see if it's a koowa toolbar
//if it's not, then continue like always - TODO: find generic solution
if (!$buttons && isset($buffer['modules']['toolbar'])) {
$this->toolbar_output = $buffer['modules']['toolbar'];
//new help button
$helpbar = new JToolbar('help');
$this->help = $helpbar;
return;
}
$newbar = array();
$newhelp = array();
$actions = array();
$first = array();
foreach ($buttons as $button) {
if (strtolower($button[0]) == 'help') {
$newhelp[] = $button;
} elseif (isset($button[1]) && (strtolower($button[1]) == 'unarchive' or strtolower($button[1]) == 'archive' or strtolower($button[1]) == 'publish' or strtolower($button[1]) == 'unpublish' or strtolower($button[1]) == 'move' or strtolower($button[1]) == 'copy' or strtolower($button[1]) == 'trash' or strtolower($button[1]) == 'delete' or strtolower($button[1]) == 'tag')) {
$actions[] = $button;
} else {
if (isset($button[1]) && (strtolower($button[1]) == 'new' or strtolower($button[1]) == 'apply' or strtolower($button[1]) == 'save')) {
$first[] = $button;
} else {
$newbar[] = $button;
}
}
}
//create new toolbar object
$toolbar = new JToolbar('toolbar');
$toolbar->setToolBar($newbar);
$toolbar->setButtonPath($bar->getButtonPath());
$toolbar->_actions = $actions;
$toolbar->_first = $first;
$this->toolbar = $toolbar;
$this->actions = $actions;
$this->first = $first;
//new help button
$helpbar = new JToolbar('help');
$helpbar->setToolbar($newhelp);
$this->help = $helpbar;
$this->toolbar_output = $this->toolbar->render('toolbar');
}