當前位置: 首頁>>代碼示例>>PHP>>正文


PHP repository::update_draftfile方法代碼示例

本文整理匯總了PHP中repository::update_draftfile方法的典型用法代碼示例。如果您正苦於以下問題:PHP repository::update_draftfile方法的具體用法?PHP repository::update_draftfile怎麽用?PHP repository::update_draftfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在repository的用法示例。


在下文中一共展示了repository::update_draftfile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: zip_packer

     break;
 case 'unzip':
     $zipper = new zip_packer();
     $file = $fs->get_file($user_context->id, 'user', 'draft', $itemid, $draftpath, $filename);
     if ($newfile = $file->extract_to_storage($zipper, $user_context->id, 'user', 'draft', $itemid, $draftpath, $USER->id)) {
         $str = get_string('unzipped', 'repository');
     } else {
         $str = get_string('cannotunzip', 'error');
     }
     $home_url->param('action', 'browse');
     $home_url->param('draftpath', $draftpath);
     redirect($home_url, $str);
     break;
 case 'movefile':
     if (!empty($targetpath)) {
         repository::update_draftfile($itemid, $draftpath, $filename, array('filepath' => $targetpath));
         $home_url->param('action', 'browse');
         $home_url->param('draftpath', $targetpath);
         redirect($home_url);
     }
     echo $OUTPUT->header();
     echo $OUTPUT->container_start();
     echo html_writer::link($home_url, get_string('back', 'repository'));
     echo $OUTPUT->container_end();
     $data = new stdClass();
     $home_url->param('action', 'movefile');
     $home_url->param('draftpath', $draftpath);
     $home_url->param('filename', $filename);
     file_get_drafarea_folders($itemid, '/', $data);
     print_draft_area_tree($data, true, $home_url);
     echo $OUTPUT->footer();
開發者ID:EmmanuelYupit,項目名稱:educursos,代碼行數:31,代碼來源:draftfiles_manager.php

示例2: catch

            $updatedata['author'] = $v;
        }
        try {
            repository::update_draftfile($draftid, $filepath, $filename, $updatedata);
        } catch (moodle_exception $e) {
            die(json_encode((object)array('error' => $e->getMessage())));
        }
        die(json_encode((object)array('filepath' => $newfilepath)));

    case 'updatedir':
        $filepath = required_param('filepath', PARAM_PATH);
        $newdirname = required_param('newdirname', PARAM_FILE);
        $parent = required_param('newfilepath', PARAM_PATH);
        $newfilepath = clean_param($parent . '/' . $newdirname . '/', PARAM_PATH);
        try {
            repository::update_draftfile($draftid, $filepath, '.', array('filepath' => $newfilepath));
        } catch (moodle_exception $e) {
            die(json_encode((object)array('error' => $e->getMessage())));
        }
        die(json_encode((object)array('filepath' => $parent)));

    case 'zip':
        $filepath = required_param('filepath', PARAM_PATH);

        $zipper = get_file_packer('application/zip');
        $fs = get_file_storage();

        $file = $fs->get_file($user_context->id, 'user', 'draft', $draftid, $filepath, '.');

        $parent_path = $file->get_parent_directory()->get_filepath();
開發者ID:ncsu-delta,項目名稱:moodle,代碼行數:30,代碼來源:draftfiles_ajax.php


注:本文中的repository::update_draftfile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。