本文整理汇总了PHP中JLayoutFile类的典型用法代码示例。如果您正苦于以下问题:PHP JLayoutFile类的具体用法?PHP JLayoutFile怎么用?PHP JLayoutFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JLayoutFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToolbar
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = JHelperContent::getActions('com_messages');
JToolbarHelper::title(JText::_('COM_MESSAGES_MANAGER_MESSAGES'), 'envelope inbox');
if ($canDo->get('core.create')) {
JToolbarHelper::addNew('message.add');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::divider();
JToolbarHelper::publish('messages.publish', 'COM_MESSAGES_TOOLBAR_MARK_AS_READ', true);
JToolbarHelper::unpublish('messages.unpublish', 'COM_MESSAGES_TOOLBAR_MARK_AS_UNREAD', true);
}
JToolbarHelper::divider();
$bar = JToolBar::getInstance('toolbar');
// Instantiate a new JLayoutFile instance and render the layout
JHtml::_('behavior.modal', 'a.messagesSettings');
$layout = new JLayoutFile('toolbar.mysettings');
$bar->appendButton('Custom', $layout->render(array()), 'upload');
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::divider();
JToolbarHelper::deleteList('', 'messages.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::divider();
JToolbarHelper::trash('messages.trash');
}
if ($canDo->get('core.admin')) {
JToolbarHelper::preferences('com_messages');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_COMPONENTS_MESSAGING_INBOX');
}
示例2: fetchButton
/**
* Fetch the HTML for the button
*
* @param string $type Unused string, formerly button type.
* @param string $name Modal name, used to generate element ID
* @param string $text The link text
* @param string $url URL for popup
* @param integer $width Width of popup
* @param integer $height Height of popup
* @param integer $top Top attribute. [@deprecated Unused, will be removed in 4.0]
* @param integer $left Left attribute. [@deprecated Unused, will be removed in 4.0]
* @param string $onClose JavaScript for the onClose event.
* @param string $title The title text
*
* @return string HTML string for the button
*
* @since 3.0
*/
public function fetchButton($type = 'Modal', $name = '', $text = '', $url = '', $width = 640, $height = 480, $top = 0, $left = 0, $onClose = '', $title = '')
{
// If no $title is set, use the $text element
if (strlen($title) == 0) {
$title = $text;
}
// Store all data to the options array for use with JLayout
$options = array();
$options['name'] = trim(JText::_($name), '*?');
$options['text'] = JText::_($text);
$options['title'] = JText::_($title);
$options['class'] = $this->fetchIconClass($name);
$options['doTask'] = $this->_getCommand($url);
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.popup');
$html = array();
$html[] = $layout->render($options);
// Place modal div and scripts in a new div
$html[] = '<div class="btn-group" style="width: 0; margin: 0">';
// Build the options array for the modal
$params = array();
$params['title'] = $options['title'];
$params['url'] = $options['doTask'];
$params['height'] = $height;
$params['width'] = $width;
$html[] = JHtml::_('bootstrap.renderModal', 'modal-' . $name, $params);
// If an $onClose event is passed, add it to the modal JS object
if (strlen($onClose) >= 1) {
$html[] = '<script>' . 'jQuery(\'#modal-' . $name . '\').on(\'hide\', function () {' . $onClose . ';});' . '</script>';
}
$html[] = '</div>';
return implode("\n", $html);
}
示例3: addToolBar
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolBar()
{
$input = JFactory::getApplication()->input;
// Hide Joomla Administrator Main menu
$input->set('hidemainmenu', true);
$isNew = $this->item->id == 0;
if ($isNew) {
$title = JText::_('COM_ISSNREGISTRY_PUBLISHER_NEW');
} else {
$title = JText::_('COM_ISSNREGISTRY_PUBLISHER_EDIT');
$title .= ' : ' . $this->item->official_name;
}
JToolBarHelper::title($title, 'publisher');
JToolbarHelper::apply('publisher.apply');
if (!$isNew) {
// Add custom button for sending a message
$toolbar = JToolBar::getInstance('toolbar');
$layout = new JLayoutFile('joomla.toolbar.popup');
// Render the popup button
$dhtml = $layout->render(array('name' => 'generate-message', 'doTask' => '', 'text' => JText::_('COM_ISSNREGISTRY_PUBLISHER_BUTTON_SEND_MESSAGE'), 'class' => 'icon-envelope'));
$toolbar->appendButton('Custom', $dhtml);
// Render the popup button
$dhtml = $layout->render(array('name' => 'print', 'doTask' => '', 'text' => JText::_('COM_ISSNREGISTRY_PUBLISHER_BUTTON_PRINT'), 'class' => 'icon-print'));
$toolbar->appendButton('Custom', $dhtml);
}
JToolBarHelper::cancel('publisher.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
}
示例4: addToolbar
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
// Get the toolbar object instance
$bar = JToolbar::getInstance('toolbar');
$user = JFactory::getUser();
// Set the titlebar text
JToolbarHelper::title(JText::_('COM_MEDIA'), 'images mediamanager');
// Add an upload button
if ($user->authorise('core.create', 'com_media')) {
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.uploadmedia');
$bar->appendButton('Custom', $layout->render(array()), 'upload');
JToolbarHelper::divider();
}
// Add a create folder button
if ($user->authorise('core.create', 'com_media')) {
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.newfolder');
$bar->appendButton('Custom', $layout->render(array()), 'upload');
JToolbarHelper::divider();
}
// Add a delete button
if ($user->authorise('core.delete', 'com_media')) {
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.deletemedia');
$bar->appendButton('Custom', $layout->render(array()), 'upload');
JToolbarHelper::divider();
}
// Add a preferences button
if ($user->authorise('core.admin', 'com_media') || $user->authorise('core.options', 'com_media')) {
JToolbarHelper::preferences('com_media');
JToolbarHelper::divider();
}
JToolbarHelper::help('JHELP_CONTENT_MEDIA_MANAGER');
}
示例5: addToolBar
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolBar()
{
JToolBarHelper::addNew('publisher.add');
JToolBarHelper::editList('publisher.edit');
JToolBarHelper::deleteList('', 'publishers.delete');
// Get the value of no_identifier filter
$state = $this->state->get('filter.no_identifier');
// Check that we're showing publisher register
if ($state == 5) {
// Set page title
JToolBarHelper::title(JText::_('COM_ISBNREGISTRY_PUBLISHERS_REGISTRY'));
$toolbar = JToolBar::getInstance('toolbar');
$layout = new JLayoutFile('joomla.toolbar.popup');
// Render the popup button
$dhtml = $layout->render(array('name' => 'statistics', 'doTask' => '', 'text' => JText::_('COM_ISBNREGISTRY_PUBLISHER_BUTTON_STATISTICS'), 'class' => 'icon-pie'));
$toolbar->appendButton('Custom', $dhtml);
} else {
if ($state == 1) {
JToolBarHelper::title(JText::_('COM_ISBNREGISTRY_PUBLISHERS_APPLICATION'));
} else {
JToolBarHelper::title(JText::_('COM_ISBNREGISTRY_PUBLISHERS'));
}
}
// Has user rights to access preferences?
if (JFactory::getUser()->authorise('core.admin', 'com_isbnregistry')) {
JToolBarHelper::preferences('com_isbnregistry');
}
}
示例6: addToolbar
protected function addToolbar()
{
$canDo = JHelperContent::getActions($this->option, $this->edit_view, $this->state->get('filter.category_id'));
$user = JFactory::getUser();
JToolbarHelper::title(ucfirst($this->view), 'address contact');
if ($canDo->get('core.create') || count($user->getAuthorisedCategories($this->option, 'core.create')) > 0) {
JToolbarHelper::addNew($this->edit_view . '.add');
}
if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
JToolbarHelper::editList($this->edit_view . '.edit');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publish($this->view . '.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish($this->view . '.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if ($user->authorise('core.create', $this->option) && $user->authorise('core.edit', $this->option) && $user->authorise('core.edit.state', $this->option)) {
$title = JText::_('JTOOLBAR_BATCH');
$layout = new JLayoutFile('joomla.toolbar.batch');
$dhtml = $layout->render(array('title' => $title));
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::deleteList('', $this->view . '.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::deleteList($this->option, $this->view . '.delete', 'Delete');
}
if ($user->authorise('core.admin', $this->option) || $user->authorise('core.options', $this->option)) {
JToolbarHelper::preferences($this->option);
}
JHtmlSidebar::setAction('index.php?option=' . $this->option);
}
示例7: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
$html = '';
if ($value || ($config['client'] == 'list' || $config['client'] == 'item')) {
$location = isset($config['location']) && $config['location'] ? $config['location'] : 'joomla_article';
$properties = array('context');
$properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
/* temporary fix for content categories */
if ($properties['context'] == 'com_categories.category') {
$properties['context'] = 'com_content.category';
// todo: dynamic context per extension (#__categories)
}
/* temporary fix for content categories */
if (is_object($value) && isset($value->tags)) {
$value = $value->tags;
}
$tags = new JHelperTags();
$tags->getItemTags($properties['context'], $config['pk']);
$tagLayout = new JLayoutFile('joomla.content.tags');
$html = $tagLayout->render($tags->itemTags);
}
// Set
$field->value = $value;
$field->html = $html;
}
示例8: display
function display($tpl = null)
{
//require_once( JPATH_COMPONENT.DS.'helpers'.DS.'sajax.php' );
$db = JFactory::getDBO();
$customer = $this->get('customer');
//print_r($customer);die;
$user = $this->get('User');
$isNew = $customer->id < 1;
$text = $isNew ? JText::_('COM_DIGICOM_NEW') : JText::_('COM_DIGICOM_EDIT') . " : " . $customer->firstname;
JToolBarHelper::title(JText::_('COM_DIGICOM_CUSTOMER') . ":<small>[" . $text . "]</small>");
$bar = JToolBar::getInstance('toolbar');
$layout = new JLayoutFile('toolbar.title');
$title = array('title' => JText::_('COM_DIGICOM_CUSTOMER') . ":<small>[" . $text . "]</small>", 'class' => 'title');
$bar->appendButton('Custom', $layout->render($title), 'title');
$layout = new JLayoutFile('toolbar.settings');
$bar->appendButton('Custom', $layout->render(array()), 'settings');
JToolBarHelper::apply('customer.apply');
JToolBarHelper::save('customer.save');
JToolBarHelper::divider();
JToolBarHelper::cancel('customer.cancel');
$this->assign("cust", $customer);
$this->assign("user", $user);
$configs = $this->get("Configs");
$this->assign("configs", $configs);
DigiComHelperDigiCom::addSubmenu('customers');
$this->sidebar = DigiComHelperDigiCom::renderSidebar();
parent::display($tpl);
}
示例9: addToolbar
/**
* Method to add a toolbar
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = JDeveloperHelper::getActions();
$user = JFactory::getUser();
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
JToolBarHelper::title(JText::_('COM_JDEVELOPER_FORMS_VIEW_FORMS_TITLE'));
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('form.add', 'JTOOLBAR_NEW');
}
if (($canDo->get('core.edit') || $canDo->get('core.edit.own')) && isset($this->items[0])) {
JToolBarHelper::editList('form.edit', 'JTOOLBAR_EDIT');
}
if ($canDo->get('core.delete') && isset($this->items[0])) {
JToolBarHelper::deleteList('', 'forms.delete', 'JTOOLBAR_DELETE');
}
// Add a batch button
if (isset($this->items[0]) && $user->authorise('core.create', 'com_contacts') && $user->authorise('core.edit', 'com_contacts')) {
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 ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_jdeveloper');
}
}
示例10: title
/**
* Render the action bar title
*
* @param array $config An optional array with configuration options
* @return string Html
*/
public function title($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array('command' => NULL));
$title = $this->getObject('translator')->translate($config->command->title);
$icon = $config->command->icon;
$html = '';
if (!empty($title)) {
if (JFactory::getApplication()->isAdmin() && version_compare(JVERSION, '3.2', 'ge')) {
$layout = new JLayoutFile('joomla.toolbar.title');
$html = $layout->render(array('title' => $title, 'icon' => $icon));
} elseif ($this->_useBootstrap()) {
// Strip the extension.
$icons = explode(' ', $icon);
foreach ($icons as &$icon) {
$icon = 'pagetitle--' . preg_replace('#\\.[^.]*$#', '', $icon);
}
$html = '<div class="pagetitle ' . htmlspecialchars(implode(' ', $icons)) . '"><h2>' . $title . '</h2></div>';
} else {
$html = '<div class="header pagetitle icon-48-' . $icon . '">';
$html .= '<h2>' . $title . '</h2>';
$html .= '</div>';
}
if (JFactory::getApplication()->isAdmin()) {
$app = JFactory::getApplication();
$app->JComponentTitle = $html;
$html = '';
JFactory::getDocument()->setTitle($app->getCfg('sitename') . ' - ' . JText::_('JADMINISTRATION') . ' - ' . $title);
}
}
return $html;
}
示例11: onMediaEditorDisplay
public function onMediaEditorDisplay($filePath)
{
// @suggestion: Add CSS, JavaScript
$data = array('filePath' => $filePath);
$layout = new JLayoutFile('form', __DIR__ . '/layout');
$html = $layout->render($data);
return $html;
}
示例12: onMediaEditorDisplay
/**
* Method to return the HTML shown in a modal popup within the Media Manager
*
* @param $filePath string
*
* @return string
*/
public function onMediaEditorDisplay($filePath)
{
//todo: allow for setup of cropper parameters
$data = array('filePath' => $filePath);
$layout = new JLayoutFile('form', __DIR__ . '/layout');
$html = $layout->render($data);
return $html;
}
示例13: render
/**
* Method to render the layout.
*
* @param string $layoutFile Dot separated path to the layout file, relative to base path
* @param object $displayData Object which properties are used inside the layout file to build displayed output
* @param string $basePath Base path to use when loading layout files
* @param mixed $options Optional custom options to load. JRegistry or array format
*
* @return string
*
* @since 3.1
*/
public static function render($layoutFile, $displayData = null, $basePath = '', $options = null)
{
$basePath = empty($basePath) ? self::$defaultBasePath : $basePath;
// Make sure we send null to JLayoutFile if no path set
$basePath = empty($basePath) ? null : $basePath;
$layout = new JLayoutFile($layoutFile, $basePath, $options);
$renderedLayout = $layout->render($displayData);
return $renderedLayout;
}
示例14: fetchButton
/**
* Fetches the button HTML code.
*
* @param string $type Unused string.
* @param string $ref The name of the help screen (its key reference).
* @param boolean $com Use the help file in the component directory.
* @param string $override Use this URL instead of any other.
* @param string $component Name of component to get Help (null for current component)
*
* @return string
*
* @since 3.0
*/
public function fetchButton($type = 'Help', $ref = '', $com = false, $override = null, $component = null)
{
// Store all data to the options array for use with JLayout
$options = array();
$options['text'] = JText::_('JTOOLBAR_HELP');
$options['doTask'] = $this->_getCommand($ref, $com, $override, $component);
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.help');
return $layout->render($options);
}
示例15: render
/**
* Render the batch selection options.
*
* @return string The necessary HTML to display the batch selection options
*
* @since 3.0
*/
public static function render()
{
// Collect display data
$data = new stdClass();
$data->ListSelection = static::getListSelection();
// Create a layout object and ask it to render the batch selection options
$layout = new JLayoutFile('batchselection');
$batchHtml = $layout->render($data);
return $batchHtml;
}