Skip to content
This repository has been archived by the owner on Aug 22, 2021. It is now read-only.

Commit

Permalink
Re-added Related Videos
Browse files Browse the repository at this point in the history
  • Loading branch information
anhyeuviolet committed Jun 30, 2016
1 parent 7be739d commit a3b6c7b
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 20 deletions.
26 changes: 18 additions & 8 deletions modules/videos/admin/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
$array_config['indexfile'] = $nv_Request->get_title('indexfile', 'post', '', 1);
$array_config['per_page'] = $nv_Request->get_int('per_page', 'post', 0);
$array_config['st_links'] = $nv_Request->get_int('st_links', 'post', 0);
$array_config['per_line'] = $nv_Request->get_int('per_line', 'post', 0);
$array_config['homewidth'] = $nv_Request->get_int('homewidth', 'post', 0);
$array_config['homeheight'] = $nv_Request->get_int('homeheight', 'post', 0);
$array_config['blockwidth'] = $nv_Request->get_int('blockwidth', 'post', 0);
Expand Down Expand Up @@ -239,20 +240,29 @@
$xtpl->parse('main.per_page');
}

// Bai viet chi hien thi link
$_st = array(

for ($i = 0; $i <= 30; ++ $i) {
$xtpl->assign('ST_LINKS', array(
'key' => $i,
'title' => $i,
'selected' => $i == $module_config[$module_name]['st_links'] ? ' selected="selected"' : ''
));
$xtpl->parse('main.st_links');
}

$per_line = array(
3,
4,
6,
8
);
foreach ($_st as $_st_i) {
$xtpl->assign('ST_LINKS', array(
'key' => $_st_i,
'title' => $_st_i,
'selected' => $_st_i == $module_config[$module_name]['st_links'] ? ' selected="selected"' : ''
foreach ($per_line as $per_line_i) {
$xtpl->assign('PER_LINE', array(
'key' => $per_line_i,
'title' => $per_line_i,
'selected' => $per_line_i == $module_config[$module_name]['per_line'] ? ' selected="selected"' : ''
));
$xtpl->parse('main.st_links');
$xtpl->parse('main.per_line');
}

// Show points rating article on google
Expand Down
19 changes: 16 additions & 3 deletions modules/videos/funcs/detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
if ( $st_links > 0)
{
$db->sqlreset()
->select( 'id, title, alias, publtime, homeimgfile, homeimgthumb, hometext' )
->select( '*' )
->from( NV_PREFIXLANG . '_' . $module_data . '_' . $catid )
->where( 'status=1 AND publtime > ' . $publtime )
->order( 'id ASC' )
Expand All @@ -181,14 +181,21 @@
{
$row['imghome'] = '';
}
$row['uploader_name'] = $global_array_uploader[$row['admin_id']]['uploader_name'];
$row['uploader_link'] = $global_array_uploader[$row['admin_id']]['link'];
$row['uploader_gravatar'] = $global_array_uploader[$row['admin_id']]['uploader_gravatar'];

$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$catid]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
$related_new_array[] = array(
'title' => $row['title'],
'time' => $row['publtime'],
'link' => $link,
'uploader_name' => $row['uploader_name'],
'uploader_link' => $row['uploader_link'],
'uploader_gravatar' => $row['uploader_gravatar'],
'newday' => $global_array_cat[$catid]['newday'],
'hometext' => $row['hometext'],
'homeimgthumb' => $row['homeimgthumb'],
'imghome' => $row['imghome']
);
}
Expand All @@ -197,7 +204,7 @@
sort( $related_new_array, SORT_NUMERIC );

$db->sqlreset()
->select( 'id, title, alias, publtime, homeimgfile, homeimgthumb, hometext' )
->select( '*' )
->from( NV_PREFIXLANG . '_' . $module_data . '_' . $catid )
->where( 'status=1 AND publtime < ' . $publtime )
->order( 'id DESC' )
Expand All @@ -222,12 +229,18 @@
{
$row['imghome'] = '';
}

$row['uploader_name'] = $global_array_uploader[$row['admin_id']]['uploader_name'];
$row['uploader_link'] = $global_array_uploader[$row['admin_id']]['link'];
$row['uploader_gravatar'] = $global_array_uploader[$row['admin_id']]['uploader_gravatar'];

$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$catid]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
$related_array[] = array(
'title' => $row['title'],
'time' => $row['publtime'],
'link' => $link,
'uploader_name' => $row['uploader_name'],
'uploader_link' => $row['uploader_link'],
'uploader_gravatar' => $row['uploader_gravatar'],
'newday' => $global_array_cat[$catid]['newday'],
'hometext' => $row['hometext'],
'homeimgthumb' => $row['homeimgthumb'],
Expand Down
2 changes: 2 additions & 0 deletions modules/videos/funcs/viewcat.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@

$item['newday'] = $global_array_cat[$catid_i]['newday'];
$item['link'] = $global_array_cat[$catid_i]['link'] . '/' . $item['alias'] . '-' . $item['id'] . $global_config['rewrite_exturl'];
$item['uploader_name'] = $global_array_uploader[$item['admin_id']]['uploader_name'];
$item['uploader_link'] = $global_array_uploader[$item['admin_id']]['link'];
$array_cat_other[$key]['content'][] = $item;
}

Expand Down
3 changes: 2 additions & 1 deletion modules/videos/language/admin_vi.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
$lang_module['setting_thumbblock'] = 'Kích thước của hình tại các block, tags ';
$lang_module['setting_titlecut'] = 'Cắt ký tự tiêu đề Video';
$lang_module['setting_per_page'] = 'Số Videos được hiển thị trên một trang (Theo từng chuyên mục)';
$lang_module['setting_st_links'] = 'Số Videos trên một dòng (Dạng lưới)';
$lang_module['setting_st_links'] = 'Số Videos liên quan (Xem chi tiết)';
$lang_module['setting_per_line'] = 'Số Videos trên một dòng (Dạng lưới)';
$lang_module['setting_idf_df'] = 'Mặc định';
$lang_module['setting_copyright'] = 'Nội dung hiển thị nếu Videos có lựa chọn giữ bản quyền Videos';
$lang_module['setting_view'] = 'Cấu hình hiển thị';
Expand Down
15 changes: 7 additions & 8 deletions modules/videos/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function viewcat_grid_new($array_catpage, $catid, $generate_page)
$xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
$xtpl->assign('IMGHEIGHT', $module_config[$module_name]['homeheight']);
$xtpl->assign('MODULE_NAME', $module_file);
$per_line = 24 / $module_config[$module_name]['st_links'];
$per_line = 24 / $module_config[$module_name]['per_line'];
$xtpl->assign('PER_LINE', $per_line);

if (($global_array_cat[$catid]['viewdescription'] and $page == 1) or $global_array_cat[$catid]['viewdescription'] == 2) {
Expand Down Expand Up @@ -154,7 +154,7 @@ function viewsubcat_main($viewcat, $array_cat)
$xtpl->assign('MODULE_NAME', $module_file);
$xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
$xtpl->assign('IMGHEIGHT', $module_config[$module_name]['homeheight']);
$per_line = 24 / $module_config[$module_name]['st_links'];
$per_line = 24 / $module_config[$module_name]['per_line'];
$xtpl->assign('PER_LINE', $per_line);

// Hien thi cac chu de con
Expand Down Expand Up @@ -223,6 +223,8 @@ function detail_theme($news_contents, $href_vid, $array_keyword, $related_new_ar
} else {
$template = 'default';
}
$per_line = 24 / $module_config[$module_name]['per_line'];
$xtpl->assign('PER_LINE', $per_line);

$xtpl->assign('TEMPLATE', $template);
$xtpl->assign('MODULE_NAME', $module_name);
Expand Down Expand Up @@ -365,13 +367,10 @@ function detail_theme($news_contents, $href_vid, $array_keyword, $related_new_ar
if (! empty($related_new_array) or ! empty($related_array)) {
if (! empty($related_new_array)) {
foreach ($related_new_array as $key => $related_new_array_i) {
$newday = $related_new_array_i['time'] + (86400 * $related_new_array_i['newday']);
if ($newday >= NV_CURRENTTIME) {
$xtpl->parse('main.others.related_new.loop.newday');
}
$related_new_array_i['time'] = humanTiming($related_new_array_i['time']);
$related_new_array_i['title_cut'] = nv_clean60($related_new_array_i['title'], $module_config[$module_name]['titlecut'], true);
$xtpl->assign('RELATED_NEW', $related_new_array_i);
if ($related_new_array_i['imghome'] != '') {
if ($related_new_array_i['imghome'] != ''){
$xtpl->parse('main.others.related_new.loop.image');
}
$xtpl->parse('main.others.related_new.loop');
Expand All @@ -386,6 +385,7 @@ function detail_theme($news_contents, $href_vid, $array_keyword, $related_new_ar
if ($newday >= NV_CURRENTTIME) {
$xtpl->parse('main.others.related.loop.newday');
}
$related_array_i['title_cut'] = nv_clean60($related_array_i['title'], $module_config[$module_name]['titlecut'], true);
$related_array_i['time'] = humanTiming($related_array_i['time']);
$xtpl->assign('RELATED', $related_array_i);

Expand All @@ -396,7 +396,6 @@ function detail_theme($news_contents, $href_vid, $array_keyword, $related_new_ar
}
$xtpl->parse('main.others.related');
}

$xtpl->parse('main.others');
}

Expand Down
9 changes: 9 additions & 0 deletions themes/admin_default/modules/videos/settings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@
<!-- END: st_links -->
</select></td>
</tr>
<tr>
<th>{LANG.setting_per_line}</th>
<td>
<select class="form-control" name="per_line">
<!-- BEGIN: per_line -->
<option value="{PER_LINE.key}"{PER_LINE.selected}>{PER_LINE.title}</option>
<!-- END: per_line -->
</select></td>
</tr>
<tr>
<th>{LANG.socialbutton}</th>
<td><input type="checkbox" value="1" name="socialbutton"{SOCIALBUTTON}/></td>
Expand Down
70 changes: 70 additions & 0 deletions themes/default/modules/videos/detail.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,76 @@
</div>
<!-- END: comment -->

<!-- BEGIN: others -->
<div class="news_column panel panel-default">
<div class="panel-body other-news">
<!-- BEGIN: related_new -->
<p class="h3"><strong>{LANG.related_new}</strong></p>
<div class="row clearfix related_new">
<!-- BEGIN: loop -->
<div class="col-md-{PER_LINE} col-lg-{PER_LINE} col-sm-12 col-xs-24 videos_list">
<!-- BEGIN: image -->
<div class="videos-home-thumbnail pull-left col-md-24 col-lg-24 col-xs-24">
<a class="clearfix" title="{RELATED_NEW.title}" href="{RELATED_NEW.link}">
<img src="{RELATED_NEW.imghome}" alt="{HOMEIMGALT}" class="imghome img-responsive" width="{IMGWIDTH}" height="{IMGHEIGHT}"/>
</a>
</div>
<!-- END: image -->
<div class="videos-home-info pull-left col-md-24 col-lg-24 col-xs-24">
<h3 class="clearfix">
<a title="{RELATED_NEW.title}" href="{RELATED_NEW.link}">{RELATED_NEW.title_cut}</a>
</h3>
<div class="text-muted">
<ul class="list-unstyled">
<li>{LANG.by}&nbsp;<a href="{RELATED_NEW.uploader_link}" title="{RELATED_NEW.uploader_name}">{RELATED_NEW.uploader_name}</a></li>
<li class="pull-left">{RELATED_NEW.time}</li>
<!-- BEGIN: hitstotal -->
<li class="spacer pull-left"></li>
<li>{RELATED_NEW.hitstotal}&nbsp;{LANG.hits_view}</li>
<!-- END: hitstotal -->
</ul>
</div>
</div>
</div>
<!-- END: loop -->
</div>
<!-- END: related_new -->

<!-- BEGIN: related -->
<p class="h3"><strong>{LANG.related}</strong></p>
<div class="row clearfix related">
<!-- BEGIN: loop -->
<div class="col-md-{PER_LINE} col-lg-{PER_LINE} col-sm-12 col-xs-24 videos_list">
<!-- BEGIN: image -->
<div class="videos-home-thumbnail pull-left col-md-24 col-lg-24 col-xs-24">
<a class="clearfix" title="{RELATED.title}" href="{RELATED.link}">
<img src="{RELATED.imghome}" alt="{HOMEIMGALT}" class="imghome img-responsive" width="{IMGWIDTH}" height="{IMGHEIGHT}"/>
</a>
</div>
<!-- END: image -->
<div class="videos-home-info pull-left col-md-24 col-lg-24 col-xs-24">
<h3 class="clearfix">
<a title="{RELATED.title}" href="{RELATED.link}">{RELATED.title_cut}</a>
</h3>
<div class="text-muted">
<ul class="list-unstyled">
<li>{LANG.by}&nbsp;<a href="{RELATED.uploader_link}" title="{RELATED.uploader_name}">{RELATED.uploader_name}</a></li>
<li class="pull-left">{RELATED.time}</li>
<!-- BEGIN: hitstotal -->
<li class="spacer pull-left"></li>
<li>{RELATED.hitstotal}&nbsp;{LANG.hits_view}</li>
<!-- END: hitstotal -->
</ul>
</div>
</div>
</div>
<!-- END: loop -->
</div>
<!-- END: related -->
</div>
</div>
<!-- END: others -->

<!-- BEGIN: fb_comment -->
<div class="panel panel-default">
<div class="panel-body">
Expand Down

0 comments on commit a3b6c7b

Please sign in to comment.