本文整理匯總了PHP中JCck類的典型用法代碼示例。如果您正苦於以下問題:PHP JCck類的具體用法?PHP JCck怎麽用?PHP JCck使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了JCck類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: display
function display($tpl = null)
{
switch ($this->getlayout()) {
case 'delete':
$this->prepareDelete();
break;
case 'edit':
case 'error':
$this->prepareDisplay();
break;
case 'edit2':
$this->prepareDisplay();
$this->prepareDisplay_Ajax();
break;
default:
break;
}
if (JCck::on()) {
$this->css = array('_' => '', 'panel_height' => '89px', 'w30' => 'span4', 'w70' => 'span8', 'wrapper' => 'container', 'wrapper2' => 'row-fluid', 'wrapper_tmpl' => 'span');
$this->js = array('_' => '', 'tooltip' => '$(".hasTooltip").tooltip({});');
} else {
$this->css = array('_' => '', 'panel_height' => '65px', 'w30' => 'width-30', 'w70' => 'width-70 fltlft', 'wrapper' => 'sebwrapper', 'wrapper2' => 'seb-wrapper workshop', 'wrapper_tmpl' => 'width-100 bg-dark fltlft');
$this->js = array('_' => '', 'tooltip' => '');
}
$this->uix = 'full';
parent::display($tpl);
}
示例2: display
function display($tpl = NULL)
{
$app = JFactory::getApplication();
$this->item = new stdClass();
$this->state = $this->get('State');
$this->option = $app->input->get('option', '');
$this->file = $this->state->get('file', '');
$this->item->id = $this->state->get('bx.id', '');
$this->item->name = $this->state->get('bx.name', '');
$this->item->alt = $this->state->get('alt', 0);
if ($this->getLayout() != 'raw') {
$this->function = $this->state->get('function', '');
$this->item->title = $this->state->get('bx.title', '');
$this->item->type = $this->state->get('bx.type', '');
$this->item->params = $this->state->get('bx.params', '');
$this->doValidation = $this->state->get('validation', 0);
}
if (JCck::on()) {
$this->css = array('items' => 'seblod-manager', 'table' => 'table table-striped', 'wrapper_tmpl' => 'span12');
} else {
$this->css = array('items' => 'seblod', 'table' => 'adminlist', 'wrapper_tmpl' => 'width-100 bg-dark fltlft');
}
JFactory::getApplication()->input->set('hidemainmenu', true);
parent::display($tpl);
}
示例3: prepareDisplay
protected function prepareDisplay($preconfig)
{
if (JCck::getConfig_Param('debug', 0)) {
jimport('joomla.error.profiler');
$profiler = new JProfiler();
}
$app = JFactory::getApplication();
$this->form = $this->get('Form');
$this->option = $app->input->get('option', '');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$option = $this->option;
$params = new JRegistry();
$view = $this->getName();
$isNew = 1;
$live = '';
$lives = array();
$variation = '';
jimport('cck.base.form.form');
include_once JPATH_LIBRARIES_CCK . '/base/form/form_inc.php';
if (isset($config['id'])) {
JFactory::getSession()->set('cck_hash_seblod_form', JApplication::getHash($id . '|' . $type->name . '|' . $config['id']));
}
$this->config =& $config;
$this->data =& $data;
$this->id =& $id;
$this->isNew =& $isNew;
$this->params =& $params;
$this->stage =& $stage;
$this->type =& $type;
$title = isset($type->title) ? $type->title : '';
$name = isset($type->name) ? $type->name : '';
$this->addToolbar($title, $name);
}
示例4: apply
public static function apply($type, &$total)
{
$user = JCck::getUser();
$my_groups = $user->getAuthorisedGroups();
$my_zones = JCckEcommerce::getUserZones();
$currency = JCckEcommerce::getCurrency();
$tax = '';
$taxes = JCckEcommerce::getTaxes($type, $my_zones);
if (count($taxes)) {
foreach ($taxes as $p) {
$groups = explode(',', $p->groups);
if (count(array_intersect($my_groups, $groups)) > 0) {
switch ($p->tax) {
case 'plus':
$tax = $p->tax_amount;
$total += $tax;
break;
case 'percentage':
$tax = $total * $p->tax_amount / 100;
$total += $tax;
break;
default:
break;
}
}
}
}
return $tax;
}
示例5: setHead
public static function setHead(&$head)
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
if (isset($app->cck_document)) {
if (isset($app->cck_document['styleSheets']) && count($app->cck_document['styleSheets'])) {
foreach ($app->cck_document['styleSheets'] as $k => $v) {
$head['styleSheets'][$k] = $v;
}
if (JCck::on()) {
$doc->setHeadData(array('styleSheets' => $head['styleSheets']));
} else {
$doc->_styleSheets = $head['styleSheets'];
}
}
if (isset($app->cck_document['scripts']) && count($app->cck_document['scripts'])) {
foreach ($app->cck_document['scripts'] as $k => $v) {
$head['scripts'][$k] = $v;
}
if (JCck::on()) {
$doc->setHeadData(array('scripts' => $head['scripts']));
} else {
$doc->_scripts = $head['scripts'];
}
}
}
}
示例6: onCCK_Storage_LocationAfterRender
public static function onCCK_Storage_LocationAfterRender(&$buffer, &$data, $uri = array())
{
$app = JFactory::getApplication();
if ($uri['layout']) {
return;
}
if ($uri['view'] == 'featured') {
$data['return_view'] = 'featured';
$tag = '&return=featured';
} else {
$data['return_view'] = '';
$tag = '';
}
$class = JCck::on('3.4') ? ' class="hasTooltip"' : '';
$data['doIntegration'] = false;
$data['multilanguage'] = $data['options']->get('multilanguage', 0);
if ($data['multilanguage']) {
$data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)" (.*)>#U';
} else {
$data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)"#';
}
$data['search_alt'] = '#<a href = "javascript://" onclick="listItemTask\\(\'cb([0-9]*)\', \'articles.archive\'\\)">(.*)</a>#sU';
if (JCckDevHelper::hasLanguageAssociations() && $data['multilanguage']) {
$query = 'SELECT a.pk, a.cck, b.key, c.language FROM #__cck_core AS a' . ' LEFT JOIN #__associations AS b ON ( b.id = a.pk AND context = "com_content.item" )' . ' LEFT JOIN #__content AS c ON c.id = a.pk' . ' WHERE storage_location="joomla_article"';
$list_assoc = JCckDatabase::loadObjectListArray('SELECT a.id, a.key, b.language FROM #__associations AS a LEFT JOIN #__content AS b ON ( b.id = a.id AND a.context = "com_content.item" )', 'key', 'language');
} else {
$query = 'SELECT pk, cck FROM #__cck_core WHERE storage_location="joomla_article"';
$list_assoc = array();
}
$list = JCckDatabase::loadObjectList($query, 'pk');
$buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list, $list_assoc);
}
示例7: 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);
}
示例8: prepareToolbar
public function prepareToolbar()
{
Helper_Admin::addToolbar($this->vName, $this->vTitle, $this->state->get('filter.folder'));
if (JCck::on()) {
JHtmlSidebar::setAction('index.php?option=com_cck&view=templates');
}
}
示例9: getInput
protected function getInput()
{
JPluginHelper::importPlugin('cck_field');
require_once JPATH_PLUGINS . '/cck_field_validation/required/required.php';
$name = 'core_options';
$override = array('rows' => 1);
$storage = (string) $this->element['cck_storage_field_prefix'];
$and = $storage != '' ? ' AND a.storage_field LIKE "' . $storage . '%"' : '';
$fields = JCckDatabase::loadObjectList('SELECT a.title as text, a.name as value FROM #__cck_core_fields AS a' . ' WHERE a.storage = "dev" AND a.id > 500' . $and . ' ORDER BY text');
$fields = is_array($fields) ? array_merge(array(JHtml::_('select.option', '', '- ' . JText::_('COM_CCK_ADD_A_FIELD') . ' -')), $fields) : array();
$html = JHtml::_('select.genericlist', $fields, 'fields_list', 'size="1" class="inputbox select" style="max-width:175px;"', 'value', 'text', '', 'fields_list');
$format = (string) $this->element['js_format'];
$lang = JFactory::getLanguage();
$lang->load('com_cck');
$lang->load('com_cck_default', JPATH_SITE);
if ($format != 'raw') {
JCck::loadjQuery(true, true, true);
}
$force_id = (string) $this->element['id'];
$config = array('asset' => '', 'asset_id' => 0, 'client' => '', 'doTranslation' => 1, 'doValidation' => 2, 'pk' => '');
if ($format == 'raw') {
$config['tmpl'] = 'ajax';
}
$inherit = $force_id != '' ? array('id' => (string) $this->element['id']) : array();
$field = JCckDevField::getObject($name);
if (!$field) {
return;
}
$storage_field = $field->storage_field;
$field->storage_field = $this->name;
$field = JCckDevField::get($field, $this->value, $config, $inherit, $override);
$script = $this->_addScripts((string) $this->element['name'], array('value' => $this->value), $format);
return $field->form . $html . $script;
}
示例10: addValidation
public static function addValidation($rules, $options, $id = '', &$config = array())
{
$doc = JFactory::getDocument();
if (!$id) {
$id = 'seblod_form';
}
if (empty($rules)) {
$rules = '';
}
$rules = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $rules);
if (is_object($options)) {
$bgcolor = $options->get('validation_background_color', JCck::getConfig_Param('validation_background_color', ''));
$color = $options->get('validation_color', JCck::getConfig_Param('validation_color', ''));
$position = $options->get('validation_position', JCck::getConfig_Param('validation_position', 'topRight'));
$scroll = $options->get('validation_scroll', JCck::getConfig_Param('validation_scroll', 1)) ? 'scroll:true' : 'scroll:false';
if ($color != '') {
if ($position == 'inline') {
$doc->addStyleDeclaration('#' . $id . ' .formError .formErrorContent{color: ' . $color . '}');
} else {
$doc->addStyleDeclaration('.formError .formErrorContent{color: ' . $color . '}');
}
}
if ($position != 'inline' && $bgcolor != '') {
$doc->addStyleDeclaration('.formError .formErrorContent, .formError .formErrorArrow div{background: ' . $bgcolor . '}');
}
$options = '{' . $scroll . ',promptPosition:"' . $position . '"}';
} else {
$options = '{}';
}
$doc->addStyleSheet(JURI::root(true) . '/media/cck/css/cck.validation.css');
$doc->addScript(JURI::root(true) . '/media/cck/js/cck.validation-3.2.0.min.js');
$js = 'jQuery(document).ready(function($){ $.validationEngineLanguage.newLang({' . $rules . '}); $("#' . $id . '").validationEngine(' . $options . '); });';
$doc->addScriptDeclaration($js);
}
示例11: onCCK_Field_ValidationPrepareForm
public static function onCCK_Field_ValidationPrepareForm(&$field, $fieldId, &$config)
{
if (self::$type != $field->validation) {
return;
}
$and = '';
$extra = '';
$extraData2 = '';
$name = 'availability_' . $fieldId;
$validation = parent::g_getValidation($field->validation_options);
$alert = self::_alert($validation, 'alert', $config);
$alert2 = self::_alert($validation, 'alert2', $config);
$alert3 = self::_alert($validation, 'alert3', $config);
$prefix = JCck::getConfig_Param('validation_prefix', '* ');
if (isset($validation->fieldnames) && $validation->fieldnames) {
$extra .= '&avWhere=' . str_replace('||', ',', $validation->fieldnames);
$extraData2 = '"extraDataDynamic": "#' . str_replace('||', ',#', $validation->fieldnames) . '",';
$and = self::_where($validation->table, $validation->fieldnames, $config['storages'][$validation->table], 'object');
}
if ($field->value) {
$pk = (int) JCckDatabase::loadResult('SELECT ' . $validation->key . ' FROM ' . $validation->table . ' WHERE ' . $validation->column . '="' . JCckDatabase::escape($field->value) . '"' . $and);
$extra .= '&avKey=' . $validation->key . '&avPk=' . $pk . '&avPv=' . htmlspecialchars(str_replace(array('<', '>', "'"), array('%26lt;', '%26gt;', '%27'), $field->value));
}
$rule = '
"' . $name . '":{
"url": "' . JUri::base() . 'index.php?option=com_cck&task=ajax&format=raw&file=/plugins/cck_field_validation/ajax_availability/assets/ajax/script.php",
"extraData": "avTable=' . str_replace('#__', '', $validation->table) . '&avColumn=' . $validation->column . $extra . '",
' . $extraData2 . '
"alertText": "' . $prefix . $alert . '",
"alertTextOk": "' . $prefix . $alert2 . '",
"alertTextLoad": "' . $prefix . $alert3 . '"}
';
$config['validation'][$name] = $rule;
$field->validate[] = 'ajax[' . $name . ']';
}
示例12: apply
public static function apply($type, &$total, $params = array())
{
$user = JCck::getUser();
$my_groups = $user->getAuthorisedGroups();
$currency = JCckEcommerce::getCurrency();
$discount = '';
$promotions = JCckEcommerce::getPromotions($type);
if (count($promotions)) {
foreach ($promotions as $p) {
if (isset($params['target']) && $params['target']) {
if ($params['target'] == 'order' && $p->target == 0) {
// OK
} elseif ($params['target'] == 'product') {
if ($p->target == 1) {
// OK
} elseif ($p->target == 2) {
$products = self::getTargets($p->id);
if (!isset($products[$params['target_id']])) {
continue;
}
} elseif ($p->target == -2) {
$products = self::getTargets($p->id);
if (isset($products[$params['target_id']])) {
continue;
}
} else {
continue;
}
} else {
continue;
}
}
if ($p->type == 'coupon') {
if ($p->code && $p->code != @$params['code']) {
continue;
}
}
$groups = explode(',', $p->groups);
if (count(array_intersect($my_groups, $groups)) > 0) {
switch ($p->discount) {
case 'free':
$discount = 'FREE';
$total = 0;
break;
case 'minus':
$discount = '- ' . $currency->lft . $p->discount_amount . $currency->right;
$total -= $p->discount_amount;
break;
case 'percentage':
$discount = '- ' . $p->discount_amount . ' %';
$total = $total - $total * $p->discount_amount / 100;
break;
default:
break;
}
}
}
}
return $discount;
}
示例13: prepareUI
public function prepareUI()
{
if (JCck::on()) {
$this->css = array('w30' => 'span4', 'w70' => 'span8', 'wrapper' => 'container', 'wrapper2' => 'row-fluid', 'wrapper_tmpl' => 'span');
} else {
$this->css = array('w30' => 'width-30', 'w70' => 'width-70 fltlft', 'wrapper' => 'sebwrapper', 'wrapper2' => 'seb-wrapper', 'wrapper_tmpl' => 'width-100 bg-dark fltlft');
}
}
示例14: prepareUI
protected function prepareUI()
{
if (JCck::on()) {
$this->css = array('items' => 'seblod-manager', 'table' => 'table table-striped', 'w33' => 'span4', 'w50' => 'span6', 'w66' => 'span8', 'w100' => 'span12', 'wrapper' => 'row-fluid');
} else {
$this->css = array('items' => 'seblod', 'table' => 'adminlist', 'w33' => 'width-30', 'w50' => 'width-50 fltlft', 'w66' => 'width-100', 'w100' => 'width-100', 'wrapper' => 'sebwrapper');
}
}
示例15: g_onCCK_Storage_LocationStore
public function g_onCCK_Storage_LocationStore($location, $default, $pk, &$config, $params = array())
{
if (!$pk) {
return;
}
static $already = 0;
$config['author'] = (int) $config['author'] > 0 ? $config['author'] : JCck::getConfig_Param('integration_user_default_author', 42);
$config['parent'] = isset($config['parent']) && (int) $config['parent'] > 0 ? $config['parent'] : 0;
$table = $location['_']->table;
// Core
if (!$already) {
if (isset($params['bridge']) && $params['bridge']) {
if (!isset($params['bridge_default_title'])) {
$params['bridge_default_title'] = '';
}
if (!isset($params['bridge_default_title_mode'])) {
$params['bridge_default_title_mode'] = 0;
}
if ($params['bridge'] == 1) {
self::g_doBridge('joomla_article', $pk, $location, $config, $params);
} elseif ($params['bridge'] == 2) {
self::g_doBridge('joomla_category', $pk, $location, $config, $params);
}
} else {
$core = JCckTable::getInstance('#__cck_core', 'id');
$core->load($config['id']);
$core->cck = $config['type'];
if (!$core->pk) {
$core->date_time = JFactory::getDate()->toSql();
}
$core->pk = $pk;
$core->storage_location = isset($location['_']->location) ? $location['_']->location : JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $config['type'] . '"');
$core->author_id = $config['author'];
$core->parent_id = $config['parent'];
if (isset($config['storages']['#__cck_core']['store_id'])) {
$core->store_id = $config['storages']['#__cck_core']['store_id'];
}
$core->storeIt();
}
if (!(isset($config['component']) && $config['component'] == 'com_cck_importer')) {
$already = 1;
}
}
// More
if ($table && $table != $default) {
$more = JCckTable::getInstance($table, 'id');
$more->load($pk, true);
if (isset($more->cck)) {
$more->cck = $config['type'];
}
$more->bind($config['storages'][$table]);
$more->check();
$more->store();
}
if (!isset($config['primary'])) {
$config['primary'] = $location['_']->location;
}
}