Example #1
0
 public function getAllUserChannelsIdsByUid($uid)
 {
     if (Config::getSafe('enable_tariff_plans', false) && !Config::getSafe('enable_tv_subscription_for_tariff_plans', false)) {
         $user = User::getInstance($uid);
         $subscription = $user->getServicesByType('tv');
         if (empty($subscription)) {
             $subscription = array();
         }
         $channel_ids = $subscription;
     } else {
         $channel_ids = array_unique(array_merge(ItvSubscription::getSubscriptionChannelsIds($uid), ItvSubscription::getBonusChannelsIds($uid), $this->getBaseChannelsIds()));
     }
     $filtered_channels = self::getFilteredUserChannelsIds();
     if (!empty($_COOKIE['ext_channels']) && in_array('ext_channels', stb::getAvailableModulesByUid($this->stb->id))) {
         $ext_channels = explode(',', $_COOKIE['ext_channels']);
         $ext_channels = Mysql::getInstance()->from('itv')->where(array('bonus_ch' => 1))->in('id', $ext_channels)->get()->all('id');
         $channel_ids = array_merge($channel_ids, $ext_channels);
     }
     if ($channel_ids == 'all') {
         $channel_ids = $filtered_channels;
     } else {
         $channel_ids = array_intersect($channel_ids, $filtered_channels);
     }
     return $channel_ids;
 }