本文整理汇总了PHP中Criteria::setSort方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::setSort方法的具体用法?PHP Criteria::setSort怎么用?PHP Criteria::setSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::setSort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: item_get_userlist
function item_get_userlist($upage)
{
global $xoopsDB;
global $xoopsUser;
// myuid
$myuid = $xoopsUser->getVar('uid', 'n');
$xusers_handler =& xoonips_getormhandler('xoonips', 'users');
$tables['users'] = $xoopsDB->prefix('users');
$tables['xusers'] = $xoopsDB->prefix('xoonips_users');
$join_criteria = new XooNIpsJoinCriteria('users', 'uid', 'uid');
$criteria = new Criteria($tables['users'] . '.level', 0, '>');
$criteria->setSort($tables['users'] . '.uname');
$fields = array();
$fields[] = $tables['xusers'] . '.uid';
$fields[] = $tables['users'] . '.uname';
$xusers_objs =& $xusers_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria);
$textutil =& xoonips_getutility('text');
$users = array();
$users[] = array('uid' => 0, 'uname' => $textutil->html_special_chars(_AM_XOONIPS_MAINTENANCE_ITEM_LABEL_ALLUSERS), 'selected' => 'selected="selected"');
foreach ($xusers_objs as $xusers_obj) {
$uid = $xusers_obj->getVar('uid', 'e');
$uname = $textutil->html_special_chars($xusers_obj->getExtraVar('uname'));
$users[] = array('uid' => $uid, 'uname' => $uname, 'selected' => '');
}
return $users;
}
示例4: 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);
}
示例5: 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;
}
示例6: 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);
}
示例7: search
/**
* @brief search file
*
* @param query query
* @param limit the maximum number of rows to return
* @param offset the offset of the first row to return
* @param uid user ID
* @return array of item id
*/
function search($query, $limit, $offset, $uid)
{
$msg = false;
$iids = false;
$dummy = false;
$search_cache_id = false;
$_SESSION['XNPSID'] = session_id();
$member_handler =& xoops_gethandler('member');
if (empty($GLOBALS['xoopsUser'])) {
$GLOBALS['xoopsUser'] = $member_handler->getUser($uid);
}
if (xnpSearchExec('quicksearch', $query, 'all', false, $dummy, $dummy, $dummy, $search_cache_id, false, 'file')) {
// search_cache_id -> file_ids
$criteria = new Criteria('search_cache_id', $search_cache_id);
$criteria->setSort('item_id');
$criteria->setStart($offset);
if ($limit) {
$criteria->setLimit($limit);
}
$join = new XooNIpsJoinCriteria('xoonips_search_cache_file', 'file_id', 'file_id', 'LEFT');
$file_handler =& xoonips_getormhandler('xoonips', 'file');
$files =& $file_handler->getObjects($criteria, false, 'item_id', true, $join);
if (false === $files) {
return false;
}
$item_ids = array();
foreach ($files as $file) {
$item_ids[] = $file->get('item_id');
}
return $item_ids;
} else {
return false;
}
}
示例8: 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;
}
示例9: getCreators
/**
* get creator objects of this item
* @return XNPConferenceOrmCreator[]
*/
function getCreators()
{
$handler =& xoonips_getormhandler('xnpmodel', 'creator');
$criteria = new Criteria('model_id', $this->get('model_id'));
$criteria->setSort('creator_order');
$result =& $handler->getObjects($criteria);
if ($result) {
return $result;
}
return array();
}
示例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;
}
示例11: getAuthors
/**
* get author objects of this item
* @return XNPPaperOrmAuthor[]
*/
function getAuthors()
{
$handler =& xoonips_getormhandler('xnppaper', 'author');
$criteria = new Criteria('paper_id', $this->get('paper_id'));
$criteria->setSort('author_order');
$result =& $handler->getObjects($criteria);
if ($result) {
return $result;
}
return array();
}
示例12: 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;
}
示例13: getExperimenters
/**
* get experimenter objects of this item
* @return XNPDataOrmExperimenter[]
*/
function getExperimenters()
{
$handler =& xoonips_getormhandler('xnpdata', 'experimenter');
$criteria = new Criteria('data_id', $this->get('data_id'));
$criteria->setSort('experimenter_order');
$result =& $handler->getObjects($criteria);
if ($result) {
return $result;
}
return array();
}
示例14: 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;
}
示例15: getDevelopers
/**
* get developer objects of this item
* @return XnpstimulusOrmDeveloper[]
*/
function getDevelopers()
{
$handler =& xoonips_getormhandler('xnpstimulus', 'developer');
$criteria = new Criteria('stimulus_id', $this->get('stimulus_id'));
$criteria->setSort('developer_order');
$result =& $handler->getObjects($criteria);
if ($result) {
return $result;
}
return array();
}