本文整理汇总了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();
示例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();