本文整理汇总了PHP中JDatabase::loadObjectList方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabase::loadObjectList方法的具体用法?PHP JDatabase::loadObjectList怎么用?PHP JDatabase::loadObjectList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabase
的用法示例。
在下文中一共展示了JDatabase::loadObjectList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTypes
/**
* Method to get the content types.
*
* @return array An array of JContentType objects.
*
* @since 12.1
* @throws RuntimeException
*/
public function getTypes()
{
$types = array();
// Get the cache store id.
$storeId = $this->getStoreId('getTypes');
// Attempt to retrieve the types from cache first.
$cached = $this->retrieve($storeId);
// Check if the cached value is usable.
if (is_array($cached)) {
return $cached;
}
// Build the query to get the content types.
$query = $this->db->getQuery(true);
$query->select('a.*');
$query->from($query->qn('#__content_types') . ' AS a');
// Get the content types.
$this->db->setQuery($query);
$results = $this->db->loadObjectList();
// Reorganize the type information.
foreach ($results as $result) {
// Create a new JContentType object.
$type = $this->factory->getType();
// Bind the type data.
$type->bind($result);
// Add the type, keyed by alias.
$types[$result->alias] = $type;
}
// Store the types in cache.
return $this->store($storeId, $types);
}
示例2: doExecute
/**
* Execute the application.
*
* @return void
*/
public function doExecute()
{
// Get the query builder class from the database and set it up
// to select everything in the 'db' table.
$query = $this->dbo->getQuery(true)->select('*')->from($this->dbo->qn('db'));
// Push the query builder object into the database connector.
$this->dbo->setQuery($query);
// Get all the returned rows from the query as an array of objects.
$rows = $this->dbo->loadObjectList();
// Just dump the value returned.
var_dump($rows);
}
示例3: getK2Users
public function getK2Users()
{
$query = "SELECT id, userID, userName, description, image, url from #__k2_users ;";
$query_set = $this->dbo->setQuery($query);
$items = $this->dbo->loadObjectList();
return $items;
}
示例4: getBrands
public function getBrands()
{
$query = "SELECT a.group_id,u.*, ku.userName, ku.description, ku.image, ku.url FROM `#__user_usergroup_map` as a LEFT JOIN #__users as u ON u.id = a.user_id LEFT JOIN #__k2_users as ku ON ku.userID = a.user_id where a.group_id = 13;";
$query_set = $this->dbo->setQuery($query);
$items = $this->dbo->loadObjectList();
return $items;
}
示例5: reorder
/**
* Compacts the ordering sequence of the selected records
*
* @access public
* @param string Additional where query to limit ordering to a particular subset of records
*/
function reorder($where = '')
{
$k = $this->_tbl_key;
if (!in_array('ordering', array_keys($this->getProperties()))) {
$this->setError(get_class($this) . ' does not support ordering');
return false;
}
if ($this->_tbl == '#__content_frontpage') {
$order2 = ", content_id DESC";
} else {
$order2 = "";
}
$query = 'SELECT ' . $this->_tbl_key . ', ordering' . ' FROM ' . $this->_tbl . ' WHERE ordering >= 0' . ($where ? ' AND ' . $where : '') . ' ORDER BY ordering' . $order2;
$this->_db->setQuery($query);
if (!($orders = $this->_db->loadObjectList())) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// compact the ordering numbers
for ($i = 0, $n = count($orders); $i < $n; $i++) {
if ($orders[$i]->ordering >= 0) {
if ($orders[$i]->ordering != $i + 1) {
$orders[$i]->ordering = $i + 1;
$query = 'UPDATE ' . $this->_tbl . ' SET ordering = ' . (int) $orders[$i]->ordering . ' WHERE ' . $k . ' = ' . $this->_db->Quote($orders[$i]->{$k});
$this->_db->setQuery($query);
$this->_db->query();
}
}
}
return true;
}
示例6: getK2Categories
public function getK2Categories()
{
//$query = "SELECT * from #__k2_categories WHERE trash != 1 and published = 1 and extraFieldsGroup = 1 order by id;" ;
$query = "SELECT * from #__k2_categories WHERE trash != 1 and published = 1 order by id;";
$query_set = $this->dbo->setQuery($query);
$categories = $this->dbo->loadObjectList();
return $categories;
}
示例7: getElementScripts
public function getElementScripts(){
$retArray = array();
$this->db->setQuery("Select id, package, name, title, description, type From #__facileforms_scripts Where published = 1 And type = 'Element Validation'");
$retArray['validation'] = $this->db->loadObjectList();
$this->db->setQuery("Select id, package, name, title, description, type From #__facileforms_scripts Where published = 1 And type = 'Element Action'");
$retArray['action'] = $this->db->loadObjectList();
$this->db->setQuery("Select id, package, name, title, description, type From #__facileforms_scripts Where published = 1 And type = 'Element Init'");
$retArray['init'] = $this->db->loadObjectList();;
return $retArray;
}
示例8: getRecentItems
public function getRecentItems()
{
$query = "SELECT id, alias, catid, title, created_by, publish_up, TIMESTAMPDIFF(HOUR,NOW(),publish_up) as `differences` FROM #__k2_items where TIMESTAMPDIFF(HOUR,NOW(),publish_up) > -24 and TIMESTAMPDIFF(HOUR,NOW(),publish_up) < 0 and published = 1 order by `differences` desc";
$query_set = $this->dbo->setQuery($query);
//$this->out("Query Object set --> " . print_r($query_set,true));
$items = $this->dbo->loadObjectList();
if (empty($items)) {
return false;
}
return $items;
}
示例9: reorder
/**
* Method to compact the ordering values of rows in a group of rows
* defined by an SQL WHERE clause.
*
* @param string $where WHERE clause to use for limiting the selection of rows to compact the ordering values.
*
* @return mixed Boolean true on success.
*
* @link http://docs.joomla.org/JTable/reorder
* @since 11.1
*/
public function reorder($where = '')
{
// If there is no ordering field set an error and return false.
if (!property_exists($this, 'ordering')) {
$e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_CLASS_DOES_NOT_SUPPORT_ORDERING', get_class($this)));
$this->setError($e);
return false;
}
// Initialise variables.
$k = $this->_tbl_key;
// Get the primary keys and ordering values for the selection.
$query = $this->_db->getQuery(true);
$query->select($this->_tbl_key . ', ordering');
$query->from($this->_tbl);
$query->where('ordering >= 0');
$query->order('ordering');
// Setup the extra where and ordering clause data.
if ($where) {
$query->where($where);
}
$this->_db->setQuery($query);
$rows = $this->_db->loadObjectList();
// Check for a database error.
if ($this->_db->getErrorNum()) {
$e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_REORDER_FAILED', get_class($this), $this->_db->getErrorMsg()));
$this->setError($e);
return false;
}
// Compact the ordering values.
foreach ($rows as $i => $row) {
// Make sure the ordering is a positive integer.
if ($row->ordering >= 0) {
// Only update rows that are necessary.
if ($row->ordering != $i + 1) {
// Update the row ordering field.
$query = $this->_db->getQuery(true);
$query->update($this->_tbl);
$query->set('ordering = ' . ($i + 1));
$query->where($this->_tbl_key . ' = ' . $this->_db->quote($row->{$k}));
$this->_db->setQuery($query);
// Check for a database error.
if (!$this->_db->execute()) {
$e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_REORDER_UPDATE_ROW_FAILED', get_class($this), $i, $this->_db->getErrorMsg()));
$this->setError($e);
return false;
}
}
}
}
return true;
}
示例10: loadK2ItemsMap
public function loadK2ItemsMap()
{
$db = $this->dbo;
$query = "select * from #__k2_recipe_map ;";
$query_set = $this->dbo->setQuery($query);
$items = $this->dbo->loadObjectList();
$this->k2_items_maps = array();
foreach ($items as $key => $item) {
$obj = new stdClass();
$obj->item_type = $item->item_type;
$obj->new_item_id = $item->new_item_id;
$this->k2_items_maps[$item->k2_item_id] = $obj;
}
}
示例11: getCriteriaFixed
public function getCriteriaFixed($ruleId){
$this->db->setQuery("
Select
crit.*
From
#__facileforms_integrator_criteria_fixed As crit
Where
crit.rule_id = ".$this->db->Quote($ruleId)."
Group By crit.id
Order By crit.id Desc
");
$ret = $this->db->loadObjectList();
return $ret;
}
示例12: getExistingRecords
/**
* get exisiting records sets, optionally filtered by inn list
*
* @param string $table table suffix
* @param array $filter array of inns or numbers
* @return array of record objects
*/
private function getExistingRecords($filter = array(), $table = "")
{
if ($table && $table == "_oldcert") {
$fields = "id,number,adding_date";
$wherefld = "number";
} else {
$fields = "id,inn,adding_date";
$wherefld = "inn";
}
$sql = "SELECT {$fields} FROM #__sro{$table} ";
if (!empty($filter)) {
$numbers = implode(",", $filter);
$sql .= " WHERE {$wherefld} IN ({$numbers})";
}
$this->_db->setQuery($sql);
$result = $this->_db->loadObjectList($wherefld);
if (is_null($result)) {
$this->setError("Ошибка при загрузке существующих данных:" . $this->_db->getErrorMsg());
return array();
}
return $result;
}
示例13: getRows
public function getRows($class = null)
{
// get the subset (based on limits) of records
$query = 'SELECT *' . ' FROM #__acctexp_' . $this->table . $this->getConstraints() . $this->getOrdering() . $this->getLimit();
$this->db->setQuery($query);
$rows = $this->db->loadObjectList();
if ($this->db->getErrorNum()) {
echo $this->db->stderr();
return false;
}
if ($class) {
foreach ($rows as $k => $obj) {
$rows[$k] = new $class();
$rows[$k]->load($obj->id);
}
}
return $rows;
}
示例14: getExtensions
/**
* Get a JSON formatted list of installed extensions
* Needs to be public so we can call it from the audit.
*
* @return string
*/
public function getExtensions()
{
// connect/get the Joomla db object
$this->db = JFactory::getDbo();
// crazy way of handling Joomla 1.5.x legacy :-(
$one5 = FALSE;
// Get Joomla 2.0+ Extensions
$this->db->setQuery('SELECT e.extension_id, e.name, e.type, e.element, e.enabled, e.folder,
(
SELECT title
FROM #__menu AS m
WHERE m.component_id = e.extension_id
AND parent_id = 1
ORDER BY ID ASC LIMIT 1
)
AS title
FROM #__extensions AS e
WHERE protected = 0');
$installedExtensions = $this->db->loadObjectList();
// ok if we have none maybe we are Joomla < 1.5.26
if (!$installedExtensions) {
// Yooo hoo I'm on a crap old, out of date, probably hackable Joomla version!
$one5 = TRUE;
// Get the extensions - used to be called components
$this->db->setQuery('SELECT "component" as "type", name, `option` as "element", enabled FROM #__components WHERE iscore != 1 and parent = 0');
$components = $this->db->loadObjectList();
// Get the plugins
$this->db->setQuery('SELECT "plugin" as "type", name, element, folder, published as enabled FROM #__plugins WHERE iscore != 1');
$plugins = $this->db->loadObjectList();
// get the modules
$this->db->setQuery('SELECT "module" as "type", module, module as name, client_id, published as enabled FROM #__modules WHERE iscore != 1');
$modules = $this->db->loadObjectList();
/**
* Get the templates - I n Joomla 1.5.x the templates are not in the
* db unless published so we need to read the folders from the /templates folders
* Note in Joomla 1.5.x there was no such think as admin templates
*/
$folders = array_merge(scandir(JPATH_BASE . '/templates'), scandir(JPATH_ADMINISTRATOR . '/templates'));
$templates = array();
foreach ($folders as $templateFolder) {
$f = JPATH_BASE . '/templates/' . trim($templateFolder);
$a = JPATH_ADMINISTRATOR . '/templates/' . trim($templateFolder);
// We dont want index.html etc...
if (!is_dir($f) && !is_dir($a) || ($templateFolder == '.' || $templateFolder == '..')) {
continue;
}
if (is_dir($a)) {
$client_id = 1;
} else {
$client_id = 0;
}
// make it look like we want like Joomla 2.5+ would
$template = array('type' => 'template', 'template' => $templateFolder, 'client_id' => $client_id, 'enabled' => 1);
// Convert to an obj
$templates[] = json_decode(json_encode($template));
}
// Merge all the "extensions" we have found all over the place
$installedExtensions = array_merge($components, $plugins, $modules, $templates);
}
$lang = JFactory::getLanguage();
// Load all the language strings up front incase any strings are shared
foreach ($installedExtensions as $k => $ext) {
$lang->load(strtolower($ext->element) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($ext->element) . ".sys", JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($ext->name) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($ext->name) . ".sys", JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($ext->title) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($ext->title) . ".sys", JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($ext->element), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($ext->element), JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($ext->name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($ext->name), JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($ext->title), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($ext->title), JPATH_SITE, 'en-GB', TRUE);
$element = str_replace('_TITLE', '', strtoupper($ext->element));
$name = str_replace('_TITLE', '', strtoupper($ext->name));
$title = str_replace('_TITLE', '', strtoupper($ext->title));
$lang->load(strtolower($element) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($element) . ".sys", JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($name) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($name) . ".sys", JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($title) . ".sys", JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($title) . ".sys", JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($element), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($element), JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($name), JPATH_SITE, 'en-GB', TRUE);
$lang->load(strtolower($title), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load(strtolower($title), JPATH_SITE, 'en-GB', TRUE);
// templates
$lang->load('tpl_' . strtolower($name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
$lang->load('tpl_' . strtolower($name), JPATH_SITE, 'en-GB', TRUE);
// Joomla 1.5.x modules
$lang->load('mod_' . strtolower($name), JPATH_ADMINISTRATOR, 'en-GB', TRUE);
//.........这里部分代码省略.........
示例15: expcsv
function expcsv(array $ids)
{
global $ff_config;
$csvdelimiter = stripslashes($ff_config->csvdelimiter);
$csvquote = stripslashes($ff_config->csvquote);
$cellnewline = $ff_config->cellnewline == 0 ? "\n" : "\\n";
$fields = array();
$lines = array();
$ids = implode(',', $ids);
$this->db->setQuery(
"select * from #__facileforms_records where id in ($ids) order by submitted Desc"
);
$recs = $this->db->loadObjectList();
$recsSize = count($recs);
for($r = 0; $r < $recsSize; $r++) {
$rec = $recs[$r];
$lineNum = count($lines);
$fields['ZZZ_A_ID'] = true;
$fields['ZZZ_B_SUBMITTED'] = true;
$fields['ZZZ_C_USER_ID'] = true;
$fields['ZZZ_D_USERNAME'] = true;
$fields['ZZZ_E_USER_FULL_NAME'] = true;
$fields['ZZZ_F_TITLE'] = true;
$fields['ZZZ_G_IP'] = true;
$fields['ZZZ_H_BROWSER'] = true;
$fields['ZZZ_I_OPSYS'] = true;
$fields['ZZZ_J_TRANSACTION_ID'] = true;
$fields['ZZZ_K_DATE'] = true;
$fields['ZZZ_L_TEST_ACCOUNT'] = true;
$fields['ZZZ_M_DOWNLOAD_TRIES'] = true;
$lines[$lineNum]['ZZZ_A_ID'][] = $rec->id;
$lines[$lineNum]['ZZZ_B_SUBMITTED'][] = $rec->submitted;
$lines[$lineNum]['ZZZ_C_USER_ID'][] = $rec->user_id;
$lines[$lineNum]['ZZZ_D_USERNAME'][] = $rec->username;
$lines[$lineNum]['ZZZ_E_USER_FULL_NAME'][] = $rec->user_full_name;
$lines[$lineNum]['ZZZ_F_TITLE'][] = $rec->title;
$lines[$lineNum]['ZZZ_G_IP'][] = $rec->ip;
$lines[$lineNum]['ZZZ_H_BROWSER'][] = $rec->browser;
$lines[$lineNum]['ZZZ_I_OPSYS'][] = $rec->opsys;
$lines[$lineNum]['ZZZ_J_TRANSACTION_ID'][] = $rec->paypal_tx_id;
$lines[$lineNum]['ZZZ_K_DATE'][] = $rec->paypal_payment_date;
$lines[$lineNum]['ZZZ_L_TEST_ACCOUNT'][] = $rec->paypal_testaccount;
$lines[$lineNum]['ZZZ_M_DOWNLOAD_TRIES'][] = $rec->paypal_download_tries;
$rec = $recs[$r];
$this->db->setQuery(
"select Distinct * from #__facileforms_subrecords where record = $rec->id order by id"
);
$subs = $this->db->loadObjectList();
$subsSize = count($subs);
for($s = 0; $s < $subsSize; $s++) {
$sub = $subs[$s];
if($sub->name != 'bfFakeName' && $sub->name != 'bfFakeName2' && $sub->name != 'bfFakeName3' && $sub->name != 'bfFakeName4'){
if(!isset($fields[strtoupper($sub->name)]))
{
$fields[strtoupper($sub->name)] = true;
}
$lines[$lineNum][strtoupper($sub->name)][] = $sub->value;
}
}
}
$head = '';
ksort($fields);
$lineLength = count($lines);
foreach($fields As $fieldName => $null)
{
$head .= $csvquote.$fieldName.$csvquote.$csvdelimiter;
for($i = 0; $i < $lineLength;$i++)
{
if(!isset($lines[$i][$fieldName]))
{
$lines[$i][$fieldName] = array();
}
}
}
$head = substr($head,0,strlen($head)-1) . nl();
$out = '';
for($i = 0; $i < $lineLength;$i++)
{
ksort($lines[$i]);
foreach($lines[$i] As $line){
$out .= $csvquote.str_replace($csvquote,$csvquote.$csvquote,str_replace("\n",$cellnewline,str_replace("\r","",implode('|',$line)))).$csvquote.$csvdelimiter;
}
$out = substr($out,0,strlen($out)-1);
$out .= nl();
}
$csvname = JPATH_SITE.'/components/com_breezingforms/exports/ffexport-'.date('YmdHis').'.csv';
JFile::makeSafe($csvname);
if (!JFile::write($csvname,$head.$out)) {
echo "<script> alert('".addslashes(BFText::_('COM_BREEZINGFORMS_RECORDS_XMLNORWRTBL'))."'); window.history.go(-1);</script>\n";
//.........这里部分代码省略.........