本文整理匯總了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'];
}