$iVal) {
switch (true) {
case isset($_POST['Delete']):
$oNew->deleteMedia((int)$iVal, $logged);
break;
case isset($_POST['Approve']):
$oNew->approveMedia((int)$iVal);
break;
}
}
}
$aWhere = array();
$aWhere[] = '1';
if (isset($_GET['userID'])) {
$iUser = (int)$_GET['userID'];
$aWhere[] = "`{$oNew->sMainTable}`.`{$oNew->aTableFields['medProfId']}`=$iUser";
}
if (isset($_GET['tag'])) {
$sTag = htmlspecialchars_adv($_GET['tag']);
$aWhere[] = "`{$oNew->sMainTable}`.`{$oNew->aTableFields['medTags']}` like '%$sTag%'";
}
$aSqlQuery['sqlWhere'] = "WHERE " . implode( ' AND ', $aWhere );
$iTotalNum = db_value( "SELECT COUNT( * ) FROM `{$oNew->sMainTable}` {$aSqlQuery['sqlWhere']}" );
if( !$iTotalNum )
$sCode .= '
There are no files
';
$iPerPage = (int)$_GET['per_page'];
if (!$iPerPage)
$iPerPage = 10;
$iTotalPages = ceil( $iTotalNum / $iPerPage );
$iCurPage = (int)$_GET['page'];
if( $iCurPage > $iTotalPages )
$iCurPage = $iTotalPages;
if( $iCurPage < 1 )
$iCurPage = 1;
$sLimitFrom = ( $iCurPage - 1 ) * $iPerPage;
$aSqlQuery['sqlLimit'] = "LIMIT $sLimitFrom, $iPerPage";
$aSqlQuery['sqlOrder'] = "ORDER BY `{$oNew->aTableFields['medDate']}` DESC";
$aManage = array('medID', 'medProfId', 'medTitle', 'medUri', 'medDate', 'medViews', 'medExt', 'Approved');
if ($iTotalNum > 0) {
$aCount = array('total'=>$iTotalPages, 'current'=>$iCurPage, 'per_page'=>$iPerPage);
$rData = $oNew->getFilesList($aSqlQuery, $aManage);
$sCode = browseCode($oNew, $rData, $aCount);
}
TopCodeAdmin();
ContentBlockHead("List of $sBigType files");
echo $sCode;
ContentBlockFoot();
BottomCode();
function browseCode($oNew, $rData, $aCount) {
$sCode = '';
ob_start();
?>
=$sCheckAll?>
$sCode .= ob_get_clean();
$sPagination = $oNew->showPagination($aCount['total'], $aCount['current'], $aCount['per_page'], true);
return $sCode.$sPagination.'';
}
?>