本文整理匯總了PHP中JCck::callFunc_Array方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCck::callFunc_Array方法的具體用法?PHP JCck::callFunc_Array怎麽用?PHP JCck::callFunc_Array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JCck
的用法示例。
在下文中一共展示了JCck::callFunc_Array方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$model = $this->getModel('form');
$preconfig = $app->input->post->get('config', array(), 'array');
$task = $this->getTask();
$config = $model->store($preconfig);
$id = $config['pk'];
if ($config['validate'] == 'retry') {
parent::display();
return true;
}
if ($id) {
if ($config['stage'] > -1) {
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
if ($config['stage'] > 0) {
$link .= '&stage=' . $config['stage'];
}
$this->setRedirect(htmlspecialchars_decode($link));
return;
}
if ($config['message_style']) {
if (isset($config['message'])) {
$msg = $config['doTranslation'] ? JText::_('COM_CCK_' . str_replace(' ', '_', trim($config['message']))) : $config['message'];
} else {
$msg = JText::_('COM_CCK_SUCCESSFULLY_SAVED');
}
$msgType = $config['message_style'];
} else {
$msg = '';
$msgType = '';
}
} else {
$msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED');
$msgType = 'error';
}
switch ($task) {
case 'apply':
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
break;
case 'save2new':
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . $this->_getRedirectQuery();
break;
case 'save2view':
$location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $id);
$sef = 0;
$itemId2 = 0;
if ($location) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/' . $location . '.php';
$link = JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type'])));
$link = str_replace('/administrator/', '/', $link);
break;
}
default:
$link = $this->_getRedirectQuery(true);
break;
}
$this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType);
}
示例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
$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;
}
}
示例3: CckParseRoute
function CckParseRoute($segments)
{
$app = JFactory::getApplication();
$count = count($segments);
$menu = $app->getMenu();
$menuItem = $menu->getActive();
$vars = array();
if ($segments[0] == 'form') {
$menu->setActive($app->input->getInt('Itemid', 0));
$vars['option'] = 'com_cck';
$vars['view'] = 'form';
$vars['layout'] = 'edit';
$vars['type'] = $segments[1];
} else {
$legacy = 0;
// check later
if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) {
$legacy = 0;
}
if (!$legacy) {
if (isset($menuItem->query['search'])) {
$params = JCckDevHelper::getRouteParams($menuItem->query['search']);
}
if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php';
JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params));
} else {
$legacy = 1;
}
}
if ($legacy) {
if ($count == 2) {
$vars['option'] = 'com_content';
$vars['view'] = 'article';
$vars['catid'] = $segments[0];
$vars['id'] = $segments[1];
} elseif ($count == 1) {
$vars['option'] = 'com_content';
@(list($id, $alias) = explode(':', $segments[0], 2));
$category = JCategories::getInstance('Content')->get($id);
if ($category && $category->id == $id && $category->alias == $alias) {
$vars['view'] = 'categories';
} else {
$vars['view'] = 'article';
}
$vars['id'] = $segments[0];
}
}
}
return $vars;
}
示例4: renderField
public function renderField($fieldname = '', $options = NULL)
{
$html = '';
$field = $this->get($fieldname);
if (!$field) {
return $html;
}
if ($field->display) {
$html = JCck::callFunc_Array('plgCCK_Field' . $field->type, $this->methodRender, array($field, &$this->config));
if ($field->display > 1 && $html) {
if (!$options) {
$options = new JRegistry();
}
if ($this->markup) {
$call = $this->markup;
$html = $call($this, $html, $field, $options);
} else {
$style = '';
if ($this->methodRender == 'onCCK_FieldRenderForm' && @$field->conditional) {
$conditions = explode(',', $field->conditional);
$field->conditional_options = str_replace('#form#', '#' . $field->name, $field->conditional_options);
if (count($conditions) > 1) {
$this->addJS('$j("#' . $this->id . '_' . $fieldname . '").conditionalStates(' . $field->conditional_options . ');');
} else {
$this->addJS('$j("#' . $this->id . '_' . $fieldname . '").conditionalState(' . $field->conditional_options . ');');
}
}
$desc = '';
if ($this->getStyleParam('field_description', 0)) {
$desc = $field->description != '' ? '<div id="' . $this->id . '_desc_' . $fieldname . '" class="cck_desc cck_desc_' . $field->type . '">' . $field->description . '</div>' : '';
}
$label = '';
if ($options->get('field_label', $this->getStyleParam('field_label', 1))) {
$label = $this->getLabel($fieldname, true, $field->required ? '*' : '');
$label = $label != '' ? '<div id="' . $this->id . '_label_' . $fieldname . '" class="cck_label cck_label_' . $field->type . '">' . $label . '</div>' : '';
}
}
}
}
return $html;
}
示例5: delete
function delete($pks = array())
{
JPluginHelper::importPlugin('content');
JPluginHelper::importPlugin('cck_storage_location');
$nb = 0;
$pks_in = implode(',', $pks);
$items = JCckDatabase::loadObjectList('SELECT a.id, a.cck, a.pk, a.pkb, a.storage_location, a.storage_table, a.author_id, b.id as type_id FROM #__cck_core as a' . ' LEFT JOIN #__cck_core_types AS b ON b.name = a.cck' . ' WHERE a.id IN (' . $pks_in . ')', 'id');
$config = array('author' => 0, 'type' => '', 'type_id' => 0);
foreach ($pks as $pk) {
$location = $items[$pk]->storage_location;
if ($location) {
$config['author'] = $items[$pk]->author_id;
$config['type'] = $items[$pk]->cck;
$config['type_id'] = $items[$pk]->type_id;
if (JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationDelete', array($items[$pk]->pk, &$config))) {
$nb++;
}
}
}
return $nb;
}
示例6: saveOrder
public function saveOrder($pks = array(), $lft = array())
{
JPluginHelper::importPlugin('cck_storage_location');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, pk, storage_location')->from('#__cck_core')->where('id IN (' . implode(',', $pks) . ')');
$db->setQuery($query);
$results = $db->loadAssocList('id');
if (!empty($results)) {
$ids = array();
$location = null;
foreach ($pks as $pk) {
$ids[] = $results[$pk]['pk'];
if (null === $location) {
$location = $results[$pk]['storage_location'];
}
}
return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft));
}
return false;
}
示例7: save
//.........這裏部分代碼省略.........
}
} else {
$msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED');
$msgType = 'error';
}
$link = $this->_getReturnPage(false);
$redirect = $config['options']['redirection'];
$return = '';
if ($task == 'apply' || $task == 'save2copy') {
$link = '';
$redirect = 'form_edition';
$return = $app->input->getBase64('return');
} elseif ($task == 'save2new') {
$link = '';
$redirect = 'form';
$return = $app->input->getBase64('return');
} elseif ($task == 'save2view') {
$link = '';
$redirect = 'content';
} elseif ($task == 'save2redirect') {
$link = '';
$redirect = '';
}
if (!$link) {
switch ($redirect) {
case 'content':
$loc = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $config['id']);
$sef = 0;
$itemId2 = isset($config['options']['redirection_itemid']) && $config['options']['redirection_itemid'] ? (int) $config['options']['redirection_itemid'] : $itemId;
if ($itemId2 > 0) {
$target = JCckDatabase::loadResult('SELECT link FROM #__menu WHERE id = ' . (int) $itemId2);
if ($target) {
$vars = explode('&', $target);
foreach ($vars as $var) {
$v = explode('=', $var);
if ($v[0] == 'search') {
$target = $v[1];
break;
}
}
$vars = JCckDatabase::loadResult('SELECT options FROM #__cck_core_searchs WHERE name = "' . (string) $target . '"');
if ($vars) {
$vars = new JRegistry($vars);
$sef = $vars->get('sef', JCck::getConfig_Param('sef', '2'));
}
}
}
if ($loc) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $loc . '/' . $loc . '.php';
$link = JCck::callFunc_Array('plgCCK_Storage_Location' . $loc, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type'])));
} else {
$link = JUri::root();
}
break;
case 'form':
$link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $config['type'];
if ($itemId > 0) {
$link .= '&Itemid=' . $itemId;
}
if ($return != '') {
$link .= '&return=' . $return;
}
$link = JRoute::_($link);
break;
case 'form_edition':
$link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $config['type'] . '&id=' . $id;
if ($itemId > 0) {
$link .= '&Itemid=' . $itemId;
}
if ($return != '') {
$link .= '&return=' . $return;
}
$link = JRoute::_($link);
break;
case 'url':
$link = JRoute::_($config['options']['redirection_url']);
break;
default:
$link = $config['url'] ? $config['url'] : JUri::root();
break;
}
}
if ($id) {
$char = strpos($link, '?') > 0 ? '&' : '?';
if (isset($config['thanks'])) {
if (!empty($config['thanks'])) {
$thanks = @$config['thanks']->name ? $config['thanks']->name : 'thanks';
$thanks_value = @$config['thanks']->value ? $config['thanks']->value : $preconfig['type'];
$link .= $char . $thanks . '=' . $thanks_value;
}
} else {
$link .= $char . 'thanks=' . $preconfig['type'];
}
}
if ($msg != '') {
$this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType);
} else {
$this->setRedirect(htmlspecialchars_decode($link));
}
}
示例8: _render
protected function _render($context, &$article, $tpl, $contentType, $fields, $property, $client, $cck, $parent_type)
{
$app = JFactory::getApplication();
$dispatcher = JDispatcher::getInstance();
$user = JFactory::getUser();
$params = array('template' => $tpl['folder'], 'file' => 'index.php', 'directory' => $tpl['root']);
$lang = JFactory::getLanguage();
$lang->load('com_cck_default', JPATH_SITE);
JPluginHelper::importPlugin('cck_field');
JPluginHelper::importPlugin('cck_field_link');
JPluginHelper::importPlugin('cck_field_restriction');
$p_sef = isset($this->loaded[$contentType . '_' . $client . '_options']['sef']) ? $this->loaded[$contentType . '_' . $client . '_options']['sef'] : JCck::getConfig_Param('sef', '2');
$p_title = isset($this->loaded[$contentType . '_' . $client . '_options']['title']) ? $this->loaded[$contentType . '_' . $client . '_options']['title'] : '';
$p_typo = isset($this->loaded[$contentType . '_' . $client . '_options']['typo']) ? $this->loaded[$contentType . '_' . $client . '_options']['typo'] : 1;
if ($p_typo) {
JPluginHelper::importPlugin('cck_field_typo');
}
jimport('cck.rendering.document.document');
$doc = CCK_Document::getInstance('html');
$positions = array();
if ($parent_type != '') {
$w_type = '(b.name = "' . $contentType . '" OR b.name = "' . $parent_type . '")';
} else {
$w_type = 'b.name = "' . $contentType . '"';
}
if ($client == 'intro') {
$positions_more = JCckDatabaseCache::loadObjectList('SELECT * FROM #__cck_core_type_position AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE ' . $w_type . ' AND a.client ="' . $client . '"', 'position');
// todo::improve
} else {
$positions_more = JCckDatabase::loadObjectList('SELECT * FROM #__cck_core_type_position AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE ' . $w_type . ' AND a.client ="' . $client . '"', 'position');
// todo::improve
}
// Fields
if (count($fields)) {
JPluginHelper::importPlugin('cck_storage');
$config = array('author' => 0, 'client' => $client, 'doSEF' => $p_sef, 'doTranslation' => JCck::getConfig_Param('language_jtext', 0), 'doTypo' => $p_typo, 'error' => 0, 'fields' => array(), 'id' => $cck->id, 'isNew' => 0, 'Itemid' => $app->input->getInt('Itemid', 0), 'location' => $cck->storage_location, 'pk' => $article->id, 'pkb' => $cck->pkb, 'storages' => array(), 'store_id' => (int) $cck->store_id, 'type' => $cck->cck, 'type_id' => (int) $cck->type_id, 'type_alias' => $cck->type_alias ? $cck->type_alias : $cck->cck);
foreach ($fields as $field) {
$field->typo_target = 'value';
$fieldName = $field->name;
$value = '';
$name = !empty($field->storage_field2) ? $field->storage_field2 : $fieldName;
//-
if ($fieldName) {
$Pt = $field->storage_table;
if ($Pt && !isset($config['storages'][$Pt])) {
$config['storages'][$Pt] = '';
$dispatcher->trigger('onCCK_Storage_LocationPrepareContent', array(&$field, &$config['storages'][$Pt], $config['pk'], &$config, &$article));
}
$dispatcher->trigger('onCCK_StoragePrepareContent', array(&$field, &$value, &$config['storages'][$Pt]));
if (is_string($value)) {
$value = trim($value);
}
if ($p_title != '' && $p_title == $field->name) {
$this->title = $value;
}
$hasLink = $field->link != '' ? 1 : 0;
$dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config));
$target = $field->typo_target;
if ($hasLink) {
$dispatcher->trigger('onCCK_Field_LinkPrepareContent', array(&$field, &$config));
if ($field->link) {
JCckPluginLink::g_setHtml($field, $target);
}
}
if (@$field->typo && ($field->{$target} !== '' || $field->typo_label == -2) && $p_typo) {
$dispatcher->trigger('onCCK_Field_TypoPrepareContent', array(&$field, $field->typo_target, &$config));
} else {
$field->typo = '';
}
$position = $field->position;
$positions[$position][] = $fieldName;
// Was it the last one?
if ($config['error']) {
break;
}
}
}
// Merge
if (count($config['fields'])) {
$fields = array_merge($fields, $config['fields']);
// Test: a loop may be faster.
$config['fields'] = NULL;
unset($config['fields']);
}
}
// BeforeRender
if (isset($config['process']['beforeRenderContent']) && count($config['process']['beforeRenderContent'])) {
foreach ($config['process']['beforeRenderContent'] as $process) {
if ($process->type) {
JCck::callFunc_Array('plg' . $process->group . $process->type, 'on' . $process->group . 'BeforeRenderContent', array($process->params, &$fields, &$config['storages'], &$config));
}
}
}
// Finalize
$doc->fields =& $fields;
$infos = array('context' => $context, 'params' => $tpl['params'], 'path' => $tpl['path'], 'root' => JURI::root(true), 'template' => $tpl['folder'], 'theme' => $tpl['home']);
$doc->finalize('content', $contentType, $client, $positions, $positions_more, $infos, $cck->id);
$data = $doc->render(false, $params);
$article->{$property} = str_replace($article->{$property}, $data, $article->{$property});
}
示例9: renderContent
public static function renderContent($field, $value = '', &$config = array('doTranslation' => 1, 'doValidation' => 2))
{
if (!is_object($field)) {
$field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name = "' . $field . '"');
//#
if (!$field) {
return;
}
}
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config));
return JCck::callFunc_Array('plgCCK_Field' . $field->type, 'onCCK_FieldRenderContent', array($field, &$config));
}
示例10: delete
public function delete()
{
if ($this->_object == '') {
return false;
}
if (!($this->_id && $this->_pk)) {
return false;
}
$config = array('author' => $this->_instance_core->author_id, 'type' => $this->_instance_core->cck, 'type_id' => 0);
$nb = 0;
if ($config['type']) {
$config['type_id'] = JCckDatabaseCache::loadResult('SELECT id FROM #__cck_core_types WHERE name = "' . $config['type'] . '"');
}
if (!$config['type_id']) {
return false;
}
JPluginHelper::importPlugin('content');
if (JCck::callFunc_Array('plgCCK_Storage_Location' . $this->_object, 'onCCK_Storage_LocationDelete', array($this->_pk, &$config))) {
$nb++;
}
return $nb ? true : false;
}
示例11: download
public function download()
{
$app = JFactory::getApplication();
$id = $app->input->getInt('id', 0);
$fieldname = $app->input->getString('file', '');
$collection = $app->input->getString('collection', '');
$xi = $app->input->getString('xi', 0);
$client = $app->input->getString('client', 'content');
$restricted = '';
$user = JFactory::getUser();
if (!$id) {
$file = $fieldname;
$path = JPATH_ROOT . '/' . $file;
$paths = JCck::getConfig_Param('media_paths', '');
if ($paths != '') {
$allowed = false;
$paths = strtr($paths, array("\r\n" => '<br />', "\r" => '<br />', "\n" => '<br />'));
$paths = explode('<br />', $paths);
if (count($paths)) {
$paths[] = 'tmp/';
foreach ($paths as $p) {
if (strpos($path, JPATH_ROOT . '/' . $p) !== false) {
$allowed = true;
break;
}
}
}
if (!$allowed) {
$this->setRedirect(JUri::root(), JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
return;
}
} elseif (strpos($path, JPATH_ROOT . '/tmp/') === false) {
$this->setRedirect(JUri::base(), JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
return;
}
} else {
$field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name="' . ($collection != '' ? $collection : $fieldname) . '"');
//#
$query = 'SELECT a.pk, a.author_id, a.cck as type, b.' . $field->storage_field . ' as value FROM #__cck_core AS a LEFT JOIN ' . $field->storage_table . ' AS b on b.id = a.pk WHERE a.id =' . (int) $id;
$core = JCckDatabase::loadObject($query);
switch ($field->storage) {
//todo: call plugins!
case 'custom':
if ($collection != '') {
$regex = CCK_Content::getRegex_Group($fieldname, $collection, $xi);
preg_match($regex, $core->value, $matches);
$value = $matches[1];
} else {
$regex = CCK_Content::getRegex_Field($fieldname);
preg_match($regex, $core->value, $matches);
$value = $matches[1];
}
break;
case 'standard':
default:
$value = $core->value;
break;
}
// Access
// $current = JSite::getMenu()->getActive()->id;
$clients = JCckDatabase::loadObjectList('SELECT a.fieldid, a.client, a.access, a.restriction, a.restriction_options FROM #__cck_core_type_field AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE a.fieldid = ' . (int) $field->id . ' AND b.name="' . (string) $core->type . '"', 'client');
$access = isset($clients[$client]->access) ? (int) $clients[$client]->access : 0;
$autorised = $user->getAuthorisedViewLevels();
$restricted = isset($clients[$client]->restriction) ? $clients[$client]->restriction : '';
if (!($access > 0 && array_search($access, $autorised) !== false)) {
$this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
return;
}
JPluginHelper::importPlugin('cck_field');
$dispatcher = JDispatcher::getInstance();
$config = array('client' => $client, 'id' => id, 'pk' => $core->pk, 'pkb' => 0);
$field = JCckDatabase::loadObject('SELECT a.* FROM #__cck_core_fields AS a WHERE a.name="' . $fieldname . '"');
//#
if ($restricted) {
JPluginHelper::importPlugin('cck_field_restriction');
$field->restriction = $restricted;
$field->restriction_options = $clients[$client]->restriction_options;
$allowed = JCck::callFunc_Array('plgCCK_Field_Restriction' . $restricted, 'onCCK_Field_RestrictionPrepareContent', array(&$field, &$config));
if ($allowed !== true) {
$this->setRedirect('index.php', JText::_('COM_CCK_ALERT_FILE_NOT_AUTH'), "error");
return;
}
}
$dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config));
// Path Folder
if ($collection != '') {
$group_x = JCckDatabase::loadObject('SELECT a.options2 FROM #__cck_core_fields AS a WHERE a.name="' . $fieldname . '"');
$f_opt2 = JCckDev::fromJSON($group_x->options2);
} else {
$f_opt2 = JCckDev::fromJSON($field->options2);
}
$file = '';
if (isset($f_opt2['storage_format']) && $f_opt2['storage_format']) {
$file .= $f_opt2['path'];
$file .= isset($f_opt2['path_user']) && $f_opt2['path_user'] ? $core->author_id . '/' : '';
$file .= isset($f_opt2['path_content']) && $f_opt2['path_content'] ? $core->pk . '/' : '';
}
$file .= $field->value;
}
$path = JPATH_ROOT . '/' . $file;
//.........這裏部分代碼省略.........
示例12: g_onCCK_FieldPrepareStore_Validation
public function g_onCCK_FieldPrepareStore_Validation(&$field, $name, &$value, &$config = array())
{
if ($config['doValidation'] == 1 || $config['doValidation'] == 3) {
if ($field->required) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareStore($field, $name, $value, $config);
}
$validation = $field->validation;
if (!$validation) {
return;
}
require_once JPATH_PLUGINS . '/cck_field_validation/' . $validation . '/' . $validation . '.php';
JCck::callFunc_Array('plgCCK_Field_Validation' . $validation, 'onCCK_Field_ValidationPrepareStore', array(&$field, $name, &$value, &$config));
}
}
示例13: saveOrder
public function saveOrder($pks = array(), $lft = array())
{
JPluginHelper::importPlugin('cck_storage_location');
if (!count($pks)) {
return false;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.id, a.pk, a.storage_location, b.id AS type_id')->from('#__cck_core AS a')->join('LEFT', '#__cck_core_types AS b ON b.name = a.cck')->where('a.id IN (' . implode(',', $pks) . ')');
$db->setQuery($query);
$results = $db->loadAssocList('id');
if (!empty($results)) {
$ids = array();
$location = null;
$user = JCck::getUser();
$user_id = $user->get('id');
foreach ($pks as $i => $pk) {
$canEdit = $user->authorise('core.edit', 'com_cck.form.' . $results[$pk]['type_id']);
$canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $results[$pk]['type_id']);
// Check Permissions
if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $results[$pk]['author_id'] != $user_id || $canEditOwn && $results[$pk]['author_id'] == $user_id)) {
unset($lft[$i]);
continue;
}
$ids[] = $results[$pk]['pk'];
if (null === $location) {
$location = $results[$pk]['storage_location'];
}
}
if ($location && count($ids)) {
return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft));
}
}
return false;
}
示例14: renderField
public function renderField($fieldname, $options = NULL)
{
$field = $this->get($fieldname);
$html = '';
if (!$field) {
return $html;
}
if ($field->display) {
$html = JCck::callFunc_Array('plgCCK_Field' . $field->type, $this->methodRender, array(&$field, &$this->config));
if ($field->display > 1 && $html != '') {
if (!$options) {
$options = new JRegistry();
}
if ($field->markup == 'none') {
if ($this->methodRender == 'onCCK_FieldRenderForm') {
// Conditional
if ($field->conditional) {
$this->setConditionalStates($field);
}
}
// Label
$label = '';
if ($options->get('field_label', $this->getStyleParam('field_label', 1))) {
$label = $this->getLabel($fieldname, true, $field->required ? '*' : '');
$html = $label . $html;
}
} elseif ($this->markup) {
$call = $this->markup;
$html = $call($this, $html, $field, $options);
} else {
if ($this->methodRender == 'onCCK_FieldRenderForm') {
// Computation
if (@$field->computation) {
$this->setComputationRules($field);
}
// Conditional
if (@$field->conditional) {
$this->setConditionalStates($field);
}
}
// Description
$desc = '';
if ($this->getStyleParam('field_description', 0)) {
if ($field->description != '') {
if ($this->getStyleParam('field_description', 0) == 5) {
JHtml::_('bootstrap.popover', '.hasPopover', array('container' => 'body', 'html' => true, 'trigger' => 'hover'));
$desc = '<div class="hasPopover" data-placement="top" data-animation="false" data-content="' . htmlspecialchars($field->description) . '" title="' . htmlspecialchars($field->label) . '"><span class="icon-help"></span></div>';
} else {
$desc = $field->description;
}
$desc = '<div id="' . $this->id . '_desc_' . $fieldname . '" class="cck_desc cck_desc_' . $field->type . '">' . $desc . '</div>';
}
}
// Label
$label = '';
if ($options->get('field_label', $this->getStyleParam('field_label', 1))) {
$label = $this->getLabel($fieldname, true, $field->required ? '*' : '');
$label = $label != '' ? '<div id="' . $this->id . '_label_' . $fieldname . '" class="cck_label cck_label_' . $field->type . '">' . $label . '</div>' : '';
}
// Markup
$html = '<div id="' . $this->id . '_' . $this->mode_property . '_' . $fieldname . '" class="cck_' . $this->mode_property . ' cck_' . $this->mode_property . '_' . $field->type . @$field->markup_class . '">' . $html . '</div>';
$html = '<div id="' . $this->id . '_' . $fieldname . '" class="cck_' . $this->mode . 's cck_' . $this->client . ' cck_' . $field->type . ' cck_' . $fieldname . '">' . $label . $html . $desc . '</div>';
}
}
}
return $html;
}
示例15: render
public function render()
{
if (isset($this->_params->type)) {
return JCck::callFunc_Array('plgCCK_Field' . $this->_params->type, 'onCCK_FieldRender' . $this->_config['mode'], array($this->_params, &$this->_config));
}
}