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


PHP error::createInvalidSortError方法代码示例

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


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

示例1: connectionOrderString

/**
 * Create the SQL ORDER and LIMIT BY clause for connections
 *
 * @param integer $start start row
 * @param integer $max max number of rows to return
 * @param string $o order by column
 * @param string $s sort order (ASC or DESC)
 * @return string
 */
function connectionOrderString($o, $s)
{
    global $CFG, $HUB_FLM, $HUB_SQL;
    //check order by param is valid
    switch ($o) {
        case "date":
            $orderby = "t.CreationDate";
            break;
        case "moddate":
            $orderby = "t.ModificationDate";
            break;
        case "vote":
            $orderby = "vote";
            break;
        default:
            global $ERROR;
            $ERROR = new error();
            $ERROR->createInvalidOrderbyError();
            include $HUB_FLM->getCodeDirPath("core/formaterror.php");
            die;
    }
    //check sort param is valid
    switch ($s) {
        case "ASC":
            $sort = $HUB_SQL->ASC;
            break;
        case "DESC":
            $sort = $HUB_SQL->DESC;
            break;
        default:
            global $ERROR;
            $ERROR = new error();
            $ERROR->createInvalidSortError();
            include $HUB_FLM->getCodeDirPath("core/formaterror.php");
            die;
    }
    if ($o == 'vote') {
        $str = $HUB_SQL->ORDER_BY . $orderby . " " . $sort . ", weight " . $HUB_SQL->DESC . ", CreationDate " . $HUB_SQL->DESC;
    } else {
        $str = $HUB_SQL->ORDER_BY . $orderby . " " . $sort;
    }
    return $str;
}
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:52,代码来源:databaseutillib.php

示例2: connectionOrderString

/**
 * Create the SQL ORDER and LIMIT BY clause for connections
 *
 * @param integer $start start row
 * @param integer $max max number of rows to return
 * @param string $o order by column
 * @param string $s sort order (ASC or DESC)
 * @return string
 */
function connectionOrderString($o, $s)
{
    global $CFG, $HUB_FLM, $HUB_SQL;
    //check order by param is valid
    switch ($o) {
        case "date":
            $orderby = "t.CreationDate";
            break;
        case "moddate":
            $orderby = "t.ModificationDate";
            break;
        case "vote":
            $orderby = "vote";
            break;
        case "ideavote":
            $orderby = "vote";
            break;
        case "fromname":
            $orderby = "t.FromLabel";
            break;
        case "toname":
            $orderby = "t.ToLabel";
            break;
        case "random":
            //MB: This does not scale and should be replaced eventually.
            $day = date('j', time());
            $hour = date('G', time());
            $orderby = "RAND(" . $day . $hour . ")";
            break;
        default:
            global $ERROR;
            $ERROR = new error();
            $ERROR->createInvalidOrderbyError();
            include $HUB_FLM->getCodeDirPath("core/formaterror.php");
            die;
    }
    //check sort param is valid
    switch ($s) {
        case "ASC":
            $sort = $HUB_SQL->ASC;
            break;
        case "DESC":
            $sort = $HUB_SQL->DESC;
            break;
        default:
            global $ERROR;
            $ERROR = new error();
            $ERROR->createInvalidSortError();
            include $HUB_FLM->getCodeDirPath("core/formaterror.php");
            die;
    }
    if ($o == 'ideavote') {
        $str = $HUB_SQL->ORDER_BY . $orderby . " " . $sort . ", weight " . $HUB_SQL->DESC . ", kids " . $HUB_SQL->DESC . ", kidsweight " . $HUB_SQL->DESC;
    } else {
        if ($o == 'vote') {
            $str = $HUB_SQL->ORDER_BY . $orderby . " " . $sort . ", weight " . $HUB_SQL->DESC . ", CreationDate " . $HUB_SQL->DESC;
        } else {
            $str = $HUB_SQL->ORDER_BY . $orderby . " " . $sort;
        }
    }
    return $str;
}
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:71,代码来源:databaseutillib.php


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