本文整理匯總了PHP中Publication::ProcessLanguageListOrder方法的典型用法代碼示例。如果您正苦於以下問題:PHP Publication::ProcessLanguageListOrder方法的具體用法?PHP Publication::ProcessLanguageListOrder怎麽用?PHP Publication::ProcessLanguageListOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Publication
的用法示例。
在下文中一共展示了Publication::ProcessLanguageListOrder方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getLanguages
/**
* Return all languages used in the publication as an array of
* Language objects.
*
* @param integer $p_excludeLanguageId
* If greater than 0, exclude the language with the given
* identifier from the list.
* @param array $p_order
* The array of order directives in the format:
* array('field'=>field_name, 'dir'=>order_direction)
* field_name can take one of the following values:
* bynumber, byname, byenglish_name, bycode
* order_direction can take one of the following values:
* asc, desc
* @return array
*/
public function getLanguages($p_excludeLanguageId = null, array $p_order = array(), $p_published = false)
{
$queryStr = 'SELECT Languages.* FROM Issues LEFT JOIN Languages ' . 'ON Issues.IdLanguage = Languages.Id WHERE ' . 'Issues.IdPublication = ' . $this->getPublicationId();
if ($p_excludeLanguageId > 0) {
$queryStr .= ' AND Languages.Id != ' . $p_excludeLanguageId;
}
if ($p_published) {
$queryStr .= " AND Issues.Published = 'Y'";
}
$queryStr .= ' GROUP BY Languages.Id';
$order = Publication::ProcessLanguageListOrder($p_order);
foreach ($order as $orderDesc) {
$sqlOrder[] = $orderDesc['field'] . ' ' . $orderDesc['dir'];
}
if (count($sqlOrder) > 0) {
$queryStr .= ' ORDER BY ' . implode(', ', $sqlOrder);
}
$languages = DbObjectArray::Create('Language', $queryStr);
return $languages;
}