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


PHP Search::order方法代码示例

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


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

示例1: content

 public function content()
 {
     echo '<div id="thumbnails">';
     // generate a basic newest search with a range from 0 to 12
     $s = new Search();
     $s->order(SORT_NEWEST);
     $s->range(0, 12);
     $res = $s->search();
     while ($image = $res->fetch_object()) {
         echo $this->imageBlock($image);
     }
     echo '</div><div id="modal"></div><div id="modalContent"> </div>';
 }
开发者ID:nyson,项目名称:izwei,代码行数:13,代码来源:Design.php

示例2: Search

<body>
	<div id="dialog">
		<div class='content'></div>
	</div>
    <div id="menu"><h2>iZwei</h2>
    <?php 
echo $site->form(FORM_SIMPLESEARCH);
echo $site->form(FORM_UPLOAD);
?>
    </div>
    <div id="content">
    <?php 
// will be moved to design later on
$s = new Search();
$s->order(SORT_NEWEST);
$s->range(0, 12);
$res = $s->search();
while ($image = $res->fetch_object()) {
    echo $site->imageBlock($image);
}
?>
    </div>
    <div id="modal">
    	
    </div>
    <div id="modalContent"> </div>
</body>

<?php 
$site->footer();
开发者ID:valderman,项目名称:izwei,代码行数:30,代码来源:index.php

示例3: array

                     $o = SORT_OLDEST;
                     break;
                 case 'best':
                     $o = SORT_POPULARITY;
                     break;
                 case 'worst':
                     $o = SORT_IMPOPULARITY;
                     break;
                 case 'random':
                     $o = SORT_RANDOM;
                     break;
                 default:
                     trigger_error("Sort mode {$o} is not supported!", E_USER_NOTICE);
             }
         }
         $s->order($orders);
     }
     $result = $s->search();
     $images = array();
     while ($image = $result->fetch_assoc()) {
         $images[] = $image;
     }
     echo json_encode($images);
     break;
     /**
      * Get the tags of an image
      * 
      * @param image valid image id
      */
 /**
  * Get the tags of an image
开发者ID:valderman,项目名称:izwei,代码行数:31,代码来源:ajax.php

示例4: Search

 function __construct($params)
 {
     $this->_get = $params;
     $this->getDBParams();
     $mSearch = new Search(true);
     $mSearch->limit($this->start, $this->limit);
     $mSearch->order($this->order_by['column_name'], $this->order_by['type'], $this->order_by['table_name']);
     if (Params::getParam("catId") != "") {
         $mSearch->addCategory(Params::getParam("catId"));
     }
     if ($this->search) {
         //$mSearch->addConditions(sprintf("(d.s_title LIKE '%%%s%%' OR d.s_description LIKE '%%%s%%')", $this->search, $this->search));
         $mSearch->addConditions(sprintf("MATCH(d.s_title, d.s_description) AGAINST('%s' IN BOOLEAN MODE)", $this->search));
     }
     if (@$this->stat['spam']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_spam'] = true;
         $mSearch->addField('SUM(s.`i_num_spam`) as i_num_spam');
         $mSearch->addConditions("s.`i_num_spam` > 0");
         $mSearch->addConditions(sprintf("%st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['duplicated']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_repeated'] = true;
         $mSearch->addField('SUM(s.`i_num_repeated`) as i_num_repeated');
         $mSearch->addConditions("s.`i_num_repeated` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['bad']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_bad_classified'] = true;
         $mSearch->addField('SUM(s.`i_num_bad_classified`) as i_num_bad_classified');
         $mSearch->addConditions("s.`i_num_bad_classified` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['offensive']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_offensive'] = true;
         $mSearch->addField('SUM(s.`i_num_offensive`) as i_num_offensive');
         $mSearch->addConditions("s.`i_num_offensive` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['expired']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_expired'] = true;
         $mSearch->addField('SUM(s.`i_num_expired`) as i_num_expired');
         $mSearch->addConditions("s.`i_num_expired` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     foreach ($this->filters as $aFilter) {
         $sFilter = "";
         if ($aFilter[1] == 'NULL') {
             $sFilter .= $aFilter[0] . " IS NULL";
         } else {
             $sFilter .= $aFilter[0] . " = '" . $aFilter[1] . "'";
         }
         $sFilter = sprintf($sFilter, DB_TABLE_PREFIX);
         $mSearch->addConditions($sFilter);
     }
     // do Search
     $list_items = $mSearch->doSearch(true);
     $this->result = Item::newInstance()->extendCategoryName(Item::newInstance()->extendData($list_items));
     $this->filtered_total = $mSearch->count();
     $this->total = count($list_items);
     //TEMPORARY FIX
     $this->toDatatablesFormat();
     $this->dumpToDatatables();
 }
开发者ID:acharei,项目名称:OSClass,代码行数:73,代码来源:items_processing.php

示例5: axSetSearch

function axSetSearch(Search $search)
{
    // gets the range of our search
    if (isset($_GET['offset'])) {
        if (isset($_GET['count'])) {
            $search->range($_GET['offset'], $_GET['count']);
        } else {
            $search->range($_GET['offset']);
        }
    } else {
        if (isset($_GET['count'])) {
            $search->range(NULL, $_GET['count']);
        }
    }
    // sets our tags
    if (isset($_GET['include'])) {
        $tags = explode(',', $_GET['include']);
        foreach ($tags as $k => $v) {
            $tags[$k] = urldecode($v);
        }
        $search->with($tags);
    }
    if (isset($_GET['exclude'])) {
        $tags = explode(',', $_GET['exclude']);
        foreach ($tags as $k => $v) {
            $tags[$k] = urldecode($v);
        }
        $search->without($tags);
    }
    // sets our order
    if (isset($_GET['order'])) {
        $orders = explode(',', $_GET['order']);
        foreach ($orders as $key => &$o) {
            switch ($o) {
                case 'newest':
                    $o = SORT_NEWEST;
                    break;
                case 'oldest':
                    $o = SORT_OLDEST;
                    break;
                case 'best':
                    $o = SORT_POPULARITY;
                    break;
                case 'worst':
                    $o = SORT_IMPOPULARITY;
                    break;
                case 'random':
                    $o = SORT_RANDOM;
                    break;
                case 'mosttags':
                    $o = SORT_MORETAGS;
                    break;
                case 'leasttags':
                    $o = SORT_LESSTAGS;
                    break;
                default:
                    trigger_error("Sort mode {$o} is not supported!", E_USER_NOTICE);
            }
        }
        $search->order($orders);
    }
    return $search;
}
开发者ID:nyson,项目名称:izwei,代码行数:63,代码来源:ajax.php


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