本文整理汇总了PHP中JForm::getInput方法的典型用法代码示例。如果您正苦于以下问题:PHP JForm::getInput方法的具体用法?PHP JForm::getInput怎么用?PHP JForm::getInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JForm
的用法示例。
在下文中一共展示了JForm::getInput方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
$end = $this->element['end'];
$styles = $this->element['styles'];
$background = $this->element['background'] ? 'background-image: url(' . $this->getPathToImages() . '/images/' . $this->element['background'] . ');' : '';
$tag = $this->element['tag'];
if ($end == '1') {
// $html = '</li></'.$tag.'><li>';
$html = '</' . $tag . '><div><div>';
} else {
// $html = '</li><'.$tag.' style="'.$background.$styles.'" ><li>';
$html = '</div></div><' . $tag . ' style="' . $background . $styles . '" >';
}
// var_dump($html);
$identifier = 'menustyles';
$form = new JForm($identifier);
JForm::addFormPath(JPATH_SITE . '/modules/mod_slideshowck/elements/test');
if (!($formexists = $form->loadFile($identifier, false))) {
echo '<p style="color:red">' . JText::_('Problem loading the file : ' . $identifier . '.xml') . '</p>';
return '';
}
$fields = $form->getFieldset();
foreach ($fields as $key => $field) {
// echo '<div class="ckpopup_row">';
$html .= $form->getLabel(str_replace($identifier . "_", "", $key), $identifier);
$html .= $form->getInput(str_replace($identifier . "_", "", $key), $identifier);
// echo '</div>';
}
return $html;
}
示例2: date
/**
* Display date form field. If field value equal database null date reset to empty string.
*
* @param string $field form field name
* @return string field form html
*/
public function date($field)
{
static $nullDate;
if (empty($nullDate)) {
$db = JFactory::getDbo();
/* @var $db JDatabaseMySQL */
$nullDate = $db->getNullDate();
}
if ($this->form->getValue($field) == $nullDate) {
$this->form->setValue($field, null, '');
}
return $this->form->getInput($field);
}
示例3: getInput
/**
* result html input code (in "LIst" type use extraValues and extraOptions)
* @result string html code
* @param string $fieldName
*/
public function getInput($fieldName)
{
$actValue = $this->extraValues[$fieldName];
$result = parent::getInput($fieldName);
//$result = str_replace(' value="'.$actValue.'">',' value="'.$actValue.'" selected="selected">',$result);
if (substr($result, 0, 7) == '<select') {
$options = '';
foreach ($this->extraOptions[$fieldName] as $fn => $fv) {
if ($fv == $actValue) {
$options .= '<option value="' . $fv . '" selected="selected">' . $fn . '</option>';
} else {
$options .= '<option value="' . $fv . '">' . $fn . '</option>';
}
}
$result = str_replace('</select>', $options . '</select>', $result);
}
return $result;
}
示例4: renderFieldset
/**
*
* @param JForm $form form object
* @param string $name name of the fieldset
* @param string $group name of the group
* @param string $type may be classic, table, params
* @return string Raw HTML text
*/
public static function renderFieldset($form, $name, $defaults, $group = null, $type = 1, $title = 1)
{
$fieldsets = $form->getFieldsets($group);
$fieldset = $fieldsets[$name];
if (is_array($defaults)) {
$registry = new JRegistry();
$registry->loadArray($defaults);
$defaults = $registry;
}
/*else if(is_string($item->params))
{
$registry = new JRegistry;
$registry->loadString($item->params);
$defaults = $registry;
}*/
$fields = $form->getFieldset($name);
$defaultGetName = empty($group) ? '%2$s' : '%s.%s';
$doc = JFactory::getDocument();
$doc->addStyleSheet(JURI::root() . 'libraries/mint/forms/style.css');
$out = '';
switch ($type) {
case FORM_STYLE_CLASSIC:
if ($title && $fieldset->label) {
$out .= '<fieldset class="adminform whitebg"><legend>' . JText::_($fieldset->label) . '</legend>';
}
if (isset($fieldset->description) && !empty($fieldset->description)) {
$out .= '<small class="small">' . JText::_($fieldset->description) . '</small>';
}
$out .= '<ul class="adminformlist">';
foreach ($fields as $key => $field) {
$out .= '<li>';
if (!$field->hidden) {
$out .= $field->label;
}
$out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname)));
$out .= '</li>';
}
$out .= '</ul>';
if ($title) {
$out .= '</fieldset>';
}
break;
case FORM_STYLE_TABLE:
if ($title && $fieldset->label) {
$out .= '<legend>' . JText::_($fieldset->label) . '</legend>';
}
if (isset($fieldset->description) && !empty($fieldset->description)) {
$out .= '<small>' . JText::_($fieldset->description) . '</small><br /><br />';
}
$out .= '<table class="table table-bordered table-striped table-hover">';
$i = 1;
$hidden = array();
foreach ($fields as $key => $field) {
if ($field->hidden) {
$hidden[] = $field;
continue;
}
if ($field->type == 'Caddress' || $field->type == 'Ccontacts' || $field->type == 'Clinks' || $field->type == 'Cobaltevents') {
if (trim($out) == '<legend>' . JText::_($fieldset->label) . '</legend><table class="table table-bordered table-striped table-hover">') {
$out = '<legend>' . JText::_($fieldset->label) . '</legend>';
} else {
$out .= '</table>';
}
//$out .= '<tr class="row'.$i = 1 - $i.'"><td colspan="2">';
if ($field->type != 'Cobaltevents') {
$out .= '<legend>' . $field->label . '</legend>';
$out .= '<br />';
}
$out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname)));
//$out .= '</td></tr>';
$out .= '<br /><table class="table table-bordered table-striped table-hover">';
} else {
$out .= '<tr><td>';
if (substr($field->description, 0, 3) == 'XX_') {
$out .= '<img src="' . JUri::root(true) . '/media/mint/icons/16/exclamation-button.png" alt="Important" class="pull-right">';
}
$out .= $field->label;
$out .= '</td><td nowrap="nowrap">';
$out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname)));
$out .= '</td></tr>';
}
}
$out .= '</table>';
foreach ($hidden as $field) {
$out .= $field->input;
}
break;
case FORM_STYLE_PARAMS:
$hidden = array();
if ($title && $fieldset->label) {
$out .= '<h2 class="params-title">' . JText::_($fieldset->label) . '</h2>';
}
//.........这里部分代码省略.........