本文整理汇总了PHP中DocumentManager::get_all_document_data方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentManager::get_all_document_data方法的具体用法?PHP DocumentManager::get_all_document_data怎么用?PHP DocumentManager::get_all_document_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::get_all_document_data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
if (Security::check_abs_path($cwd, api_get_path(SYS_PATH))) {
die;
}
// check if user can delete files. He must be manager and be inside /videoconf
$is_below_videoconf_dir = substr($cwd, 0, strlen(VIDEOCONF_UPLOAD_PATH)) == VIDEOCONF_UPLOAD_PATH;
if ($debug > 0) {
error_log('Current working directory: ' . $cwd);
}
if ($debug > 0) {
error_log('Videoconf upload path: ' . VIDEOCONF_UPLOAD_PATH);
}
/* $canDelete = ($canDelete && $isBellowVideoConfUploadPath);
*/
$can_delete = $is_manager && $is_below_videoconf_dir;
// get files list
$files = DocumentManager::get_all_document_data($_course, $cwd, 0, null, false);
printf("<dokeosobject><fileListMeta></fileListMeta><fileList>");
printf("<folders>");
// title filter
if (is_array($files)) {
foreach (array_keys($files) as $k) {
// converting to UTF-8
$files[$k]['title'] = api_convert_encoding(api_strlen($files[$k]['title']) > 32 ? api_substr($files[$k]['title'], 0, 32) . "..." : $files[$k]['title'], 'utf-8', api_get_system_encoding());
// removing '<', '>' and '_'
$files[$k]['title'] = str_replace(array('<', '>', '_'), ' ', $files[$k]['title']);
}
}
if (is_array($files)) {
foreach ($files as $i) {
if ($i["filetype"] == "folder") {
printf('<folder><path>%s</path><title>%s</title><canDelete>%s</canDelete></folder>', $i['path'], $i['title'], $can_delete ? 'true' : 'false');
示例2: foreach
foreach ($group_list as $group_data) {
$quota_percentage = 0;
$my_group_id = $group_data['id'];
$quota_bytes = intval(DocumentManager::documents_total_space($course_id, $my_group_id, 0));
if (!empty($quota_bytes)) {
$quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100;
}
if ($group_id == $my_group_id) {
$group_data['name'] = $group_data['name'] . ' * ';
}
$used_quota_bytes += $quota_bytes;
$session[] = array(addslashes(get_lang('Group') . ': ' . $group_data['name']) . ' (' . format_file_size($quota_bytes) . ')', $quota_percentage);
}
}
//Showing weight of documents uploaded by user
$document_list = DocumentManager::get_all_document_data($_course);
if (is_array($document_list)) {
foreach ($document_list as $document_data) {
if ($document_data['insert_user_id'] == api_get_user_id() && $document_data['filetype'] == 'file') {
$quota_bytes += $document_data['size'];
}
}
if ($quota_bytes != 0) {
$quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100;
}
$session[] = array(addslashes(get_lang('Teacher') . ': ' . $user_name) . ' (' . format_file_size($quota_bytes) . ')', $quota_percentage);
//if a sesson is active
if ($session_id != 0) {
if (!empty($course_list)) {
$total_courses_quota = 0;
$total_quota_bytes = 0;
示例3: array
if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isset($_GET['set_certificate']) && $_GET['set_certificate'] == strval(intval($_GET['set_certificate']))) {
if (isset($_GET['cidReq'])) {
$course_id = Security::remove_XSS($_GET['cidReq']);
// course id
$document_id = Security::remove_XSS($_GET['set_certificate']);
// document id
DocumentManager::attach_gradebook_certificate($course_id, $document_id);
$message = Display::return_message(get_lang('IsDefaultCertificate'), 'normal');
Display::addFlash($message);
}
}
/* GET ALL DOCUMENT DATA FOR CURDIRPATH */
if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
$documentAndFolders = DocumentManager::get_all_document_data($courseInfo, $curdirpath, $groupId, null, $is_allowed_to_edit || $group_member_with_upload_rights, true);
} else {
$documentAndFolders = DocumentManager::get_all_document_data($courseInfo, $curdirpath, $groupId, null, $is_allowed_to_edit || $group_member_with_upload_rights, false);
}
if ($groupId != 0) {
$userAccess = GroupManager::user_has_access(api_get_user_id(), $groupId, GroupManager::GROUP_TOOL_DOCUMENTS);
if ($userAccess) {
$folders = DocumentManager::get_all_document_folders($courseInfo, $groupId, $is_allowed_to_edit || $group_member_with_upload_rights);
}
} else {
$folders = DocumentManager::get_all_document_folders($courseInfo, $groupId, $is_allowed_to_edit || $group_member_with_upload_rights);
}
if (!isset($folders) || $folders === false) {
$folders = array();
}
$btngroup = array('class' => 'btn btn-default');
/* GO TO PARENT DIRECTORY */
$actionsLeft = '';
示例4: api_protect_course_script
/* Integrate svg-edit libraries with Chamilo default documents
* @author Juan Carlos Raña Trabado
* @since 25/september/2010
*/
//Chamilo load libraries
require_once '../../../../../inc/global.inc.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$curdirpath = '/images/gallery';
//path of library directory
$course_info = api_get_course_info();
//get all files and folders
$docs_and_folders = DocumentManager::get_all_document_data($course_info, $curdirpath, 0, null, $is_allowed_to_edit, false);
//get all filenames
$array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array();
if (count($array_to_search) > 0) {
while (list($key) = each($array_to_search)) {
$all_files[] = basename($array_to_search[$key]['path']);
}
}
//get all svg and png files
$accepted_extensions = array('.svg', '.png');
if (is_array($all_files) && count($all_files) > 0) {
foreach ($all_files as &$file) {
$slideshow_extension = strrchr($file, '.');
$slideshow_extension = strtolower($slideshow_extension);
if (in_array($slideshow_extension, $accepted_extensions)) {
$png_svg_files[] = $file;
示例5: array
// Attach certificate in the gradebook
if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isset($_GET['set_certificate']) && $_GET['set_certificate'] == strval(intval($_GET['set_certificate']))) {
if (isset($_GET['cidReq'])) {
$course_id = Security::remove_XSS($_GET['cidReq']);
// course id
$document_id = Security::remove_XSS($_GET['set_certificate']);
// document id
DocumentManager::attach_gradebook_certificate($course_id, $document_id);
Display::display_normal_message(get_lang('IsDefaultCertificate'));
}
}
/* GET ALL DOCUMENT DATA FOR CURDIRPATH */
if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
$docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, true);
} else {
$docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, false);
}
$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit || $group_member_with_upload_rights);
if ($folders === false) {
$folders = array();
}
$table_footer = '';
$total_size = 0;
if (isset($docs_and_folders) && is_array($docs_and_folders)) {
// Create a sortable table with our data
$sortable_data = array();
$count = 1;
foreach ($docs_and_folders as $key => $document_data) {
$row = array();
$row['id'] = $document_data['id'];
//$row['type'] = $document_data['filetype'];
示例6: api_protect_course_script
/* Integrate svg-edit libraries with Chamilo default documents
* @author Juan Carlos Raña Trabado
* @since 25/september/2010
*/
require_once '../../../../../inc/global.inc.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$course_info = api_get_course_info();
$group_properties = GroupManager::get_group_properties(api_get_group_id());
$groupdirpath = $group_properties['directory'];
$group_disk_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $groupdirpath . '/';
$group_web_path = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document' . $groupdirpath . '/';
//get all group files and folders
$docs_and_folders = DocumentManager::get_all_document_data($course_info, $groupdirpath, api_get_group_id(), null, $is_allowed_to_edit, false);
//get all group filenames
$array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array();
if (count($array_to_search) > 0) {
while (list($key) = each($array_to_search)) {
$all_files[] = basename($array_to_search[$key]['path']);
}
}
//get all svg and png group files
$accepted_extensions = array('.svg', '.png');
if (is_array($all_files) && count($all_files) > 0) {
foreach ($all_files as &$file) {
$slideshow_extension = strrchr($file, '.');
$slideshow_extension = strtolower($slideshow_extension);
if (in_array($slideshow_extension, $accepted_extensions)) {
$png_svg_files[] = $file;