當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JCckDatabase::loadColumn方法代碼示例

本文整理匯總了PHP中JCckDatabase::loadColumn方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCckDatabase::loadColumn方法的具體用法?PHP JCckDatabase::loadColumn怎麽用?PHP JCckDatabase::loadColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JCckDatabase的用法示例。


在下文中一共展示了JCckDatabase::loadColumn方法的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::getConfig()->get('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();
         }
     }
 }
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:29,代碼來源:cck.php

示例2: getTargets

 public static function getTargets($id)
 {
     static $cache = array();
     if (!isset($cache[$id])) {
         $cache[$id] = JCckDatabase::loadColumn('SELECT product_id FROM #__cck_more_ecommerce_promotion_product WHERE promotion_id = ' . (int) $id);
         $cache[$id] = array_flip($cache[$id]);
     }
     return $cache[$id];
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:9,代碼來源:promotion.php

示例3: onContentAfterDelete

 public function onContentAfterDelete($context, $data)
 {
     switch ($context) {
         case 'com_content.article':
             $base = 'content';
             $custom = 'introtext';
             $pk = $data->id;
             break;
         case 'com_categories.category':
             $base = 'categories';
             $custom = 'description';
             $pk = $data->id;
             break;
         default:
             return true;
     }
     preg_match('#::cck::(.*)::/cck::#U', $data->{$custom}, $matches);
     $id = $matches[1];
     if (!$id) {
         return true;
     }
     $table = JCckTable::getInstance('#__cck_core', 'id', $id);
     $type = $table->cck;
     $table->delete();
     // Processing
     JLoader::register('JCckToolbox', JPATH_PLATFORM . '/cms/cck/toolbox.php');
     if (JCckToolbox::getConfig()->get('processing', 0)) {
         $event = 'onContentAfterDelete';
         $processing = JCckDatabaseCache::loadObjectListArray('SELECT type, scriptfile FROM #__cck_more_toolbox_processings WHERE published = 1 ORDER BY ordering', 'type');
         if (isset($processing[$event])) {
             foreach ($processing[$event] as $p) {
                 if (is_file(JPATH_SITE . $p->scriptfile)) {
                     include_once JPATH_SITE . $p->scriptfile;
                     /* Variables: $id, $pk, $type */
                 }
             }
         }
     }
     $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();
         }
     }
     return true;
 }
開發者ID:olafzieger,項目名稱:joomla3.x-seblod-test,代碼行數:54,代碼來源:cck.php

示例4: getItems

 public function getItems()
 {
     jimport('joomla.filesystem.folder');
     $folders = JFolder::folders(JPATH_LIBRARIES . '/cck/rendering/variations');
     $i = 0;
     $items = array();
     $variations = array('empty' => '', 'joomla' => '', 'seb_css3' => '', 'seb_css3b' => '');
     // Filter Search
     $location = $this->getState('filter.location');
     $search = $this->getState('filter.search');
     // Library
     if (count($folders) && $location != 'template_name') {
         foreach ($folders as $k => $v) {
             if ($search && strpos($v, $search) === false) {
                 continue;
             }
             $items[$i] = new stdClass();
             $items[$i]->folder = '/libraries/cck/rendering/variations/';
             $items[$i]->template = '';
             $items[$i]->title = $v;
             $items[$i]->type = isset($variations[$v]) ? 0 : 1;
             $items[$i++]->id = $i;
         }
     }
     // Templates
     if ($search && $location == 'template_name') {
         $templates = array(0 => $search);
         $search = '';
     } else {
         $templates = JCckDatabase::loadColumn('SELECT name FROM #__cck_core_templates');
     }
     if (count($templates)) {
         foreach ($templates as $k => $template) {
             $path = '/templates/' . $template . '/variations';
             if (JFolder::exists(JPATH_SITE . $path)) {
                 $folders = JFolder::folders(JPATH_SITE . $path);
                 if (count($folders)) {
                     foreach ($folders as $k => $v) {
                         if ($search && strpos($v, $search) === false) {
                             continue;
                         }
                         $items[$i] = new stdClass();
                         $items[$i]->folder = $path;
                         $items[$i]->template = $template;
                         $items[$i]->title = $v;
                         $items[$i]->type = 1;
                         $items[$i++]->id = $i;
                     }
                 }
             }
         }
     }
     return $items;
 }
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:54,代碼來源:variations.php

示例5: onContentAfterDelete

 public function onContentAfterDelete($context, $data)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('name AS object')->from('#__cck_core_objects')->where('context = ' . $db->quote($context));
     $db->setQuery($query);
     $object = $db->loadResult();
     if (!$object) {
         return true;
     }
     $tableKey = $data->getKeyName();
     $pk = $data->{$tableKey};
     $base = str_replace('#__', '', $data->getTableName());
     require_once JPATH_SITE . '/plugins/cck_storage_location/' . $object . '/' . $object . '.php';
     $properties = array('custom');
     $properties = JCck::callFunc('plgCCK_Storage_Location' . $object, 'getStaticProperties', $properties);
     $custom = $properties['custom'];
     $type = '';
     // Core
     if ($custom) {
         preg_match('#::cck::(.*)::/cck::#U', $data->{$custom}, $matches);
         $id = $matches[1];
         if (!$id) {
             return true;
         }
         $table = JCckTable::getInstance('#__cck_core', 'id', $id);
         $type = $table->cck;
     } else {
         $table = JCckTable::getInstance('#__cck_core');
         if ($table->load(array('pk' => $pk, 'storage_location' => $object))) {
             $type = $table->cck;
         }
     }
     if ($table->pk > 0) {
         // -- Leave nothing behind
         if ($type != '') {
             require_once JPATH_LIBRARIES . '/cck/base/form/form.php';
             JPluginHelper::importPlugin('cck_field');
             JPluginHelper::importPlugin('cck_storage');
             JPluginHelper::importPlugin('cck_storage_location');
             $config = array('pk' => $table->pk, 'storages' => array(), 'type' => $table->cck);
             $dispatcher = JDispatcher::getInstance();
             $parent = JCckDatabase::loadResult('SELECT parent FROM #__cck_core_types WHERE name = "' . $type . '"');
             $fields = CCK_Form::getFields(array($type, $parent), 'all', -1, '', true);
             if (count($fields)) {
                 foreach ($fields as $field) {
                     $Pt = $field->storage_table;
                     $value = '';
                     /* Yes but, .. */
                     if ($Pt && !isset($config['storages'][$Pt])) {
                         $config['storages'][$Pt] = '';
                         $dispatcher->trigger('onCCK_Storage_LocationPrepareDelete', array(&$field, &$config['storages'][$Pt], $pk, &$config));
                     }
                     $dispatcher->trigger('onCCK_StoragePrepareDelete', array(&$field, &$value, &$config['storages'][$Pt], &$config));
                     $dispatcher->trigger('onCCK_FieldDelete', array(&$field, $value, &$config, array()));
                 }
             }
         }
         // -- Leave nothing behind
         $table->delete();
     }
     // Processing
     JLoader::register('JCckToolbox', JPATH_PLATFORM . '/cms/cck/toolbox.php');
     if (JCckToolbox::getConfig()->get('processing', 0)) {
         $event = 'onContentAfterDelete';
         $processing = JCckDatabaseCache::loadObjectListArray('SELECT type, scriptfile 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)) {
                     include_once JPATH_SITE . $p->scriptfile;
                     /* Variables: $id, $pk, $type */
                 }
             }
         }
     }
     $tables = JCckDatabase::loadColumn('SHOW TABLES');
     $prefix = JFactory::getConfig()->get('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();
         }
     }
     return true;
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:90,代碼來源:cck.php

示例6: onCCK_Storage_LocationDelete

 public static function onCCK_Storage_LocationDelete($pk, &$config = array())
 {
     $app = JFactory::getApplication();
     $dispatcher = JDispatcher::getInstance();
     $item = JCckDatabase::loadObject('SELECT id, cck as type, pk, storage_table FROM #__cck_core WHERE cck = "' . $config['type'] . '" AND pk = ' . (int) $pk);
     if (!is_object($item)) {
         return false;
     }
     $table = JCckTable::getInstance($item->storage_table, 'id');
     $table->load($pk);
     if (!$table) {
         return false;
     }
     // Check
     $user = JCck::getUser();
     $canDelete = $user->authorise('core.delete', 'com_cck.form.' . $config['type_id']);
     $canDeleteOwn = $user->authorise('core.delete.own', 'com_cck.form.' . $config['type_id']);
     if (!$canDelete && !$canDeleteOwn || !$canDelete && $canDeleteOwn && $config['author'] != $user->get('id') || $canDelete && !$canDeleteOwn && $config['author'] == $user->get('id')) {
         $app->enqueueMessage(JText::_('COM_CCK_ERROR_DELETE_NOT_PERMITTED'), 'error');
         return;
     }
     // Process
     // -- onContentBeforeDelete?
     if (!$table->delete($pk)) {
         return false;
     }
     // Delete Core
     if ($item->id) {
         $table = JCckTable::getInstance('#__cck_core', 'id', $item->id);
         $table->delete();
     }
     // Delete More
     $base = str_replace('#__', '', $item->storage_table);
     $tables = JCckDatabase::loadColumn('SHOW TABLES');
     $prefix = JFactory::getConfig()->get('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_' . $item->type, $tables)) {
         $table = JCckTable::getInstance('#__cck_store_form_' . $item->type, 'id', $pk);
         if ($table->id) {
             $table->delete();
         }
     }
     // -- onContentAfterDelete?
     return true;
 }
開發者ID:codigoaberto,項目名稱:SEBLOD,代碼行數:50,代碼來源:free.php

示例7: importTables

 public static function importTables($data)
 {
     $db = JFactory::getDbo();
     $path = $data['root'] . '/tables';
     if (file_exists($path)) {
         $items = JFolder::files($path, '\\.xml$');
         if (count($items)) {
             $prefix = JFactory::getConfig()->get('dbprefix');
             $tables = array_flip(JCckDatabase::loadColumn('SHOW TABLES'));
             foreach ($items as $item) {
                 $xml = JCckDev::fromXML($path . '/' . $item);
                 if (!$xml || (string) $xml->attributes()->type != 'tables') {
                     return;
                 }
                 $name = (string) $xml->table->name;
                 $table_key = (string) $xml->table->primary_key;
                 $short = str_replace('#__', $prefix, $name);
                 if (isset($tables[$short])) {
                     $table = JCckTable::getInstance($name);
                     $table_fields = $table->getFields();
                     $previous = '';
                     // Fields
                     $fields = $xml->fields->children();
                     if (count($fields)) {
                         foreach ($fields as $field) {
                             $column = (string) $field;
                             $type = (string) $field->attributes()->type;
                             $default = (string) $field->attributes()->default;
                             if (!isset($table_fields[$column])) {
                                 $query = 'ALTER TABLE ' . $name . ' ADD ' . JCckDatabase::quoteName($column) . ' ' . $type . ' NOT NULL';
                                 $query .= $default != '' ? ' DEFAULT "' . $default . '"' : '';
                                 $query .= $previous != '' ? ' AFTER ' . JCckDatabase::quoteName($previous) : ' FIRST';
                                 JCckDatabase::execute($query);
                             } else {
                                 if ($type != $table_fields[$column]->Type) {
                                     $query = 'ALTER TABLE ' . $name . ' CHANGE ' . JCckDatabase::quoteName($column) . ' ' . JCckDatabase::quoteName($column) . ' ' . $type . ' NOT NULL';
                                     $query .= $default != '' ? ' DEFAULT "' . $default . '"' : '';
                                     JCckDatabase::execute($query);
                                 }
                             }
                             $previous = $column;
                         }
                     }
                     // Indexes
                     $indexes = $xml->indexes->children();
                     $indexes2 = array();
                     if (count($indexes)) {
                         foreach ($indexes as $index) {
                             $idx = (string) $index;
                             $indexes2[$idx][(string) $index->attributes()->seq_in_type] = (string) $index->attributes()->column_name;
                         }
                     }
                     if (count($indexes2)) {
                         foreach ($indexes2 as $k => $v) {
                             if ($k == 'PRIMARY') {
                                 JCckDatabase::execute('ALTER TABLE ' . $name . ' DROP PRIMARY KEY, ADD PRIMARY KEY ( ' . implode(',', $v) . ' )');
                             } else {
                                 // todo
                             }
                         }
                     }
                 } else {
                     $sql_query = '';
                     // Fields
                     $fields = $xml->fields->children();
                     if (count($fields)) {
                         foreach ($fields as $field) {
                             $type = (string) $field->attributes()->type;
                             $default = (string) $field->attributes()->default;
                             $sql_query .= ' ' . JCckDatabase::quoteName((string) $field) . ' ' . $type . ' NOT NULL';
                             if ($default != '') {
                                 $sql_query .= ' DEFAULT "' . $default . '"';
                             }
                             $sql_query .= ',';
                         }
                     }
                     // Indexes
                     $indexes = $xml->indexes->children();
                     $indexes2 = array();
                     if (count($indexes)) {
                         foreach ($indexes as $index) {
                             $idx = (string) $index;
                             $indexes2[$idx][(string) $index->attributes()->seq_in_type] = (string) $index->attributes()->column_name;
                         }
                     }
                     if (count($indexes2)) {
                         foreach ($indexes2 as $k => $v) {
                             $sql_query .= $k == 'PRIMARY' ? ' PRIMARY KEY ( ' . implode(',', $v) . ' ),' : ' KEY ' . $k . ' ( ' . implode(',', $v) . ' ),';
                         }
                     }
                     $sql_query = $sql_query ? substr($sql_query, 0, -1) : '';
                     JCckDatabase::execute('CREATE TABLE IF NOT EXISTS ' . $name . ' (' . $sql_query . ') ENGINE=InnoDB DEFAULT CHARSET=utf8;');
                 }
             }
         }
     }
 }
開發者ID:kenyonjohnston,項目名稱:hott_theater,代碼行數:97,代碼來源:import.php

示例8: getUserZones

 public static function getUserZones()
 {
     $user = JCck::getUser();
     $zones = array();
     if (!(isset($user->country) && $user->country != '')) {
         return $zones;
     }
     $where = 'countries = "' . $user->country . '" OR countries LIKE "' . $user->country . '||%" OR countries LIKE "%||' . $user->country . '" OR countries LIKE "%||' . $user->country . '||%"';
     $zones = JCckDatabase::loadColumn('SELECT id FROM #__cck_more_ecommerce_zones WHERE published = 1 AND (' . $where . ') ORDER BY CHARACTER_LENGTH(countries) ASC');
     return $zones;
 }
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:11,代碼來源:ecommerce.php

示例9: prepareExport

 public function prepareExport($id = 0, $elements = array(), $dependencies = array(), $options = array())
 {
     $config = JFactory::getConfig();
     $tmp_path = $config->get('tmp_path');
     $tmp_dir = uniqid('cck_');
     $path = $tmp_path . '/' . $tmp_dir;
     $folders = isset($elements['subfolders']) ? Helper_Folder::getBranch($id, ',') : $id;
     $folders = JCckDatabase::loadObjectList('SELECT * FROM #__cck_core_folders WHERE id IN (' . (string) $folders . ') ORDER BY lft');
     if (!@$folders[0]) {
         return;
     }
     $isApp = false;
     $isCck = false;
     $name = $folders[0]->name;
     if (!$name) {
         return;
     }
     // Core
     jimport('joomla.filesystem.file');
     jimport('cck.base.install.export');
     $data = array('root' => $path, 'root_content' => $path . '/content', 'root_elements' => $path . '/elements', 'root_extensions' => $path . '/extensions', 'root_sql' => $path . '/sql', 'root_category' => '', 'elements' => array(), 'db_prefix' => $config->get('dbprefix'));
     $extensions = array(0 => (object) array('type' => 'plugin', 'id' => 'plg_system_blank', 'group' => 'system', '_file' => 'plg_system_blank.zip'));
     $data['folders'] = JCckDatabase::loadObjectList('SELECT id, name, path FROM #__cck_core_folders WHERE lft', 'id');
     $data['folders2'] = JCckDatabase::loadObjectList('SELECT id, name, path FROM #__cck_core_folders WHERE lft', 'name');
     $data['plugins'] = CCK_Export::getCorePlugins();
     $data['plugins']['cck_field_live']['stage'] = true;
     $data['processings'] = JCckDatabase::loadObjectList('SELECT * FROM #__cck_more_processings', 'id');
     $data['processings2'] = JCckDatabase::loadObjectList('SELECT folder FROM #__cck_more_processings', 'folder');
     $data['styles'] = JCckDatabase::loadObjectList('SELECT * FROM #__template_styles', 'id');
     $data['tables'] = array_flip(JCckDatabase::loadColumn('SHOW TABLES'));
     $data['tables_excluded'] = CCK_Export::getCoreTables();
     $data['variations'] = array('empty' => true, 'joomla' => true, 'seb_css3' => true, 'seb_css3b' => true);
     // Copyright
     if (JCckDatabase::loadResult('SELECT extension_id FROM #__extensions WHERE type = "component" AND element = "com_cck_packager"') > 0) {
         $params = JComponentHelper::getParams('com_cck_packager');
         $copyright = $params->get('copyright');
     } else {
         $copyright = '';
     }
     CCK_Export::createDir($data['root_content']);
     CCK_Export::createDir($data['root_elements']);
     CCK_Export::createDir($data['root_extensions']);
     CCK_Export::createDir($data['root_sql']);
     if (isset($dependencies['categories'])) {
         $data['root_category'] = CCK_Export::exportRootCategory($folders['0'], $data, $extensions);
     }
     if (isset($dependencies['menu'])) {
         $data['root_menu'] = CCK_Export::exportMenus($dependencies['menu'], $data, $extensions);
     }
     foreach ($folders as $i => $folder) {
         if ($i == 0) {
             if ($folder->path && $folder->path != $folder->name) {
                 $branch = explode('/', $folder->path);
                 array_pop($branch);
                 if (count($branch)) {
                     $parent_id = 2;
                     foreach ($branch as $k => $v) {
                         $elem = JCckDatabase::loadObject('SELECT * FROM #__cck_core_folders WHERE name = "' . (string) $v . '" AND parent_id = ' . (int) $parent_id);
                         $parent_id = $elem->id;
                         CCK_Export::createDir($data['root_elements'] . '/folder' . 's');
                         CCK_Export::exportElement('folder', $elem, $data, $extensions, 0);
                     }
                 }
             }
         }
         CCK_Export::exportElements('folder', $folders, $data, $extensions, 0, $copyright);
         if (isset($elements['fields'])) {
             $fields = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_fields AS a WHERE a.folder = ' . (int) $folder->id);
             CCK_Export::exportElements('field', $fields, $data, $extensions, 500, $copyright);
         }
         if (isset($elements['templates'])) {
             $templates = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_templates AS a WHERE a.folder = ' . (int) $folder->id);
             CCK_Export::exportElements('template', $templates, $data, $extensions, 0, $copyright);
         }
         if (isset($elements['types'])) {
             $types = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_types AS a WHERE a.folder = ' . (int) $folder->id);
             if (count($types)) {
                 $isApp = true;
             }
             CCK_Export::exportElements('type', $types, $data, $extensions, 0, $copyright);
         }
         if (isset($elements['searchs'])) {
             $searchs = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_searchs AS a WHERE a.folder = ' . (int) $folder->id);
             if (count($searchs)) {
                 $isApp = true;
             }
             CCK_Export::exportElements('search', $searchs, $data, $extensions, 0, $copyright);
         }
     }
     if (count($data['elements']['tables'])) {
         CCK_Export::exportTables($data);
     }
     if (count($data['elements']['processings'])) {
         $isCck = true;
         CCK_Export::exportProcessings($data, $extensions);
     }
     // Name & Root
     if ($isApp) {
         $filename = 'app_cck_' . $name;
     } else {
//.........這裏部分代碼省略.........
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:101,代碼來源:folder.php

示例10: rebuildTree

 public static function rebuildTree($parent_id = 0, $lft = 0, $depth = 0, $more = '')
 {
     $childs = JCckDatabase::loadColumn('SELECT id FROM #__cck_core' . $more . '_folders WHERE parent_id = ' . (int) $parent_id . ' ORDER BY parent_id, title');
     $n = count($childs);
     $rgt = $lft + 1;
     for ($i = 0; $i < $n; $i++) {
         $depth++;
         $rgt = self::rebuildTree($childs[$i], $rgt, $depth);
         $depth--;
         if ($rgt === false) {
             return false;
         }
     }
     if (!JCckDatabase::doQuery('UPDATE #__cck_core_folders SET depth = ' . (int) $depth . ', lft = ' . (int) $lft . ', rgt = ' . (int) $rgt . ' WHERE id =' . (int) $parent_id)) {
         return false;
     }
     return $rgt + 1;
 }
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:18,代碼來源:helper_folder.php

示例11: getBranch

 public static function getBranch($table, $pk)
 {
     $query = 'SELECT s.id, (COUNT(parent.id) - (branch.depth2 + 1)) AS depth2' . ' FROM ' . $table . ' AS s,' . $table . ' AS parent,' . $table . ' AS subparent,' . ' (' . ' SELECT s.id, (COUNT(parent.id) - 1) AS depth2' . ' FROM ' . $table . ' AS s,' . $table . ' AS parent' . ' WHERE s.lft BETWEEN parent.lft AND parent.rgt' . ' AND s.id =' . (int) $pk . ' GROUP BY s.id' . ' ORDER BY s.lft' . ' ) AS branch' . ' WHERE s.lft BETWEEN parent.lft AND parent.rgt' . ' AND s.lft BETWEEN subparent.lft AND subparent.rgt' . ' AND subparent.id = branch.id' . ' GROUP BY s.id' . ' ORDER BY s.lft';
     $items = JCckDatabase::loadColumn($query);
     return $items;
 }
開發者ID:kenyonjohnston,項目名稱:hott_theater,代碼行數:6,代碼來源:helper.php

示例12: getCoreTables

 public static function getCoreTables()
 {
     $core = array();
     $plugins = JCckDatabase::loadColumn('SELECT element FROM #__extensions WHERE folder = "cck_storage_location"');
     if (count($plugins)) {
         foreach ($plugins as $plugin) {
             if ($plugin != '' && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $plugin . '/' . $plugin . '.php')) {
                 require_once JPATH_SITE . '/plugins/cck_storage_location/' . $plugin . '/' . $plugin . '.php';
                 $properties = array('table');
                 $properties = JCck::callFunc('plgCCK_Storage_Location' . $plugin, 'getStaticProperties', $properties);
                 if ($properties['table']) {
                     $core[$properties['table']] = '';
                 }
             }
         }
     }
     return $core;
 }
開發者ID:kolydart,項目名稱:SEBLOD,代碼行數:18,代碼來源:export.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;
     }
     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

示例14: onCCK_FieldPrepareForm


//.........這裏部分代碼省略.........
             $opt_group = '';
             if ($count2) {
                 foreach ($opt_attrs as $k => $v) {
                     if ($v != '') {
                         $v = str_replace('[lang]', $lang_code, $v) . ' AS attr' . ($k + 1);
                         $opt_attr .= ',' . $v;
                     }
                 }
                 if ($opt_attr == ',') {
                     $opt_attr = '';
                 }
             }
             if ($opt_name && $opt_value && $opt_table) {
                 $query = 'SELECT ' . $opt_name . ',' . $opt_value . $opt_attr . $opt_table . $opt_where . $opt_orderby . $opt_limit;
                 $query = JCckDevHelper::replaceLive($query);
                 if ($config['client'] == '' || $config['client'] == 'dev') {
                     $tables = JCckDatabaseCache::getTableList();
                     $prefix = JFactory::getDbo()->getPrefix();
                     $items = in_array(str_replace('#__', $prefix, $options2['table']), $tables) ? JCckDatabase::loadObjectList($query) : array();
                 } else {
                     $items = JCckDatabase::loadObjectList($query);
                 }
             }
         } else {
             if (@$options2['query'] != '') {
                 // Language Detection
                 $lang_code = '';
                 self::_languageDetection($lang_code, $value, $options2);
                 $query = str_replace('[lang]', $lang_code, $options2['query']);
                 $query = JCckDevHelper::replaceLive($query);
                 if (strpos($query, ' value ') !== false || strpos($query, 'AS value') !== false || strpos($query, ' value,') !== false) {
                     $items = JCckDatabase::loadObjectList($query);
                 } else {
                     $opts2 = JCckDatabase::loadColumn($query);
                     if (count($opts2)) {
                         $opts2 = array_combine(array_values($opts2), $opts2);
                     }
                     $opts = array_merge($opts, $opts2);
                 }
             }
             $opt_name = 'text';
             $opt_value = 'value';
             $opt_group = 'optgroup';
         }
         if (count($items)) {
             if ($opt_group) {
                 $group = '';
                 foreach ($items as $o) {
                     if (isset($o->optgroup) && $o->optgroup != $group) {
                         if ($group) {
                             $opts[] = JHtml::_('select.option', '</OPTGROUP>');
                         }
                         $opts[] = JHtml::_('select.option', '<OPTGROUP>', $o->optgroup);
                         $group = $o->optgroup;
                     }
                     if ($attrib) {
                         $attr['attr'] = '';
                         foreach ($attribs as $k => $a) {
                             $ka = 'attr' . ($k + 1);
                             if (isset($o->{$ka})) {
                                 $va = $o->{$ka};
                             } else {
                                 $ka = isset($options2['attr' . ($k + 1)]) ? $options2['attr' . ($k + 1)] : '';
                                 $va = $ka != '' && isset($o->{$ka}) ? $o->{$ka} : '';
                             }
                             $attr['attr'] .= ' ' . $a . '="' . $va . '"';
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:67,代碼來源:select_dynamic.php

示例15: postflight


//.........這裏部分代碼省略.........
             $table = JTable::getInstance('category');
             $table->access = 2;
             $table->setLocation(1, 'last-child');
             $table->bind($category);
             $rules = new JAccessRules('{"core.create":{"1":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}');
             $table->setRules($rules);
             $table->check();
             $table->extension = 'com_content';
             $table->path .= $table->alias;
             $table->language = '*';
             $table->store();
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $dispatcher->trigger('onContentBeforeSave', array('', &$table, true));
             $table->store();
             $dispatcher->trigger('onContentAfterSave', array('', &$table, true));
             //
             $query = 'SELECT extension_id as id, params FROM #__extensions WHERE type="plugin" AND folder="cck_storage_location" AND element="' . $category['plg_name'] . '"';
             $db->setQuery($query);
             $plugin = $db->loadObject();
             $params = str_replace('"bridge_default-catid":"2"', '"bridge_default-catid":"' . $table->id . '"', $plugin->params);
             $query = 'UPDATE #__extensions SET params = "' . $db->escape($params) . '" WHERE extension_id = ' . (int) $plugin->id;
             $db->setQuery($query);
             $db->execute();
         }
         // Init Default Author
         $res = JCckDatabase::loadResult('SELECT id FROM #__users ORDER BY id ASC');
         $params = JComponentHelper::getParams('com_cck');
         $params->set('integration_user_default_author', (int) $res);
         $db->setQuery('UPDATE #__extensions SET params = "' . $db->escape($params) . '" WHERE name = "com_cck"');
         $db->execute();
         // Init ACL
         require_once JPATH_ADMINISTRATOR . '/components/com_cck/helpers/helper_admin.php';
         $pks = JCckDatabase::loadColumn('SELECT id FROM #__cck_core_folders ORDER BY lft');
         if (count($pks)) {
             $rules = '{"core.create":[],"core.delete":[],"core.delete.own":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}';
             Helper_Admin::initACL(array('table' => 'folder', 'name' => 'folder', 'rules' => $rules), $pks);
         }
         $pks = JCckDatabase::loadColumn('SELECT id FROM #__cck_core_types ORDER BY id');
         if (count($pks)) {
             $rules = '{"core.create":[],"core.create.max.parent":{"8":0},"core.create.max.parent.author":{"8":0},"core.create.max.author":{"8":0},' . '"core.delete":[],"core.delete.own":[],"core.edit":[],"core.edit.own":[]}';
             $rules2 = array(8 => '{"core.create":{"1":1,"2":0},"core.create.max.parent":{"8":0},"core.create.max.parent.author":{"8":0},"core.create.max.author":{"8":0},' . '"core.delete":[],"core.delete.own":[],"core.edit":{"4":0},"core.edit.own":{"2":1}}');
             Helper_Admin::initACL(array('table' => 'type', 'name' => 'form', 'rules' => $rules), $pks, $rules2);
         }
     } else {
         $new = $app->cck_core_version;
         $old = $app->cck_core_version_old;
         $root = JPATH_ADMINISTRATOR . '/components/com_cck';
         require_once JPATH_ADMINISTRATOR . '/components/' . CCK_COM . '/helpers/helper_folder.php';
         // ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** //
         $versions = array(0 => '2.0.0', 1 => '2.0.0.RC2', 2 => '2.0.0.RC2-1', 3 => '2.0.0.RC2-2', 4 => '2.0.0.RC2-3', 5 => '2.0.0.RC3', 6 => '2.0.0.RC4', 7 => '2.0.0.GA', 8 => '2.0.5', 9 => '2.0.6', 10 => '2.0.7', 11 => '2.1.0', 12 => '2.1.5', 13 => '2.2.0', 14 => '2.2.5', 15 => '2.3.0', 16 => '2.3.1', 17 => '2.3.5', 18 => '2.3.6', 19 => '2.3.7', 20 => '2.3.8', 21 => '2.3.9', 22 => '2.3.9.2', 23 => '2.4.5', 24 => '2.4.6', 25 => '2.4.7', 26 => '2.4.8', 27 => '2.4.8.5', 28 => '2.4.9', 29 => '2.4.9.1', 30 => '2.4.9.2', 31 => '2.4.9.5', 32 => '2.4.9.6', 33 => '2.4.9.7', 34 => '2.4.9.8', 35 => '2.5.0', 36 => '2.5.1', 37 => '2.5.2', 38 => '2.6.0', 39 => '2.7.0', 40 => '2.8.0', 41 => '2.9.0', 42 => '3.0.0', 43 => '3.0.1', 44 => '3.0.2', 45 => '3.0.3', 46 => '3.0.4', 47 => '3.0.5', 48 => '3.1.0', 49 => '3.1.1', 50 => '3.1.2', 51 => '3.1.3', 52 => '3.1.4', 53 => '3.1.5', 54 => '3.2.0', 55 => '3.2.1', 56 => '3.2.2', 57 => '3.3.0', 58 => '3.3.1', 59 => '3.3.2', 60 => '3.3.3', 61 => '3.3.4', 62 => '3.3.5', 63 => '3.3.6', 64 => '3.3.7', 65 => '3.3.8', 66 => '3.4.0', 67 => '3.4.1', 68 => '3.4.2', 69 => '3.4.3', 70 => '3.5.0', 71 => '3.5.1', 72 => '3.6.0', 73 => '3.6.1', 74 => '3.6.2', 75 => '3.6.3', 76 => '3.6.4', 77 => '3.6.5', 78 => '3.7.0', 79 => '3.7.1', 80 => '3.7.2', 81 => '3.7.3', 82 => '3.7.4', 83 => '3.7.5', 82 => '3.8.0');
         // ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** //
         $i = array_search($old, $versions);
         $i2 = $i;
         $n = array_search($new, $versions);
         if ($i < 7) {
             // ONLY < 2.0 GA
             $prefix = JFactory::getConfig()->get('dbprefix');
             $tables = JCckDatabase::loadColumn('SHOW TABLES');
             if (count($tables)) {
                 foreach ($tables as $table) {
                     if (strpos($table, $prefix . 'cck_item_') !== false) {
                         $replace = str_replace($prefix . 'cck_item_', $prefix . 'cck_store_item_', $table);
                         if ($replace) {
                             JCckDatabase::doQuery('ALTER TABLE ' . $table . ' RENAME ' . $replace);
                         }
開發者ID:kolydart,項目名稱:SEBLOD,代碼行數:67,代碼來源:script.php


注:本文中的JCckDatabase::loadColumn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。