コード例 #1
0
ファイル: Sync.php プロジェクト: CiviCooP/org.civicoop.myemma
 public function __construct($account_id)
 {
     $account = civicrm_api3('MyEmmaAccount', 'getsingle', array('id' => $account_id));
     if (!$account) {
         throw new Exception('Account not found');
     }
     $this->emma = new CRM_Myemma_Emma($account['account_id'], $account['public_key'], $account['private_key'], false);
     $this->contact_custom_field = CRM_Myemma_BAO_MyEmmaAccount::createCustomField('myemma', $account['name'], $account_id);
     $this->group_custom_field = CRM_Myemma_BAO_MyEmmaAccount::createCustomField('myemma_group', $account['name'], $account_id);
     $this->group_custom_field_name = civicrm_api3('CustomField', 'getvalue', array('return' => 'column_name', 'id' => $this->group_custom_field));
     $this->parent_group_id = $account['parent_group_id'];
     $this->civiFields = CRM_Myemma_Utils::buildCiviCRMFieldList();
     $this->field_maps = array();
     $dao = new CRM_Myemma_DAO_MyEmmaFieldMap();
     $dao->account_id = $account_id;
     $dao->find();
     while ($dao->fetch()) {
         $map = array();
         CRM_Core_DAO::storeValues($dao, $map);
         $this->field_maps[$map['my_emma_field']] = $map;
     }
 }
コード例 #2
0
 public function delete($useWhere = FALSE)
 {
     $result = parent::delete($useWhere);
     return $result;
 }
コード例 #3
0
 /**
  * Returns the list of fields that can be exported
  *
  * @param bool $prefix
  *
  * @return array
  */
 static function &export($prefix = false)
 {
     if (!self::$_export) {
         self::$_export = array();
         $fields = self::fields();
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('export', $field)) {
                 if ($prefix) {
                     self::$_export['my_emma_field_map'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }