Example #1
0
if (!isset($_SESSION['uid'])) {
    redirect_visitor();
}
$last_message = isset($_REQUEST['last_message']) ? $_REQUEST['last_message'] : '';
// get a list of documents the user has "view" permission for
// get current user's information-->department
$user_obj = new User($_SESSION['uid'], $pdo);
if (!$user_obj->isRoot()) {
    header('Location:error.php?ec=24');
}
$flag = 0;
if (isset($_GET['submit']) && $_GET['submit'] == 'view_checkedout') {
    echo PHP_EOL . '<form name="table" action="file_ops.php" method="POST">';
    echo PHP_EOL . '<input name="submit" type="hidden" value="Clear Status">';
    draw_header(msg('label_checked_out_files'), $last_message);
    $file_id_array = $user_obj->getCheckedOutFiles();
    $page_url = 'file_ops.php?';
    $user_perm_obj = new UserPermission($_SESSION['uid'], $pdo);
    $list_status = list_files($file_id_array, $user_perm_obj, $GLOBALS['CONFIG']['dataDir'], true, true);
    if ($list_status != -1) {
        echo PHP_EOL . '<BR><div class="buttons"><button class="positive" type="submit" name="submit" value="Clear Status">' . msg('button_clear_status') . '</button></div><br />';
        echo PHP_EOL . '</form>';
    }
    draw_footer();
} elseif (isset($_POST['submit']) && $_POST['submit'] == 'Clear Status') {
    if (isset($_POST["checkbox"])) {
        foreach ($_POST['checkbox'] as $cbox) {
            $file_id = $cbox;
            $file_obj = new FileData($file_id, $pdo);
            $file_obj->setStatus(0);
        }