本文整理汇总了PHP中JDom类的典型用法代码示例。如果您正苦于以下问题:PHP JDom类的具体用法?PHP JDom怎么用?PHP JDom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JDom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
function build()
{
$html = '';
$ctrl = $this->ctrl ? $this->ctrl . '.' : '';
$html = JDom::_('html.grid.bool', array_merge($this->options, array('strNO' => $this->togglable ? 'JTOOLBAR_PUBLISH' : 'JNO', 'strYES' => $this->togglable ? 'JTOOLBAR_UNPUBLISH' : 'JYES')));
return $html;
}
示例2: build
function build()
{
$html = "\n" . "<div id='" . $this->ajaxWrapper . "'" . ($this->required ? " class='ajax-required'" : "") . "></div>";
$html .= LN . '<%VALIDOR_ICON%>' . LN . '<%MESSAGE%>';
$html .= JDom::_('html.form.input.hidden', array_merge($this->options, array('dataValue' => $this->dataValue == 0 ? "" : $this->dataValue)));
return $html;
}
示例3: build
function build()
{
$jinput = new JInput();
//Initialize default form
$keys = array('option' => $this->getExtension(), 'view' => $this->getView(), 'layout' => $jinput->get('layout', null, 'CMD'), 'task' => "");
//For item layout
if (isset($this->dataObject)) {
$keys['id'] = isset($this->dataObject->id) ? $this->dataObject->id : 0;
//Deprecated
$keys['cid[]'] = isset($this->dataObject->id) ? $this->dataObject->id : 0;
}
//Specifics values or overrides
if (isset($this->values)) {
foreach ($this->values as $key => $value) {
$keys[$key] = $value;
}
}
//Reproduce current query in the form
$followers = array('lang', 'Itemid', 'tmpl');
//Cmd types only for the moment
foreach ($followers as $follower) {
$val = $jinput->get($follower, null, 'CMD');
if ($val) {
$keys[$follower] = $val;
}
}
$html = "";
foreach ($keys as $key => $value) {
$html .= JDom::_('html.form.input.hidden', array('dataKey' => $key, 'dataValue' => $value));
}
//Token
$html .= JHTML::_('form.token');
return $html;
}
示例4: displayAjax
/**
* Execute and display ajax queries
*
* @access protected
* @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 JError object.
*
* @since 11.1
*/
protected function displayAjax($tpl = null)
{
$jinput = JFactory::getApplication()->input;
$render = $jinput->get('render', null, 'CMD');
$token = $jinput->get('token', null, 'BASE64');
$values = $jinput->get('values', null, 'ARRAY');
switch ($render) {
case 'filter3':
/* Ajax Filter : Manufacturer > Name
* Called from: view:printers, layout:default
* Group Level : 1
*/
$model = $this->getModel();
$model->addSelect('a.name');
$items = $model->getItems();
$selected = is_array($values) ? $values[count($values) - 1] : $values;
$ajaxNamespace = "rtiprint.printermdls.ajax.filter3";
$wrapper = "_ajax_printermdls_{$render}";
$event = 'jQuery("#filter_printer_model").val("");' . 'if(this.value != ""){' . 'jQuery("#' . $wrapper . '").jdomAjax({namespace:"' . $ajaxNamespace . '", vars:{"filter_manufacturer":this.value}})' . '}else{' . 'jQuery("#' . $wrapper . '").innerHTML = "";' . '}';
echo '<div class="ajaxchain-filter ajaxchain-filter-hz">';
echo JDom::_('html.form.input.select', array('dataKey' => 'filter_printer_model_manufacturer', 'dataValue' => $selected, 'domClass' => 'span-2 element-filter', 'labelKey' => 'name', 'list' => $items, 'listKey' => 'id', 'nullLabel' => 'RTIPRINT_FILTER_NULL_MANUFACTURER', 'selectors' => array('onchange' => $event), 'ui' => 'chosen'));
echo '</div>';
//Ajax chain on load -> Follows the values
echo JDom::_('html.form.input.ajax.chain', array('ajaxWrapper' => $wrapper, 'ajaxContext' => $ajaxNamespace, 'ajaxVars' => array('filter_manufacturer' => $selected, 'values' => $values), 'ajaxToken' => $token));
//Wrapper Div
echo "<div id='" . $wrapper . "' class='ajaxchain-wrapper ajaxchain-wrapper-hz'></div>";
break;
}
exit;
}
示例5: build
function build()
{
$dir = $this->pathToUrl($this->systemImagesDir(), true);
$task = $this->ctrl . '.saveorder';
$alt = JText::_('JGRID_HEADING_ORDERING');
$htmlIcon = '<div style="background-image:url(' . $dir . '/filesave.png); width:16px; height:16px; display:inline-block"></div>';
$html = JDom::_('html.link', array('content' => $htmlIcon, 'title' => JText::_('Save Order'), 'task' => $task));
return $html;
}
示例6: build
function build()
{
if ($this->viewType == 'text') {
//Text alone
$html = JDom::_('html.fly', array('dataValue' => JText::_($this->label), 'task' => $this->task, 'num' => $this->num, 'tooltip' => $this->tooltip, 'title' => JText::_($this->label), 'description' => $this->description));
return $html;
}
return JHTML::_('jgrid.action', $this->num, $this->task, array('active_title' => JText::_($this->label) . '::' . JText::_($this->description), 'inactive_title' => JText::_($this->label) . '::' . JText::_($this->description), 'tip' => $this->tooltip, 'active_class' => $this->taskIcon, 'inactive_class' => $this->taskIcon, 'enabled' => $this->enabled, 'translate' => true, 'checkbox' => 'cb', 'prefix' => $this->ctrl ? $this->ctrl . '.' : ''));
}
示例7: build
function build()
{
// Load the modal behavior script.
JHtml::_('behavior.modal', 'a.modal');
$id = $this->dataKey;
$name = $this->name;
$label = JText::_($this->nullLabel);
$link = $this->getRoute($this->route, 'modal');
$rel = '{handler: \'iframe\', size: {x: ' . $this->width . ', y: ' . $this->height . '}}';
$title = $this->title;
if (empty($title)) {
$title = $label;
}
$scriptReset = "document.id('" . $id . "_id').value = '';";
$scriptReset .= "document.id('" . $id . "_name').value = '" . htmlspecialchars($label, ENT_QUOTES, 'UTF-8') . "';";
$html = array();
//Remove button
$htmlReset = ' <a class="btn"' . ' title="' . htmlspecialchars($label, ENT_QUOTES, 'UTF-8') . '"' . ' onclick="' . htmlspecialchars($scriptReset, ENT_QUOTES, 'UTF-8') . '"' . '>' . LN;
$htmlReset .= ' <i class="icon-delete"></i>' . LN;
$htmlReset .= ' </a>' . LN;
//Input area (readonly)
$htmlInput = JDom::_('html.form.input.text', array('dataKey' => $id . '_name', 'dataValue' => $title, 'domClass' => 'inputbox input-medium', 'selectors' => array('disabled' => 'disabled', 'readonly' => 'readonly'), 'size' => 40));
//Select button
$htmlSelect = ' <a class="modal btn btn-primary" title="' . $label . '" href="' . $link . '" rel="' . $rel . '">' . LN;
$htmlSelect .= ' <i class="icon-list icon-white"></i> ' . JText::_('JSELECT') . LN;
$htmlSelect .= ' </a>' . LN;
// Hidden field
$htmlHidden = JDom::_('html.form.input.hidden', array('dataKey' => $this->dataKey . '_id', 'domName' => $this->domName, 'dataValue' => $this->dataValue));
$htmlTasks = '';
//Extra tasks buttons
if (count($this->tasks)) {
foreach ($this->tasks as $taskName => $task) {
$label = isset($task['label']) ? JText::_($task['label']) : '';
$desc = isset($task['description']) ? JText::_($task['description']) : $label;
$jsCommand = isset($task['jsCommand']) ? $task['jsCommand'] : null;
$icon = isset($task['icon']) ? $task['icon'] : $taskName;
$caption = '';
if (in_array($this->display, array('icon', 'both'))) {
$caption .= ' <i class="icon-' . $icon . '"></i> ';
}
if (in_array($this->display, array('text', 'both'))) {
$caption .= $label;
}
$htmlTasks .= ' <a class="btn hasTooltip" title="' . htmlspecialchars($desc, ENT_QUOTES, 'UTF-8') . '"' . ($jsCommand ? ' onclick="' . htmlspecialchars($jsCommand, ENT_QUOTES, 'UTF-8') . '"' : '') . '>' . LN;
$htmlTasks .= $caption;
$htmlTasks .= ' </a>' . LN;
}
}
// Construct the control
$html = $htmlReset . $htmlInput . $htmlSelect . $htmlTasks;
// Embed in bootsrap btn-group
$html = '<span class="input-append input-prepend">' . $html . '</span>';
// Add the hidden field (storing the value)
$html .= $htmlHidden;
return $html;
}
示例8: build
function build()
{
$html = "";
if (isset($this->dataValue) && isset($this->list[$this->dataValue][$this->labelKey])) {
$html = $this->list[$this->dataValue][$this->labelKey];
}
//Embed in a bootstrap label
$html = JDom::_('html.label', array('content' => $html));
return $html;
}
示例9: build
function build()
{
//Requires jQuery
JDom::_('framework.jquery');
if ($this->live) {
$this->addScript($this->hostedSource);
} else {
$this->attachJs[] = 'jquery.ui.min.js';
}
}
示例10: build
function build()
{
if ($this->position == 'top') {
//Must reverse the order of filters of the right side
$filtersLeft = array();
$filtersRight = array();
if (!empty($this->list)) {
foreach ($this->list as $filter) {
if ($filter->align && $filter->align == 'right') {
$filtersRight[] = $filter;
} else {
$filtersLeft[] = $filter;
}
}
}
$filtersRight = array_reverse($filtersRight);
$this->list = array_merge($filtersLeft, $filtersRight);
}
if (empty($this->list)) {
return;
}
$html = array();
$i = 0;
foreach ($this->list as $filter) {
// Horizontal separator
if ($i > 0 && $this->position == 'sidebar') {
$html[] = '<hr class="hr-condensed" />';
}
$htmlControl = '';
// Label is invisible
$htmlControl .= '<label class="element-invisible">';
$htmlControl .= $filter->label;
$htmlControl .= '</label>';
// Render the input
$htmlControl .= $filter->input;
$classes = array();
//Wrap in a div for horizontal alignement
if ($filter->align && in_array($filter->align, array('left', 'right'))) {
$classes[] = 'btn-group';
$classes[] = 'pull-' . $filter->align;
}
if ($responsive = $filter->responsive) {
$classes[] = $this->getResponsiveClass($responsive);
}
if (count($classes)) {
$htmlControl = JDom::_('html.fly', array('domClass' => implode(' ', $classes), 'dataValue' => $htmlControl, 'markup' => 'div'));
}
$html[] = $htmlControl;
$i++;
}
return implode('', $html);
}
示例11: build
function build()
{
if (empty($this->list)) {
return;
}
$html = '';
$html .= '<ul id="submenu" class="nav nav-list">';
foreach ($this->list as $item) {
$html .= JDom::_('html.link.menu.submenu', array('content' => JText::_($item[0]), 'href' => $item[1], 'active' => $item[2]));
}
$html .= '</ul>';
return $html;
}
示例12: build
function build()
{
if ($this->groupBy) {
$options = $this->buildOptionsGroup();
} else {
$options = $this->buildOptions();
}
if ($this->ui == 'chosen') {
JDom::_('framework.jquery.chosen');
$this->addClass('chzn-select');
}
$html = '<select id="<%DOM_ID%>" name="<%INPUT_NAME%>"<%STYLE%><%CLASS%><%SELECTORS%>' . ((int) $this->size > 1 ? ' size="' . (int) $this->size . '"' : '') . '>' . LN . $this->indent($this->buildDefault(), 1) . $this->indent($options, 1) . '</select>' . LN . '<%VALIDOR_ICON%>' . LN . '<%MESSAGE%>';
return $html;
}
示例13: build
function build()
{
return JDom::_('html.fly.datetime', $this->options);
//DEPRECATED : Use fly.datetime
$formatedDate = "";
if ($this->dataValue && $this->dataValue != "0000-00-00" && $this->dataValue != "00:00:00" && $this->dataValue != "0000-00-00 00:00:00") {
jimport("joomla.utilities.date");
$date = new JDate($this->dataValue);
$formatedDate = $date->toFormat($this->dateFormat);
}
$this->addClass('grid-date');
$html = '<span <%STYLE%><%CLASS%><%SELECTORS%>>' . $formatedDate . '</span>';
return $html;
}
示例14: build
function build()
{
//Only for bootstrap
if (!$this->useFramework('bootstrap')) {
echo $this->error('Bootstrap is required');
return;
}
if (!$this->href) {
$this->href = '#';
}
JDom::_('framework.bootstrap');
$this->addSelector('rel', $this->rel);
$this->link_title = $this->title;
$html = '<a<%ID%><%CLASS%><%STYLE%><%TITLE%><%HREF%><%JS%><%TARGET%><%SELECTORS%>' . ' data-title="' . $this->title . '"' . ' data-content="' . $this->contents . '"' . '>' . $this->content . '</a>';
return $html;
}
示例15: build
function build()
{
//Icon alone
if ($this->viewType == 'icon') {
$html .= JDom::_('html.icon', array('icon' => $this->icon, 'tooltip' => true, 'title' => $this->text));
return $html;
}
//Icon
if ($this->viewType == 'both') {
$html .= JDom::_('html.icon', array('icon' => $this->icon));
}
$html .= $this->text;
//Embed in label
$html = JDom::_('html.label', array('content' => $html, 'color' => $this->color));
return $html;
}