本文整理汇总了PHP中JHtml::_方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtml::_方法的具体用法?PHP JHtml::_怎么用?PHP JHtml::_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHtml
的用法示例。
在下文中一共展示了JHtml::_方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
public function getInput()
{
jimport('joomla.filesystem.file');
$mainframe = JFactory::getApplication();
if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php')) {
$mainframe->enqueueMessage(JText::_('JM_PLEASE_INSTALL_JOOMLAMAILER'), 'error');
$mainframe->redirect('index.php');
}
$listId = $this->form->getValue('listid', 'params');
require_once JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php';
$params = JComponentHelper::getParams('com_joomailermailchimpintegration');
$MCapi = $params->get('params.MCapi');
$api = new joomlamailerMCAPI($MCapi);
$interests = $api->listInterestGroupings($listId);
$options = array();
if ($interests) {
foreach ($interests as $interest) {
if ($interest['form_field'] != 'hidden') {
$groups = array();
foreach ($interest['groups'] as $ig) {
$groups[] = $ig['name'];
}
$groups = implode('####', $groups);
$options[] = array('id' => $interest['id'] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, 'name' => $interest['name']);
}
}
}
if (count($options)) {
return JHtml::_('select.genericlist', $options, 'jform[params][interests][]', 'multiple="multiple"', 'id', 'name', $this->value, $this->id);
} else {
return JText::_('JM_NO_INTEREST_GROUPS');
}
}
示例2: getHeader
/**
* Get the header
*
* @return string The header HTML
*/
protected function getHeader()
{
$sortable = $this->element['sortable'] != 'false';
$view = $this->form->getView();
$model = $this->form->getModel();
$hasAjaxOrderingSupport = $view->hasAjaxOrderingSupport();
if (!$sortable) {
// Non sortable?! I'm not sure why you'd want that, but if you insist...
return JText::_('JGRID_HEADING_ORDERING');
}
if (!$hasAjaxOrderingSupport) {
// Ye olde Joomla! 2.5 method
$html = JHTML::_('grid.sort', 'JFIELD_ORDERING_LABEL', 'ordering', $view->getLists()->order_Dir, $view->getLists()->order, 'browse');
$html .= JHTML::_('grid.order', $model->getList());
return $html;
} else {
// The new, drag'n'drop ordering support WITH a save order button
$html = JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $view->getLists()->order_Dir, $view->getLists()->order, null, 'asc', 'JGRID_HEADING_ORDERING');
$ordering = $view->getLists()->order == 'ordering';
if ($ordering) {
$html .= '<a href="javascript:saveorder(' . (count($model->getList()) - 1) . ', \'saveorder\')" ' . 'rel="tooltip" class="save-order btn btn-micro pull-right" title="' . JText::_('JLIB_HTML_SAVE_ORDER') . '">' . '<span class="icon-ok"></span></a>';
}
return $html;
}
}
示例3: fetchButton
function fetchButton($type = 'Acyactions')
{
$url = JURI::base() . "index.php?option=com_acymailing&ctrl=filter&tmpl=component";
$top = 0;
$left = 0;
$width = 700;
$height = 500;
$text = JText::_('ACTIONS');
if (!ACYMAILING_J30) {
$class = "icon-32-acyaction";
} else {
$class = "icon-14-acyaction";
}
$js = "\r\nfunction getAcyActionUrl() {\r\n\ti = 0;\r\n\tmylink = 'index.php?option=com_acymailing&ctrl=filter&tmpl=component&subid=';\r\n\twhile(window.document.getElementById('cb'+i)){\r\n\t\tif(window.document.getElementById('cb'+i).checked)\r\n\t\t\tmylink += window.document.getElementById('cb'+i).value+',';\r\n\t\ti++;\r\n\t}\r\n\treturn mylink;\r\n}\r\n";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
if (!ACYMAILING_J30) {
JHTML::_('behavior.modal', 'a.modal');
return '<a href="' . $url . '" class="modal" onclick="this.href=getAcyActionUrl();" rel="{handler: \'iframe\', size: {x: ' . $width . ', y: ' . $height . '}}"><span class="' . $class . '" title="' . $text . '"></span>' . $text . '</a>';
}
$html = '<button class="btn btn-small modal" data-toggle="modal" data-target="#modal-' . $type . '"><i class="' . $class . '"></i> ' . $text . '</button>';
$params['title'] = $text;
$params['url'] = '\'+getAcyActionUrl()+\'';
//$url;
$params['height'] = $height;
$params['width'] = $width;
$modalHtml = JHtml::_('bootstrap.renderModal', 'modal-' . $type, $params);
$html .= str_replace(array('id="modal-' . $type . '"'), array('id="modal-' . $type . '" style="width:' . ($width + 20) . 'px;height:' . ($height + 90) . 'px;margin-left:-' . ($width + 20) / 2 . 'px"'), $modalHtml);
$html .= '<script>' . "\r\n" . 'jQuery(document).ready(function(){jQuery("#modal-' . $type . '").appendTo(jQuery(document.body));});' . "\r\n" . '</script>';
return $html;
}
示例4: getOptions
protected function getOptions()
{
// Initialize variables.
$options = array();
foreach ($this->element->children() as $option) {
// Only add <option /> elements.
if ($option->getName() != 'option') {
continue;
}
$disabled = (string) $option['disabled'];
$disabled = $disabled == 'true' || $disabled == 'disabled' || $disabled == '1';
// Create a new option object based on the <option /> element.
$tmp = JHtml::_('select.option', (string) $option['value'], trim((string) $option), 'value', 'text', $disabled);
// Set some option attributes.
$tmp->class = (string) $option['class'];
// Set some JavaScript option attributes.
$tmp->onclick = (string) $option['onclick'];
$tmp->onchange = (string) $option['onchange'];
$tmp->image = '';
if (isset($option['imagesrc'])) {
$tmp->image = (string) $option['imagesrc'];
}
$tmp->icon = '';
if (isset($option['icon'])) {
$tmp->icon = (string) $option['icon'];
}
// Add the option object to the result set.
$options[] = $tmp;
}
reset($options);
return $options;
}
示例5: getInput
protected function getInput()
{
$html = '';
$db = JFactory::getDbo();
$options = JUDownloadHelper::getFieldGroupOptions();
if ($this->element['usenone'] == 'true') {
array_unshift($options, array('value' => '0', 'text' => JText::_('COM_JUDOWNLOAD_NONE')));
}
if ($this->element['useinherit'] == 'true') {
$appendInherit = "";
if ($this->form->getValue("id")) {
$appendInherit = " ( " . JText::_('COM_JUDOWNLOAD_NONE') . " )";
if ($this->form->getValue("id") > 0) {
$catObj = JUDownloadHelper::getCategoryById($this->form->getValue("parent_id"));
if ($catObj->fieldgroup_id > 1) {
$query = "SELECT name, published FROM #__judownload_fields_groups WHERE id = " . (int) $catObj->fieldgroup_id . " AND id != 1";
$db->setQuery($query);
$fieldgroup = $db->loadObject();
$groupName = $fieldgroup->published != 1 ? "[" . $fieldgroup->name . "]" : $fieldgroup->name;
$appendInherit = "( " . $groupName . " )";
}
}
}
array_unshift($options, array('value' => '-1', 'text' => JText::_('COM_JUDOWNLOAD_INHERIT') . $appendInherit));
} else {
array_unshift($options, array('value' => '', 'text' => JText::_('COM_JUDOWNLOAD_SELECT_FIELD_GROUP')));
}
$required_class = $this->element['required'] == 'true' ? 'required' : '';
$attributes = "class=\"inputbox {$required_class}\"";
$html .= JHtml::_('select.genericlist', $options, $this->name, $attributes, 'value', 'text', $this->value, $this->id);
return $html;
}
示例6: addToolbar
/**
* Method to configure the toolbar for this view.
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_finder');
JToolbarHelper::title(JText::_('COM_FINDER_MAPS_TOOLBAR_TITLE'), 'zoom-in finder');
$toolbar = JToolbar::getInstance('toolbar');
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publishList('maps.publish');
JToolbarHelper::unpublishList('maps.unpublish');
JToolbarHelper::divider();
}
if ($canDo->get('core.admin') || $canDo->get('core.options')) {
JToolbarHelper::preferences('com_finder');
}
JToolbarHelper::divider();
$toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350);
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_COMPONENTS_FINDER_MANAGE_CONTENT_MAPS');
if ($canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'maps.delete');
JToolbarHelper::divider();
}
JHtmlSidebar::setAction('index.php?option=com_finder&view=maps');
JHtmlSidebar::addFilter('', 'filter_branch', JHtml::_('select.options', JHtml::_('finder.mapslist'), 'value', 'text', $this->state->get('filter.branch')), true);
JHtmlSidebar::addFilter(JText::_('COM_FINDER_INDEX_FILTER_BY_STATE'), 'filter_state', JHtml::_('select.options', JHtml::_('finder.statelist'), 'value', 'text', $this->state->get('filter.state')));
}
示例7: getLanguageList
/**
* Get an HTML select list of the available languages.
*
* @return string
*/
public static function getLanguageList()
{
$languages = array();
$languages = JLanguageHelper::createLanguageList(null, JPATH_ADMINISTRATOR, false, true);
array_unshift($languages, JHtml::_('select.option', '', JText::_('JDEFAULT')));
return JHtml::_('select.genericlist', $languages, 'lang', ' class="inputbox"', 'value', 'text', null);
}
示例8: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$group = $this->get('group', 'countries');
$options = array();
foreach ($this->{$group} as $key => $val) {
if (!$val) {
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', true);
} else {
if ($key['0'] == '-') {
$options[] = JHtml::_('select.option', '-', $val, 'value', 'text', true);
} else {
$val = nnText::prepareSelectItem($val);
$options[] = JHtml::_('select.option', $key, $val);
}
}
}
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
示例9: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// Initialise variables.
$html = array();
$recordId = (int) $this->form->getValue('id');
$size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
$class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
// Get a reverse lookup of the base link URL to Title
$model = JModel::getInstance('menutypes', 'menusModel');
$rlu = $model->getReverseLookup();
switch ($this->value) {
case 'url':
$value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL');
break;
case 'alias':
$value = JText::_('COM_MENUS_TYPE_ALIAS');
break;
case 'separator':
$value = JText::_('COM_MENUS_TYPE_SEPARATOR');
break;
default:
$link = $this->form->getValue('link');
// Clean the link back to the option, view and layout
$value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link)));
break;
}
// Load the javascript and css
JHtml::_('behavior.framework');
JHtml::_('behavior.modal');
$html[] = '<input type="text" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' />';
$html[] = '<input type="button" value="' . JText::_('JSELECT') . '" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 600, y: 450}, url:\'' . JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId) . '\'})" />';
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
return implode("\n", $html);
}
示例10: getOptions
/**
* Create objects for the options
*
* @return array The array of option objects
*/
protected function getOptions()
{
$options = array();
// Initialize some field attributes.
$key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
$value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
$translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
$query = (string) $this->element['query'];
// Get the database object.
$db = F0FPlatform::getInstance()->getDbo();
// Set the query and get the result list.
$db->setQuery($query);
$items = $db->loadObjectlist();
// Build the field options.
if (!empty($items)) {
foreach ($items as $item) {
if ($translate == true) {
$options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
} else {
$options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例11: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a 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;
}
// Preprocess the list of items to find ordering divisions.
foreach ($this->items as &$item) {
$this->ordering[$item->parent_id][] = $item->id;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') {
$this->addToolbar();
}
parent::display($tpl);
}
示例12: onDisplay
/**
* Display the button
*
* @return array A four element array of (article_id, article_title, category_id, object)
*/
function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectArticle when an article is clicked
* jSelectArticle creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "\n\t\tfunction jSelectArticle(id, title, catid, object) {\n\t\t\tvar tag = '<a href='+'\"index.php?option=com_content&view=article&catid='+catid+'&id='+id+'\">'+title+'</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
JHtml::_('behavior.modal');
/*
* Use the built-in element view to select the article.
* Currently uses blank class.
*/
$link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component';
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('PLG_ARTICLE_BUTTON_ARTICLE'));
$button->set('name', 'article');
$button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
return $button;
}
示例13: getInput
protected function getInput()
{
$html = array();
$attr = '';
// Initialize some field attributes.
$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
$attr .= $this->size ? ' style="width:' . $this->size . 'px"' : '';
$attr .= $this->multiple ? ' multiple' : '';
$attr .= $this->required ? ' required aria-required="true"' : '';
$attr .= $this->autofocus ? ' autofocus' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true') {
$attr .= ' disabled="disabled"';
}
// Initialize JavaScript field attributes.
$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
// Get the field options.
$options = (array) $this->getOptions();
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true') {
// Create a read-only list (no name) with a hidden input to store the value.
$html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"/>';
} else {
// Create a regular list.
$html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
return implode($html);
}
示例14: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
ContentHelper::addSubmenu('featured');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->authors = $this->get('Authors');
$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;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例15: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
JHtml::_('jquery.framework');
$itemid = JFactory::getApplication()->input->getInt('id', 0);
$document = JFactory::getDocument();
$document->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/customfield.js');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_NO_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_LOAD_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_BTN_EDIT_GROUP');
$html = '<div
id="' . $this->id . '"
class="form-horizontal customfield"
data-fieldname="' . $this->fieldname . '"
data-controller="' . $this->element['controller'] . '"
data-itemid="' . $itemid . '">
<div class="form-container"></div>
<img class="img-loading" src="' . JUri::root() . '/media/system/images/modal/spinner.gif" />
<div class="control-group">
<div class="controls">
<button class="btn btn-primary btn-reload"><span class="icon-refresh"></span> ' . JText::_('COM_DZPRODUCT_RELOAD_FIELDS') . '</button>
</div>
</div>
</div>';
return $html;
}