/** * Encrypted Id after find * @param array $result data * @param bool $primary * @return array $result encrypted id * @author Laxmi Saini */ public function afterFind($results, $primary = false) { $collection = new ComponentCollection(); $Encryption = new EncryptionComponent($collection); foreach ($results as $key => $val) { if (isset($val[$this->alias]['id'])) { $results[$key][$this->alias]['id'] = $Encryption->encode($val[$this->alias]['id']); } } return $results; }
/** *Function CheckReferralExist to check the referrals exists or not *@return boolean false if not exists *@author Priti Kabra */ public function CheckReferralExist($deleteIdArr) { $return = 0; $collection = new ComponentCollection(); $Encryption = new EncryptionComponent($collection); foreach ($deleteIdArr as $deleteId) { if (!$this->exists($Encryption->decode($deleteId))) { $return = 1; } } return $return; }
/** * function to get the list of member from a group * @author Jitendra Sharma * @param int $groupId id of group * @param int $userId Login user id * @return array $memberList List of members */ public function getMyGroupMemberList($groupId = null, $userId = null) { if ($groupId != NULL) { $usersList = $this->find('all', array('fields' => 'User.id,BusinessOwner.fname,BusinessOwner.lname', 'conditions' => array('BusinessOwner.group_id' => $groupId, 'BusinessOwner.user_id !=' => $userId, 'User.is_active' => 1), 'order' => 'BusinessOwner.lname ASC')); $memberList = array(); $collection = new ComponentCollection(); $Encryption = new EncryptionComponent($collection); foreach ($usersList as $user) { $id = $Encryption->decode($user['User']['id']); $name = $user['BusinessOwner']['lname'] . " " . $user['BusinessOwner']['fname']; $memberList[$id] = $name; } return $memberList; } }