本文整理匯總了PHP中JCckDatabase::loadResult方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCckDatabase::loadResult方法的具體用法?PHP JCckDatabase::loadResult怎麽用?PHP JCckDatabase::loadResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JCckDatabase
的用法示例。
在下文中一共展示了JCckDatabase::loadResult方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _delete
protected function _delete($pk, $location, $base)
{
$id = JCckDatabase::loadResult('SELECT id FROM #__cck_core WHERE storage_location = "' . (string) $location . '" AND pk = ' . (int) $pk);
if (!$id) {
return true;
}
$table = JCckTable::getInstance('#__cck_core', 'id', $id);
$type = $table->cck;
$pkb = (int) $table->pkb;
$table->delete();
if ($pkb > 0) {
$table = JTable::getInstance('content');
$table->delete($pkb);
}
$tables = JCckDatabase::loadColumn('SHOW TABLES');
$prefix = JFactory::getApplication()->getCfg('dbprefix');
if (in_array($prefix . 'cck_store_item_' . $base, $tables)) {
$table = JCckTable::getInstance('#__cck_store_item_' . $base, 'id', $pk);
if ($table->id) {
$table->delete();
}
}
if (in_array($prefix . 'cck_store_form_' . $type, $tables)) {
$table = JCckTable::getInstance('#__cck_store_form_' . $type, 'id', $pk);
if ($table->id) {
$table->delete();
}
}
}
示例2: 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);
}
示例3: g_onCCK_PaymentValidate
public static function g_onCCK_PaymentValidate($data, $success, &$config)
{
$update = 'pay_return = "' . JCckDatabase::escape(json_encode($data['order'])) . '",' . 'pay_return_payments = "' . JCckDatabase::escape(json_encode($data['payments'])) . '",' . 'state = ' . $data['order_state'];
JCckDatabase::execute('UPDATE #__cck_more_ecommerce_orders SET ' . $update . ' WHERE pay_key = "' . $config['pay_key'] . '"');
if (!$success) {
return;
}
// Cart
$cart_id = (int) JCckDatabase::loadResult('SELECT a.id FROM #__cck_more_ecommerce_carts AS a WHERE a.pay_key = "' . $config['pay_key'] . '"');
if ($cart_id) {
JCckDatabase::execute('UPDATE #__cck_more_ecommerce_carts SET pay_key = "" WHERE id = ' . $cart_id);
JCckDatabase::execute('DELETE a.* FROM #__cck_more_ecommerce_cart_product AS a WHERE a.cart_id = ' . $cart_id);
}
// Execute Processings (Invoice, Notifications, ...)
if (JCckToolbox::getConfig()->get('processing', 0)) {
$event = 'onCckPaymentSuccess';
$processing = JCckDatabaseCache::loadObjectListArray('SELECT type, scriptfile, options FROM #__cck_more_processings WHERE published = 1 ORDER BY ordering', 'type');
if (isset($processing[$event])) {
foreach ($processing[$event] as $p) {
if (is_file(JPATH_SITE . $p->scriptfile)) {
$options = new JRegistry($p->options);
include_once JPATH_SITE . $p->scriptfile;
}
}
}
}
}
示例4: getGateway
public static function getGateway()
{
$user = JFactory::getUser();
$access = implode(',', $user->getAuthorisedViewLevels());
$name = JCckDatabase::loadResult('SELECT type' . ' FROM #__cck_more_ecommerce_gateways' . ' WHERE published = 1 AND access IN (' . $access . ')' . ' ORDER BY id DESC');
return $name;
}
示例5: getRow
public static function getRow($id, $content_type = '')
{
if (!$id) {
return NULL;
}
$index = $id . '_' . $content_type;
if (isset(self::$_items[$index])) {
return self::$_items[$index];
}
$row = JTable::getInstance('content');
$row->load($id);
if (!$content_type) {
$content_type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location = "joomla_article" AND pk = ' . $row->id);
}
if ($content_type) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_form_' . $content_type . ' WHERE id = ' . $row->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$row->{$k} = $v;
}
}
}
self::$_items[$index] = $row;
return $row;
}
示例6: getAttribute
public static function getAttribute($fieldname, $attribute)
{
if (!$fieldname || !$attribute) {
return false;
}
$res = JCckDatabase::loadResult('SELECT s.' . $attribute . ' FROM #__cck_core_fields AS s' . ' WHERE s.name="' . $fieldname . '"');
return $res;
}
示例7: loadResult
public static function loadResult($query)
{
static $cache = array();
$idx = md5($query);
if (!isset($cache[$idx])) {
$cache[$idx] = parent::loadResult($query);
}
return $cache[$idx];
}
示例8: authorise
public static function authorise(&$field, &$config)
{
$user = JCck::getUser();
$check = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_more_ecommerce_order_product AS a LEFT JOIN #__cck_more_ecommerce_orders AS b ON b.id = a.order_id' . ' WHERE a.product_id = ' . $config['pk'] . ' AND b.user_id =' . $user->id);
if ((int) $check > 0) {
//
} else {
$field->display = 0;
}
}
示例9: countItems
public static function countItems($definition)
{
static $cache = array();
$count = 0;
$user = JCck::getUser();
if (!isset($cache[$definition])) {
$cache[$definition] = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_more_ecommerce_cart_product AS a' . ' LEFT JOIN #__cck_more_ecommerce_carts AS b ON b.id = a.cart_id WHERE b.type = "' . $definition . '" AND b.' . (string) $user->where_clause . ' AND b.state = 1');
}
return $cache[$definition];
}
示例10: countItems
public static function countItems($store_id, $object = 'joomla_article')
{
$cache = array();
$count = 0;
$user = JFactory::getUser();
if (!isset($cache[$store_id])) {
$cache[$store_id] = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_core AS a' . ' LEFT JOIN #__content AS b ON (b.id = a.pk AND a.storage_location = "joomla_article")' . ' WHERE a.store_id = ' . $store_id . ' AND b.state = 1');
}
return $cache[$store_id];
}
示例11: uniqid
public static function &getUser($userid = 0, $content_type = '', $profile = true)
{
if (!$userid) {
$user = JFactory::getUser();
} else {
$user = JFactory::getUser($userid);
}
// Core
if ($user->id && $user->guest != 1) {
$user->session_id = null;
$user->where_clause = 'user_id=' . $user->id;
} else {
$user->session_id = JFactory::getSession()->getId();
if (empty($user->session_id)) {
$user->session_id = uniqid();
/* Not good, but better than empty */
}
$user->where_clause = 'session_id="' . $user->session_id . '"';
}
// IP
$user->ip = getenv('REMOTE_ADDR');
// $_SERVER["REMOTE_ADDR"];
// More
if ($user->id && $profile) {
if (!$content_type) {
$content_type = '';
// todo: config
if (!$content_type) {
$content_type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location = "joomla_user" AND pk = ' . (int) $user->id);
}
}
$db = JFactory::getDbo();
$prefix = $db->getPrefix();
$tables = $db->getTableList();
$tables = array_flip($tables);
if (isset($tables[$prefix . 'cck_store_item_users'])) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_item_users WHERE id = ' . (int) $user->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$user->{$k} = $v;
}
}
}
if (isset($tables[$prefix . 'cck_store_form_' . $content_type])) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_form_' . $content_type . ' WHERE id = ' . (int) $user->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$user->{$k} = $v;
}
}
}
}
return $user;
}
示例12: prepareDisplay
function prepareDisplay()
{
$app = JFactory::getApplication();
$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->item->cck_type = $this->state->get('content_type', '');
$this->item->skip = $this->state->get('skip');
if (@$this->item->id > 0) {
$this->isNew = 0;
$this->panel_class = 'closed';
$this->panel_style = 'display:none; ';
$name = $this->item->name;
$app->setUserState(CCK_COM . '.edit.search.client', NULL);
} else {
$this->isNew = 1;
$this->panel_class = 'open';
$this->panel_style = '';
$name = '';
if ($this->item->cck_type != '') {
$this->item->storage_location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $this->item->cck_type . '"');
if ($this->item->storage_location == 'none') {
$this->item->storage_location = '';
}
}
$this->tpl_list = $this->state->get('tpl.list');
}
$this->item->folder = Helper_Admin::getSelected($this->vName, 'folder', $this->item->folder, 1);
$this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1);
if ($this->item->skip != '') {
$this->item->client = $this->item->skip;
$this->item->master = $this->item->client == 'list' || $this->item->client == 'item' ? 'content' : ($this->item->client == 'order' ? 'order' : 'search');
$this->item->layer = $app->input->getString('layer', 'fields');
$P = 'template_' . $this->item->client;
$force_template = $this->item->client == 'list' ? $this->state->get('tpl.list') : Helper_Workshop::getDefaultTemplate();
} else {
$this->item->client = $this->isNew ? 'search' : $this->state->get('client', $app->input->cookie->getString('cck_search' . $name . '_client', 'search'));
$this->item->master = $this->item->client == 'list' || $this->item->client == 'item' ? 'content' : ($this->item->client == 'order' ? 'order' : 'search');
$this->item->layer = $app->input->getString('layer', 'fields');
$P = 'template_' . $this->item->client;
$force_template = $this->item->client == 'list' ? '' : Helper_Workshop::getDefaultTemplate();
}
$this->style = $this->item->client != 'order' ? Helper_Workshop::getTemplateStyle($this->vName, $this->item->{$P}, $this->state->get('tpl.' . $this->item->client, $force_template)) : '';
$this->item->template = isset($this->style->template) ? $this->style->template : '';
$this->insidebox = Helper_Admin::addInsidebox($this->isNew);
Helper_Admin::addToolbarEdit($this->vName, 'COM_CCK_' . _C4_TEXT, array('isNew' => $this->isNew, 'folder' => $this->state->get('filter.folder'), 'checked_out' => $this->item->checked_out), array('template' => $this->item->template));
}
示例13: 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"');
}
}
示例14: getItems
public function getItems()
{
if ($items = parent::getItems()) {
$group_map = JCckDatabase::loadObjectList('SELECT a.group_id, COUNT( DISTINCT a.user_id ) AS num FROM #__user_usergroup_map AS a GROUP BY a.group_id', 'group_id');
foreach ($items as $item) {
$viewlevels = $item->guest_only_viewlevel ? $item->guest_only_viewlevel . ',' . $item->viewlevels : $item->viewlevels;
$query = 'SELECT COUNT(a.id) FROM #__cck_core AS a LEFT JOIN #__content AS b ON b.id = a.pk WHERE a.storage_location = "joomla_article" AND b.access IN (' . $viewlevels . ');';
$item->articles = JCckDatabase::loadResult($query);
$groups = $item->guest_only_group ? $item->guest_only_group . ',' . $item->groups : $item->groups;
$query = 'SELECT COUNT(DISTINCT a.user_id) FROM #__user_usergroup_map AS a WHERE a.group_id IN (' . $groups . ');';
$item->users = JCckDatabase::loadResult($query);
}
}
return $items;
}
示例15: 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;
}