• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP file_get_drafarea_folders函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中file_get_drafarea_folders函数的典型用法代码示例。如果您正苦于以下问题:PHP file_get_drafarea_folders函数的具体用法?PHP file_get_drafarea_folders怎么用?PHP file_get_drafarea_folders使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了file_get_drafarea_folders函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: array

 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();
     break;
 case 'mkdirform':
     echo $OUTPUT->header();
     echo $OUTPUT->container_start();
     echo html_writer::link($home_url, get_string('back', 'repository'));
     echo $OUTPUT->container_end();
     $home_url->param('draftpath', $draftpath);
     $home_url->param('action', 'mkdir');
     echo ' <form method="post" action="' . $home_url->out() . '">';
     echo html_writer::label(get_string('entername', 'repository'), 'newdirname', array('class' => 'accesshide'));
     echo '  <input name="newdirname" id="newdirname" type="text" />';
     echo '  <input name="draftpath" type="hidden" value="' . s($draftpath) . '" />';
     echo '  <input type="submit" value="' . s(get_string('makeafolder', 'moodle')) . '" />';
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:draftfiles_manager.php


示例2: switch

//NOTE TO ALL DEVELOPERS: this script must deal only with draft area of current user, it has to use only file_storage and no file_browser!!
//
switch ($action) {
    case 'dir':
        $data = new stdClass();
        file_get_drafarea_folders($draftid, $filepath, $data);
        echo json_encode($data);
        die;
    case 'list':
        $filepath = optional_param('filepath', '/', PARAM_PATH);
        $data = repository::prepare_listing(file_get_drafarea_files($draftid, $filepath));
        $info = file_get_draft_area_info($draftid);
        $data->filecount = $info['filecount'];
        $data->filesize = $info['filesize'];
        $data->tree = new stdClass();
        file_get_drafarea_folders($draftid, '/', $data->tree);
        echo json_encode($data);
        die;
    case 'mkdir':
        $filepath = required_param('filepath', PARAM_PATH);
        $newdirname = required_param('newdirname', PARAM_FILE);
        $fs = get_file_storage();
        $fs->create_directory($user_context->id, 'user', 'draft', $draftid, file_correct_filepath(file_correct_filepath($filepath) . $newdirname));
        $return = new stdClass();
        $return->filepath = $filepath;
        echo json_encode($return);
        die;
    case 'delete':
        $filename = required_param('filename', PARAM_FILE);
        $filepath = required_param('filepath', PARAM_PATH);
        $fs = get_file_storage();
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:draftfiles_ajax.php


示例3: file_get_drafarea_folders

/**
 * Generate a folder tree of draft area of current USER recursively
 *
 * @todo MDL-31073 use normal return value instead, this does not fit the rest of api here (skodak)
 * @param int $draftitemid
 * @param string $filepath
 * @param mixed $data
 */
function file_get_drafarea_folders($draftitemid, $filepath, &$data)
{
    global $USER, $OUTPUT, $CFG;
    $data->children = array();
    $context = context_user::instance($USER->id);
    $fs = get_file_storage();
    if ($files = $fs->get_directory_files($context->id, 'user', 'draft', $draftitemid, $filepath, false)) {
        foreach ($files as $file) {
            if ($file->is_directory()) {
                $item = new stdClass();
                $item->sortorder = $file->get_sortorder();
                $item->filepath = $file->get_filepath();
                $foldername = explode('/', trim($item->filepath, '/'));
                $item->fullname = trim(array_pop($foldername), '/');
                $item->id = uniqid();
                file_get_drafarea_folders($draftitemid, $item->filepath, $item);
                $data->children[] = $item;
            } else {
                continue;
            }
        }
    }
}
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:31,代码来源:filelib.php


示例4: print_error

    print_error('noguest');
}
require_sesskey();
$action = required_param('action', PARAM_ALPHA);
$draftid = required_param('itemid', PARAM_INT);
$filepath = optional_param('filepath', '/', PARAM_PATH);
$user_context = get_context_instance(CONTEXT_USER, $USER->id);
echo $OUTPUT->header();
// send headers
//
//NOTE TO ALL DEVELOPERS: this script must deal only with draft area of current user, it has to use only file_storage and no file_browser!!
//
switch ($action) {
    case 'dir':
        $data = new stdClass();
        file_get_drafarea_folders($draftid, $filepath, $data);
        echo json_encode($data);
        die;
    case 'list':
        $filepath = optional_param('filepath', '/', PARAM_PATH);
        $data = file_get_drafarea_files($draftid, $filepath);
        echo json_encode($data);
        die;
    case 'mkdir':
        $filepath = required_param('filepath', PARAM_PATH);
        $newdirname = required_param('newdirname', PARAM_FILE);
        $fs = get_file_storage();
        $fs->create_directory($user_context->id, 'user', 'draft', $draftid, file_correct_filepath(file_correct_filepath($filepath) . $newdirname));
        $return = new stdClass();
        $return->filepath = $filepath;
        echo json_encode($return);
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:draftfiles_ajax.php



注:本文中的file_get_drafarea_folders函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_get_draft_area_info函数代码示例发布时间:2022-05-15
下一篇:
PHP file_get_drafarea_files函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap