<?php
if ( !defined( "SAXUE_CORE_INCLUDE" ) ) {
		include "../../core.php";
} 
saxue_checkpower( 'memberdoing' );
if ( empty( $_REQUEST['pagesize'] ) || !is_numeric( $_REQUEST['pagesize'] ) || !in_array( $_REQUEST['pagesize'], array( '10', '30', '50', '100' ) ) ) $_REQUEST['pagesize'] = 30;
if ( empty( $_REQUEST['page'] ) || !is_numeric( $_REQUEST['page'] ) ) $GLOBALS['_REQUEST']['page'] = 1;
include SAXUE_ROOT_PATH . "/model/member_doing.php";
$doing_handler = &saxuememberdoinghandler :: getinstance( "saxuememberdoinghandler" );
if ( !empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'delete' && !empty( $_REQUEST['ids'] ) && is_array( $_REQUEST['ids'] ) && count( $_REQUEST['ids'] ) > 0 ) {
		$doing_handler -> db -> query( "DELETE FROM " . saxue_dbprefix( "member_doing" ) . " WHERE doid IN(" . implode( ',', $_REQUEST['ids'] ) . ")" );
		if ( empty( $_REQUEST['jumpurl'] ) ) {
				saxue_jumppage( 'doing.php', LANG_DO_SUCCESS );
		} else {
				saxue_jumppage( $_REQUEST['jumpurl'], LANG_DO_SUCCESS );
		}
}
$criteria = new criteriacompo();
if ( !empty( $_REQUEST['keytype'] ) && !empty( $_REQUEST['keyword'] ) ) {
		$criteria -> add( new criteria( $_REQUEST['keytype'], $_REQUEST['keyword'] ) );
} 
if ( isset( $_REQUEST['doing'] ) && $_REQUEST['doing'] != '' ) {
		$criteria -> add( new criteria( 'doing', $_REQUEST['doing'] ) );
} 
$criteria -> setsort( "doid" );
$criteria -> setorder( "DESC" );
$criteria -> setlimit( $_REQUEST['pagesize'] );
$criteria -> setstart( ( $_REQUEST['page'] - 1 ) * $_REQUEST['pagesize'] );
$doing_handler -> queryobjects( $criteria );
$rows = array();
$k = 0;
saxue_getconfigs( "doingtype", 'member' );
while ( $v = $doing_handler -> getobject() ) {
		$rows[$k] = $v -> getvars( "n" );
		$rows[$k]['doname'] = $saxueDoingtype[$rows[$k]['doing']];
		++$k;
} 
include SAXUE_ADMIN_PATH . "/header.php";
$saxueTpl -> assign_by_ref( "rows", $rows );
$saxueTpl -> assign_by_ref( "doingtype", $saxueDoingtype );
include SAXUE_ROOT_PATH . "/lib/util/page.php";
$jumppage = new saxuepage( $doing_handler -> getcount( $criteria ), $_REQUEST['pagesize'], $_REQUEST['page'] );
$jumppage -> setlink( "", true, true );
$saxueTpl -> assign( "url_jumppage", $jumppage -> whole_bar() );
$saxueTpl -> setcaching( 0 );
$saxueTset['saxue_contents_template'] = SAXUE_WEB_PATH . "/member/templates/doing.html";
include SAXUE_ADMIN_PATH . "/footer.php";
