當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。