當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Publication::ProcessLanguageListOrder方法代碼示例

本文整理匯總了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;
 }
開發者ID:nidzix,項目名稱:Newscoop,代碼行數:36,代碼來源:Publication.php


注:本文中的Publication::ProcessLanguageListOrder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。