Пример #1
0
 /**
  * Return tag in current channel 
  * 
  * @return Sppc_Tag|null
  */
 function getTag()
 {
     $tagModel = new Sppc_TagModel();
     $tag = $tagModel->findObjectById($this->id_channel);
     return $tag;
 }
Пример #2
0
 /**
  * Загрузка данных канала
  *
  * @param array $fields параметры создаваемого канала
  * @return string описание ошибки ('' при успешной загрузке)
  */
 public function _load($id)
 {
     try {
         $channelModel = new Sppc_ChannelModel();
         $channel = $channelModel->findObjectById($id);
         if (is_null($channel)) {
             throw new Sppc_Exception('Channel is not found');
         }
         $site = $channel->getParentSite();
         $tagModel = new Sppc_TagModel();
         $tag = $tagModel->findObjectById($id);
         $category = $channel->getCategory();
         if (null === $category) {
             $category = $site->getCategory();
         }
         $data = array('name' => $channel->getName(), 'description' => $channel->getDescription(), 'format' => $channel->getDimension()->getId(), 'ad_type_text' => $channel->isAdTypeAllowed(Sppc_Channel::AD_TYPE_TEXT) ? 'text' : '', 'ad_type_image' => $channel->isAdTypeAllowed(Sppc_Channel::AD_TYPE_IMAGE) ? 'image' : '', 'channel_type' => $channel->getChannelType(), 'ad_settings' => $channel->getAdSettings(), 'tag_code' => $tag->getCode(), 'blank_color' => '#' . $channel->getBlankColor(), 'category' => $category, 'ad_sources_advertisers' => $channel->hasAdSource(Sppc_Channel::AD_SOURCE_ADVERTISERS), 'ad_sources_xml_feeds' => $channel->hasAdSource(Sppc_Channel::AD_SOURCE_XMLFEEDS));
         return $data;
     } catch (Exception $e) {
         return __($e->getMessage());
     }
 }