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


PHP Criteria::setOrder方法代码示例

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


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

示例1: Criteria

 /**
  * get keywords
  *
  * @access public
  * @param int $item_id
  * @return array object array
  */
 function &getKeywords($item_id)
 {
     $criteria = new Criteria('item_id', $item_id);
     $criteria->setSort('keyword_id');
     $criteria->setOrder('ASC');
     return $this->getObjects($criteria);
 }
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:14,代码来源:keyword.class.php

示例2: b_mysearch_last_search_show

function b_mysearch_last_search_show()
{
    include_once XOOPS_ROOT_PATH . '/modules/mysearch/include/functions.php';
    $mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
    $visiblekeywords = 0;
    $block = array();
    $visiblekeywords = mysearch_getmoduleoption('showindex');
    if ($visiblekeywords > 0) {
        $block['visiblekeywords'] = $visiblekeywords;
        $totalcount = $mysearch_handler->getCount();
        $start = 0;
        $critere = new Criteria('mysearchid', 0, '<>');
        $critere->setSort('datesearch');
        $critere->setLimit($visiblekeywords);
        $critere->setStart($start);
        $critere->setOrder('DESC');
        $tmpmysearch = new searches();
        $elements = $mysearch_handler->getObjects($critere);
        foreach ($elements as $oneelement) {
            $search = array();
            $search['keyword'] = $oneelement->getVar('keyword');
            $search['date'] = formatTimestamp(strtotime($oneelement->getVar('datesearch')));
            $search['uid'] = $oneelement->getVar('keyword');
            $search['uname'] = $tmpmysearch->uname($oneelement->getVar('uid'));
            $search['link'] = "<a href='" . XOOPS_URL . '/search.php?query=' . $oneelement->getVar('keyword') . "&action=results' target='_blank'>";
            $block['searches'][] = $search;
            unset($search);
        }
    }
    return $block;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:mysearch_last_search.php

示例3: __callStatic

 public static function __callStatic($name, $arguments)
 {
     $pos = strpos($name, 'getListBy');
     if ($pos !== false) {
         $class = get_called_class();
         $table = $class::TABLE;
         $att = str_replace('getListBy', '', $name);
         $tabledesc = self::getTableDescription($table);
         foreach ($tabledesc as $field) {
             if (strtolower($field) == strtolower($att)) {
                 $c = new Criteria();
                 $c->setOrder($field);
                 return $class::getList($c);
             }
         }
     }
     $pos = strpos($name, 'findBy');
     if ($pos !== false) {
         $class = get_called_class();
         $table = $class::TABLE;
         $att = str_replace('findBy', '', $name);
         $tabledesc = self::getTableDescription($table);
         foreach ($tabledesc as $field) {
             if (strtolower($field) == strtolower($att)) {
                 $c = new Criteria();
                 if (count($arguments)) {
                     $c->addCondition($field, '=', $arguments[0]);
                 }
                 return $class::getList($c);
             }
         }
     }
 }
开发者ID:petersonsantos,项目名称:lazyphp,代码行数:33,代码来源:Record.php

示例4: execute

 function execute(&$controller, &$request, &$user)
 {
     exFrame::init(EXFRAME_PERM);
     // 閲覧権限のチェック
     exPerm::GuardRedirect('view_detail', 'index.php', _MD_PLZXOO_ERROR_PERMISSION);
     $id = isset($_REQUEST['qid']) ? intval($_REQUEST['qid']) : 0;
     $handler =& plzXoo::getHandler('question');
     $question =& $handler->get($id);
     if (!is_object($question)) {
         return VIEW_ERROR;
     }
     // ステータスが1,2と異なるものは管理者以外キック
     if (!in_array($question->getVar('status'), array(1, 2))) {
         if (!is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin()) {
             return VIEW_ERROR;
         }
     }
     $handler =& plzXoo::getHandler('answer');
     $criteria = new Criteria('qid', $id);
     $criteria->setSort('input_date');
     $criteria->setOrder('DESC');
     $answers =& $handler->getObjects($criteria);
     $request->setAttribute('question', $question);
     $request->setAttribute('answers', $answers);
     return VIEW_SUCCESS;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:26,代码来源:detail.class.php

示例5: Criteria

 /**
  * get titles
  *
  * @access public
  * @param int $item_id
  * @return array object array
  */
 function &getTitles($item_id)
 {
     $criteria = new Criteria('item_id', $item_id);
     $criteria->setSort('title_id');
     $criteria->setOrder('ASC');
     return $this->getObjects($criteria);
 }
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:14,代码来源:title.class.php

示例6: getChangeLogs

 /**
  * get change logs
  *
  * @access public
  * @param int $item_id
  * @return array objects
  */
 function getChangeLogs($item_id)
 {
     $criteria = new Criteria('item_id', $item_id);
     $criteria->setSort('log_date');
     $criteria->setOrder('DESC');
     return $this->getObjects($criteria);
 }
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:14,代码来源:changelog.class.php

示例7: b_mypics_lastpictures_show

function b_mypics_lastpictures_show($options)
{
    $criteria = new Criteria('id', 0, '>');
    $criteria->setSort('id');
    $criteria->setOrder('DESC');
    $criteria->setLimit($options[0]);
    $handler = xoops_getModuleHandler('image', 'mypics');
    $block = $handler->getLastPicturesForBlock($options[0]);
    return $block;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:10,代码来源:blocks.php

示例8: getAllVats

 /**
  * Return All TAX
  *
  * @param integer $start Position de départ
  * @param integer $limit Nombre total d'enregistrements à renvoyer
  * @param string $order Champ sur lequel faire le tri
  * @param string $order Ordre du tri
  * @param boolean $idaskey Indique si le tableau renvoyé doit avoir pour clé l'identifiant unique de l'enregistrement
  * @return array tableau d'objets de type TVA
  */
 function getAllVats($start = 0, $limit = 0, $sort = 'vat_id', $order = 'ASC', $idaskey = true)
 {
     $critere = new Criteria('vat_id', 0, '<>');
     $critere->setLimit($limit);
     $critere->setStart($start);
     $critere->setSort($sort);
     $critere->setOrder($order);
     $tblVats = array();
     $tblVats = $this->getObjects($critere, $idaskey);
     return $tblVats;
 }
开发者ID:naao,项目名称:myshop,代码行数:21,代码来源:myshop_vat.php

示例9: getAllStores

 /**
  * Renvoie la liste de tous les vendeurs du module
  *
  * @param integer $start Position de départ
  * @param integer $limit Nombre total d'enregistrements à renvoyer
  * @param string $order Champ sur lequel faire le tri
  * @param string $order Ordre du tri
  * @param boolean $idaskey Indique si le tableau renvoyé doit avoir pour clé l'identifiant unique de l'enregistrement
  * @return array tableau d'objets de type stores
  */
 function getAllStores($start = 0, $limit = 0, $sort = 'store_name', $order = 'ASC', $idaskey = true)
 {
     $critere = new Criteria('store_id', 0, '<>');
     $critere->setLimit($limit);
     $critere->setStart($start);
     $critere->setSort($sort);
     $critere->setOrder($order);
     $tbl_categs = array();
     $tbl_categs = $this->getObjects($critere, $idaskey);
     return $tbl_categs;
 }
开发者ID:naao,项目名称:myshop,代码行数:21,代码来源:myshop_stores.php

示例10: getLastVotes

 /**
  * Returns the (x) last votes
  *
  * @param integer $start Starting position
  * @param integer $limit count of items to return
  * @return array Array of votedata objects
  */
 function getLastVotes($start = 0, $limit = 0)
 {
     $tbl_datas = array();
     $criteria = new Criteria('vote_ratingid', 0, '<>');
     $criteria->setLimit($limit);
     $criteria->setStart($start);
     $criteria->setSort('vote_ratingtimestamp');
     $criteria->setOrder('DESC');
     $tbl_datas = $this->getObjects($criteria, true);
     return $tbl_datas;
 }
开发者ID:naao,项目名称:myshop,代码行数:18,代码来源:myshop_votedata.php

示例11: getAllLocation

 public function getAllLocation(oledrion_parameters $parameters)
 {
     $parameters = $parameters->extend(new oledrion_parameters(array('start' => 0, 'limit' => 0, 'sort' => 'location_id', 'order' => 'ASC')));
     $critere = new Criteria('location_id', 0, '<>');
     $critere->setLimit($parameters['limit']);
     $critere->setStart($parameters['start']);
     $critere->setSort($parameters['sort']);
     $critere->setOrder($parameters['order']);
     $location = array();
     $location = $this->getObjects($critere);
     return $location;
 }
开发者ID:osw17,项目名称:oledrion,代码行数:12,代码来源:oledrion_location.php

示例12: getAllVats

 /**
  * Renvoie la liste de toutes les TVA du module
  *
  * @param  integer $start   Position de départ
  * @param  integer $limit   Nombre total d'enregistrements à renvoyer
  * @param  string  $order   Champ sur lequel faire le tri
  * @param  string  $order   Ordre du tri
  * @param  boolean $idaskey Indique si le tableau renvoyé doit avoir pour clé l'identifiant unique de l'enregistrement
  * @return array   tableau d'objets de type TVA
  */
 public function getAllVats(oledrion_parameters $parameters)
 {
     $parameters = $parameters->extend(new oledrion_parameters(array('start' => 0, 'limit' => 0, 'sort' => 'vat_id', 'order' => 'ASC', 'idaskey' => true)));
     $critere = new Criteria('vat_id', 0, '<>');
     $critere->setLimit($parameters['limit']);
     $critere->setStart($parameters['start']);
     $critere->setSort($parameters['sort']);
     $critere->setOrder($parameters['order']);
     $vats = array();
     $vats = $this->getObjects($critere, $parameters['idaskey']);
     return $vats;
 }
开发者ID:osw17,项目名称:oledrion,代码行数:22,代码来源:oledrion_vat.php

示例13: b_xoonips_userlist_show

function b_xoonips_userlist_show()
{
    global $xoopsDB;
    $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid', 'n') : UID_GUEST;
    // hide block if user is invalid xoonips user
    $xsession_handler =& xoonips_getormhandler('xoonips', 'session');
    if (!$xsession_handler->validateUser($uid, false)) {
        return false;
    }
    $tables['users'] = $xoopsDB->prefix('users');
    $tables['xusers'] = $xoopsDB->prefix('xoonips_users');
    $user_handler =& xoonips_getormhandler('xoonips', 'xoops_users');
    $positions_handler =& xoonips_getormhandler('xoonips', 'positions');
    // get visible positions
    $criteria = new Criteria('posi_order', 0, '>');
    $criteria->setSort('posi_order');
    $criteria->setOrder('ASC');
    $position_objs =& $positions_handler->getObjects($criteria);
    $positions = array();
    foreach ($position_objs as $position_obj) {
        $posi_id = $position_obj->getVar('posi_id', 'n');
        $posi_title = $position_obj->getVar('posi_title', 's');
        // get visible users, who set position to $posi_id
        $join_criteria = new XooNIpsJoinCriteria('xoonips_users', 'uid', 'uid');
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria($tables['users'] . '.level', '0', '>'));
        $criteria->add(new Criteria($tables['xusers'] . '.activate', '1'));
        $criteria->add(new Criteria($tables['xusers'] . '.posi', $posi_id));
        $sort = array($tables['users'] . '.uid', $tables['xusers'] . '.user_order');
        $criteria->setSort($sort);
        $criteria->setOrder('ASC');
        $fields = array($tables['users'] . '.uid', $tables['users'] . '.uname', $tables['users'] . '.name');
        $user_objs =& $user_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria);
        if (!empty($user_objs)) {
            $position['title'] = $posi_title;
            $position['users'] = array();
            foreach ($user_objs as $user_obj) {
                $position['users'][] = array('uid' => $user_obj->getVar('uid', 'e'), 'name' => $user_obj->getVar('name', 's'), 'uname' => $user_obj->getVar('uname', 's'));
            }
            $positions[] = $position;
        }
    }
    if (empty($positions)) {
        return false;
        // visible users not found
    }
    // assign block template variables
    $block = array();
    $block['positions'] = $positions;
    return $block;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:51,代码来源:xoonips_userlist.php

示例14: adminPrepare

 function adminPrepare($element)
 {
     $ele_value = $element ? $element->getVar('ele_value') : array();
     $fid = $element ? $element->getVar('id_form') : intval($_GET['fid']);
     if (!$element) {
         $ele_value[3] = "horizontal";
         $ele_value[5] = 1;
         $ele_value[0] = "caption";
     }
     $background = $ele_value[3];
     $sideortop = $ele_value[5] == 1 ? "side" : "above";
     $heading = $ele_value[0];
     $grid_elements_criteria = new Criteria();
     $grid_elements_criteria->setSort('ele_order');
     $grid_elements_criteria->setOrder('ASC');
     $element_handler = xoops_getmodulehandler('elements', 'formulize');
     $grid_elements = $element_handler->getObjects($grid_elements_criteria, $fid);
     foreach ($grid_elements as $this_element) {
         $grid_start_options[$this_element->getVar('ele_id')] = $this_element->getVar('ele_colhead') ? printSmart(trans($this_element->getVar('ele_colhead'))) : printSmart(trans($this_element->getVar('ele_caption')));
     }
     return array('grid_start_options' => $grid_start_options, 'background' => $background, 'sideortop' => $sideortop, 'heading' => $heading, 'ele_value' => $ele_value);
 }
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:22,代码来源:newgridElement-example.php

示例15: b_sitemap_newbb

function b_sitemap_newbb()
{
    global $sitemap_configs;
    $sitemap = array();
    $forum_handler =& xoops_getmodulehandler('forum', 'newbb');
    /* Allowed forums */
    $forums_allowed = $forum_handler->getIdsByPermission();
    /* fetch top forums */
    $forums_top_id = array();
    if (!empty($forums_allowed)) {
        $crit_top = new CriteriaCompo(new Criteria("parent_forum", 0));
        //$crit_top->add(new Criteria("cat_id", "(".implode(", ", array_keys($categories)).")", "IN"));
        $crit_top->add(new Criteria("forum_id", "(" . implode(", ", $forums_allowed) . ")", "IN"));
        $forums_top_id = $forum_handler->getIds($crit_top);
    }
    $forums_sub_id = array();
    if ($sitemap_configs["show_subcategoris"] && !empty($forums_top_id)) {
        $crit_sub = new CriteriaCompo(new Criteria("parent_forum", "(" . implode(", ", $forums_top_id) . ")", "IN"));
        $crit_sub->add(new Criteria("forum_id", "(" . implode(", ", $forums_allowed) . ")", "IN"));
        $forums_sub_id = $forum_handler->getIds($crit_sub);
    }
    /* Fetch forum data */
    $forums_available = array_merge($forums_top_id, $forums_sub_id);
    $forums_array = array();
    if (!empty($forums_available)) {
        $crit_forum = new Criteria("forum_id", "(" . implode(", ", $forums_available) . ")", "IN");
        $crit_forum->setSort("cat_id ASC, parent_forum ASC, forum_order");
        $crit_forum->setOrder("ASC");
        $forums_array = $forum_handler->getAll($crit_forum, array("forum_name", "parent_forum", "cat_id"), false);
    }
    $forums = array();
    foreach ($forums_array as $forumid => $forum) {
        if (!empty($forum["parent_forum"])) {
            $forums[$forum['parent_forum']]["fchild"][$forumid] = array('id' => $forumid, 'url' => "viewforum.php?forum=" . $forumid, 'title' => $forum['forum_name']);
        } else {
            $forums[$forumid] = array('id' => $forumid, 'cid' => $forum['cat_id'], 'url' => "viewforum.php?forum=" . $forumid, 'title' => $forum['forum_name']);
        }
    }
    if ($sitemap_configs["show_subcategoris"]) {
        $category_handler =& xoops_getmodulehandler('category', 'newbb');
        $categories = $category_handler->getByPermission('access', array("cat_id", "cat_title"), false);
        foreach ($categories as $key => $category) {
            $cat_id = $category["cat_id"];
            $i = $cat_id;
            $sitemap['parent'][$i]['id'] = $cat_id;
            $sitemap['parent'][$i]['title'] = $category["cat_title"];
            $sitemap['parent'][$i]['url'] = "index.php?cat=" . $cat_id;
        }
        foreach ($forums as $id => $forum) {
            $cid = $forum['cid'];
            $sitemap['parent'][$cid]['child'][$id] = $forum;
            $sitemap['parent'][$cid]['child'][$id]['image'] = 2;
            if (empty($forum['fchild'])) {
                continue;
            }
            foreach ($forum['fchild'] as $_id => $_forum) {
                $sitemap['parent'][$cid]['child'][$_id] = $_forum;
                $sitemap['parent'][$cid]['child'][$_id]['image'] = 3;
            }
        }
    } else {
        foreach ($forums as $id => $forum) {
            $sitemap['parent'][$id] = $forum;
        }
    }
    return $sitemap;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:67,代码来源:sitemap.plugin.php


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