예제 #1
0
 private static function getPrivacyContextsByCategoryEntries(entry $entry)
 {
     $defaultPrivacyContext = self::DEFAULT_CONTEXT . $entry->getPartnerId();
     $privacyContexts = array();
     $categoriesIds = array();
     //get category entries that have privacy context
     $categoryEntries = categoryEntryPeer::retrieveByEntryIdStatusPrivacyContextExistance($entry->getId(), null, true);
     foreach ($categoryEntries as $categoryEntry) {
         $categoriesIds[] = $categoryEntry->getCategoryId();
     }
     $categories = self::getCategoriesByIds($categoriesIds);
     foreach ($categories as $category) {
         $categoryPrivacy = $category->getPrivacy();
         $categoryPrivacyContext = $category->getPrivacyContexts();
         if (!isset($privacyContexts[$categoryPrivacyContext]) || $privacyContexts[$categoryPrivacyContext] > $categoryPrivacy) {
             $privacyContexts[trim($categoryPrivacyContext)] = $categoryPrivacy;
         }
     }
     $noPrivacyContextCategory = categoryEntryPeer::retrieveOneByEntryIdStatusPrivacyContextExistance($entry->getId());
     if ($noPrivacyContextCategory) {
         $privacyContexts[$defaultPrivacyContext] = PrivacyType::ALL;
     }
     return $privacyContexts;
 }