コード例 #1
0
ファイル: index.php プロジェクト: ilosada/chamilo-lms-icpna
        Display::display_confirmation_message($return_information['message']);
    }
    if ($return_information['type'] == 'error') {
        Display::display_error_message(get_lang('FormHasErrorsPleaseComplete') . '<br />' . $return_information['message']);
        display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction);
    }
}
// Move a File
if (($action == 'movesent' or $action == 'movereceived') and isset($_GET['move_id'])) {
    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
        api_not_allowed();
    }
    display_move_form(str_replace('move', '', $action), $_GET['move_id'], get_dropbox_categories(str_replace('move', '', $action)), $sort_params, $viewReceivedCategory, $viewSentCategory, $view);
}
if (isset($_POST['do_move'])) {
    Display::display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part']));
}
// Delete a file
if (($action == 'deletereceivedfile' or $action == 'deletesentfile') and isset($_GET['id']) and is_numeric($_GET['id'])) {
    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
        api_not_allowed();
    }
    $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
    if ($action == 'deletereceivedfile') {
        $dropboxfile->deleteReceivedWork($_GET['id']);
        $message = get_lang('ReceivedFileDeleted');
    }
    if ($action == 'deletesentfile') {
        $dropboxfile->deleteSentWork($_GET['id']);
        $message = get_lang('SentFileDeleted');
    }
コード例 #2
0
/**
* This function is a wrapper function for the multiple actions feature.
* @return   Mixed   If there is a problem, return a string message, otherwise nothing
* @author   Patrick Cool <*****@*****.**>, Ghent University
* @version  march 2006
*/
function handle_multiple_actions()
{
    $_user = api_get_user_info();
    $is_courseAdmin = api_is_course_admin();
    $is_courseTutor = api_is_course_tutor();
    // STEP 1: are we performing the actions on the received or on the sent files?
    if ($_POST['action'] == 'delete_received' || $_POST['action'] == 'download_received') {
        $part = 'received';
    } elseif ($_POST['action'] == 'delete_sent' || $_POST['action'] == 'download_sent') {
        $part = 'sent';
    }
    // STEP 2: at least one file has to be selected. If not we return an error message
    $ids = isset($_GET['id']) ? $_GET['id'] : array();
    if (count($ids) > 0) {
        $checked_file_ids = $_POST['id'];
    } else {
        foreach ($_POST as $key => $value) {
            if (strstr($value, $part . '_') and $key != 'view_received_category' and $key != 'view_sent_category') {
                $checked_files = true;
                $checked_file_ids[] = intval(substr($value, strrpos($value, '_')));
            }
        }
    }
    $checked_file_ids = $_POST['id'];
    if (!is_array($checked_file_ids) || count($checked_file_ids) == 0) {
        return get_lang('CheckAtLeastOneFile');
    }
    // STEP 3A: deleting
    if ($_POST['action'] == 'delete_received' || $_POST['action'] == 'delete_sent') {
        $dropboxfile = new Dropbox_Person($_user['user_id'], $is_courseAdmin, $is_courseTutor);
        foreach ($checked_file_ids as $key => $value) {
            if ($_GET['view'] == 'received') {
                $dropboxfile->deleteReceivedWork($value);
                $message = get_lang('ReceivedFileDeleted');
            }
            if ($_GET['view'] == 'sent' or empty($_GET['view'])) {
                $dropboxfile->deleteSentWork($value);
                $message = get_lang('SentFileDeleted');
            }
        }
        return $message;
    }
    // STEP 3B: giving comment
    if ($_POST['actions'] == 'comment') {
        // This has not been implemented.
        // The idea was that it would be possible to write the same feedback for the selected documents.
    }
    // STEP 3C: moving
    if (strstr($_POST['action'], 'move_')) {
        // check move_received_n or move_sent_n command
        if (strstr($_POST['action'], 'received')) {
            $part = 'received';
            $to_cat_id = str_replace('move_received_', '', $_POST['action']);
        } else {
            $part = 'sent';
            $to_cat_id = str_replace('move_sent_', '', $_POST['action']);
        }
        foreach ($checked_file_ids as $value) {
            store_move($value, $to_cat_id, $part);
        }
        return get_lang('FilesMoved');
    }
    // STEP 3D: downloading
    if ($_POST['action'] == 'download_sent' || $_POST['action'] == 'download_received') {
        zip_download($checked_file_ids);
    }
}