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


PHP CRM_Core_DAO_OptionValue::orderBy方法代码示例

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


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

示例1: getOptionValuesArray

 /**
  * Get the values of all option values given an option group ID. Store in system cache
  * Does not take any filtering arguments. The object is to avoid hitting the DB and retrieve
  * from memory
  *
  * @param int $optionGroupID
  *   The option group for which we want the values from.
  *
  * @return array
  *   an array of array of values for this option group
  */
 public static function getOptionValuesArray($optionGroupID)
 {
     // check if we can get the field values from the system cache
     $cacheKey = "CRM_Core_BAO_OptionValue_OptionGroupID_{$optionGroupID}";
     $cache = CRM_Utils_Cache::singleton();
     $optionValues = $cache->get($cacheKey);
     if (empty($optionValues)) {
         $dao = new CRM_Core_DAO_OptionValue();
         $dao->option_group_id = $optionGroupID;
         $dao->orderBy('weight ASC, label ASC');
         $dao->find();
         $optionValues = array();
         while ($dao->fetch()) {
             $optionValues[$dao->id] = array();
             CRM_Core_DAO::storeValues($dao, $optionValues[$dao->id]);
         }
         $cache->set($cacheKey, $optionValues);
     }
     return $optionValues;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:31,代码来源:OptionValue.php

示例2: array

 /**
  * Get list of PDF Page Formats.
  *
  * @param bool $namesOnly
  *   Return simple list of names.
  *
  * @return array
  *   (reference)   PDF Page Format list
  */
 public static function &getList($namesOnly = FALSE)
 {
     static $list = array();
     if (self::_getGid()) {
         // get saved PDF Page Formats from Option Value table
         $dao = new CRM_Core_DAO_OptionValue();
         $dao->option_group_id = self::_getGid();
         $dao->is_active = 1;
         $dao->orderBy('weight');
         $dao->find();
         while ($dao->fetch()) {
             if ($namesOnly) {
                 $list[$dao->id] = $dao->name;
             } else {
                 CRM_Core_DAO::storeValues($dao, $list[$dao->id]);
             }
         }
     }
     return $list;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:29,代码来源:PdfFormat.php

示例3: array

 /**
  * Retrieve list of Label Formats.
  *
  * @param bool    $namesOnly    return simple list of names
  * @param string  $groupName    group name of the label format option group
  *
  * @return array  (reference)   label format list
  * @static
  * @access public
  */
 static function &getList($namesOnly = FALSE, $groupName = 'label_format')
 {
     static $list = array();
     if (self::_getGid($groupName)) {
         // get saved label formats from Option Value table
         $dao = new CRM_Core_DAO_OptionValue();
         $dao->option_group_id = self::_getGid($groupName);
         $dao->is_active = 1;
         $dao->orderBy('weight');
         $dao->find();
         while ($dao->fetch()) {
             if ($namesOnly) {
                 $list[$groupName][$dao->name] = $dao->label;
             } else {
                 CRM_Core_DAO::storeValues($dao, $list[$groupName][$dao->id]);
             }
         }
     }
     return $list[$groupName];
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:30,代码来源:LabelFormat.php

示例4: getRows

 /**
  * Return option-values of a particular group
  *
  * @param array $groupParams
  *   Array containing group fields whose option-values is to retrieved.
  * @param array $links
  *   Has links like edit, delete, disable ..etc.
  * @param string $orderBy
  *   For orderBy clause.
  *
  * @return array
  *   Array of option-values
  *
  */
 public static function getRows($groupParams, $links, $orderBy = 'weight')
 {
     $optionValue = array();
     $optionGroupID = NULL;
     if (!isset($groupParams['id']) || !$groupParams['id']) {
         if ($groupParams['name']) {
             $config = CRM_Core_Config::singleton();
             $optionGroup = CRM_Core_BAO_OptionGroup::retrieve($groupParams, $dnc);
             $optionGroupID = $optionGroup->id;
         }
     } else {
         $optionGroupID = $groupParams['id'];
     }
     $groupName = CRM_Utils_Array::value('name', $groupParams);
     if (!$groupName && $optionGroupID) {
         $groupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $optionGroupID, 'name', 'id');
     }
     $dao = new CRM_Core_DAO_OptionValue();
     if ($optionGroupID) {
         $dao->option_group_id = $optionGroupID;
         if (in_array($groupName, CRM_Core_OptionGroup::$_domainIDGroups)) {
             $dao->domain_id = CRM_Core_Config::domainID();
         }
         $dao->orderBy($orderBy);
         $dao->find();
     }
     if ($groupName == 'case_type') {
         $caseTypeIds = CRM_Case_BAO_Case::getUsedCaseType();
     } elseif ($groupName == 'case_status') {
         $caseStatusIds = CRM_Case_BAO_Case::getUsedCaseStatuses();
     }
     $componentNames = CRM_Core_Component::getNames();
     $visibilityLabels = CRM_Core_PseudoConstant::visibility();
     while ($dao->fetch()) {
         $optionValue[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $optionValue[$dao->id]);
         // form all action links
         $action = array_sum(array_keys($links));
         // update enable/disable links depending on if it is is_reserved or is_active
         if ($dao->is_reserved) {
             $action = CRM_Core_Action::UPDATE;
         } else {
             if ($dao->is_active) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             if ($groupName == 'case_type' && in_array($dao->value, $caseTypeIds) || $groupName == 'case_status' && in_array($dao->value, $caseStatusIds)) {
                 $action -= CRM_Core_Action::DELETE;
             }
         }
         $optionValue[$dao->id]['label'] = htmlspecialchars($optionValue[$dao->id]['label']);
         $optionValue[$dao->id]['order'] = $optionValue[$dao->id]['weight'];
         $optionValue[$dao->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $dao->id, 'gid' => $optionGroupID, 'value' => $dao->value), ts('more'), FALSE, 'optionValue.row.actions', 'optionValue', $dao->id);
         if (!empty($optionValue[$dao->id]['component_id'])) {
             $optionValue[$dao->id]['component_name'] = $componentNames[$optionValue[$dao->id]['component_id']];
         } else {
             $optionValue[$dao->id]['component_name'] = 'Contact';
         }
         if (!empty($optionValue[$dao->id]['visibility_id'])) {
             $optionValue[$dao->id]['visibility_label'] = $visibilityLabels[$optionValue[$dao->id]['visibility_id']];
         }
     }
     return $optionValue;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:79,代码来源:OptionValue.php

示例5: browse

 /**
  * Browse all options value.
  *
  *
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     $dao = new CRM_Core_DAO_OptionValue();
     $dao->option_group_id = $this->_gid;
     if (in_array($this->_gName, CRM_Core_OptionGroup::$_domainIDGroups)) {
         $dao->domain_id = CRM_Core_Config::domainID();
     }
     if ($this->_gName == 'encounter_medium') {
         $mediumIds = CRM_Case_BAO_Case::getUsedEncounterMediums();
     } elseif ($this->_gName == 'case_status') {
         $caseStatusIds = CRM_Case_BAO_Case::getUsedCaseStatuses();
     } elseif ($this->_gName == 'case_type') {
         $caseTypeIds = CRM_Case_BAO_Case::getUsedCaseType();
     }
     $dao->orderBy('name');
     $dao->find();
     $optionValue = array();
     while ($dao->fetch()) {
         $optionValue[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $optionValue[$dao->id]);
         // form all action links
         $action = array_sum(array_keys($this->links()));
         if ($dao->is_default) {
             $optionValue[$dao->id]['default_value'] = '[x]';
         }
         //do not show default option for email/postal greeting and addressee, CRM-4575
         if (!in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) {
             $this->assign('showIsDefault', TRUE);
         }
         // update enable/disable links depending on if it is is_reserved or is_active
         if ($dao->is_reserved) {
             $action = CRM_Core_Action::UPDATE;
         } else {
             if ($dao->is_active) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             if ($this->_gName == 'encounter_medium' && in_array($dao->value, $mediumIds) || $this->_gName == 'case_status' && in_array($dao->value, $caseStatusIds) || $this->_gName == 'case_type' && in_array($dao->value, $caseTypeIds)) {
                 $action -= CRM_Core_Action::DELETE;
             }
         }
         $optionValue[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id, 'gid' => $this->_gid));
     }
     $this->assign('rows', $optionValue);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:54,代码来源:OptionValue.php

示例6: getCustomOption

 /**
  * Returns all active options ordered by weight for a given field
  *
  * @param  int      $fieldId         field whose options are needed
  * @param  boolean  $inactiveNeeded  do we need inactive options ?
  *
  * @return array $customOption all active options for fieldId
  * @static
  */
 static function getCustomOption($fieldID, $inactiveNeeded = false)
 {
     $options = array();
     if (!$fieldID) {
         return $options;
     }
     // get the option group id
     $optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldID, 'option_group_id');
     if (!$optionGroupID) {
         return $options;
     }
     require_once 'CRM/Core/DAO/OptionValue.php';
     $dao = new CRM_Core_DAO_OptionValue();
     $dao->option_group_id = $optionGroupID;
     if (!$inactiveNeeded) {
         $dao->is_active = 1;
     }
     $dao->orderBy('weight ASC, label ASC');
     $dao->find();
     while ($dao->fetch()) {
         $options[$dao->id] = array();
         $options[$dao->id]['id'] = $dao->id;
         $options[$dao->id]['label'] = $dao->label;
         $options[$dao->id]['value'] = $dao->value;
     }
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::customFieldOptions($fieldID, $options, true);
     return $options;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:38,代码来源:CustomOption.php


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