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


PHP CRM_Utils_Hook::optionValues方法代码示例

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


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

示例1: activityTypes

 /**
  * @param $activityTypesXML
  * @param bool $maxInst
  * @param bool $isLabel
  * @param bool $maskAction
  *
  * @return array
  */
 public function activityTypes($activityTypesXML, $maxInst = FALSE, $isLabel = FALSE, $maskAction = FALSE)
 {
     $activityTypes =& $this->allActivityTypes(TRUE, TRUE);
     $result = array();
     foreach ($activityTypesXML as $activityTypeXML) {
         foreach ($activityTypeXML as $recordXML) {
             $activityTypeName = (string) $recordXML->name;
             $maxInstances = (string) $recordXML->max_instances;
             $activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes);
             if ($activityTypeInfo['id']) {
                 if ($maskAction) {
                     if ($maskAction == 'edit' && '0' === (string) $recordXML->editable) {
                         $result[$maskAction][] = $activityTypeInfo['id'];
                     }
                 } else {
                     if (!$maxInst) {
                         //if we want,labels of activities should be returned.
                         if ($isLabel) {
                             $result[$activityTypeInfo['id']] = $activityTypeInfo['label'];
                         } else {
                             $result[$activityTypeInfo['id']] = $activityTypeName;
                         }
                     } else {
                         if ($maxInstances) {
                             $result[$activityTypeName] = $maxInstances;
                         }
                     }
                 }
             }
         }
     }
     // call option value hook
     CRM_Utils_Hook::optionValues($result, 'case_activity_type');
     return $result;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:43,代码来源:Process.php

示例2: array

 /**
  * This function retrieves all the values for the specific option group by name
  * this is primarily used to create various html based form elements
  * (radio, select, checkbox etc). OptionGroups for most cases have the
  * 'label' in the label colum and the 'id' or 'name' in the value column
  *
  * @param string $name
  *   name of the option group.
  * @param bool $flip
  *   results are return in id => label format if false.
  *                            if true, the results are reversed
  * @param bool $grouping
  *   if true, return the value in 'grouping' column.
  * @param bool $localize
  *   if true, localize the results before returning.
  * @param string $condition
  *   add another condition to the sql query.
  * @param string $labelColumnName
  *   the column to use for 'label'.
  * @param bool $onlyActive
  *   return only the action option values.
  * @param bool $fresh
  *   ignore cache entries and go back to DB.
  * @param string $keyColumnName
  *   the column to use for 'key'.
  *
  * @return array
  *   the values as specified by the above params
  * @void
  */
 public static function &values($name, $flip = FALSE, $grouping = FALSE, $localize = FALSE, $condition = NULL, $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE, $keyColumnName = 'value')
 {
     $cache = CRM_Utils_Cache::singleton();
     $cacheKey = self::createCacheKey($name, $flip, $grouping, $localize, $condition, $labelColumnName, $onlyActive, $keyColumnName);
     if (!$fresh) {
         // Fetch from static var
         if (array_key_exists($cacheKey, self::$_cache)) {
             return self::$_cache[$cacheKey];
         }
         // Fetch from main cache
         $var = $cache->get($cacheKey);
         if ($var) {
             return $var;
         }
     }
     $query = "\nSELECT  v.{$labelColumnName} as {$labelColumnName} ,v.{$keyColumnName} as value, v.grouping as grouping\nFROM   civicrm_option_value v,\n       civicrm_option_group g\nWHERE  v.option_group_id = g.id\n  AND  g.name            = %1\n  AND  g.is_active       = 1 ";
     if ($onlyActive) {
         $query .= " AND  v.is_active = 1 ";
     }
     if (in_array($name, self::$_domainIDGroups)) {
         $query .= " AND v.domain_id = " . CRM_Core_Config::domainID();
     }
     if ($condition) {
         $query .= $condition;
     }
     $query .= " ORDER BY v.weight";
     $p = array(1 => array($name, 'String'));
     $dao = CRM_Core_DAO::executeQuery($query, $p);
     $var = self::valuesCommon($dao, $flip, $grouping, $localize, $labelColumnName);
     // call option value hook
     CRM_Utils_Hook::optionValues($var, $name);
     self::$_cache[$cacheKey] = $var;
     $cache->set($cacheKey, $var);
     return $var;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:65,代码来源:OptionGroup.php

示例3: array

 static function &values($name, $flip = false, $grouping = false, $localize = false, $condition = null, $valueColumnName = 'label', $onlyActive = true)
 {
     $cacheKey = "CRM_OG_{$name}_{$flip}_{$grouping}_{$localize}_{$condition}_{$valueColumnName}_{$onlyActive}";
     $cache =& CRM_Utils_Cache::singleton();
     $var = $cache->get($cacheKey);
     if ($var) {
         return $var;
     }
     $query = "\nSELECT  v.{$valueColumnName} as {$valueColumnName} ,v.value as value, v.grouping as grouping\nFROM   civicrm_option_value v,\n       civicrm_option_group g\nWHERE  v.option_group_id = g.id\n  AND  g.name            = %1\n  AND  g.is_active       = 1 ";
     if ($onlyActive) {
         $query .= " AND  v.is_active = 1 ";
     }
     if (in_array($name, self::$_domainIDGroups)) {
         $query .= " AND v.domain_id = " . CRM_Core_Config::domainID();
     }
     if ($condition) {
         $query .= $condition;
     }
     $query .= "  ORDER BY v.weight";
     $p = array(1 => array($name, 'String'));
     $dao =& CRM_Core_DAO::executeQuery($query, $p);
     $var =& self::valuesCommon($dao, $flip, $grouping, $localize, $valueColumnName);
     $cache->set($cacheKey, $var);
     // call option value hook
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::optionValues($var, $name);
     return $var;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:28,代码来源:OptionGroup.php


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