本文整理汇总了PHP中SQL::ORDER_BY方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::ORDER_BY方法的具体用法?PHP SQL::ORDER_BY怎么用?PHP SQL::ORDER_BY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQL
的用法示例。
在下文中一共展示了SQL::ORDER_BY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fcpf_categories_select
/**
* Get the categories list
*
* @param integer Parent category ID
* @param integer Level
* @return array Categories
*/
function fcpf_categories_select($parent_category_ID = -1, $level = 0)
{
global $blog, $DB;
$result_Array = array();
$SQL = new SQL();
$SQL->SELECT('cat_ID, cat_name');
$SQL->FROM('T_categories');
$SQL->WHERE('cat_blog_ID = ' . $DB->quote($blog));
if ($parent_category_ID == -1) {
$SQL->WHERE_and('cat_parent_ID IS NULL');
} else {
$SQL->WHERE('cat_parent_ID = ' . $DB->quote($parent_category_ID));
}
$SQL->ORDER_BY('cat_name');
$categories = $DB->get_results($SQL->get());
if (!empty($categories)) {
foreach ($categories as $category) {
$result_Array[] = array('value' => $category->cat_ID, 'label' => str_repeat(' ', $level) . $category->cat_name);
$child_Categories_opts = fcpf_categories_select($category->cat_ID, $level + 1);
if ($child_Categories_opts != '') {
foreach ($child_Categories_opts as $cat) {
$result_Array[] = $cat;
}
}
}
}
return $result_Array;
}
示例2: SQL
/**
* Get the latest Comment on this Item
*
* @param string the status of the latest comment
* @return Comment
*/
function &get_latest_Comment($status = NULL)
{
global $DB;
if (is_null($this->latest_Comment)) {
$SQL = new SQL('Get the latest Comment on the Item');
$SQL->SELECT('comment_ID');
$SQL->FROM('T_comments');
$SQL->WHERE('comment_item_ID = ' . $DB->quote($this->ID));
$SQL->WHERE_and('comment_type != "meta"');
$SQL->ORDER_BY('comment_date DESC');
$SQL->LIMIT('1');
if ($status != NULL) {
$SQL->WHERE_and('comment_status = ' . $DB->quote($status));
}
if ($comment_ID = $DB->get_var($SQL->get())) {
$CommentCache =& get_CommentCache();
$this->latest_Comment =& $CommentCache->get_by_ID($comment_ID);
}
}
return $this->latest_Comment;
}
示例3: contacts_groups
function contacts_groups($user_ID)
{
global $current_User, $DB, $cache_user_contacts_groups;
if (!is_array($cache_user_contacts_groups)) {
// Execute only first time to init cache
$cache_user_contacts_groups = array();
// Get contacts of current user
$groups_SQL = new SQL();
$groups_SQL->SELECT('cgr_ID AS ID, cgu_user_ID AS user_ID, cgr_name AS name');
$groups_SQL->FROM('T_messaging__contact_groupusers');
$groups_SQL->FROM_add('LEFT JOIN T_messaging__contact_groups ON cgu_cgr_ID = cgr_ID');
$groups_SQL->WHERE('cgr_user_ID = ' . $current_User->ID);
$groups_SQL->ORDER_BY('cgr_name');
$groups = $DB->get_results($groups_SQL->get());
$remove_link = url_add_param(get_dispctrl_url('contacts'), 'action=remove_user&view=contacts&' . url_crumb('messaging_contacts'));
foreach ($groups as $group) {
// Init cache for groups for each contact of current user
$group_name = $group->name . action_icon(T_('Remove user from this group'), 'remove', url_add_param($remove_link, 'user_ID=' . $group->user_ID . '&group_ID=' . $group->ID));
if (isset($cache_user_contacts_groups[$group->user_ID])) {
// nth group of this user
$cache_user_contacts_groups[$group->user_ID] .= '<br />' . $group_name;
} else {
// first group of this user
$cache_user_contacts_groups[$group->user_ID] = $group_name;
}
}
}
if (isset($cache_user_contacts_groups[$user_ID])) {
// user has groups
echo $cache_user_contacts_groups[$user_ID];
}
}
示例4: tool_create_sample_comments
/**
* Create sample comments and display a process of creating
*
* @param integer Blog ID
* @param integer Number of comments
* @param integer Number of posts
*/
function tool_create_sample_comments($blog_ID, $num_comments, $num_posts)
{
global $DB, $posttypes_specialtypes, $localtimenow, $Hit, $Messages, $Debuglog;
$BlogCache =& get_BlogCache();
$selected_Blog = $BlogCache->get_by_ID($blog_ID, false, false);
if ($selected_Blog == NULL) {
// Incorrect blog ID, Exit here
return;
}
echo T_('Creating of the sample comments...');
evo_flush();
/**
* Disable log queries because it increases the memory and stops the process with error "Allowed memory size of X bytes exhausted..."
*/
$DB->log_queries = false;
$curr_orderby = $selected_Blog->get_setting('orderby');
if ($curr_orderby == 'RAND') {
$curr_orderby .= '()';
} else {
$curr_orderby = 'post_' . $curr_orderby;
}
$curr_orderdir = $selected_Blog->get_setting('orderdir');
// find the $num_posts latest posts in blog
$SQL = new SQL();
$SQL->SELECT('post_ID');
$SQL->FROM('T_items__item');
$SQL->FROM_add('INNER JOIN T_categories ON post_main_cat_ID = cat_ID');
$SQL->WHERE('cat_blog_ID = ' . $DB->quote($blog_ID));
$SQL->WHERE_and('post_status = ' . $DB->quote('published'));
// Set condition to not create sample comments for special posts
$SQL->WHERE_and('post_ptyp_ID NOT IN ( ' . $DB->quote($posttypes_specialtypes) . ' )');
$SQL->ORDER_BY($curr_orderby . ' ' . $curr_orderdir . ', post_ID ' . $curr_orderdir);
$SQL->LIMIT($num_posts);
$items_result = $DB->get_results($SQL->get(), ARRAY_A, 'Find the x latest posts in blog');
$count = 1;
$fix_content = 'This is an auto generated comment for testing the moderation features.
http://www.test.com/test_comment_';
// go through on selected items
foreach ($items_result as $row) {
$item_ID = $row['post_ID'];
$ItemCache =& get_ItemCache();
$commented_Item =& $ItemCache->get_by_ID($item_ID);
// create $num_comments comments for each item
for ($i = 0; $i < $num_comments; $i++) {
$author = 'Test ' . $count;
$email = 'test_' . $count . '@test.com';
$url = 'http://www.test-' . rand(1, 3) . '.com/test_comment_' . $count;
$content = $fix_content . $count;
for ($j = 0; $j < 50; $j++) {
// create 50 random word
$length = rand(1, 15);
$word = generate_random_key($length, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
$content = $content . ' ' . $word;
}
// create and save a new comment
$Comment = new Comment();
$Comment->set_Item($commented_Item);
$Comment->set('status', 'draft');
$Comment->set('author', $author);
$Comment->set('author_email', $email);
$Comment->set('author_url', $url);
$Comment->set('content', $content);
$Comment->set('date', date('Y-m-d H:i:s', $localtimenow));
$Comment->set('author_IP', $Hit->IP);
$Comment->dbsave();
$count++;
if ($count % 100 == 0) {
// Display a process of creating by one dot for 100 comments
echo ' .';
evo_flush();
}
// Clear all debug messages, To avoid an error about full memory
$Debuglog->clear('all');
}
}
echo ' OK.';
$Messages->add(sprintf(T_('Created %d comments.'), $count - 1), 'success');
}
示例5: param
/*
* Query user list:
*/
if (get_param('action') == 'filter2') {
$keywords = param('keywords2', 'string', '', true);
set_param('keywords1', $keywords);
} else {
$keywords = param('keywords1', 'string', '', true);
set_param('keywords2', $keywords);
}
$SQL = new SQL();
$SQL->SELECT('user_ID, user_login, user_level, bloguser_perm_poststatuses + 0 as perm_poststatuses, bloguser_perm_edit, bloguser_ismember,' . 'bloguser_perm_delcmts, bloguser_perm_recycle_owncmts, bloguser_perm_vote_spam_cmts, bloguser_perm_cmtstatuses + 0 as perm_cmtstatuses, bloguser_perm_edit_cmt,' . 'bloguser_perm_delpost, bloguser_perm_edit_ts, bloguser_perm_cats,' . 'bloguser_perm_properties, bloguser_perm_admin, bloguser_perm_media_upload,' . 'bloguser_perm_media_browse, bloguser_perm_media_change, bloguser_perm_page,' . 'bloguser_perm_intro, bloguser_perm_podcast, bloguser_perm_sidebar');
$SQL->FROM('T_users LEFT JOIN T_coll_user_perms ON (
user_ID = bloguser_user_ID
AND bloguser_blog_ID = ' . $edited_Blog->ID . ' )');
$SQL->ORDER_BY('bloguser_ismember DESC, *, user_login, user_ID');
if (!empty($keywords)) {
$SQL->add_search_field('user_login');
$SQL->add_search_field('user_firstname');
$SQL->add_search_field('user_lastname');
$SQL->add_search_field('user_nickname');
$SQL->add_search_field('user_email');
$SQL->WHERE_keywords($keywords, 'AND');
}
// Display wide layout:
?>
<div id="userlist_wide" class="clear">
<?php
$Results = new Results($SQL->get(), 'colluser_');
示例6: _wp_mw_getcategories
/**
* metaWeblog.getCategories
*
* @see http://www.xmlrpc.com/metaWeblogApi#metawebloggetcategories
*
* @param xmlrpcmsg XML-RPC Message
* 0 blogid (string): Unique identifier of the blog the post will be added to.
* Currently ignored in b2evo, in favor of the category.
* 1 username (string): Login for a Blogger user who has permission to edit the given
* post (either the user who originally created it or an admin of the blog).
* 2 password (string): Password for said username.
* @param array of params to narrow category selection
*/
function _wp_mw_getcategories($m, $params = array())
{
global $DB, $Settings;
// CHECK LOGIN:
/**
* @var User
*/
if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// GET BLOG:
/**
* @var Blog
*/
if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
$SQL = new SQL();
$SQL->SELECT('cat_ID, cat_name, cat_order');
$SQL->FROM('T_categories');
$SQL->WHERE($Blog->get_sql_where_aggregate_coll_IDs('cat_blog_ID'));
if (!empty($params['search'])) {
// Category name starts with 'search'
$SQL->WHERE_and('cat_name LIKE "' . $DB->like_escape($params['search']) . '%"');
}
if ($Settings->get('chapter_ordering') == 'manual') {
// Manual order
$SQL->ORDER_BY('cat_order');
} else {
// Alphabetic order
$SQL->ORDER_BY('cat_name');
}
$rows = $DB->get_results($SQL->get());
if ($DB->error) {
// DB error
return xmlrpcs_resperror(99, 'DB error: ' . $DB->last_error);
// user error 9
}
$total_rows = count($rows);
logIO('Categories: ' . $total_rows);
$ChapterCache =& get_ChapterCache();
$data = array();
for ($i = 0; $i < $total_rows; $i++) {
if (!empty($params['limit']) && $i >= $params['limit']) {
// We found enough, exit the loop
break;
}
$Chapter =& $ChapterCache->get_by_ID($rows[$i]->cat_ID, false, false);
if (!$Chapter) {
continue;
}
if (isset($params['search'])) {
// wp.suggestCategories
$data[] = new xmlrpcval(array('category_id' => new xmlrpcval(intval($Chapter->ID)), 'category_name' => new xmlrpcval($Chapter->name)), 'struct');
} else {
$data[] = new xmlrpcval(array('categoryId' => new xmlrpcval(intval($Chapter->ID)), 'parentId' => new xmlrpcval(intval($Chapter->parent_ID)), 'description' => new xmlrpcval($Chapter->name), 'categoryDescription' => new xmlrpcval($Chapter->description), 'categoryName' => new xmlrpcval($Chapter->name), 'htmlUrl' => new xmlrpcval($Chapter->get_permanent_url()), 'rssUrl' => new xmlrpcval(url_add_param($Chapter->get_permanent_url(), 'tempskin=_rss2'))), 'struct');
}
}
logIO('OK.');
return new xmlrpcresp(new xmlrpcval($data, 'array'));
}
示例7: upgrade_b2evo_tables
//.........这里部分代码省略.........
foreach ($new_item_types as $blog_type => $item_type_data) {
$DB->query('UPDATE T_items__item
INNER JOIN T_categories
ON post_main_cat_ID = cat_ID
AND post_ityp_ID = 1
INNER JOIN T_blogs
ON cat_blog_ID = blog_ID
AND blog_type = ' . $DB->quote($blog_type) . '
SET post_ityp_ID = ' . $DB->quote($item_type_data['new_type_ID']));
}
}
$DB->commit();
task_end();
task_begin('Upgrade table comments... ');
$DB->query("ALTER TABLE T_comments\n\t\t\tCHANGE comment_type comment_type enum('comment','linkback','trackback','pingback','meta') COLLATE ascii_general_ci NOT NULL default 'comment'");
task_end();
task_begin('Creating table for custom fields of Post Types... ');
$DB->query('CREATE TABLE T_items__type_custom_field (
itcf_ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
itcf_ityp_ID INT(11) UNSIGNED NOT NULL,
itcf_label VARCHAR(255) NOT NULL,
itcf_name VARCHAR(255) COLLATE ascii_general_ci NOT NULL,
itcf_type ENUM( \'double\', \'varchar\' ) COLLATE ascii_general_ci NOT NULL,
itcf_order INT NULL,
PRIMARY KEY ( itcf_ID ),
UNIQUE itcf_ityp_ID_name( itcf_ityp_ID, itcf_name )
) ENGINE = innodb');
global $posttypes_perms;
// Create post types for each blog that has at aleast one custom field
$SQL = new SQL();
$SQL->SELECT('*');
$SQL->FROM('T_coll_settings');
$SQL->WHERE('cset_name LIKE ' . $DB->quote('custom_%'));
$SQL->ORDER_BY('cset_coll_ID');
$setting_rows = $DB->get_results($SQL->get());
$custom_fields = array();
$blog_setting_delete_data = array();
$blog_setting_item_types = array();
if (count($setting_rows)) {
// Initialize an array of custom fields from blog settings
foreach ($setting_rows as $setting_row) {
if (preg_match('/custom_(double|varchar)\\d+/', $setting_row->cset_name, $matches)) {
// It is a custom field
if (!isset($custom_fields[$setting_row->cset_coll_ID])) {
$custom_fields[$setting_row->cset_coll_ID] = array();
}
// Delete this blog setting
$blog_setting_delete_data[] = 'cset_coll_ID = ' . $DB->quote($setting_row->cset_coll_ID) . ' AND cset_name = ' . $DB->quote($setting_row->cset_name);
$cf_type = $matches[1];
$cf_key = $setting_row->cset_value;
$cf_label = '';
$cf_name = '';
foreach ($setting_rows as $s_row) {
if ($s_row->cset_name == 'custom_' . $cf_type . '_' . $cf_key) {
// Label
$cf_label = $s_row->cset_value;
// Delete this blog setting
$blog_setting_delete_data[] = 'cset_coll_ID = ' . $DB->quote($s_row->cset_coll_ID) . ' AND cset_name = ' . $DB->quote($s_row->cset_name);
}
if ($s_row->cset_name == 'custom_fname_' . $cf_key) {
// Name
$cf_name = $s_row->cset_value;
// Delete this blog setting
$blog_setting_delete_data[] = 'cset_coll_ID = ' . $DB->quote($s_row->cset_coll_ID) . ' AND cset_name = ' . $DB->quote($s_row->cset_name);
}
}
示例8: param
$Form->begin_fieldset(T_('Group permissions') . get_manual_link('group_permissions'));
/*
* Query user list:
*/
if (get_param('action') == 'filter2') {
$keywords = param('keywords2', 'string', '', true);
set_param('keywords1', $keywords);
} else {
$keywords = param('keywords1', 'string', '', true);
set_param('keywords2', $keywords);
}
$SQL = new SQL();
$SQL->SELECT('grp_ID, grp_name, bloggroup_perm_poststatuses + 0 as perm_poststatuses, bloggroup_perm_edit, bloggroup_ismember,' . 'bloggroup_perm_delcmts, bloggroup_perm_recycle_owncmts, bloggroup_perm_vote_spam_cmts, bloggroup_perm_cmtstatuses + 0 as perm_cmtstatuses, bloggroup_perm_edit_cmt,' . 'bloggroup_perm_delpost, bloggroup_perm_edit_ts, bloggroup_perm_cats,' . 'bloggroup_perm_properties, bloggroup_perm_admin, bloggroup_perm_media_upload,' . 'bloggroup_perm_media_browse, bloggroup_perm_media_change, bloggroup_perm_page,' . 'bloggroup_perm_intro, bloggroup_perm_podcast, bloggroup_perm_sidebar');
$SQL->FROM('T_groups LEFT JOIN T_coll_group_perms ON
( grp_ID = bloggroup_group_ID AND bloggroup_blog_ID = ' . $edited_Blog->ID . ' )');
$SQL->ORDER_BY('bloggroup_ismember DESC, *, grp_name, grp_ID');
if (!empty($keywords)) {
$SQL->add_search_field('grp_name');
$SQL->WHERE_keywords($keywords, 'AND');
}
// Display wide layout:
?>
<div id="userlist_wide" class="clear">
<?php
$Results = new Results($SQL->get(), 'collgroup_');
// Tell the Results class that we already have a form for this page:
$Results->Form =& $Form;
$Results->title = T_('Group permissions');
$Results->filter_area = array('submit' => 'actionArray[filter1]', 'callback' => 'filter_collobjectlist', 'url_ignore' => 'results_collgroup_page,keywords1,keywords2', 'presets' => array('all' => array(T_('All users'), regenerate_url('action,results_collgroup_page,keywords1,keywords2', 'action=edit'))));
示例9: enumerate_types
$SQL->FROM('T_users__fielddefs RIGHT JOIN T_users__fieldgroups ON ufdf_ufgp_ID = ufgp_ID');
$where_clause = '';
if (!empty($s)) {
// We want to filter on search keyword:
// Note: we use CONCAT_WS (Concat With Separator) because CONCAT returns NULL if any arg is NULL
$where_clause = 'CONCAT_WS( " ", ufdf_name ) LIKE "%' . $DB->escape($s) . '%"';
}
if (!empty($s_type)) {
// We want to filter on user field type:
$where_clause = 'ufdf_type LIKE "%' . $DB->escape($s_type) . '%"';
}
if ($where_clause != '') {
$SQL->WHERE_and($where_clause);
}
$SQL->GROUP_BY('ufdf_ID, ufgp_ID');
$SQL->ORDER_BY('ufgp_order, ufgp_name, ufdf_order');
$count_sql = 'SELECT COUNT(*)
FROM T_users__fielddefs';
if ($where_clause != '') {
$count_sql .= ' WHERE ' . $where_clause;
}
// Create result set:
$Results = new Results($SQL->get(), 'ufdf_', 'A', NULL, $count_sql);
$Results->title = T_('User fields') . get_manual_link('user-fields-list');
/**
* Callback to enumerate possible user field types
*
*/
function enumerate_types($selected = '')
{
$options = '<option value="">All</option>';
示例10: SQL
// set the number of count all files which will be displayed
$num_file_results = array_sum($hash_results);
if ($num_file_results > 0) {
// Create SQL query to build a results table
$SQL = new SQL();
$SQL->SELECT('f.*,
SUM( IFNULL( lvot_like, 0 ) ) as total_like,
SUM( IFNULL( lvot_inappropriate, 0 ) ) as total_inappropriate,
SUM( IFNULL( lvot_spam, 0 ) ) as total_spam,
( SELECT COUNT( file_ID ) FROM T_files AS f2 WHERE f.file_hash = f2.file_hash ) AS total_duplicates');
$SQL->FROM('T_files AS f');
$SQL->FROM_add('LEFT JOIN T_links AS l ON l.link_file_ID = f.file_ID');
$SQL->FROM_add('LEFT JOIN T_links__vote AS lv ON lv.lvot_link_ID = l.link_ID');
$SQL->WHERE('f.file_hash IN ( ' . $DB->quote($file_hash_values) . ' )');
$SQL->GROUP_BY('f.file_ID, f.file_hash');
$SQL->ORDER_BY('f.file_hash, *, total_spam DESC, total_inappropriate DESC');
}
$Results = new Results($num_file_results ? $SQL->get() : NULL, 'fdupl_', $default_order, $UserSettings->get('results_per_page'), $num_file_results);
$Results->Cache =& get_FileCache();
$Results->Cache->clear();
$Results->title = T_('Duplicate files') . get_manual_link('file-moderation-duplicates');
/*
* Grouping params:
*/
$Results->group_by = 'file_hash';
/*
* Group columns:
*/
$Results->grp_cols[] = array('td_class' => 'firstcol' . ($current_User->check_perm('users', 'edit', false) ? '' : ' lastcol'), 'td_colspan' => 0, 'td' => sprintf(T_('%s duplicates'), '$total_duplicates$'));
/**
* Callback to add filters on top of the result set
示例11: SQL
/**
* Get organizations that are accepted for this user
*
* @return array Organizations: array( 'name', 'url' )
*/
function get_organizations()
{
global $DB;
$SQL = new SQL();
$SQL->SELECT('org_name AS name, org_url AS url');
$SQL->FROM('T_users__user_org');
$SQL->FROM_add('INNER JOIN T_users__organization ON org_ID = uorg_org_ID');
$SQL->WHERE('uorg_user_ID = ' . $DB->quote($this->ID));
// Organization must be accepted by Admin
$SQL->WHERE_and('uorg_accepted = 1');
$SQL->ORDER_BY('org_name');
return $DB->get_results($SQL->get());
}
示例12: iost_td_actions
* @package admin
*
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
* @author fplanque: Francois PLANQUE.
*
* @version $Id: _translation_new.view.php 985 2012-03-05 21:59:17Z yura $
*/
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
/**
* @var User
*/
global $current_User;
global $edit_locale;
// Create query
$SQL = new SQL();
$SQL->SELECT('iost_ID, iost_string');
$SQL->FROM('T_i18n_original_string');
$SQL->ORDER_BY('*, iost_string');
// Create result set:
$Results = new Results($SQL->get(), 'iost_', 'A');
$Results->title = sprintf(T_('Translation editor for locale "%s"'), $edit_locale);
$Results->cols[] = array('th' => T_('Original string'), 'order' => 'iost_string', 'td' => '%htmlspecialchars( #iost_string# )%');
function iost_td_actions($translated_string_ID)
{
$r = action_icon(T_('Translate this string...'), 'add', regenerate_url('action', 'iost_ID=' . $translated_string_ID . '&action=new'));
return $r;
}
$Results->cols[] = array('th' => T_('Actions'), 'td' => '%iost_td_actions( #iost_ID# )%', 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap');
$Results->display();
示例13: display
/**
* Display the widget!
*
* @param array MUST contain at least the basic display params
*/
function display($params)
{
global $localtimenow;
$this->init_display($params);
if ($this->disp_params['order_by'] == 'RAND' && isset($this->BlockCache)) {
// Do NOT cache if display order is random
$this->BlockCache->abort_collect();
}
global $Blog;
$list_blogs = $this->disp_params['blog_ID'] ? $this->disp_params['blog_ID'] : $Blog->ID;
//pre_dump( $list_blogs );
// Display photos:
// TODO: permissions, complete statuses...
// TODO: A FileList object based on ItemListLight but adding File data into the query?
// overriding ItemListLigth::query() for starters ;)
$FileCache =& get_FileCache();
$FileList = new DataObjectList2($FileCache);
// Query list of files:
$SQL = new SQL();
$SQL->SELECT('post_ID, post_datestart, post_datemodified, post_main_cat_ID, post_urltitle, post_canonical_slug_ID,
post_tiny_slug_ID, post_ptyp_ID, post_title, post_excerpt, post_url, file_ID,
file_title, file_root_type, file_root_ID, file_path, file_alt, file_desc');
$SQL->FROM('T_categories INNER JOIN T_postcats ON cat_ID = postcat_cat_ID
INNER JOIN T_items__item ON postcat_post_ID = post_ID
INNER JOIN T_links ON post_ID = link_itm_ID
INNER JOIN T_files ON link_file_ID = file_ID');
$SQL->WHERE('cat_blog_ID IN (' . $list_blogs . ')');
// fp> TODO: want to restrict on images :]
$SQL->WHERE_and('post_status = "published"');
// TODO: this is a dirty hack. More should be shown.
$SQL->WHERE_and('post_datestart <= \'' . remove_seconds($localtimenow) . '\'');
if (!empty($this->disp_params['item_type'])) {
// Get items only with specified type
$SQL->WHERE_and('post_ptyp_ID = ' . intval($this->disp_params['item_type']));
}
$SQL->GROUP_BY('link_ID');
$SQL->LIMIT($this->disp_params['limit'] * 4);
// fp> TODO: because we have no way of getting images only, we get 4 times more data than requested and hope that 25% at least will be images :/
$SQL->ORDER_BY(gen_order_clause($this->disp_params['order_by'], $this->disp_params['order_dir'], 'post_', 'post_ID ' . $this->disp_params['order_dir'] . ', link_ID'));
$FileList->sql = $SQL->get();
$FileList->query(false, false, false, 'Media index widget');
$layout = $this->disp_params['thumb_layout'];
$nb_cols = $this->disp_params['grid_nb_cols'];
$count = 0;
$r = '';
/**
* @var File
*/
while ($File =& $FileList->get_next()) {
if ($count >= $this->disp_params['limit']) {
// We have enough images already!
break;
}
if (!$File->is_image()) {
// Skip anything that is not an image
// fp> TODO: maybe this property should be stored in link_ltype_ID or in the files table
continue;
}
if ($layout == 'grid') {
if ($count % $nb_cols == 0) {
$r .= $this->disp_params['grid_colstart'];
}
$r .= $this->disp_params['grid_cellstart'];
} else {
$r .= $this->disp_params['item_start'];
}
// 1/ Hack a dirty permalink( will redirect to canonical):
// $link = url_add_param( $Blog->get('url'), 'p='.$post_ID );
// 2/ Hack a link to the right "page". Very daring!!
// $link = url_add_param( $Blog->get('url'), 'paged='.$count );
// 3/ Instantiate a light object in order to get permamnent url:
$ItemLight = new ItemLight($FileList->get_row_by_idx($FileList->current_idx - 1));
// index had already been incremented
$r .= '<a href="' . $ItemLight->get_permanent_url() . '">';
// Generate the IMG THUMBNAIL tag with all the alt, title and desc if available
$r .= $File->get_thumb_imgtag($this->disp_params['thumb_size'], '', '', $ItemLight->title);
$r .= '</a>';
if ($this->disp_params['disp_image_title']) {
$title = $File->get('title') ? $this->get('title') : $ItemLight->title;
$r .= '<span class="note">' . $title . '</span>';
}
++$count;
if ($layout == 'grid') {
$r .= $this->disp_params['grid_cellend'];
if ($count % $nb_cols == 0) {
$r .= $this->disp_params['grid_colend'];
}
} else {
$r .= $this->disp_params['item_end'];
}
}
// Exit if no files found
if (empty($r)) {
return;
}
//.........这里部分代码省略.........
示例14: filter_crontab
if ($ctst_pending) {
$SQL->WHERE_or('clog_status IS NULL');
}
if ($ctst_started) {
$SQL->WHERE_or('clog_status = "started"');
}
if ($ctst_timeout) {
$SQL->WHERE_or('clog_status = "timeout"');
}
if ($ctst_error) {
$SQL->WHERE_or('clog_status = "error"');
}
if ($ctst_finished) {
$SQL->WHERE_or('clog_status = "finished"');
}
$SQL->ORDER_BY('*, ctsk_ID');
$Results = new Results($SQL->get(), 'crontab_', '-D');
$Results->title = T_('Scheduled jobs') . get_manual_link('scheduler');
$Results->global_icon(T_('Refresh'), 'refresh', regenerate_url(), T_('Refresh'), 3, 4);
if ($current_User->check_perm('options', 'edit', false, NULL)) {
// Permission to edit settings:
$Results->global_icon(T_('Create a new scheduled job...'), 'new', regenerate_url('action,cjob_ID', 'action=new'), T_('New job') . ' »', 3, 4);
}
/**
* Callback to add filters on top of the result set
*
* @param Form
*/
function filter_crontab(&$Form)
{
global $ctst_pending, $ctst_started, $ctst_timeout, $ctst_error, $ctst_finished;
示例15: filter_keyphrases
$SQL->SELECT_add(', COUNT(DISTINCT hit_remote_addr) as count');
} else {
// We ARE retsrticting to a Goal
$SQL->SELECT_add(', COUNT(DISTINCT goalhit_hit.hit_ID, T_hitlog.hit_remote_addr) as count');
}
$vars = $DB->get_row('SELECT COUNT(keyp_ID) AS count, SUM(count) AS total
FROM (' . $SQL->get() . ') AS dummy', OBJECT, 0, 'Count rows + total for stats');
$sql_count = (int) $vars->count;
$total = (int) $vars->total;
// DATA:
$SQL->SELECT_add(', keyp_phrase');
$SQL->SELECT_add(', keyp_count_refered_searches, keyp_count_internal_searches');
if ($split_engines) {
$SQL->SELECT_add(', dom_name, T_hitlog.hit_referer ');
$SQL->FROM_add('LEFT JOIN T_basedomains ON dom_ID = T_hitlog.hit_referer_dom_ID');
$SQL->ORDER_BY('*, keyp_phrase, dom_name');
} else {
$SQL->ORDER_BY('*, keyp_phrase');
}
$sql = $SQL->get();
}
// Create result set:
$Results = new Results($sql, 'keywords_', $split_engines ? '--D' : '-D', NULL, $sql_count);
$Results->title = T_('Keyphrases') . get_manual_link('search-keywords-list');
/**
* Callback to add filters on top of the result set
*
* @param Form
*/
function filter_keyphrases(&$Form)
{