Code:
<?php
if (!defined('MODULE_FILE')) {
Header('Location: index.php');
exit('Access Denied');
}
//Number of items per page
$perpage = 10;
if (isset($_GET['pagenum'])) {
$pagenum = abs(intval($_GET['pagenum']));
$min = $perpage * ($pagenum - 1);
$max = $min + $perpage;
} else {
$min = 0;
$max = $perpage;
}
require_once 'mainfile.php';
$module_name = basename(dirname(__FILE__));
$index = 0;
if (!defined('INDEX_FILE')) define('INDEX_FILE', false); // Set to FALSE to hide right blocks
if (defined('INDEX_FILE') AND INDEX_FILE === true) {
// auto set right blocks for pre patch 3.1 compatibility
$index = 1;
}
global $db, $prefix, $bgcolor1, $bgcolor3, $bgcolor2, $textcolor1, $module_name;
$result = $db->sql_query('SELECT * FROM `' . $prefix . '_screencasts` ORDER BY pos ASC');
$totalcasts = $db->sql_numrows($result);
$link = 'modules.php?name=' . $module_name;
$sPaginatorHTML = pagenums($link, $totalcasts, $perpage, $max);
include 'header.php';
OpenTable();
if ($sPaginatorHTML) {
echo $sPaginatorHTML;
}
echo '<center>' , "\n" , '<table width="100%" cellpadding="2" cellspacing="1" bgcolor="' , $bgcolor2 , '">' , "\n"
, '<tr><td align="center" colspan="4" class="option"><b><font color="gray">Screencasts</font></b></td></tr>' , "\n";
$result = $db->sql_query('SELECT * FROM `' . $prefix . '_screencasts` ORDER BY pos ASC');
while($row = $db->sql_fetchrow($result, MYSQL_ASSOC)) {
$rid = intval($row['rid']);
$pos = intval($row['pos']);
$rtitle = $row['rtitle'];
$rimg = $row['rimg'];
$rurl = $row['rurl'];
$furl = $row['furl'];
$rdetails = $row['rdetails'];
$one = $row['one'];
echo '<tr bgcolor="' , $bgcolor1 , '" align="center">' , "\n"
, '<td align="left" colspan="2"><a href="' , $rurl , '" class="colorbox"><b>' , $rtitle , '</b></a></td><td align="right"><b>Screencast Image</b></td></tr>' , "\n"
, '<tr bgcolor="' , $bgcolor1 , '"><td width="100%" colspan="2">' , $rdetails , '<br /><br /><b>Duration</b> ' , $one , '<br /><br /><a href="' , $furl , '"><b>Disscusions Forums</b></a></td>'
, '<td align="right"><a href="' , $rurl , '" class="colorbox"><img src="' , $rimg , '" width="150" height="150" /></a></td></tr>'
, '<tr><td colspan="2"></td></tr>';
}
echo '</tr></table><br />';
CloseTable();
include 'footer.php';
function pagenums($link, $totalselected, $perpage, $max) {
global $pagenum, $cfgPaginatorControl;
$pagenum = abs(intval($pagenum));
$usePaginatorControl = true;
$rowsperpage = $perpage + 1;
if ($totalselected < $rowsperpage) {
$usePaginatorControl = false;
}
if ($usePaginatorControl) {
include_once NUKE_CLASSES_DIR . 'class.paginator.php';
include_once NUKE_CLASSES_DIR . 'class.paginator_html.php';
$oPaginator = new Paginator_html($pagenum, $totalselected, $perpage);
$oPaginator->setDefaults($cfgPaginatorControl);
$oPaginator->set_Limit($perpage);
$oPaginator->set_Links($cfgPaginatorControl['iMaxPages']);
$oPaginator->setLink($link);
$oPaginator->setTotalItems(_PAGINATOR_TOTALSTORIES);
$sPaginatorHTML = $oPaginator->getPagerHTML() . '<br />';
return $sPaginatorHTML;
} else {
return false;
}
}
?>
|