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


PHP CRM_Utils_Weight::getMax方法代码示例

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


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

示例1: getDefaultWeight

 /**
  * returns the default weight ( highest weight + 1 ) to be used.
  *
  * @param string $daoName full name of the DAO
  * @param array  $fieldValues field => value to be used in the WHERE
  * @param string $weightField field which contains the weight value,
  * defaults to 'weight'
  * @return integer
  */
 static function getDefaultWeight($daoName, $fieldValues = null, $weightField = 'weight')
 {
     $maxWeight = CRM_Utils_Weight::getMax($daoName, $fieldValues, $weightField);
     return $maxWeight + 1;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:14,代码来源:Weight.php

示例2: copy

 /**
  * make a copy of a profile, including
  * all the fields in the profile
  *
  * @param int $id
  *   The profile id to copy.
  *
  * @return \CRM_Core_DAO
  */
 public static function copy($id)
 {
     $fieldsFix = array('prefix' => array('title' => ts('Copy of ')));
     $copy =& CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFGroup', array('id' => $id), NULL, $fieldsFix);
     if ($pos = strrpos($copy->name, "_{$id}")) {
         $copy->name = substr_replace($copy->name, '', $pos);
     }
     $copy->name = CRM_Utils_String::munge($copy->name, '_', 56) . "_{$copy->id}";
     $copy->save();
     $copyUFJoin =& CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array('uf_group_id' => $id), array('uf_group_id' => $copy->id), NULL, 'entity_table');
     $copyUFField =& CRM_Core_DAO::copyGeneric('CRM_Core_BAO_UFField', array('uf_group_id' => $id), array('uf_group_id' => $copy->id));
     $maxWeight = CRM_Utils_Weight::getMax('CRM_Core_DAO_UFJoin', NULL, 'weight');
     //update the weight
     $query = "\nUPDATE civicrm_uf_join\nSET    weight = %1\nWHERE  uf_group_id = %2\nAND    ( entity_id IS NULL OR entity_id <= 0 )\n";
     $p = array(1 => array($maxWeight + 1, 'Integer'), 2 => array($copy->id, 'Integer'));
     CRM_Core_DAO::executeQuery($query, $p);
     if ($copy->is_reserved) {
         $query = "UPDATE civicrm_uf_group SET is_reserved = 0 WHERE id = %1";
         $params = array(1 => array($copy->id, 'Integer'));
         CRM_Core_DAO::executeQuery($query, $params);
     }
     CRM_Utils_Hook::copy('UFGroup', $copy);
     return $copy;
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:33,代码来源:UFGroup.php

示例3: copy

 /**
  * This function is to make a copy of a profile, including
  * all the fields in the profile
  *
  * @param int $id the profile id to copy
  *
  * @return void
  * @access public
  */
 static function copy($id)
 {
     $fieldsFix = array('prefix' => array('title' => ts('Copy of ')));
     $copy =& CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFGroup', array('id' => $id), null, $fieldsFix);
     $copyUFJoin =& CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array('uf_group_id' => $id), array('uf_group_id' => $copy->id), null, 'entity_table');
     $copyUFField =& CRM_Core_DAO::copyGeneric('CRM_Core_BAO_UFField', array('uf_group_id' => $id), array('uf_group_id' => $copy->id));
     require_once "CRM/Utils/Weight.php";
     $maxWeight = CRM_Utils_Weight::getMax('CRM_Core_DAO_UFJoin', null, 'weight');
     //update the weight
     $query = "\nUPDATE civicrm_uf_join \nSET    weight = %1\nWHERE  uf_group_id = %2\nAND    ( entity_id IS NULL OR entity_id <= 0 )\n";
     $p = array(1 => array($maxWeight + 1, 'Integer'), 2 => array($copy->id, 'Integer'));
     CRM_Core_DAO::executeQuery($query, $p);
     if ($copy->is_reserved) {
         $query = "UPDATE civicrm_uf_group SET is_reserved = 0 WHERE id = %1";
         $params = array(1 => array($copy->id, 'Integer'));
         CRM_Core_DAO::executeQuery($query, $params);
     }
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::copy('UFGroup', $copy);
     return $copy;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:30,代码来源:UFGroup.php


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