本文整理汇总了PHP中plgCCK_Field_ValidationRequired类的典型用法代码示例。如果您正苦于以下问题:PHP plgCCK_Field_ValidationRequired类的具体用法?PHP plgCCK_Field_ValidationRequired怎么用?PHP plgCCK_Field_ValidationRequired使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了plgCCK_Field_ValidationRequired类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $field->bool2 ? self::_p2nl($value) : self::_br2nl($value) : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true, 'maxSize' => true));
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$class = 'inputbox textarea' . $validate . ($field->css ? ' ' . $field->css : '');
$cols = $field->cols ? $field->cols : 25;
$rows = $field->rows ? $field->rows : 3;
$attr = 'class="' . $class . '"';
if ($field->attributes != '') {
if (strpos($field->attributes, 'J(') !== false) {
$matches = '';
$search = '#J\\((.*)\\)#U';
preg_match_all($search, $field->attributes, $matches);
if (count($matches[1])) {
foreach ($matches[1] as $text) {
$field->attributes = str_replace('J(' . $text . ')', JText::_('COM_CCK_' . str_replace(' ', '_', trim($text))), $field->attributes);
}
}
}
$attr .= ' ' . $field->attributes;
}
$form = '<textarea id="' . $id . '" name="' . $name . '" cols="' . $cols . '" rows="' . $rows . '" ' . $attr . '>' . $value . '</textarea>';
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
$hidden = '<textarea class="inputbox" style="display: none;" id="_' . $id . '" name="' . $name . '" />' . $value . '</textarea>';
parent::g_getDisplayVariation($field, $field->variation, $value, self::_bn2br(self::_bn2clear($value)), $form, $id, $name, '<textarea', $hidden, '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:59,代码来源:textarea.php
示例2: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
if ($value == 0) {
$form = '';
} else {
$class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
$xml = '
<form addfieldpath="/administrator/components/com_users/models/fields">
<field
type="' . self::$type2 . '"
name="' . $name . '"
id="' . $id . '"
label="' . htmlspecialchars($field->label) . '"
class="' . $class . '"
/>
</form>
';
$form = JForm::getInstance($id, $xml);
$form = $form->getInput($name, '', $value);
}
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
$field->text = JCckDatabase::loadResult('SELECT title FROM #__usergroups WHERE id = ' . (int) $value);
parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:58,代码来源:jform_groupparent.php
示例3: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
$xml = '
<form>
<field
type="' . self::$type2 . '"
client="administrator"
name="' . $name . '"
id="' . $id . '"
label="' . htmlspecialchars($field->label) . '"
class="' . $class . '"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
</form>
';
$form = JForm::getInstance($id, $xml);
$form = $form->getInput($name, '', $value);
$form = str_replace('<select ', '<select style="width: 150px"', $form);
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<select', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:57,代码来源:jform_templatestyle.php
示例4: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
if ($config['client'] == 'admin' && !$config['pk'] && !$value) {
$value = array(2);
} elseif ($value && is_string($value) && strpos($value, ',') !== false) {
$value = explode(',', $value);
} elseif (is_null($value)) {
$value = $field->defaultvalue;
}
if (!is_array($value)) {
$value = array($value);
}
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$class = $field->css ? ' class="' . $field->css . '"' : '';
$form = JHtml::_('access.usergroups', $name, $value);
// JForm UserGroups ?!
$form = '<div id="' . $name . '"' . $class . '>' . $form . '</div>';
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
$values = is_array($value) ? implode(',', $value) : $value;
$field->text = JCckDatabase::loadColumn('SELECT title FROM #__usergroups WHERE id IN (' . (string) $values . ')');
$field->text = implode(',', $field->text);
//todo
parent::g_getDisplayVariation($field, $field->variation, $values, $field->text, $form, $id, $name, '<input', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:55,代码来源:jform_usergroups.php
示例5: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$assoc = JCckDevHelper::hasLanguageAssociations();
$form = '';
if ($assoc && $config['pk']) {
if (isset($config['base']->location) && $config['base']->location) {
$location = $config['base']->location;
} else {
$location = JCckdatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $config['type'] . '"');
}
if (is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php')) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php';
$form = JCck::callFunc_Array('plgCCK_Storage_Location' . $location . '_Helper', 'getAssociationsForm', array($id, $name, $config));
}
}
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
//
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:52,代码来源:jform_associations.php
示例6: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
$value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
if ($config['pk']) {
// hardfix for now
$field->required = '';
} else {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
}
// Prepare
$class = 'inputbox password' . $validate . ($field->css ? ' ' . $field->css : '');
$maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
$attr = 'class="' . $class . '" size="' . $field->size . '" autocomplete="off"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
$form = '<input type="password" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:densem-2013,项目名称:exikom,代码行数:50,代码来源:password.php
示例7: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
if (trim($field->selectlabel)) {
if ($config['doTranslation']) {
$field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
}
}
$options2 = JCckDev::fromJSON($field->options2);
if (isset($options2['prepareform']) && $options2['prepareform'] != '') {
$form = self::_eval($options2['prepareform'], 'form', $field, $value, $name, $id, $config);
} else {
$form = '';
}
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:48,代码来源:42.php
示例8: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$options2 = JCckDev::fromJSON($field->options2);
$opts = self::_getOptionsList($options2, $field, $config);
$class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
if ($value != '') {
$class .= ' has-value';
}
$attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
$form = count($opts) ? JHtml::_('select.genericlist', $opts, $name, $attr, 'value', 'text', $value, $id) : '';
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<select', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:46,代码来源:select_numeric.php
示例9: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $field->bool2 ? self::_p2nl($value) : self::_br2nl($value) : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true, 'maxSize' => true));
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$class = 'inputbox textarea' . $validate . ($field->css ? ' ' . $field->css : '');
$cols = $field->cols ? $field->cols : 25;
$rows = $field->rows ? $field->rows : 3;
$attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
$form = '<textarea id="' . $id . '" name="' . $name . '" cols="' . $cols . '" rows="' . $rows . '" ' . $attr . '>' . $value . '</textarea>';
// Set
if (!$field->variation) {
$field->form = $form;
} else {
$hidden = '<textarea class="inputbox" style="display: none;" id="' . $id . '" name="' . $name . '" />' . $value . '</textarea>';
parent::g_getDisplayVariation($field, $field->variation, $value, self::_bn2br(self::_bn2clear($value)), $form, $id, $name, '<textarea', $hidden, '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:43,代码来源:textarea.php
示例10: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
$value = htmlspecialchars($value, ENT_QUOTES);
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
$attr = 'class="' . $class . '" size="' . $field->size . '" maxlenght="7"' . ($field->attributes ? ' ' . $field->attributes : '');
$form = '<input class="' . $class . '" type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
// Set
if (!$field->variation) {
$field->form = $form;
self::_addScripts($id, array(), $config);
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:41,代码来源:colorpicker.php
示例11: onCCK_FieldPrepareSearch
public function onCCK_FieldPrepareSearch(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
$options2 = JCckDev::fromJSON($field->options2);
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = trim($value) != '' ? trim($value) : trim($field->defaultvalue);
if (trim($value) == '' || $value == '0000-00-00 00:00:00') {
$Jdate = '';
$value = '';
$storedDate = '';
} else {
$options2['storage_format'] = isset($options2['storage_format']) ? $options2['storage_format'] : '0';
$value = $options2['storage_format'] == '0' ? strtotime($value) : $value;
$Jdate = date('Y-m-d H:i:s', $value);
$storedDate = date('Ymd', $value);
$value = date(@$options2['format'], $value);
}
$default_hour = @$options2['default_hour'];
$default_min = @$options2['default_min'];
$default_sec = @$options2['default_sec'];
$format_jscal2 = self::_toJScal2Format(array('format' => @$options2['format'], 'default_hour' => $default_hour, 'default_min' => $default_min, 'default_sec' => $default_sec, 'time' => $options2['time']));
$format_search = self::_toSearchFormat(array('format' => @$options2['format'], 'default_hour' => $default_hour, 'default_min' => $default_min, 'default_sec' => $default_sec, 'time' => $options2['time']));
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
if (strpos($name, '[]') !== false) {
//FieldX
$nameH = substr($name, 0, -2);
$form_more = '<input class="inputbox" type="hidden" id="' . $id . '" name="' . $nameH . '[]" value="' . $Jdate . '" />';
} elseif ($name[strlen($name) - 1] == ']') {
//GroupX
$nameH = substr($name, 0, -1);
$form_more = '<input class="inputbox" type="hidden" id="' . $id . '" name="' . $nameH . ']" value="' . $Jdate . '" />';
} else {
//Default
$form_more = '<input class="inputbox" type="hidden" id="' . $id . '" name="' . $name . '" value="' . $Jdate . '" />';
}
$class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
$maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
$readonly = $field->bool2 ? '' : ' readonly="readonly"';
$attr = 'class="' . $class . '" size="' . $field->size . '"' . $readonly . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
$form = '<input type="text" id="' . $id . '_hidden" name="' . $name . '_hidden" value="' . $value . '" ' . $attr . ' />' . $form_more;
// Set
if (!$field->variation) {
if (JCck::on()) {
$form .= '<button class="btn" id="' . $id . '_hidden-trigger"><span class="icon-calendar"></span></button>';
} else {
$form .= '<img src="' . self::$path . 'assets/images/calendar.png" alt="Calendar" class="calendar" id="' . $id . '_hidden-trigger" />';
}
$form .= self::_addScript($id, array('dateFormat' => $format_jscal2, 'time' => @$options2['time'], 'weekNumbers' => @$options2['week_numbers'], 'timePos' => @$options2['time_pos'], 'dates' => @$options2['dates'], 'storedDate' => $storedDate, 'default_hour' => $default_hour, 'default_min' => $default_min, 'default_sec' => $default_sec, 'type' => 'search', 'input_text' => $field->bool2));
$field->form = $form;
$field->markup_class .= ' input-append';
self::_addScripts(array('theme' => @$options2['theme']));
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
}
// Set
$field->value = $Jdate == '' ? '' : date($format_search, strtotime($Jdate));
// Return
if ($return === true) {
return $field;
}
}
开发者ID:olafzieger,项目名称:joomla3.x-seblod-test,代码行数:78,代码来源:calendar.php
示例12: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$opts = array();
if (trim($field->selectlabel)) {
if ($config['doTranslation']) {
$field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
}
$opts[] = JHtml::_('select.option', '', '- ' . $field->selectlabel . ' -', 'value', 'text');
}
$options = '"' . str_replace('||', '","', $field->options) . '"';
$opts2 = JCckDatabase::loadObjectList('SELECT title AS text, id AS value FROM ' . self::$table . ' WHERE catid IN(' . $options . ') AND state = 1 ORDER BY title', 'value');
if (count($opts2)) {
$opts = array_merge($opts, $opts2);
}
$class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
$attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
$form = count($opts) ? JHtml::_('select.genericlist', $opts, $name, $attr, 'value', 'text', $value, $id) : '';
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
$field->text = isset($opts2[$value]->text) ? $opts2[$value]->text : $value;
parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:54,代码来源:joomla_article.php
示例13: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$field->defaultvalue = '{"imageUrl":"","areas":[{"href":"","coords":[]}]}';
$value = json_decode($value) != NULL ? json_decode($value) : json_decode($field->defaultvalue);
$value_raw = json_encode($value);
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
//$maxlen = ( $field->maxlength > 0 ) ? ' maxlength="'.$field->maxlength.'"' : '';
$xml = '
<form>
<field
type="media"
name="' . $name . '"
id="img_' . $id . '"
label="' . htmlspecialchars($field->label) . '"
class="' . $class . '"
size="10"
/>
</form>
';
$imgurl = "";
if (isset($value->imageUrl)) {
$imgurl = $value->imageUrl;
}
$imginput = JForm::getInstance($id, $xml);
$imginput = $imginput->getInput($name, '', $imgurl);
$attr = 'class="' . $class . '" size="' . $field->size . '"' . ($field->attributes ? ' ' . $field->attributes : '');
$form = '<input type="hidden" id="' . $id . '" name="' . $name . '" value="' . htmlentities($value_raw) . '" ' . $attr . ' />';
$form = '
<div id="imgmap_' . $id . '">
<div class="htmlimgmap_img">' . $imginput . '</div>
<div>' . $form . '</div>
<div class="htmlimgmap_ctrls">
<button class="btn remove"><span class="icon-remove"></span> remove</button>
<button class="btn reset"><span class="icon-loop"></span> reset</button>
<button class="btn add"><span class="icon-save-new"></span> add</button>
</div>
<div class="htmlimgmap"></div>
<div class="htmlimgmap_layers">
<ul class="sortable"></ul>
</div>
</div>
';
// Set
if (!$field->variation) {
$field->form = $form;
self::_addScripts($id, array(), $config, $value_raw);
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:neshte,项目名称:seblod_plg_cck_field_htmlmap,代码行数:79,代码来源:htmlmap.php
示例14: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$app = JFactory::getApplication();
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
$form = '';
if ($assoc && $config['pk']) {
$languages = JLanguageHelper::getLanguages('lang_code');
// Create Form
$addform = new SimpleXMLElement('<form />');
$fields = $addform->addChild('fields');
$fields->addAttribute('name', $name);
$fieldset = $fields->addChild('fieldset');
$fieldset->addAttribute('name', 'item_associations');
$fieldset->addAttribute('description', 'COM_CONTENT_ITEM_ASSOCIATIONS_FIELDSET_DESC');
$fieldset->addAttribute('addfieldpath', '/administrator/components/com_content/models/fields');
$hasForm = false;
foreach ($languages as $tag => $language) {
if (empty($config['language']) || $tag != $config['language']) {
$hasForm = true;
$f = $fieldset->addChild('field');
$f->addAttribute('name', $tag);
$f->addAttribute('type', 'modal_article');
$f->addAttribute('language', $tag);
$f->addAttribute('label', $language->title);
$f->addAttribute('translate_label', 'false');
}
}
$form = JForm::getInstance($id, $addform->asXML());
if ($hasForm) {
$form->load($addform, false);
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $config['pk']);
if (count($associations)) {
foreach ($associations as $tag => $association) {
$form->setValue($tag, $name, $association->id);
}
}
if ($config['translate_id'] && isset($config['translate'])) {
$form->setValue($config['translate'], $name, $config['translate_id']);
}
}
// Render Form
$fields = $form->getFieldset('item_associations');
$form = '';
foreach ($fields as $f) {
$form .= '<div class="control-group"><div class="control-label">' . $f->label . '</div><div class="controls">' . $f->input . '</div></div>';
}
}
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
//
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
开发者ID:olafzieger,项目名称:joomla3.x-seblod-test,代码行数:84,代码来源:jform_associations.php
示例15: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareForm($field, $config);
// Init
if (count($inherit)) {
$id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$id = $field->name;
$name = $field->name;
}
$value = $value != '' ? $value : $field->defaultvalue;
$value = $value != ' ' ? $value : '';
$value = JCckDev::fromJSON($value);
$value['text'] = htmlspecialchars(@$value['text'], ENT_QUOTES);
$preview = '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
$class2 = 'inputbox text';
$maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
$attr = 'class="' . $class . '" size="' . $field->size . '"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
$attr2 = 'class="' . $class2 . '" size="' . $field->size . '"' . $maxlen;
$options2 = JCckDev::fromJSON($field->options2);
if ($config['doTranslation']) {
$link_label = trim(@$options2['link_label']) ? JText::_('COM_CCK_' . str_replace(' ', '_', trim(@$options2['link_label']))) : '';
$text_label = trim(@$options2['text_label']) ? JText::_('COM_CCK_' . str_replace(' ', '_', trim(@$options2['text_label']))) : '';
} else {
$link_label = @$options2['link_label'] != '' ? trim($options2['link_label']) : '';
$text_label = @$options2['text_label'] != '' ? $options2['text_label'] : '';
}
if (strpos($name, '[]') !== false) {
//FieldX
$nameH = substr($name, 0, -2);
$nameLink = $name;
$nameText = $nameH . '_text[]';
$nameClass = $nameH . '_class[]';
$nameTarget = $nameH . '_target[]';
} elseif ($name[strlen($name) - 1] == ']') {
//GroupX
$nameH = substr($name, 0, -1);
$nameLink = $name;
$nameText = $nameH . '_text]';
$nameClass = $nameH . '_class]';
$nameTarget = $nameH . '_target]';
} else {
//Default
$nameH = $name;
$nameLink = $name;
$nameText = $nameH . '_text';
$nameClass = $nameH . '_class';
$nameTarget = $nameH . '_target';
}
$form = self::_addInput($id, $nameLink, $attr, $link_label, @$value['link'], 'link');
if ($field->bool2 == 1) {
$form .= self::_addInput($id . '_text', $nameText, $attr2, $text_label, @$value['text'], 'text');
}
if ($field->bool3 == 1) {
$form .= self::_addInput($id . '_class', $nameClass, $attr2, JText::_('COM_CCK_CLASS'), @$value['class'], 'class');
}
if ($field->bool4 == 1) {
$form .= self::_addSelect($id . '_target', JText::_('COM_CCK_TARGET'), 'target', 'core_options_target', @$value['target'], array('storage_field' => $nameTarget));
}
if ($field->bool5 == 1 && $config['pk'] && @$value['link'] != '') {
$p_link = @$value['link'];
$p_text = @$value['text'] ? @$value['text'] : $p_link;
$p_link = strpos($p_link, 'index.php') === 0 ? $p_link : (strpos($p_link, 'http://') === false && strpos($p_link, 'https://') === false ? 'http://' . $p_link : $p_link);
$preview = '<a href="' . $p_link . '" class="cck_preview" target="_blank">' . $p_text . '</a>';
$preview = self::_addPreview($id . '_preview', JText::_('COM_CCK_PREVIEW'), $preview, 'preview');
}
// Set
if (!$field->variation) {
$field->form = $form . $preview;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
}
$fie
|
请发表评论