本文整理汇总了PHP中DocumentManager::is_visible_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentManager::is_visible_by_id方法的具体用法?PHP DocumentManager::is_visible_by_id怎么用?PHP DocumentManager::is_visible_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::is_visible_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFileAction
/**
* @param string $courseCode
* @param string $fileName
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function getFileAction($courseCode, $fileName)
{
$courseInfo = api_get_course_info($courseCode);
$sessionId = $this->getRequest()->get('id_session');
$docId = \DocumentManager::get_document_id($courseInfo, "/" . $fileName);
$filePath = null;
if ($docId) {
$isVisible = \DocumentManager::is_visible_by_id($docId, $courseInfo, $sessionId, api_get_user_id());
$documentData = \DocumentManager::get_document_data_by_id($docId, $courseCode);
$filePath = $documentData['absolute_path'];
event_download($filePath);
}
if (!api_is_allowed_to_edit() && !$isVisible) {
$this->abort(500);
}
return $this->sendFile($filePath);
}
示例2: array
$actionsRight = $form->returnForm();
}
$table_footer = '';
$total_size = 0;
$sortable_data = array();
if (isset($documentAndFolders) && is_array($documentAndFolders)) {
if ($groupId == 0 || GroupManager::user_has_access($userId, $groupId, GroupManager::GROUP_TOOL_DOCUMENTS)) {
$count = 1;
$countedPaths = array();
$countedPaths = array();
foreach ($documentAndFolders as $key => $document_data) {
$row = array();
$row['id'] = $document_data['id'];
$row['type'] = $document_data['filetype'];
// If the item is invisible, wrap it in a span with class invisible.
$is_visible = DocumentManager::is_visible_by_id($document_data['id'], $courseInfo, $sessionId, api_get_user_id(), false);
$invisibility_span_open = $is_visible == 0 ? '<span class="muted">' : '';
$invisibility_span_close = $is_visible == 0 ? '</span>' : '';
// Size (or total size of a directory)
$size = $document_data['filetype'] == 'folder' ? get_total_folder_size($document_data['path'], $is_allowed_to_edit) : $document_data['size'];
// Get the title or the basename depending on what we're using
if ($document_data['title'] != '') {
$document_name = $document_data['title'];
} else {
$document_name = basename($document_data['path']);
}
$row['name'] = $document_name;
// Data for checkbox
if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($documentAndFolders) > 1) {
$row[] = $document_data['id'];
}