本文整理汇总了PHP中JCckDev类的典型用法代码示例。如果您正苦于以下问题:PHP JCckDev类的具体用法?PHP JCckDev怎么用?PHP JCckDev使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JCckDev类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Prepare
$app = JFactory::getApplication();
$form = '';
$options2 = JCckDev::fromJSON($field->options2);
$variables = explode('||', $field->options);
if (count($variables)) {
foreach ($variables as $k => $name) {
if ($name) {
$request = 'get' . ucfirst($options2['options'][$k]->type ? $options2['options'][$k]->type : '');
$value = $app->input->{$request}($name, '');
$value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
$form .= '<input class="inputbox hidden" type="hidden" id="' . $name . '" name="' . $name . '" value="' . $value . '" />';
}
}
}
$field->form = $form;
$field->state = 1;
$field->value = '';
// Return
if ($return === true) {
return $field;
}
}
开发者ID:kenyonjohnston,项目名称:hott_theater,代码行数:28,代码来源:search_variables.php
示例2: g_onCCK_WebserviceConstruct
public function g_onCCK_WebserviceConstruct(&$data)
{
// JSON
if (isset($data['json']) && is_array($data['json'])) {
foreach ($data['json'] as $k => $v) {
if (is_array($v)) {
$data[$k] = JCckDev::toJSON($v);
}
}
}
// STRING
if (isset($data['string']) && is_array($data['string'])) {
foreach ($data['string'] as $k => $v) {
if (is_array($v)) {
$string = '';
foreach ($v as $s) {
if ($s) {
$string .= $s . '||';
}
}
if ($string) {
$string = substr($string, 0, -2);
}
$data[$k] = $string;
}
}
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:28,代码来源:webservice.php
示例3: _getCategories
protected static function _getCategories($value, $glue, $data)
{
$values = JCckDev::fromSTRING($value, $glue);
$value = array();
foreach ($values as $v) {
if (isset($data['categories'][$v])) {
$value[] = $data['categories'][$v];
}
}
return implode($glue, $value);
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:11,代码来源:app.php
示例4: g_getLive
public static function g_getLive($params, $format = '')
{
if ($format != '') {
return JCckDev::fromJSON($params, $format);
} else {
$reg = new JRegistry();
if ($params) {
$reg->loadString($params);
}
return $reg;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:12,代码来源:live.php
示例5: postSaveHook
protected function postSaveHook(CCKModelSite &$model, $validData = array())
{
$recordId = $model->getState($this->context . '.id');
if ($recordId == 10 || $recordId == 500) {
$db = JFactory::getDbo();
$params = JCckDatabase::loadResult('SELECT params FROM #__extensions WHERE element = "com_cck"');
$config = JCckDev::fromJSON($params, 'object');
$config->multisite = 1;
$params = $db->escape(JCckDev::toJSON($config));
JCckDatabase::execute('UPDATE #__extensions SET params = "' . $params . '" WHERE element = "com_cck"');
}
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:12,代码来源:site.php
示例6: prepareLanguages
public function prepareLanguages($lang)
{
$config = JFactory::getConfig();
$tmp_path = $config->get('tmp_path');
$tmp_dir = uniqid('cck_');
$path = $tmp_path . '/' . $tmp_dir;
$name = 'seblod2';
$filename = $lang . '_' . $name;
$path_zip = $tmp_path . '/' . $filename . '.zip';
if (!$filename) {
return;
}
// Core
jimport('cck.base.install.export');
$manifest = JCckDev::fromXML(JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml');
$extensions = array();
if (count(@$manifest->files->file)) {
foreach ($manifest->files->file as $file) {
$id = (string) $file;
$id = str_replace('.zip', '', $id);
if (strpos($id, 'var_cck_') !== false) {
$id = 'files_' . $id;
}
$extensions[$id] = '';
}
}
$extensions['com_cck_core'] = '';
$extensions['com_cck_default'] = '';
// Admin
$dest = $path . '/admin';
CCK_Export::exportLanguages(JPATH_ADMINISTRATOR . '/language/' . $lang, $dest, $lang, 'admin', 'cck', $extensions);
CCK_Export::zip($dest, $path . '/cck_' . $lang . '_admin.zip');
// Site
$dest = $path . '/site';
CCK_Export::exportLanguages(JPATH_SITE . '/language/' . $lang, $dest, $lang, 'site', 'cck|tpl_seb', $extensions);
CCK_Export::zip($dest, $path . '/cck_' . $lang . '_site.zip');
// Manifest
$package = (object) array('title' => 'SEBLOD ' . $lang, 'name' => 'cck_' . $lang, 'description' => 'SEBLOD 3.x ' . $lang . ' Language Pack - www.seblod.com');
$xml = CCK_Export::preparePackage($package);
$files = $xml->addChild('files');
$file1 = $files->addChild('file', 'cck_' . $lang . '_admin.zip');
$file1->addAttribute('type', 'file');
$file1->addAttribute('src', 'administrator/language/' . $lang);
$file1->addAttribute('id', 'cck_' . $lang . '_admin');
$file2 = $files->addChild('file', 'cck_' . $lang . '_site.zip');
$file2->addAttribute('type', 'file');
$file2->addAttribute('src', 'language/' . $lang);
$file2->addAttribute('id', 'cck_' . $lang . '_site');
CCK_Export::clean($path);
CCK_Export::createFile($path . '/pkg_cck_' . $lang . '.xml', '<?xml version="1.0" encoding="utf-8"?>' . $xml->asIndentedXML());
return CCK_Export::zip($path, $path_zip);
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:52,代码来源:cck.php
示例7: applyTypeOptions
public static function applyTypeOptions(&$config)
{
$options = JCckDatabase::loadResult('SELECT options_' . $config['client'] . ' FROM #__cck_core_types WHERE name ="' . (string) $config['type'] . '"');
$options = JCckDev::fromJSON($options);
if (isset($options['message']) && $options['message'] != '') {
$config['message'] = $options['message'];
}
if (isset($options['data_integrity_excluded'])) {
$options['data_integrity_excluded'] = explode(',', str_replace(' ', ',', trim($options['data_integrity_excluded'])));
} else {
$options['data_integrity_excluded'] = array();
}
$config['message_style'] = isset($options['message_style']) ? $options['message_style'] : 'message';
$config['options'] = $options;
}
开发者ID:densem-2013,项目名称:exikom,代码行数:15,代码来源:form.php
示例8: check
public function check()
{
$this->title = trim($this->title);
if (empty($this->title)) {
return false;
}
if (empty($this->name)) {
$this->name = $this->title;
$this->name = JCckDev::toSafeSTRING($this->name);
if (trim(str_replace('_', '', $this->name)) == '') {
$datenow = JFactory::getDate();
$this->name = $datenow->format('Y_m_d_H_i_s');
}
}
return true;
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:16,代码来源:search.php
示例9: _typo
protected static function _typo($typo, $field, $value, &$config = array())
{
$format = $typo->get('format', 'Y-m-d');
$value = trim($field->value);
if ($format == -2) {
$typo = self::_getTimeAgo($value, $typo->get('unit', ''), $typo->get('alt_format', ''), $typo->get('format2', 'Y-m-d'));
} else {
$options2 = JCckDev::fromJSON($field->options2);
if ($format == -1) {
$format = trim($typo->get('format_custom', @$options2['format']));
}
$value = self::_getValueWithFormatStorage($value, @$options2['storage_format']);
$date_eng = $format ? date($format, $value) : $value;
$typo = self::_getDateByLang($format, $value, $date_eng);
}
return $typo;
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:17,代码来源:date.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;
// 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
示例11: prepareDisplay
function prepareDisplay()
{
$app = JFactory::getApplication();
$model = $this->getModel();
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->option = $app->input->get('option', '');
$this->state = $this->get('State');
// Check Errors
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->isNew = @$this->item->id > 0 ? 0 : 1;
$this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1);
$this->item->type = $this->state->get('type', '2,7');
$this->item->fields = JCck::getConfig_Param('multisite_options', array());
$this->item->options = $this->item->options ? JCckDev::fromJSON($this->item->options) : array();
Helper_Admin::addToolbarEdit($this->vName, _C5_TEXT, array('isNew' => $this->isNew, 'folder' => 0, 'checked_out' => $this->item->checked_out));
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:20,代码来源:view.html.php
示例12: revert
public function revert($pk, $type)
{
$db = $this->getDbo();
$table = $this->getTable();
if (!$pk || !$type) {
return false;
}
$table->load($pk);
if (JCck::getConfig_Param('version_revert', 1) == 1) {
Helper_Version::createVersion($type, $table->e_id, JText::sprintf('COM_CCK_VERSION_AUTO_BEFORE_REVERT', $table->e_version));
}
$row = JTable::getInstance($type, 'CCK_Table');
$row->load($table->e_id);
$core = JCckDev::fromJSON($table->e_core);
if (isset($row->asset_id) && $row->asset_id && isset($core['rules'])) {
JCckDatabase::execute('UPDATE #__assets SET rules = "' . $db->escape($core['rules']) . '" WHERE id = ' . (int) $row->asset_id);
}
// More
if ($type == 'search') {
$clients = array(1 => 'search', 2 => 'filter', 3 => 'list', 4 => 'item', 5 => 'order');
} else {
$clients = array(1 => 'admin', 2 => 'site', 3 => 'intro', 4 => 'content');
}
foreach ($clients as $i => $client) {
$name = 'e_more' . $i;
$this->_revert_more($type, $client, $table->e_id, $table->{$name});
}
// Override
if ($row->version && $row->version != $table->e_version) {
$core['version'] = ++$row->version;
}
$core['checked_out'] = 0;
$core['checked_out_time'] = '0000-00-00 00:00:00';
$row->bind($core);
$row->check();
$row->store();
return true;
}
开发者ID:densem-2013,项目名称:exikom,代码行数:38,代码来源:version.php
示例13: defined
* @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url http://www.seblod.com
* @editor Octopoos - www.octopoos.com
* @copyright Copyright (C) 2009 - 2016 SEBLOD. All Rights Reserved.
* @license GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$userId = $user->id;
$listOrder = $this->state->get('list.ordering');
$listDir = $this->state->get('list.direction');
$title2 = JText::_('COM_CCK_DOWNLOAD_THIS_VARIATION');
$top = !JCck::on() ? 'border-top' : 'content';
$config = JCckDev::init(array('42', 'button_submit', 'select_simple', 'text'), true, array('vName' => $this->vName));
$cck = JCckDev::preload(array('core_filter_input', 'core_filter_go', 'core_filter_search', 'core_filter_clear', 'core_location_filter'));
JText::script('COM_CCK_CONFIRM_DELETE');
Helper_Include::addDependencies($this->getName(), $this->getLayout());
?>
<form action="<?php
echo JRoute::_('index.php?option=' . $this->option . '&view=' . $this->getName());
?>
" method="post" id="adminForm" name="adminForm">
<?php
if (!empty($this->sidebar)) {
?>
<div id="j-sidebar-container" class="span2">
<?php
echo $this->sidebar;
?>
开发者ID:hamby,项目名称:SEBLOD,代码行数:31,代码来源:default.php
示例14: defined
**/
defined('_JEXEC') or die;
?>
<div class="seblod cck-padding-top-0 cck-padding-bottom-0">
<?php
echo JCckDev::renderLegend(JText::_('COM_CCK_DEFAULT_VALUES'));
?>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_joomla_user_groups', '', $config, array('label' => 'User Groups', 'storage_field' => 'values[groups]'));
?>
</ul><div class="clr"></div>
<?php
echo JCckDev::renderLegend(JText::_('COM_CCK_SETTINGS'));
?>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_bool', 0, $config, array('label' => 'Force Password', 'storage_field' => 'options[force_password]'));
?>
</ul><div class="clr"></div>
<?php
echo JCckDev::renderLegend(JText::_('COM_CCK_UPDATE'));
?>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Update By Key', 'defaultvalue' => 'email', 'selectlabel' => '', 'options' => 'ID=id||Email=email||Username=username||', 'storage_field' => 'options[key]'));
echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Update By Diff', 'selectlabel' => 'None', 'options' => 'Update By Diff Desc=optgroup||Block=block', 'storage_field' => 'options[diff]'));
?>
</ul>
</div>
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:31,代码来源:importer.php
示例15: prepareExport
//.........这里部分代码省略.........
}
// Name & Root
if ($isApp) {
$filename = 'app_cck_' . $name;
} else {
if ($isCck) {
$filename = 'cck_' . $name;
} else {
$filename = $name;
}
if (isset($dependencies['categories']) && file_exists($data['root_content'] . '/joomla_category')) {
$items = JFolder::files($data['root_content'] . '/joomla_category', '\\.xml$');
if (count($items) == 1 && isset($items[0]) && $data['root_category'] != '' && JFile::stripExt($items[0]) == $data['root_category']) {
JFolder::delete($data['root_content'] . '/joomla_category');
}
}
}
// Elements
if ($copyright) {
CCK_Export::update($data['root_elements'], $copyright);
}
// Xml
$folders[0]->description = 'SEBLOD 3.x ' . $folders[0]->title . ' App - www.seblod.com';
$folders[0]->name = $filename;
$folders[0]->title = 'pkg_' . $folders['0']->name;
$manifest = NULL;
$xml = CCK_Export::preparePackage($folders[0]);
if (is_object($xml)) {
$manifest = JPATH_ADMINISTRATOR . '/manifests/packages/pkg_' . $filename . '.xml';
if (is_file($manifest)) {
if ($copyright) {
CCK_Export::update($manifest, $copyright);
}
$manifest = JCckDev::fromXML($manifest);
$tags = array('copyright', 'creationDate', 'description', 'packager', 'packageurl', 'version');
if (is_object($manifest)) {
foreach ($tags as $tag) {
if (isset($manifest->{$tag}) && isset($xml->{$tag}) && $manifest->{$tag} != $xml->{$tag}) {
$xml->{$tag} = (string) $manifest->{$tag};
}
}
}
}
}
// Filename
$path_zip = $tmp_path . '/' . $filename;
if (isset($options['filename_version']) && $options['filename_version']) {
$path_zip .= '_' . (isset($manifest->version) ? $manifest->version : '1.0.0');
}
if (isset($options['filename_date']) && $options['filename_date']) {
$path_zip .= '_' . JFactory::getDate()->format('Y_m_d');
}
$path_zip .= '.zip';
// Script
if (is_file(JPATH_ADMINISTRATOR . '/manifests/packages/' . $name . '/pkg_script.php')) {
if ($copyright) {
CCK_Export::update(JPATH_ADMINISTRATOR . '/manifests/packages/' . $name . '/pkg_script.php', $copyright);
}
}
// todo: else
$script = $xml->addChild('scriptfile', 'pkg_script.php');
JFile::copy(JPATH_SITE . '/libraries/cck/development/apps/script.php', $path . '/pkg_script.php');
$buffer = JFile::read($path . '/pkg_script.php');
$buffer = str_replace('%class%', $filename, $buffer);
JFile::write($path . '/pkg_script.php', $buffer);
if ($copyright) {
开发者ID:hamby,项目名称:SEBLOD,代码行数:67,代码来源:folder.php
示例16: strlen
<div class="legend top left"><?php
echo JText::_('COM_CCK_RENDERING') . '<span class="mini">(' . JText::_('COM_CCK_FOR_VIEW_' . $this->item->client) . ')</span>';
?>
</div>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm($cck['core_template'], $this->style->template, $config);
echo '<input type="hidden" name="template2" value="' . $this->style->template . '" />';
$style_title = strlen($this->style->title) > 32 ? substr($this->style->title, 0, 32) . '...' : $this->style->title;
echo '<li><label>' . JText::_('COM_CCK_STYLE') . '</label><span class="variation_value adminformlist-maxwidth" title="' . $this->style->title . '">' . $style_title . '</span>' . '<input class="inputbox" type="hidden" id="template_' . $this->item->client . '" name="template_' . $this->item->client . '" value="' . $this->style->id . '" /></li>';
?>
</ul>
</div>
<div class="seblod">
<div class="legend top left"><?php
echo '⇒ ' . JText::_('COM_CCK_CSS');
?>
</div>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_dev_text', @$this->style->params['rendering_css_class'], $config, array('label' => 'Root Class', 'size' => '16', 'storage_field' => 'params[rendering_css_class]'));
?>
</ul>
</div>
<?php
if (is_object($this->style)) {
Helper_Workshop::getTemplateParams($this->style->xml, '//config', 'params', $this->style->params);
}
?>
</div>
<div class="clr"></div>
开发者ID:olafzieger,项目名称:joomla3.x-seblod-test,代码行数:31,代码来源:edit_template.php
示例17: defined
<?php
/**
* @version SEBLOD 3.x Core
* @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url http://www.seblod.com
* @editor Octopoos - www.octopoos.com
* @copyright Copyright (C) 2013 SEBLOD. All Rights Reserved.
* @license GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
echo JCckDev::getForm($cck['core_storage_table'], $table, $config, array('selectlabel' => 'None'));
开发者ID:densem-2013,项目名称:exikom,代码行数:12,代码来源:edit.php
示例18: array
</button>
</li>
</ul>
</div>
<?php
}
if ($user->authorise('core.add', 'com_cck')) {
?>
<div class="<?php
echo $this->css['batch'];
?>
">
<div class="legend top left"><?php
echo JText::_('COM_CCK_DUPLICATE_PROCESS');
?>
</div>
<ul class="adminformlist">
<li>
<?php
echo JCckDev::renderForm($cck['core_dev_text'], '', $config, array('label' => 'Title', 'storage_field' => 'duplicate_title'));
?>
<button class="inputbutton" type="submit" onclick="Joomla.submitbutton('searchs.duplicate');"><?php
echo JText::_('JTOOLBAR_DUPLICATE');
?>
</button>
</li>
</ul>
</div>
<?php
}
}
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:31,代码来源:default_batch.php
示例19: array
$required = 'required';
}
?>
<div class="seblod">
<?php
echo JCckDev::renderLegend(JText::_('COM_CCK_CONSTRUCTION'), JText::_('PLG_CCK_FIELD_LINK_' . $this->item->name . '_DESC'));
?>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_list', '', $config, array(), array(), $hide);
echo JCckDev::renderForm('core_menuitem', '', $config, array('required' => $required));
echo JCckDev::renderForm('core_dev_select', '', $config, array('defaultvalue' => 0, 'label' => 'Field', 'options' => 'None=-1||Field=optgroup||Inherited=0||Custom=1', 'selectlabel' => '', 'storage_field' => 'search_field'), array(), $hide);
echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Field name', 'required' => 'required', 'storage_field' => 'search_fieldname'), array(), $hide);
echo JCckDev::renderSpacer(JText::_('COM_CCK_CONSTRUCTION') . '<span class="mini">(' . JText::_('COM_CCK_GENERIC') . ')</span>');
echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Class', 'size' => 24, 'storage_field' => 'class'));
echo JCckDev::renderForm('core_options_target', '', $config, array('defaultvalue' => '', 'selectlabel' => 'Inherited', 'storage_field' => 'target'));
echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Rel', 'size' => 32, 'storage_field' => 'rel'));
echo JCckDev::renderForm('core_tmpl', '', $config);
echo JCckDev::renderForm('core_dev_textarea', '', $config, array('label' => 'Custom variables', 'cols' => 92, 'rows' => 1, 'storage_field' => 'custom'), array(), 'w100');
echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Status', 'selectlabel' => '', 'defaultvalue' => '1', 'options' => 'Apply=1||Prepare=0', 'storage_field' => 'state'));
echo JCckDev::renderBlank();
?>
</ul>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#search_fieldname').isVisibleWhen('search_field','1');
});
</script>
开发者ID:kenyonjohnston,项目名称:hott_theater,代码行数:31,代码来源:edit.php
示例20: 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);
if (is_file(JPATH_LIBRARIES . '/joomla/html/html/category.php')) {
require_once JPATH_LIBRARIES . '/joomla/html/html/category.php';
}
// 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;
}
$app = JFactory::getApplication();
$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 (parent::g_isStaticVariation($field, $field->variation, true)) {
$form = '';
$field->text = '';
parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
} elseif ($field->variation == 'value') {
$form = '';
$field->text = JCckDatabase::loadResult('SELECT title FROM #__categories WHERE id = ' . (int) $value);
parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
} else {
$opt = '';
$options2 = JCckDev::fromJSON($field->options2);
if (trim($field->selectlabel)) {
if ($config['doTranslation']) {
$field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
}
$opt = '<option value="' . ($field->storage_field == 'parent_id' ? 1 : '') . '">' . '- ' . $field->selectlabel . ' -' . '</option>';
}
if ($config['client'] == 'search') {
$opt .= '<option value="">' . '- ' . JText::_('COM_CCK_ALL_CATEGORIES') . ' -' . '</option>';
}
$multiple = $field->bool3 == 1 ? 'multiple="multiple"' : '';
$size = $field->rows ? $field->rows : 1;
$extension = $app->input->getString('extension', @$options2['extension']);
$extension = $extension ? $extension : 'com_content';
$class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
$xml = '
<form>
<field
type="' . self::$type2 . '"
name="' . $name . '"
id="' . $id . '"
label="' . htmlspecialchars($field->label) . '"
extension="' . $extension . '"
' . $multiple . '
class="' . $class . '"
size="' . $size . '"
>' . $opt . '</field>
</form>
';
$form = JForm::getInstance($id, $xml);
if ($config['client'] == 'admin' || $config['client'] == 'site' || $config['client'] == 'search') {
if ($config['pk']) {
$form->setFieldAttribute($name, 'action', 'core.edit');
$form->setFieldAttribute($name, 'action', 'core.edit.own');
} else {
$form->setFieldAttribute($name, 'action', 'core.create');
}
}
$form = $form->getInput($name, '', $value);
if ($field->attributes) {
$form = str_replace('<select', '<select ' . $field->attributes, $form);
}
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
$field->text = JCckDatabase::loadResult('SELECT title FROM #__categories 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:pctechnikch,项目名称:SEBLOD,代码行数:97,代码来源:jform_category.php
注:本文中的JCckDev类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论