本文整理汇总了PHP中icms_db_criteria_Compo::getSort方法的典型用法代码示例。如果您正苦于以下问题:PHP icms_db_criteria_Compo::getSort方法的具体用法?PHP icms_db_criteria_Compo::getSort怎么用?PHP icms_db_criteria_Compo::getSort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类icms_db_criteria_Compo
的用法示例。
在下文中一共展示了icms_db_criteria_Compo::getSort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Retrieve a list of objects as arrays - DON'T USE WITH JOINT KEYS
*
* @param object $criteria {@link icms_db_criteria_Element} conditions to be met
* @param int $limit Max number of objects to fetch
* @param int $start Which record to start at
*
* @return array
*/
public function getList($criteria = null, $limit = 0, $start = 0, $debug = false)
{
$ret = array();
if ($criteria == null) {
$criteria = new icms_db_criteria_Compo();
}
if ($criteria->getSort() == '') {
$criteria->setSort($this->getIdentifierName());
}
$sql = 'SELECT ' . (is_array($this->keyName) ? implode(', ', $this->keyName) : $this->keyName);
if (!empty($this->identifierName)) {
$sql .= ', ' . $this->getIdentifierName();
}
$sql .= ' FROM ' . $this->table . " AS " . $this->_itemname;
if (isset($criteria) && is_subclass_of($criteria, 'icms_db_criteria_Element')) {
$sql .= ' ' . $criteria->renderWhere();
if ($criteria->getSort() != '') {
$sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
}
$limit = $criteria->getLimit();
$start = $criteria->getStart();
}
if ($debug) {
icms_core_Debug::message($sql);
}
$result = $this->db->query($sql, $limit, $start);
if (!$result) {
return $ret;
}
while ($myrow = $this->db->fetchArray($result)) {
//identifiers should be textboxes, so sanitize them like that
$ret[$myrow[$this->keyName]] = empty($this->identifierName) ? 1 : icms_core_DataFilter::checkVar($myrow[$this->identifierName], 'text', 'output');
}
return $ret;
}