当前位置: 首页>>代码示例>>PHP>>正文


PHP Results::Results方法代码示例

本文整理汇总了PHP中Results::Results方法的典型用法代码示例。如果您正苦于以下问题:PHP Results::Results方法的具体用法?PHP Results::Results怎么用?PHP Results::Results使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Results的用法示例。


在下文中一共展示了Results::Results方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DataObjectList

 /**
  * Constructor
  *
  * If provided, executes SQL query via parent Results object
  *
  * @param string Name of table in database
  * @param string Prefix of fields in the table
  * @param string Name of the ID field (including prefix)
  * @param string Name of Class for objects within this list
  * @param string SQL query
  * @param integer number of lines displayed on one screen
  * @param string prefix to differentiate page/order params when multiple Results appear one same page
  * @param string default ordering of columns (special syntax)
  */
 function DataObjectList($tablename, $prefix = '', $dbIDname = 'ID', $objType = 'Item', $sql = NULL, $limit = 20, $param_prefix = '', $default_order = NULL)
 {
     $this->dbtablename = $tablename;
     $this->dbprefix = $prefix;
     $this->dbIDname = $dbIDname;
     $this->objType = $objType;
     if (!is_null($sql)) {
         // We have an SQL query to execute:
         parent::Results($sql, $param_prefix, $default_order, $limit);
     } else {
         // TODO: do we want to autogenerate a query here???
         // Temporary...
         parent::Results($sql, $param_prefix, $default_order, $limit);
     }
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:29,代码来源:_dataobjectlist.class.php

示例2: ResultSel

 /**
  * Constructor
  *
  * @param string fieldname of item ID to select on
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @param integer current selection ID
  * @param string SQL query
  * @param NULL|string SQL query used to count the total # of rows (if NULL, we'll try to COUNT(*) by ourselves)
  * @param string prefix to differentiate page/order params when multiple Results appear one same page
  * @param string default ordering of columns (special syntax) if not URL specified
  * @param integer number of lines displayed on one screen
  */
 function ResultSel($field_ID, $table_selections, $field_sel_ID, $field_sel_name, $table_objsel, $field_selected, $field_selection, $current_selection_ID, $sql, $count_sql = NULL, $param_prefix = '', $default_order = '', $limit = 20)
 {
     global $current_User;
     // Call parent:
     parent::Results($sql, $param_prefix, $default_order, $limit, $count_sql);
     if (!$current_User->check_perm('selections', 'view')) {
         // User is NOT allowed to view selections
         // Don't do any more then base class:
         return;
     }
     $this->current_selection_ID = $current_selection_ID;
     $this->table_selections = $table_selections;
     $this->field_sel_ID = $field_sel_ID;
     $this->field_sel_name = $field_sel_name;
     $this->table_objsel = $table_objsel;
     $this->field_selected = $field_selected;
     $this->field_selection = $field_selection;
     // Presets a selection checkbox:
     $this->cols[] = array('th' => T_('Sel'), 'td_class' => 'shrinkwrap', 'td' => '%selection_checkbox( #' . $field_ID . '#, \'' . $param_prefix . '\' )%');
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:37,代码来源:_resultsel.class.php

示例3: ArchiveList


//.........这里部分代码省略.........
     * @param string
     * @param integer
     * @param boolean
     */
    function ArchiveList($archive_mode = 'monthly', $limit = 100, $sort_order = 'date', $preserve_context = false, $dbtable = 'T_items__item', $dbprefix = 'post_', $dbIDname = 'ID')
    {
        global $DB;
        global $blog, $cat, $catsel;
        global $show_statuses;
        global $author, $assgn, $status;
        global $timestamp_min, $timestamp_max;
        global $s, $sentence, $exact;
        $this->dbtable = $dbtable;
        $this->dbprefix = $dbprefix;
        $this->dbIDname = $dbIDname;
        $this->archive_mode = $archive_mode;
        /*
         * WE ARE GOING TO CONSTRUCT THE WHERE CLOSE...
         */
        $this->ItemQuery =& new ItemQuery($this->dbtable, $this->dbprefix, $this->dbIDname);
        // TEMPORARY OBJ
        // - - Select a specific Item:
        // $this->ItemQuery->where_ID( $p, $title );
        if ($preserve_context) {
            // We want to preserve the current context:
            // * - - Restrict to selected blog/categories:
            $this->ItemQuery->where_chapter($blog, $cat, $catsel);
            // * Restrict to the statuses we want to show:
            $this->ItemQuery->where_visibility($show_statuses);
            // Restrict to selected authors:
            $this->ItemQuery->where_author($author);
            // Restrict to selected assignees:
            $this->ItemQuery->where_assignees($assgn);
            // Restrict to selected satuses:
            $this->ItemQuery->where_statuses($status);
            // - - - + * * timestamp restrictions:
            $this->ItemQuery->where_datestart('', '', '', '', $timestamp_min, $timestamp_max);
            // Keyword search stuff:
            $this->ItemQuery->where_keywords($s, $sentence, $exact);
        } else {
            // We want to preserve only the minimal context:
            // * - - Restrict to selected blog/categories:
            $this->ItemQuery->where_chapter($blog, '', array());
            // * Restrict to the statuses we want to show:
            $this->ItemQuery->where_visibility($show_statuses);
            // - - - + * * timestamp restrictions:
            $this->ItemQuery->where_datestart('', '', '', '', $timestamp_min, $timestamp_max);
        }
        $this->from = $this->ItemQuery->get_from();
        $this->where = $this->ItemQuery->get_where();
        $this->group_by = $this->ItemQuery->get_group_by();
        switch ($this->archive_mode) {
            case 'monthly':
                // ------------------------------ MONTHLY ARCHIVES ------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, EXTRACT(MONTH FROM ' . $this->dbprefix . 'datestart) AS month,
																	COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, month
													ORDER BY year DESC, month DESC';
                break;
            case 'daily':
                // ------------------------------- DAILY ARCHIVES -------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, MONTH(' . $this->dbprefix . 'datestart) AS month,
																	DAYOFMONTH(' . $this->dbprefix . 'datestart) AS day,
																	COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, month, day
													ORDER BY year DESC, month DESC, day DESC';
                break;
            case 'weekly':
                // ------------------------------- WEEKLY ARCHIVES -------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, ' . $DB->week($this->dbprefix . 'datestart', locale_startofweek()) . ' AS week,
															COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, week
													ORDER BY year DESC, week DESC';
                break;
            case 'postbypost':
            default:
                // ----------------------------- POSY BY POST ARCHIVES --------------------------------
                $sql = 'SELECT DISTINCT ' . $this->dbIDname . ', ' . $this->dbprefix . 'datestart, ' . $this->dbprefix . 'title ' . $this->from . $this->where . $this->group_by . '
													ORDER BY ';
                if ($sort_order == 'title') {
                    $sql .= $this->dbprefix . 'title ASC';
                } else {
                    if ($sort_order == 'date') {
                        $sql .= $this->dbprefix . 'datestart DESC';
                    }
                }
        }
        // dh> Temp fix for MySQL bug - apparently in/around 4.1.21/5.0.24.
        // See http://forums.b2evolution.net/viewtopic.php?p=42529#42529
        if (in_array($this->archive_mode, array('monthly', 'daily', 'weekly'))) {
            $sql_version = $DB->get_var('SELECT VERSION()');
            // fp> TODO: $DB->get_mysql_version()
            if (version_compare($sql_version, '4', '>')) {
                $sql = 'SELECT SQL_CALC_FOUND_ROWS ' . substr($sql, 7);
                // "SQL_CALC_FOUND_ROWS" available since MySQL 4
            }
        }
        parent::Results($sql, 'archivelist_', '', $limit);
        $this->restart();
    }
开发者ID:LFSF,项目名称:oras,代码行数:101,代码来源:_archives.plugin.php

示例4: ArchiveList


//.........这里部分代码省略.........
         * WE ARE GOING TO CONSTRUCT THE WHERE CLOSE...
         */
        $this->ItemQuery = new ItemQuery($this->dbtable, $this->dbprefix, $this->dbIDname);
        // TEMPORARY OBJ
        // - - Select a specific Item:
        // $this->ItemQuery->where_ID( $p, $title );
        if (is_admin_page()) {
            // Don't restrict by date in the Back-office
            $timestamp_min = NULL;
            $timestamp_max = NULL;
        } else {
            // Restrict posts by date started
            $timestamp_min = $Blog->get_timestamp_min();
            $timestamp_max = $Blog->get_timestamp_max();
        }
        if ($preserve_context) {
            // We want to preserve the current context:
            // * - - Restrict to selected blog/categories:
            $this->ItemQuery->where_chapter($blog, $cat, $catsel);
            // * Restrict to the statuses we want to show:
            $this->ItemQuery->where_visibility($show_statuses);
            // Restrict to selected authors:
            $this->ItemQuery->where_author($author);
            // Restrict to selected assignees:
            $this->ItemQuery->where_assignees($assgn);
            // Restrict to selected satuses:
            $this->ItemQuery->where_statuses($status);
            // - - - + * * timestamp restrictions:
            $this->ItemQuery->where_datestart('', '', '', '', $timestamp_min, $timestamp_max);
            // Keyword search stuff:
            $this->ItemQuery->where_keywords($s, $sentence, $exact);
            $this->ItemQuery->where_types($types);
        } else {
            // We want to preserve only the minimal context:
            // * - - Restrict to selected blog/categories:
            $this->ItemQuery->where_chapter($blog, '', array());
            // * Restrict to the statuses we want to show:
            $this->ItemQuery->where_visibility($show_statuses);
            // - - - + * * timestamp restrictions:
            $this->ItemQuery->where_datestart('', '', '', '', $timestamp_min, $timestamp_max);
            // Include all types except pages, intros and sidebar links:
            $this->ItemQuery->where_types('-' . implode(',', $posttypes_specialtypes));
        }
        $this->from = $this->ItemQuery->get_from();
        $this->where = $this->ItemQuery->get_where();
        $this->group_by = $this->ItemQuery->get_group_by();
        switch ($this->archive_mode) {
            case 'monthly':
                // ------------------------------ MONTHLY ARCHIVES ------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, EXTRACT(MONTH FROM ' . $this->dbprefix . 'datestart) AS month,
																	COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, month
													ORDER BY year DESC, month DESC';
                break;
            case 'daily':
                // ------------------------------- DAILY ARCHIVES -------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, MONTH(' . $this->dbprefix . 'datestart) AS month,
																	DAYOFMONTH(' . $this->dbprefix . 'datestart) AS day,
																	COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, month, day
													ORDER BY year DESC, month DESC, day DESC';
                break;
            case 'weekly':
                // ------------------------------- WEEKLY ARCHIVES -------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, ' . $DB->week($this->dbprefix . 'datestart', locale_startofweek()) . ' AS week,
															COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, week
													ORDER BY year DESC, week DESC';
                break;
            case 'postbypost':
            default:
                // ----------------------------- POSY BY POST ARCHIVES --------------------------------
                $this->count_total_rows();
                $archives_list = new ItemListLight($Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $this->total_rows);
                $archives_list->set_filters(array('visibility_array' => array('published'), 'types' => '-' . implode(',', $posttypes_specialtypes)));
                if ($sort_order == 'title') {
                    $archives_list->set_filters(array('orderby' => 'title', 'order' => 'ASC'));
                }
                $archives_list->query();
                $this->rows = array();
                while ($Item = $archives_list->get_item()) {
                    $this->rows[] = $Item;
                }
                $this->result_num_rows = $archives_list->result_num_rows;
                $this->current_idx = 0;
                $this->arc_w_last = '';
                return;
        }
        // dh> Temp fix for MySQL bug - apparently in/around 4.1.21/5.0.24.
        // See http://forums.b2evolution.net/viewtopic.php?p=42529#42529
        if (in_array($this->archive_mode, array('monthly', 'daily', 'weekly'))) {
            $sql_version = $DB->get_version();
            if (version_compare($sql_version, '4', '>')) {
                $sql = 'SELECT SQL_CALC_FOUND_ROWS ' . substr($sql, 7);
                // "SQL_CALC_FOUND_ROWS" available since MySQL 4
            }
        }
        parent::Results($sql, 'archivelist_', '', $limit);
        $this->restart();
    }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_archives.plugin.php


注:本文中的Results::Results方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。