8 ch_import(
'ChTemplSearchResultSharedMedia');
 
   14         parent::__construct(
'ChVideosModule');
 
   15         $this->aConstants[
'linksTempl'] = array(
 
   17             'file' => 
'view/{uri}',
 
   18             'category' => 
'browse/category/{uri}',
 
   19             'browseAll' => 
'browse/',
 
   20             'browseUserAll' => 
'albums/browse/owner/{uri}',
 
   21             'browseAllTop' => 
'browse/top',
 
   22             'tag' => 
'browse/tag/{uri}',
 
   23             'album' => 
'browse/album/{uri}',
 
   24             'add' => 
'browse/my/add' 
   28             'name' => 
'ch_videos',
 
   29             'title' => 
'_ch_videos',
 
   30             'table' => 
'RayVideoFiles' 
   32         $this->aCurrent = array_merge($aMain, $this->aCurrent);
 
   33         $this->aCurrent[
'ownFields'] = array_merge($this->aCurrent[
'ownFields'], array(
'Views', 
'Source', 
'Video'));
 
   34         $this->aCurrent[
'rss'][
'title'] = 
_t(
'_ch_videos');
 
   36         $this->aAddPartsConfig[
'favorite'][
'table'] = 
'ch_videos_favorites';
 
   38         $this->oTemplate = &$this->oModule->_oTemplate;
 
   39         $this->aConstants[
'filesUrl'] = $this->oModule->_oConfig->getFilesUrl();
 
   40         $this->aConstants[
'filesDir'] = $this->oModule->_oConfig->getFilesPath();
 
   41         $this->aConstants[
'filesInAlbumCover'] = 12;
 
   42         $this->aConstants[
'picPostfix'] = $this->oModule->_oConfig->aFilePostfix;
 
   44         $this->aCurrent[
'restriction'][
'albumType'][
'value'] = $this->aCurrent[
'name'];
 
   48                 $this->aCurrent[
'restriction'][
'calendar-min'] = array(
'value' => 
"UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 00:00:00')", 
'field' => 
'Date', 
'operator' => 
'>=', 
'no_quote_value' => 
true);
 
   49                 $this->aCurrent[
'restriction'][
'calendar-max'] = array(
'value' => 
"UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 23:59:59')", 
'field' => 
'Date', 
'operator' => 
'<=', 
'no_quote_value' => 
true);
 
   50                 $this->aCurrent[
'title'] = 
_t(
'_ch_videos_caption_browse_by_day') . sprintf(
"%04u-%02u-%02u", 
$sParamValue, $sParamValue1, $sParamValue2);
 
   53                 $this->aCurrent[
'sorting'] = 
'top';
 
   56                 $this->aCurrent[
'sorting'] = 
'popular';
 
   59                 $this->aCurrent[
'restriction'][
'featured'] = array(
 
   60                     'value'=>
'1', 
'field'=>
'Featured', 
'operator'=>
'=', 
'paramName'=>
'ch_videos_mode' 
   64                 if (isset($this->aAddPartsConfig[
'favorite']) && !
empty($this->aAddPartsConfig[
'favorite']) && 
getLoggedId() != 0) {
 
   65                     $this->aCurrent[
'join'][
'favorite'] = $this->aAddPartsConfig[
'favorite'];
 
   66                     $this->aCurrent[
'restriction'][
'fav'] = array(
 
   68                         'field' => $this->aAddPartsConfig[
'favorite'][
'userField'],
 
   70                         'table' => $this->aAddPartsConfig[
'favorite'][
'table']
 
   75                 $this->aCurrent[
'sorting'] = 
'album_order';
 
   76                 $this->aCurrent[
'restriction'][
'album'] = array(
 
   77                     'value'=>
'', 
'field'=>
'Uri', 
'operator'=>
'=', 
'paramName'=>
'albumUri', 
'table'=>
'sys_albums' 
   79                 if ($sParamValue1 == 
'owner' && strlen($sParamValue2) > 0) {
 
   80                     $this->aCurrent[
'restriction'][
'owner'] = array(
 
   81                         'value'=>$sParamValue2, 
'field'=>
'NickName', 
'operator'=>
'=', 
'paramName'=>
'ownerName', 
'table' => 
'Profiles' 
   95         return $this->oTemplate->getFileConcept($aVideo[
'ID'], array(
'ext'=>$aVideo[
'video'], 
'source'=>$aVideo[
'source']));
 
  101         $sqlQuery = 
"SELECT a.`ID` as `id`, 
  102                             a.`Title` as `title`, 
  103                             a.`Description` as `description`, 
  105                             a.`Owner` as `owner`, 
  111                             a.`RateCount` AS `rate_count`, 
  112                             a.`CommentsCount` AS `comments_count`, 
  113                             a.`Views` AS `views_count`, 
  114                             a.`Status` AS `status`, 
  115                             b.`id_album` as `album_id` 
  116                         FROM `RayVideoFiles` as a 
  117                         LEFT JOIN `sys_albums_objects` as b ON b.`id_object` = a.`ID` 
  118                         LEFT JOIN `sys_albums` as c ON c.`ID`=b.`id_album` 
  119                         WHERE a.`ID`='$iId' AND c.`Type`='ch_videos'";
 
  120         $aImageInfo = 
db_arr($sqlQuery);
 
  122         if(
empty($aImageInfo) || !is_array($aImageInfo))
 
  125         $sFileName = $sFilePath = 
'';
 
  126         $sImg = $aImageInfo[
'id'] . $this->aConstants[
'picPostfix'][
$sType];
 
  127         if($sImg != 
'' && 
extFileExists($this->aConstants[
'filesDir'] . $sImg)) {
 
  128             $sFileName = $this->aConstants[
'filesUrl'] . $sImg;
 
  129             $sFilePath = $this->aConstants[
'filesDir'] . $sImg;
 
  133             'id' => $aImageInfo[
'id'],
 
  134             'file' => $sFileName,
 
  135             'file_path' => $sFilePath,
 
  136             'title' => $aImageInfo[
'title'],
 
  137             'owner' => $aImageInfo[
'owner'],
 
  138             'description' => $aImageInfo[
'description'],
 
  139             'width' => (
int)$this->oModule->_oConfig->aFilesConfig[
'browse'][
'w'] + 2 * 2,
 
  140             'height' => (
int)$this->oModule->_oConfig->aFilesConfig[
'browse'][
'h'] + 2 * 2,
 
  141             'url' => $this->getCurrentUrl(
'file', 
$iId, $aImageInfo[
'uri']),
 
  142             'video' => $aImageInfo[
'Video'],
 
  143             'source' => $aImageInfo[
'Source'],
 
  144             'duration' => $aImageInfo[
'Time'],
 
  145             'duration_f' => 
_format_time(round(($aImageInfo[
'Time'])/1000)),
 
  146             'date' => $aImageInfo[
'date'],
 
  147             'rate' => $aImageInfo[
'rate'],
 
  148             'rate_count' => $aImageInfo[
'rate_count'],
 
  149             'comments_count' => $aImageInfo[
'comments_count'],
 
  150             'views_count' => $aImageInfo[
'views_count'],
 
  151             'status' => $aImageInfo[
'status'],
 
  152             'album_id' => $aImageInfo[
'album_id']
 
  169         foreach ($aFiles 
as $k => $aRow) {
 
  170             $aFiles[$k][
'thumb'] = $this->
getImgUrl($aRow[
'id'], 
'browse');
 
  171             $aFiles[$k][
'file'] = $this->
getImgUrl($aRow[
'id'], 
'file');
 
  179             $iViewer = $this->oModule->_iProfileId;
 
  180         if ($isCheckPrivacy && !$this->oModule->oAlbumPrivacy->check(
'album_view', (
int)$iAlbumId, $iViewer))
 
  183         $this->aCurrent[
'ownFields'][] = 
'Video';
 
  184         $this->aCurrent[
'ownFields'][] = 
'Source';
 
  186         foreach ($aFiles 
as $k => $aRow) {
 
  187             $aFiles[$k][
'thumb'] = $this->
getImgUrl($aRow[
'id'], 
'browse');
 
  188             $aFiles[$k][
'file'] = $this->
getImgUrl($aRow[
'id'], 
'file');
 
  189             $aFiles[$k][
'main'] = $this->
getImgUrl($aRow[
'id'], 
'main');
 
  190             $aFiles[$k][
'video'] = $aFiles[$k][
'Video'];
 
  191             $aFiles[$k][
'source'] = $aFiles[$k][
'Source'];
 
  199         foreach ($aFiles 
as $k => $aRow) {
 
  200             $aFiles[$k][
'thumb'] = $this->
getImgUrl($aRow[
'id'], 
'browse');
 
  201             $aFiles[$k][
'file'] = $this->
getImgUrl($aRow[
'id'], 
'file');
 
  202             $aFiles[$k][
'main'] = $this->
getImgUrl($aRow[
'id'], 
'main');
 
  203             $aFiles[$k][
'video'] = $aFiles[$k][
'Video'];
 
  204             $aFiles[$k][
'source'] = $aFiles[$k][
'Source'];
 
  214         return $this->oModule->getWallPost($aEvent, 
'film');
 
  222         return $this->oModule->getWallPostOutline($aEvent, 
'film');
 
  231             'prefix' => 
'id' . 
time() . 
'_' . rand(1, 999999),
 
  233             'ch_repeat:videos' => array (),
 
  234             'ch_repeat:icons' => array (),
 
  238         foreach($aFiles 
as $aFile) {
 
  239             $aVars[
'ch_repeat:videos'][] = array (
 
  240                 'style' => 
false === 
$aVars[
'title'] ? 
'' : 
'display:none;',
 
  241                 'id' => $aFile[
'id'],
 
  242                 'video' => $this->oTemplate->getFileConcept($aFile[
'id'], ($aFile[
'source'] == 
'youtube' ? array(
'ext' => $aFile[
'video']) : array())),
 
  244             $aVars[
'ch_repeat:icons'][] = array (
 
  245                 'id' => $aFile[
'id'],
 
  246                 'icon_url' => $aFile[
'file'],
 
  247                 'title' => $aFile[
'title'],
 
  249             if (
false === 
$aVars[
'title'])
 
  250                 $aVars[
'title'] = $aFile[
'title'];
 
  253         if (!
$aVars[
'ch_repeat:icons'])
 
  256         $this->oTemplate->addCss(
'entry_view.css');
 
  257         return $this->oTemplate->parseHtmlByName(
'entry_view_block_videos.html', 
$aVars);
 
  261         $sContent = parent::getSearchUnitShort($aData);
 
  262         return $this->oTemplate->parseHtmlByContent(
$sContent, array(
 
  268         $sContent = parent::getSearchUnit($aData);
 
  269         return $this->oTemplate->parseHtmlByContent(
$sContent, array(
 
  281             'ownerId' => 
'Owner',
 
  282             'ownerName' => 
'NickName',
 
  284             'voteTime' => 
'gal_date',
 
  285             'source' => 
'Source',