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


PHP CRM_Utils_Hook::enableDisable方法代码示例

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


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

示例1: enableDisable

 /**
  * Function to perform enable / disable actions on record.
  *
  */
 static function enableDisable()
 {
     $op = CRM_Utils_Type::escape($_POST['op'], 'String');
     $recordID = CRM_Utils_Type::escape($_POST['recordID'], 'Positive');
     $recordBAO = CRM_Utils_Type::escape($_POST['recordBAO'], 'String');
     $isActive = NULL;
     if ($op == 'disable-enable') {
         $isActive = TRUE;
     } elseif ($op == 'enable-disable') {
         $isActive = FALSE;
     }
     $status = array('status' => 'record-updated-fail');
     if (isset($isActive)) {
         // first munge and clean the recordBAO and get rid of any non alpha numeric characters
         $recordBAO = CRM_Utils_String::munge($recordBAO);
         $recordClass = explode('_', $recordBAO);
         // make sure recordClass is namespaced (we cant check CRM since extensions can also use this)
         // but it should be at least 3 levels deep
         if (count($recordClass) >= 3) {
             require_once str_replace('_', DIRECTORY_SEPARATOR, $recordBAO) . ".php";
             $method = 'setIsActive';
             if (method_exists($recordBAO, $method)) {
                 $updated = call_user_func_array(array($recordBAO, $method), array($recordID, $isActive));
                 if ($updated) {
                     $status = array('status' => 'record-updated-success');
                 }
                 // call hook enableDisable
                 CRM_Utils_Hook::enableDisable($recordBAO, $recordID, $isActive);
             }
         }
         echo json_encode($status);
         CRM_Utils_System::civiExit();
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:38,代码来源:AJAX.php

示例2: setIsActive

 /**
  * update the is_active flag in the db
  *
  * @param int      $id        id of the database record
  * @param boolean  $is_active value we want to set the is_active field
  *
  * @return Object             DAO object on success, null otherwise
  * @static
  */
 static function setIsActive($id, $is_active)
 {
     CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Relationship', $id, 'is_active', $is_active);
     // call hook
     CRM_Utils_Hook::enableDisable('CRM_Contact_BAO_Relationship', $id, $is_active);
     return TRUE;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:16,代码来源:Relationship.php

示例3: setIsActive

 /**
  * update the is_active flag in the db
  *
  * @param int      $id        id of the database record
  * @param boolean  $is_active value we want to set the is_active field
  *
  * @return Object             DAO object on success, null otherwise
  * @static
  */
 static function setIsActive($id, $is_active)
 {
     // as both the create & add functions have a bunch of logic in them that
     // doesn't seem to cope with a normal update we will call the api which
     // has tested handling for this
     // however, a longer term solution would be to simplify the add, create & api functions
     // to be more standard. It is debatable @ that point whether it's better to call the BAO
     // direct as the api is more tested.
     $result = civicrm_api('relationship', 'create', array('id' => $id, 'is_active' => $is_active, 'version' => 3));
     if (is_array($result) && !empty($result['is_error']) && $result['error_message'] != 'Relationship already exists') {
         throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
     }
     // call (undocumented possibly deprecated) hook
     CRM_Utils_Hook::enableDisable('CRM_Contact_BAO_Relationship', $id, $is_active);
     return TRUE;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:25,代码来源:Relationship.php

示例4: setIsActive

 /**
  * update the is_active flag in the db
  *
  * @param int      $id        id of the database record
  * @param boolean  $is_active value we want to set the is_active field
  *
  * @return Object             DAO object on success, null otherwise
  * @static
  */
 static function setIsActive($id, $is_active)
 {
     // as both the create & add functions have a bunch of logic in them that
     // doesn't seem to cope with a normal update we will call the api which
     // has tested handling for this
     // however, a longer term solution would be to simplify the add, create & api functions
     // to be more standard. It is debatable @ that point whether it's better to call the BAO
     // direct as the api is more tested.
     civicrm_api3('relationship', 'create', array('id' => $id, 'is_active' => $is_active));
     // call (undocumented possibly deprecated) hook
     CRM_Utils_Hook::enableDisable('CRM_Contact_BAO_Relationship', $id, $is_active);
     return TRUE;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:22,代码来源:Relationship.php


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