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


PHP CRM_Core_DAO_Note::find方法代码示例

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


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

示例1: postProcess


//.........这里部分代码省略.........
         if (!$this->_rtype) {
             $this->_rtype = str_replace($relationshipTypeId . '_', '', $params['relationship_type_id']);
         }
     }
     $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], null, true);
     $params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], null, true);
     //special case to handle if all checkboxes are unchecked
     $customFields = CRM_Core_BAO_CustomField::getFields('Relationship', false, false, $relationshipTypeId);
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_relationshipId, 'Relationship');
     list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::create($params, $ids);
     // if this is called from case view,
     //create an activity for case role removal.CRM-4480
     if ($this->_caseId) {
         require_once "CRM/Case/BAO/Case.php";
         CRM_Case_BAO_Case::createCaseRoleActivity($this->_caseId, $relationshipIds, $params['contact_check'], $this->_contactId);
     }
     $status = '';
     if ($valid) {
         $status .= ' ' . ts('%count new relationship record created.', array('count' => $valid, 'plural' => '%count new relationship records created.'));
     }
     if ($invalid) {
         $status .= ' ' . ts('%count relationship record not created due to invalid target contact type.', array('count' => $invalid, 'plural' => '%count relationship records not created due to invalid target contact type.'));
     }
     if ($duplicate) {
         $status .= ' ' . ts('%count relationship record not created - duplicate of existing relationship.', array('count' => $duplicate, 'plural' => '%count relationship records not created - duplicate of existing relationship.'));
     }
     if ($saved) {
         $status .= ts('Relationship record has been updated.');
     }
     $note = new CRM_Core_DAO_Note();
     $note->entity_id = $relationshipIds[0];
     $note->entity_table = 'civicrm_relationship';
     $noteIds = array();
     if ($note->find(true)) {
         $id = $note->id;
         $noteIds["id"] = $id;
     }
     $noteParams = array('entity_id' => $relationshipIds[0], 'entity_table' => 'civicrm_relationship', 'note' => $params['note'], 'contact_id' => $this->_contactId);
     CRM_Core_BAO_Note::add($noteParams, $noteIds);
     // Membership for related contacts CRM-1657
     if (CRM_Core_Permission::access('CiviMember') && !$duplicate) {
         CRM_Contact_BAO_Relationship::relatedMemberships($this->_contactId, $params, $ids, $this->_action);
     }
     //handle current employee/employer relationship, CRM-3532
     if ($this->_allRelationshipNames[$relationshipTypeId]["name_{$this->_rtype}"] == 'Employee of') {
         $orgId = null;
         if (CRM_Utils_Array::value('employee_of', $params)) {
             $orgId = $params['employee_of'];
         } else {
             if ($this->_action & CRM_Core_Action::UPDATE) {
                 if (CRM_Utils_Array::value('is_current_employer', $params) && CRM_Utils_Array::value('is_active', $params)) {
                     if (CRM_Utils_Array::value('contactTarget', $ids) != CRM_Utils_Array::value('current_employer_id', $this->_values)) {
                         $orgId = CRM_Utils_Array::value('contactTarget', $ids);
                     }
                 } else {
                     if (CRM_Utils_Array::value('contactTarget', $ids) == CRM_Utils_Array::value('current_employer_id', $this->_values)) {
                         //clear current employer.
                         require_once 'CRM/Contact/BAO/Contact/Utils.php';
                         CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($this->_contactId);
                     }
                 }
             }
         }
         //set current employer
         if ($orgId) {
             $currentEmpParams[$this->_contactId] = $orgId;
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:Relationship.php

示例2: browse

 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $note = new CRM_Core_DAO_Note();
     $note->entity_table = 'civicrm_contact';
     $note->entity_id = $this->_contactId;
     $note->orderBy('modified_date desc');
     //CRM-4418, handling edit and delete separately.
     $permissions = array($this->_permission);
     if ($this->_permission == CRM_Core_Permission::EDIT) {
         //previously delete was subset of edit
         //so for consistency lets grant delete also.
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $values = array();
     $links = self::links();
     $action = array_sum(array_keys($links)) & $mask;
     $note->find();
     while ($note->fetch()) {
         if (!CRM_Core_BAO_Note::getNotePrivacyHidden($note)) {
             CRM_Core_DAO::storeValues($note, $values[$note->id]);
             $values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId));
             $contact = new CRM_Contact_DAO_Contact();
             $contact->id = $note->contact_id;
             $contact->find();
             $contact->fetch();
             $values[$note->id]['createdBy'] = $contact->display_name;
             $values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id);
         }
     }
     $this->assign('notes', $values);
     $commentLinks = self::commentLinks();
     $action = array_sum(array_keys($commentLinks)) & $mask;
     $commentAction = CRM_Core_Action::formLink($commentLinks, $action, array('id' => $note->id, 'pid' => $note->entity_id, 'cid' => $note->entity_id));
     $this->assign('commentAction', $commentAction);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:42,代码来源:Note.php

示例3: getDescendentIds

 /**
  * Given a note id, get a list of the ids of all notes that are descendents of that note
  *
  * @param int $parentId
  *   Id of the given note.
  * @param array $ids
  *   (reference) one-dimensional array to store found descendent ids.
  *
  * @return array
  *   One-dimensional array containing ids of all desendent notes
  */
 public static function getDescendentIds($parentId, &$ids = array())
 {
     // get direct children of given parentId note
     $note = new CRM_Core_DAO_Note();
     $note->entity_table = 'civicrm_note';
     $note->entity_id = $parentId;
     $note->find();
     while ($note->fetch()) {
         // foreach child, add to ids list, and recurse
         $ids[] = $note->id;
         self::getDescendentIds($note->id, $ids);
     }
     return $ids;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:25,代码来源:Note.php

示例4: postProcess


//.........这里部分代码省略.........
     }
     if (!$params['note']) {
         $params['note'] = 'null';
     }
     $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], NULL, TRUE);
     $params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], NULL, TRUE);
     //special case to handle if all checkboxes are unchecked
     $customFields = CRM_Core_BAO_CustomField::getFields('Relationship', FALSE, FALSE, $relationshipTypeId);
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_relationshipId, 'Relationship');
     list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::create($params, $ids);
     // if this is called from case view,
     //create an activity for case role removal.CRM-4480
     if ($this->_caseId) {
         CRM_Case_BAO_Case::createCaseRoleActivity($this->_caseId, $relationshipIds, $params['contact_check'], $this->_contactId);
     }
     $status = '';
     if ($valid) {
         CRM_Core_Session::setStatus(ts('New relationship created.', array('count' => $valid, 'plural' => '%count new relationships created.')), ts('Saved'), 'success');
     }
     if ($invalid) {
         CRM_Core_Session::setStatus(ts('%count relationship record was not created due to an invalid target contact type.', array('count' => $invalid, 'plural' => '%count relationship records were not created due to invalid target contact types.')), ts('%count invalid relationship record', array('count' => $invalid, 'plural' => '%count invalid relationship records')));
     }
     if ($duplicate) {
         CRM_Core_Session::setStatus(ts('One relationship was not created because it already exists.', array('count' => $duplicate, 'plural' => '%count relationships were not created because they already exist.')), ts('%count duplicate relationship', array('count' => $duplicate, 'plural' => '%count duplicate relationships')));
     }
     if ($saved) {
         CRM_Core_Session::setStatus(ts('Relationship record has been updated.'), ts('Saved'), 'success');
     }
     if (!empty($relationshipIds)) {
         $note = new CRM_Core_DAO_Note();
         $note->entity_id = $relationshipIds[0];
         $note->entity_table = 'civicrm_relationship';
         $noteIds = array();
         if ($note->find(TRUE)) {
             $id = $note->id;
             $noteIds['id'] = $id;
         }
         $noteParams = array('entity_id' => $relationshipIds[0], 'entity_table' => 'civicrm_relationship', 'note' => $params['note'], 'contact_id' => $this->_contactId);
         CRM_Core_BAO_Note::add($noteParams, $noteIds);
         $params['relationship_ids'] = $relationshipIds;
     }
     // Membership for related contacts CRM-1657
     if (CRM_Core_Permission::access('CiviMember') && !$duplicate) {
         if ($this->_action & CRM_Core_Action::ADD) {
             CRM_Contact_BAO_Relationship::relatedMemberships($this->_contactId, $params, $ids, $this->_action);
         } elseif ($this->_action & CRM_Core_Action::UPDATE) {
             //fixes for CRM-7985
             //only if the relationship has been toggled to enable /disable
             if (CRM_Utils_Array::value('is_active', $params) != $this->_enabled) {
                 $active = CRM_Utils_Array::value('is_active', $params) ? CRM_Core_Action::ENABLE : CRM_Core_Action::DISABLE;
                 CRM_Contact_BAO_Relationship::disableEnableRelationship($this->_relationshipId, $active);
             }
         }
     }
     //handle current employee/employer relationship, CRM-3532
     if ($this->_allRelationshipNames[$relationshipTypeId]["name_{$this->_rtype}"] == 'Employee of') {
         $orgId = NULL;
         if (CRM_Utils_Array::value('employee_of', $params)) {
             $orgId = $params['employee_of'];
         } elseif ($this->_action & CRM_Core_Action::UPDATE) {
             if (CRM_Utils_Array::value('is_current_employer', $params) && CRM_Utils_Array::value('is_active', $params)) {
                 if (CRM_Utils_Array::value('contactTarget', $ids) != CRM_Utils_Array::value('current_employer_id', $this->_values)) {
                     $orgId = CRM_Utils_Array::value('contactTarget', $ids);
                 }
             } elseif (CRM_Utils_Array::value('contactTarget', $ids) == CRM_Utils_Array::value('current_employer_id', $this->_values)) {
                 //clear current employer.
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:67,代码来源:Relationship.php


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