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

Commit

Permalink
Fix and remove old blocks
Browse files Browse the repository at this point in the history
+ Fix some and remove some ...
+ Tag 0.1.08
  • Loading branch information
anhyeuviolet committed Jan 30, 2016
1 parent 950b461 commit 8a425e7
Show file tree
Hide file tree
Showing 35 changed files with 455 additions and 1,281 deletions.
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id="0"
type="module"
name="videos"
version="0.1.07"
version="0.1.08"

[author]
name="KENNYNGUYEN"
Expand Down
6 changes: 3 additions & 3 deletions modules/videos/blocks/global.block_category.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<block>
<info>
<name>Block Categories</name>
<name>Block Videos Categories</name>
<author>VinaDes.,Jsc</author>
<website>http://vinades.vn</website>
<description></description>
Expand All @@ -10,6 +10,6 @@
<catid>22</catid>
<title_length>22</title_length>
</config>
<datafunction>nv_block_config_news_category</datafunction>
<submitfunction>nv_block_config_news_category_submit</submitfunction>
<datafunction>nv_block_config_videos_category</datafunction>
<submitfunction>nv_block_config_videos_category_submit</submitfunction>
</block>
18 changes: 9 additions & 9 deletions modules/videos/blocks/global.block_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
if( !defined( 'NV_MAINFILE' ) )
die( 'Stop!!!' );

if( !nv_function_exists( 'nv_news_category' ) )
if( !nv_function_exists( 'nv_videos_category' ) )
{

function nv_block_config_news_category( $module, $data_block, $lang_block )
function nv_block_config_videos_category( $module, $data_block, $lang_block )
{
global $site_mods;
global $site_mods, $nv_Cache;

$html_input = '';
$html = '<tr>';
Expand Down Expand Up @@ -63,7 +63,7 @@ function nv_block_config_news_category( $module, $data_block, $lang_block )
return $html;
}

function nv_block_config_news_category_submit( $module, $lang_block )
function nv_block_config_videos_category_submit( $module, $lang_block )
{
global $nv_Request;
$return = array( );
Expand All @@ -74,11 +74,11 @@ function nv_block_config_news_category_submit( $module, $lang_block )
return $return;
}

function nv_news_category( $block_config )
function nv_videos_category( $block_config )
{
global $module_array_cat, $module_info, $lang_module, $global_config;

if( file_exists( NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_category.tpl' ) )
if( file_exists( NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/videos/block_category.tpl' ) )
{
$block_theme = $global_config['module_theme'];
}
Expand All @@ -87,7 +87,7 @@ function nv_news_category( $block_config )
$block_theme = 'default';
}

$xtpl = new XTemplate( 'block_category.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news' );
$xtpl = new XTemplate( 'block_category.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/videos' );

if( !empty( $module_array_cat ) )
{
Expand Down Expand Up @@ -145,7 +145,7 @@ function nv_news_sub_category( $list_sub, $title_length )

if( defined( 'NV_SYSTEM' ) )
{
global $site_mods, $module_name, $global_array_cat, $module_array_cat;
global $site_mods, $module_name, $global_array_cat, $module_array_cat, $nv_Cache;
$module = $block_config['module'];
if( isset( $site_mods[$module] ) )
{
Expand All @@ -165,6 +165,6 @@ function nv_news_sub_category( $list_sub, $title_length )
$module_array_cat[$l['catid']]['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module . "&amp;" . NV_OP_VARIABLE . "=" . $l['alias'];
}
}
$content = nv_news_category( $block_config );
$content = nv_videos_category( $block_config );
}
}
4 changes: 2 additions & 2 deletions modules/videos/blocks/global.block_groups.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
<tooltip_position>bottom</tooltip_position>
<tooltip_length>150</tooltip_length>
</config>
<datafunction>nv_block_config_news_groups</datafunction>
<submitfunction>nv_block_config_news_groups_submit</submitfunction>
<datafunction>nv_block_config_videos_groups</datafunction>
<submitfunction>nv_block_config_videos_groups_submit</submitfunction>
</block>
110 changes: 85 additions & 25 deletions modules/videos/blocks/global.block_groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,72 @@

if( ! defined( 'NV_MAINFILE' ) ) die( 'Stop!!!' );

if( ! nv_function_exists( 'nv_block_news_groups' ) )
if( ! nv_function_exists( 'videos_thumbs' ) )
{
function nv_block_config_news_groups( $module, $data_block, $lang_block )
function videos_thumbs( $id, $file, $module_upload, $width = 200, $height = 150, $quality = 90 )
{
global $site_mods;
if( $width >= $height ) $rate = $width / $height;
else $rate = $height / $width;

$image = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/img/' . $file;

if( $file != '' and file_exists( $image ) )
{
$imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/img/' . $file;
$imginfo = nv_is_image( $image );

$basename = $module_upload . '_' . $width . 'x' . $height . '-' . $id . '-' . md5_file( $image ) . '.' . $imginfo['ext'];

if( file_exists( NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload. '/thumbs/' . $basename ) )
{
$imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload. '/thumbs/' . $basename;
}
else
{

$_image = new NukeViet\Files\Image( $image, NV_MAX_WIDTH, NV_MAX_HEIGHT );

if( $imginfo['width'] <= $imginfo['height'] )
{
$_image->resizeXY( $width, 0 );

}
elseif( ( $imginfo['width'] / $imginfo['height'] ) < $rate )
{
$_image->resizeXY( $width, 0 );
}
elseif( ( $imginfo['width'] / $imginfo['height'] ) >= $rate )
{
$_image->resizeXY( 0, $height );
}

$_image->cropFromCenter( $width, $height );

$_image->save( NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/', $basename, $quality );

if( file_exists( NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload. '/thumbs/' . $basename ) )
{
$imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload. '/thumbs/' . $basename;
}
}
}
elseif( nv_is_url( $file ) )
{
$imgsource = $file;
}
else
{
$imgsource = '';
}
return $imgsource;
}
}

if( ! nv_function_exists( 'nv_block_videos_groups' ) )
{
function nv_block_config_videos_groups( $module, $data_block, $lang_block )
{
global $site_mods, $nv_Cache;

$html_input = '';
$html = '';
Expand Down Expand Up @@ -59,7 +120,7 @@ function nv_block_config_news_groups( $module, $data_block, $lang_block )
return $html;
}

function nv_block_config_news_groups_submit( $module, $lang_block )
function nv_block_config_videos_groups_submit( $module, $lang_block )
{
global $nv_Request;
$return = array();
Expand All @@ -73,11 +134,15 @@ function nv_block_config_news_groups_submit( $module, $lang_block )
return $return;
}

function nv_block_news_groups( $block_config )
function nv_block_videos_groups( $block_config )
{
global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db;
global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db, $nv_Cache;
$module = $block_config['module'];
$show_no_image = $module_config[$module]['show_no_image'];
if(empty($show_no_image))
{
$show_no_image = 'themes/default/images/' . $module . '/' . 'video_placeholder.png';
}
$blockwidth = $module_config[$module]['blockwidth'];

$db->sqlreset()
Expand All @@ -91,39 +156,34 @@ function nv_block_news_groups( $block_config )

if( ! empty( $list ) )
{
if( file_exists( NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_groups.tpl' ) )
if( file_exists( NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/videos/block_groups.tpl' ) )
{
$block_theme = $global_config['module_theme'];
}
else
{
$block_theme = 'default';
}
$xtpl = new XTemplate( 'block_groups.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news' );
$xtpl = new XTemplate( 'block_groups.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/videos' );
foreach( $list as $l )
{
$l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl'];
if( $l['homeimgthumb'] == 1 )
if( $l['homeimgthumb'] == 1 OR $l['homeimgthumb'] == 2 ) //image file
{
$l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile'];
$l['thumb'] = videos_thumbs($l['id'], $l['homeimgfile'], $module, $module_config[$module]['homewidth'], $module_config[$module]['homeheight'], 90 );
}
elseif( $l['homeimgthumb'] == 2 )
{
$l['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile'];
}
elseif( $l['homeimgthumb'] == 3 )
elseif( $l['homeimgthumb'] == 3 ) //image url
{
$l['thumb'] = $l['homeimgfile'];
}
elseif( ! empty( $show_no_image ) )
elseif( ! empty( $show_no_image ) ) //no image
{
$l['thumb'] = NV_BASE_SITEURL . $show_no_image;
}
else
{
$l['thumb'] = '';
}

$l['blockwidth'] = $blockwidth;

$l['hometext'] = nv_clean60( $l['hometext'], $block_config['tooltip_length'], true );
Expand All @@ -135,23 +195,23 @@ function nv_block_news_groups( $block_config )

$xtpl->assign( 'ROW', $l );
if( ! empty( $l['thumb'] ) ) $xtpl->parse( 'main.loop.img' );

if( $block_config['showtooltip'] )
{
$xtpl->assign( 'TOOLTIP_POSITION', $block_config['tooltip_position'] );
$xtpl->parse( 'main.loop.tooltip' );
}
$xtpl->parse( 'main.loop' );
}

if( $block_config['showtooltip'] )
{
$xtpl->assign( 'TOOLTIP_POSITION', $block_config['tooltip_position'] );
$xtpl->parse( 'main.tooltip' );
}

$xtpl->parse( 'main' );
return $xtpl->text( 'main' );
}
}
}
if( defined( 'NV_SYSTEM' ) )
{
global $site_mods, $module_name, $global_array_cat, $module_array_cat;
global $site_mods, $module_name, $global_array_cat, $module_array_cat, $nv_Cache;
$module = $block_config['module'];
if( isset( $site_mods[$module] ) )
{
Expand All @@ -171,6 +231,6 @@ function nv_block_news_groups( $block_config )
$module_array_cat[$l['catid']]['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $l['alias'];
}
}
$content = nv_block_news_groups( $block_config );
$content = nv_block_videos_groups( $block_config );
}
}
13 changes: 9 additions & 4 deletions modules/videos/blocks/global.block_groups_multi_tabs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@

<language>
<vi>
<blockid>Nhóm tin</blockid>
<numrow>Số bản tin</numrow>
<blockid>Nhóm Videos</blockid>
<numrow>Số videos</numrow>
<title_length>Độ dài tiêu đề</title_length>
</vi>
<en>
<blockid>Groups Videos</blockid>
<numrow>How many Video(s) ?</numrow>
<title_length>Length of title</title_length>
</en>
</language>
<datafunction>nv_block_config_news_groups_multi_tabs</datafunction>
<submitfunction>nv_block_config_news_groups_multi_tabs_submit</submitfunction>
<datafunction>nv_block_config_videos_groups_multi_tabs</datafunction>
<submitfunction>nv_block_config_videos_groups_multi_tabs_submit</submitfunction>
</block>
Loading

0 comments on commit 8a425e7

Please sign in to comment.