本文整理汇总了PHP中JLayoutHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JLayoutHelper类的具体用法?PHP JLayoutHelper怎么用?PHP JLayoutHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JLayoutHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public static function render($layout, $displayData)
{
if ($file = Overrider::getOverride('lyt.' . $layout, '', true)) {
$layoutHelper = new JLayoutHelper();
$layoutHelper->doRender($layout, $displayData, $file);
}
}
示例2: association
/**
* Get the associated language flags
*
* @param integer $contactid The item id to search associations
*
* @return string The language HTML
*
* @throws Exception
*/
public static function association($contactid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $contactid)) {
foreach ($associations as $tag => $associated) {
$associations[$tag] = (int) $associated->id;
}
// Get the associated contact items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.name as title')->select('l.sef as lang_sef, lang_code')->from('#__contact_details as c')->select('cat.title as category_title')->join('LEFT', '#__categories as cat ON cat.id=c.catid')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500, $e);
}
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_contact&task=contact.edit&id=' . (int) $item->id);
$tooltip = $item->title . '<br />' . JText::sprintf('JCATEGORY_SPRINTF', $item->category_title);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '" data-content="' . $tooltip . '" data-placement="top">' . $text . '</a>';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
示例3: onContentAfterDisplay
/**
* Displays the comments area
*
* @param string $context The context of the content being passed to the plugin
* @param object &$row The article object
* @param object &$params The article params
* @param integer $page The 'page' number
*
* @return mixed html string containing code for the comment if in com_content.article else boolean false
*
*/
public function onContentAfterDisplay($context, &$row, &$params, $page = 0)
{
$parts = explode(".", $context);
$plgCatid = $this->params->def('catid');
// Check is run com_content
if ($parts[0] != 'com_content') {
return false;
}
// Check category of the plugin in the allowable category array of the plugin
if ($plgCatid[0] != 'all' && !in_array($row->catid, $plgCatid)) {
return false;
}
// Add media file
JHtml::_('jquery.framework');
JHtml::script(JUri::base() . 'media/pkg_mjcommentsystem/plg_content_mjformcomment/js/plg_mjformcomment.js', false, true);
JHtml::stylesheet(JUri::base() . 'media/pkg_mjcommentsystem/plg_content_mjformcomment/css/plg_mjformcomment.css', false, true, false);
// Add the language file of the component
$lang = JFactory::getLanguage();
$basePath = JPATH_SITE . '/components/com_mjcomments';
$lang->load('com_mjcomments', $basePath, null, true);
// Assign value to the layout variables
$content_id = $row->id;
$formReturn = 'index.php?option=com_mjcomments&task=comment.send&format=json';
// Get the comment form
$this->setCommentForm();
// Get the comment list
$this->setCommentList($content_id);
// Name of the variables that will be used in the layout
$data = array('view' => $context, 'form' => $this->form, 'formReturn' => $formReturn, 'content_id' => $content_id, 'comments' => $this->comments);
return JLayoutHelper::render('default', compact('data'), __DIR__ . '/layouts');
}
示例4: association
/**
* Render the list of associated items
*
* @param integer $catid Category identifier to search its associations
* @param string $extension Category Extension
*
* @return string The language HTML
*/
public static function association($catid, $extension = 'com_content')
{
// Defaults
$html = '';
// Get the associations
if ($associations = CategoriesHelper::getAssociations($catid, $extension)) {
JArrayHelper::toInteger($associations);
// Get the associated categories
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.title')->select('l.sef as lang_sef')->from('#__categories as c')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500);
}
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_categories&task=category.edit&id=' . (int) $item->id . '&extension=' . $extension);
$tooltipParts = array(JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true), $item->title);
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, ' label label-association label-' . $item->lang_sef);
}
}
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
示例5: association
/**
* Generate the markup to display the item associations
*
* @param int $itemid The menu item id
*
* @return string
*
* @since 3.0
*
* @throws Exception If there is an error on the query
*/
public static function association($itemid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = MenusHelper::getAssociations($itemid)) {
// Get the associated menu items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('m.id, m.title')->select('l.sef as lang_sef')->select('mt.title as menu_title')->from('#__menu as m')->join('LEFT', '#__menu_types as mt ON mt.menutype=m.menutype')->where('m.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON m.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (runtimeException $e) {
throw new Exception($e->getMessage(), 500);
}
// Construct html
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id);
$tooltipParts = array(JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true), $item->title, '(' . $item->menu_title . ')');
$class = 'hasTooltip label label-association label-' . $item->lang_sef;
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, $class);
}
}
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
示例6: render
/**
* Render the button
*
* @param array &$definition Definition
*
* @return string
*/
public function render(&$definition)
{
$data = new stdClass();
$data->button = JText::sprintf('COM_NENO_TRANSLATION_CREDIT_TOOLBAR_FAKE_BUTTON', number_format($definition[1], 0, ',', '.'));
$layout = JLayoutHelper::render('toolbartcbutton', $data, JPATH_NENO_LAYOUTS);
return $layout;
}
示例7: association
/**
* Get the associated language flags
*
* @param int $newsfeedid The item id to search associations
*
* @return string The language HTML
*/
public static function association($newsfeedid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $newsfeedid)) {
foreach ($associations as $tag => $associated) {
$associations[$tag] = (int) $associated->id;
}
// Get the associated newsfeed items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.name as title')->select('l.sef as lang_sef')->from('#__newsfeeds as c')->select('cat.title as category_title')->join('LEFT', '#__categories as cat ON cat.id=c.catid')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500);
}
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id=' . (int) $item->id);
$tooltipParts = array(JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true), $item->title, '(' . $item->category_title . ')');
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
}
}
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
示例8: association
/**
* Render the list of associated items
*
* @param integer $catid Category identifier to search its associations
* @param string $extension Category Extension
*
* @return string The language HTML
*
* @since 3.2
* @throws Exception
*/
public static function association($catid, $extension = 'com_content')
{
// Defaults
$html = '';
// Get the associations
if ($associations = CategoriesHelper::getAssociations($catid, $extension)) {
$associations = ArrayHelper::toInteger($associations);
// Get the associated categories
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.title')->select('l.sef as lang_sef')->select('l.lang_code')->from('#__categories as c')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500, $e);
}
if ($items) {
foreach ($items as &$item) {
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = JRoute::_('index.php?option=com_categories&task=category.edit&id=' . (int) $item->id . '&extension=' . $extension);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '" data-content="' . $item->title . '" data-placement="top">' . $text . '</a>';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
示例9: association
/**
* Generate the markup to display the item associations
*
* @param int $itemid The menu item id
*
* @return string
*
* @since 3.0
*
* @throws Exception If there is an error on the query
*/
public static function association($itemid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = MenusHelper::getAssociations($itemid)) {
// Get the associated menu items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('m.id, m.title')->select('l.sef as lang_sef, l.lang_code')->select('mt.title as menu_title')->from('#__menu as m')->join('LEFT', '#__menu_types as mt ON mt.menutype=m.menutype')->where('m.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON m.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (runtimeException $e) {
throw new Exception($e->getMessage(), 500);
}
// Construct html
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id);
$tooltip = $item->title . '<br />' . JText::sprintf('COM_MENUS_MENU_SPRINTF', $item->menu_title);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '" data-content="' . $tooltip . '" data-placement="top">' . $text . '</a>';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
示例10: payment
public function payment()
{
// Set base path
JLayoutHelper::$defaultBasePath = JPATH_PLUGINS . '/content/ic_paypal/layouts';
// Render mylayout.php
$renderedLayout = JLayoutHelper::render('payment_test');
echo $renderedLayout;
}
示例11: display
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->form = $this->get('form');
JDeveloperHelper::addSubmenu('import');
$this->addToolbar();
$this->sidebar = JLayoutHelper::render("sidebar", array("active" => "import"), JDeveloperLAYOUTS);
parent::display($tpl);
}
示例12: getTranslation
/**
* Get a translations
*
* @return void
*/
public function getTranslation()
{
$input = $this->input;
$translationId = $input->getInt('id');
if (!empty($translationId)) {
$translation = NenoContentElementTranslation::getTranslation($translationId);
echo JLayoutHelper::render('editor', $translation->prepareDataForView(true), JPATH_NENO_LAYOUTS);
}
JFactory::getApplication()->close();
}
示例13: DefaultPaginationForm
function DefaultPaginationForm($total, $limitstart, $limit, $keyword = "")
{
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
if ($keyword != "" && method_exists($pageNav, "setAdditionalUrlParam")) {
$pageNav->setAdditionalUrlParam("keyword", urlencode($keyword));
$pageNav->setAdditionalUrlParam("showpast", JRequest::getInt("showpast", 0));
}
$Itemid = JRequest::getInt("Itemid");
$task = JRequest::getVar("jevtask");
// include catids to make sure not lost when category is pre-selected
$catids = JRequest::getString("catids", JRequest::getString("category_fv", ""));
if (JString::strlen($catids) > 0) {
$catids = explode("|", $catids);
JArrayHelper::toInteger($catids);
$catids = "&catids=" . implode("|", $catids);
}
$year = "";
if (JRequest::getInt("year", 0) > 0) {
$year = "&year=" . JRequest::getInt("year", 0);
}
$month = "";
if (JRequest::getInt("month", 0) > 0) {
$month = "&month=" . JRequest::getInt("month", 0);
}
if ($keyword != "") {
$keyword = "&keyword=" . urlencode($keyword) . "&showpast=" . JRequest::getInt("showpast", 0);
}
$link = JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&Itemid={$Itemid}&task={$task}{$catids}{$year}{$month}{$keyword}");
?>
<div class="jev_pagination">
<form action="<?php
echo $link;
?>
" method="post" name="adminForm" id="adminForm">
<?php
if ($task != "crawler.listevents" || version_compare(JVERSION, "3.0.0", 'lt')) {
echo $pageNav->getListFooter();
} else {
// Allow to receive a null layout
$layoutId = 'pagination.crawlerlinks';
$app = JFactory::getApplication();
$list = array('prefix' => $pageNav->prefix, 'limit' => $pageNav->limit, 'limitstart' => $pageNav->limitstart, 'total' => $pageNav->total, 'limitfield' => $pageNav->getLimitBox(), 'pagescounter' => $pageNav->getPagesCounter(), 'pages' => $pageNav->getPaginationPages());
$options = array();
echo JLayoutHelper::render($layoutId, array('list' => $list, 'options' => $options));
}
?>
</form>
</div>
<?php
}
示例14: render
/**
* Method to render the layout.
*
* @param string $layout Name of the layout to render
* @param array $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
*
* @return string
*/
public static function render($layout, $displayData, $basePath)
{
$result = '';
if (is_dir($basePath)) {
if (version_compare(JVERSION, '3.0', 'ge')) {
$result = JLayoutHelper::render($layout, $displayData, $basePath);
} else {
ob_start();
require $basePath . '/' . $layout . '.php';
$result = ob_get_contents();
ob_get_clean();
}
}
return $result;
}
示例15: render
/**
* Renders the error stack and returns the results as a string
*
* @param string $name Not used.
* @param array $params Associative array of values
* @param string $content Not used.
*
* @return string The output of the script
*
* @since 11.1
*/
public function render($name, $params = array(), $content = null)
{
$msgList = $this->getData();
$displayData = array('msgList' => $msgList, 'name' => $name, 'params' => $params, 'content' => $content);
$app = JFactory::getApplication();
$chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/message.php';
if (file_exists($chromePath)) {
include_once $chromePath;
}
if (function_exists('renderMessage')) {
JLog::add('renderMessage() is deprecated. Override system message rendering with layouts instead.', JLog::WARNING, 'deprecated');
return renderMessage($msgList);
}
return JLayoutHelper::render('joomla.system.message', $displayData);
}