@@ 705-724 (lines=20) @@ | ||
702 | * |
|
703 | * @return array|false |
|
704 | */ |
|
705 | function getEntityCollections($owner_guid, $site_guid = 0) { |
|
706 | $owner_guid = (int) $owner_guid; |
|
707 | $site_guid = (int) $site_guid; |
|
708 | ||
709 | if (($site_guid == 0) && $this->site_guid) { |
|
710 | $site_guid = $this->site_guid; |
|
711 | } |
|
712 | ||
713 | $db = _elgg_services()->db; |
|
714 | $prefix = $db->getTablePrefix(); |
|
715 | ||
716 | $query = "SELECT * FROM {$prefix}access_collections |
|
717 | WHERE owner_guid = {$owner_guid} |
|
718 | AND site_guid = {$site_guid} |
|
719 | ORDER BY name ASC"; |
|
720 | ||
721 | $collections = $db->getData($query); |
|
722 | ||
723 | return $collections; |
|
724 | } |
|
725 | ||
726 | /** |
|
727 | * Get all of members of an access collection |
|
@@ 769-789 (lines=21) @@ | ||
766 | * |
|
767 | * @return array|false |
|
768 | */ |
|
769 | function getCollectionsByMember($member_guid, $site_guid = 0) { |
|
770 | $member_guid = (int) $member_guid; |
|
771 | $site_guid = (int) $site_guid; |
|
772 | ||
773 | if (($site_guid == 0) && $this->site_guid) { |
|
774 | $site_guid = $this->site_guid; |
|
775 | } |
|
776 | ||
777 | $db = _elgg_services()->db; |
|
778 | $prefix = $db->getTablePrefix(); |
|
779 | ||
780 | $query = "SELECT ac.* FROM {$prefix}access_collections ac |
|
781 | JOIN {$prefix}access_collection_membership m ON ac.id = m.access_collection_id |
|
782 | WHERE m.user_guid = {$member_guid} |
|
783 | AND ac.site_guid = {$site_guid} |
|
784 | ORDER BY name ASC"; |
|
785 | ||
786 | $collections = $db->getData($query); |
|
787 | ||
788 | return $collections; |
|
789 | } |
|
790 | ||
791 | /** |
|
792 | * Return the name of an ACCESS_* constant or an access collection, |