コード例 #1
0
 /**
  * Function to create various elements of location block
  *
  * @param array $params (reference ) an assoc array of name/value pairs
  * @param boolean $fixAddress true if you need to fix (format) address values
  *                               before inserting in db
  *
  * @param null $entity
  *
  * @return array   $location
  * @access public
  * @static
  */
 static function create(&$params, $fixAddress = TRUE, $entity = NULL)
 {
     $location = array();
     if (!self::dataExists($params)) {
         return $location;
     }
     // create location blocks.
     foreach (self::$blocks as $block) {
         if ($block != 'address') {
             $location[$block] = CRM_Core_BAO_Block::create($block, $params, $entity);
         } else {
             $location[$block] = CRM_Core_BAO_Address::create($params, $fixAddress, $entity);
         }
     }
     if ($entity) {
         // this is a special case for adding values in location block table
         $entityElements = array('entity_table' => $params['entity_table'], 'entity_id' => $params['entity_id']);
         $location['id'] = self::createLocBlock($location, $entityElements);
     } else {
         // when we come from a form which displays all the location elements (like the edit form or the inline block
         // elements, we can skip the below check. The below check adds quite a feq queries to an already overloaded
         // form
         if (!CRM_Utils_Array::value('updateBlankLocInfo', $params, FALSE)) {
             // make sure contact should have only one primary block, CRM-5051
             self::checkPrimaryBlocks(CRM_Utils_Array::value('contact_id', $params));
         }
     }
     return $location;
 }
コード例 #2
0
ファイル: OpenID.php プロジェクト: kidaa30/yes
 /**
  * Process the form.
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     // Process / save openID
     $params['contact_id'] = $this->_contactId;
     $params['updateBlankLocInfo'] = TRUE;
     CRM_Core_BAO_Block::create('openid', $params);
     $this->log();
     $this->response();
 }
コード例 #3
0
 /**
  * process the form
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     // need to process / save emails
     $params['contact_id'] = $this->_contactId;
     $params['updateBlankLocInfo'] = TRUE;
     // save email changes
     CRM_Core_BAO_Block::create('email', $params);
     // make entry in log table
     CRM_Core_BAO_Log::register($this->_contactId, 'civicrm_contact', $this->_contactId);
     $response = array('status' => 'save');
     $this->postProcessHook();
     echo json_encode($response);
     CRM_Utils_System::civiExit();
 }
コード例 #4
0
ファイル: OpenID.php プロジェクト: kcristiano/civicrm-core
 /**
  * Process the form.
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     // Process / save openID
     $params['contact_id'] = $this->_contactId;
     $params['updateBlankLocInfo'] = TRUE;
     $params['openid']['isIdSet'] = TRUE;
     foreach ($this->_openids as $count => $value) {
         if (!empty($value['id']) && isset($params['openid'][$count])) {
             $params['openid'][$count]['id'] = $value['id'];
         }
     }
     CRM_Core_BAO_Block::create('openid', $params);
     $this->log();
     $this->response();
 }
コード例 #5
0
ファイル: Email.php プロジェクト: kcristiano/civicrm-core
 /**
  * Process the form.
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     // Process / save emails
     $params['contact_id'] = $this->_contactId;
     $params['updateBlankLocInfo'] = TRUE;
     $params['email']['isIdSet'] = TRUE;
     foreach ($this->_emails as $count => $value) {
         if (!empty($value['id']) && isset($params['email'][$count])) {
             $params['email'][$count]['id'] = $value['id'];
         }
     }
     CRM_Core_BAO_Block::create('email', $params);
     // If contact has no name, set primary email as display name
     // TODO: This should be handled in the BAO for the benefit of the api, etc.
     if (!$this->contactHasName) {
         foreach ($params['email'] as $email) {
             if ($email['is_primary']) {
                 CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'display_name', $email['email']);
                 CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'sort_name', $email['email']);
                 $this->ajaxResponse['reloadBlocks'] = array('#crm-contactname-content');
                 break;
             }
         }
     }
     $this->log();
     $this->response();
 }