本文整理汇总了PHP中Portfolio::share方法的典型用法代码示例。如果您正苦于以下问题:PHP Portfolio::share方法的具体用法?PHP Portfolio::share怎么用?PHP Portfolio::share使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portfolio
的用法示例。
在下文中一共展示了Portfolio::share方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_work_user_list
//.........这里部分代码省略.........
if (!empty($work_assignment['expires_on']) &&
$work_assignment['expires_on'] != '0000-00-00 00:00:00' &&
$time_expires && ($time_expires < api_strtotime($work['sent_date'], 'UTC'))) {
$add_string = Display::label(get_lang('Expired'), 'important');
}
if (($can_read && $work['accepted'] == '1') ||
($is_author && in_array($work['accepted'], array('1', '0'))) ||
($is_allowed_to_edit || api_is_drh())
) {
// Firstname, lastname, username
$work['firstname'] = Display::div($work['firstname'], array('class' => $class));
$work['lastname'] = Display::div($work['lastname'], array('class' => $class));
if (strlen($work['title']) > 30) {
$short_title = substr($work['title'], 0, 27).'...';
$work['title'] = Display::span($short_title, array('class' => $class, 'title' => $work['title']));
} else {
$work['title'] = Display::div($work['title'], array('class' => $class));
}
// Type.
$work['type'] = build_document_icon_tag('file', $work['url']);
// File name.
$link_to_download = null;
// If URL is present then there's a file to download keep BC.
if ($work['contains_file'] || !empty($work['url'])) {
$link_to_download = '<a href="'.$url.'download.php?id='.$item_id.'&'.api_get_cidreq().'">'.
Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
}
$send_to = Portfolio::share('work', $work['id'], array('style' => 'white-space:nowrap;'));
$feedback = null;
$count = getWorkCommentCount($item_id, $course_info);
if (!is_null($count) && !empty($count)) {
if ($qualification_exists) {
$feedback .= "<br />";
}
$feedback .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
Display::label($count.' '.get_lang('Feedback'), 'info').'</a> ';
}
$work['qualification'] = $qualification_string.$feedback;
$work['qualification_only'] = $qualification_string;
// Date.
$work_date = api_convert_and_format_date($work['sent_date']);
$work['sent_date_from_db'] = $work['sent_date'];
$work['sent_date'] = date_to_str_ago(api_get_local_time($work['sent_date'])) . ' ' . $add_string . '<br />' . $work_date;
// Actions.
$action = '';
if (api_is_allowed_to_edit()) {
$action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a> ';
if ($locked) {
if ($qualification_exists) {
$action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL);
} else {
$action .= Display::return_icon('edit_na.png', get_lang('Comment'),array(), ICON_SIZE_SMALL);
示例2: create_document_link
/**
* Create a html hyperlink depending on if it's a folder or a file
*
* @param array $document_data
* @param int $show_as_icon - if it is true, only a clickable icon will be shown
* @param int $visibility (1/0)
* @param int $show_as_icon - if it is true, only a clickable icon will be shown
* @return string url
*/
public static function create_document_link($document_data, $show_as_icon = false, $counter = null, $visibility)
{
global $dbl_click_id;
$course_info = api_get_course_info();
$www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document';
$webOdflist = DocumentManager::get_web_odf_extension_list();
// Get the title or the basename depending on what we're using
if ($document_data['title'] != '') {
$title = $document_data['title'];
} else {
$title = basename($document_data['path']);
}
$filetype = $document_data['filetype'];
$size = $filetype == 'folder' ? get_total_folder_size($document_data['path'], api_is_allowed_to_edit(null, true)) : $document_data['size'];
$path = $document_data['path'];
$url_path = urlencode($document_data['path']);
// Add class="invisible" on invisible files
$visibility_class = $visibility == false ? ' class="muted"' : '';
$forcedownload_link = null;
$forcedownload_icon = null;
$prevent_multiple_click = null;
if (!$show_as_icon) {
// Build download link (icon)
$forcedownload_link = $filetype == 'folder' ? api_get_self() . '?' . api_get_cidreq() . '&action=downloadfolder&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq() . '&action=download&id=' . $document_data['id'];
// Folder download or file download?
$forcedownload_icon = $filetype == 'folder' ? 'save_pack.png' : 'save.png';
// Prevent multiple clicks on zipped folder download
$prevent_multiple_click = $filetype == 'folder' ? " onclick=\"javascript: if(typeof clic_{$dbl_click_id} == 'undefined' || !clic_{$dbl_click_id}) { clic_{$dbl_click_id}=true; window.setTimeout('clic_" . $dbl_click_id++ . "=false;',10000); } else { return false; }\"" : '';
}
$target = '_self';
$is_browser_viewable_file = false;
if ($filetype == 'file') {
// Check the extension
$ext = explode('.', $path);
$ext = strtolower($ext[sizeof($ext) - 1]);
// HTML-files an some other types are shown in a frameset by default.
$is_browser_viewable_file = self::is_browser_viewable($ext);
if ($is_browser_viewable_file) {
if ($ext == 'pdf' || in_array($ext, $webOdflist)) {
$url = api_get_self() . '?' . api_get_cidreq() . '&action=download&id=' . $document_data['id'];
} else {
$url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
}
} else {
// url-encode for problematic characters (we may not call them dangerous characters...)
$path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq();
$url = $www . $path;
}
/*$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read
$url = $www . $path;*/
} else {
$url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'];
}
// The little download icon
$tooltip_title = $title;
$tooltip_title_alt = $tooltip_title;
if ($path == '/shared_folder') {
$tooltip_title_alt = get_lang('UserFolders');
} elseif (strstr($path, 'shared_folder_session_')) {
$tooltip_title_alt = get_lang('UserFolders') . ' (' . api_get_session_name(api_get_session_id()) . ')';
} elseif (strstr($tooltip_title, 'sf_user_')) {
$userinfo = api_get_user_info(substr($tooltip_title, 8));
$tooltip_title_alt = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
} elseif ($path == '/chat_files') {
$tooltip_title_alt = get_lang('ChatFiles');
} elseif ($path == '/learning_path') {
$tooltip_title_alt = get_lang('LearningPaths');
} elseif ($path == '/video') {
$tooltip_title_alt = get_lang('Video');
} elseif ($path == '/audio') {
$tooltip_title_alt = get_lang('Audio');
} elseif ($path == '/flash') {
$tooltip_title_alt = get_lang('Flash');
} elseif ($path == '/images') {
$tooltip_title_alt = get_lang('Images');
} elseif ($path == '/images/gallery') {
$tooltip_title_alt = get_lang('DefaultCourseImages');
}
$current_session_id = api_get_session_id();
$copy_to_myfiles = $open_in_new_window_link = null;
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
$send_to = null;
$checkExtension = $path;
if (!$show_as_icon) {
if ($filetype == 'folder') {
if (api_is_allowed_to_edit() || api_is_platform_admin() || api_get_setting('students_download_folders') == 'true') {
//filter when I am into shared folder, I can show for donwload only my shared folder
if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) {
if (preg_match('/shared_folder\\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) || preg_match('/shared_folder_session_' . $current_session_id . '\\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) || api_is_allowed_to_edit() || api_is_platform_admin()) {
$force_download_html = $size == 0 ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' . Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
}
//.........这里部分代码省略.........
示例3: get_work_user_list
//.........这里部分代码省略.........
$label = 'warning';
}
$qualification_string = Display::label($work['qualification'] . ' / ' . $work_data['qualification'], $label);
}
}
$work['qualification_score'] = $work['qualification'];
$add_string = '';
$time_expires = '';
if (!empty($work_assignment['expires_on'])) {
$time_expires = api_strtotime($work_assignment['expires_on'], 'UTC');
}
if (!empty($work_assignment['expires_on']) && !empty($time_expires) && $time_expires < api_strtotime($work['sent_date'], 'UTC')) {
$add_string = Display::label(get_lang('Expired'), 'important');
}
if ($can_read && $work['accepted'] == '1' || $is_author && in_array($work['accepted'], array('1', '0')) || ($is_allowed_to_edit || api_is_drh())) {
// Firstname, lastname, username
$work['firstname'] = Display::div($work['firstname'], array('class' => $class));
$work['lastname'] = Display::div($work['lastname'], array('class' => $class));
$work['title_clean'] = $work['title'];
if (strlen($work['title']) > 30) {
$short_title = substr($work['title'], 0, 27) . '...';
$work['title'] = Display::span($short_title, array('class' => $class, 'title' => $work['title']));
} else {
$work['title'] = Display::div($work['title'], array('class' => $class));
}
// Type.
$work['type'] = DocumentManager::build_document_icon_tag('file', $work['url']);
// File name.
$link_to_download = null;
// If URL is present then there's a file to download keep BC.
if ($work['contains_file'] || !empty($work['url'])) {
$link_to_download = '<a href="' . $url . 'download.php?id=' . $item_id . '&' . api_get_cidreq() . '">' . Display::return_icon('save.png', get_lang('Save'), array(), ICON_SIZE_SMALL) . '</a> ';
}
$send_to = Portfolio::share('work', $work['id'], array('style' => 'white-space:nowrap;'));
$feedback = null;
$count = getWorkCommentCount($item_id, $course_info);
if (!is_null($count) && !empty($count)) {
if ($qualification_exists) {
$feedback .= "<br />";
}
$feedback .= '<a href="' . $url . 'view.php?' . api_get_cidreq() . '&id=' . $item_id . '" title="' . get_lang('View') . '">' . Display::label($count . ' ' . get_lang('Feedback'), 'info') . '</a> ';
}
$work['qualification'] = $qualification_string . $feedback;
$work['qualification_only'] = $qualification_string;
// Date.
$work_date = api_convert_and_format_date($work['sent_date']);
$work['sent_date_from_db'] = $work['sent_date'];
$work['sent_date'] = '<div class="date-time">' . date_to_str_ago(api_get_local_time($work['sent_date'])) . ' ' . $add_string . ' ' . $work_date . '</div>';
// Actions.
$correction = '';
$action = '';
if (api_is_allowed_to_edit()) {
if (!empty($work['url_correction'])) {
$action .= Display::url(Display::return_icon('check-circle.png', get_lang('Correction'), null, ICON_SIZE_SMALL), api_get_path(WEB_CODE_PATH) . 'work/download.php?id=' . $item_id . '&' . api_get_cidreq() . '&correction=1');
}
$action .= '<a href="' . $url . 'view.php?' . api_get_cidreq() . '&id=' . $item_id . '" title="' . get_lang('View') . '">' . Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL) . '</a> ';
if ($unoconv && empty($work['contains_file'])) {
$action .= '<a href="' . $url . 'work_list_all.php?' . api_get_cidreq() . '&id=' . $work_id . '&action=export_to_doc&item_id=' . $item_id . '" title="' . get_lang('ExportToDoc') . '" >' . Display::return_icon('export_doc.png', get_lang('ExportToDoc'), array(), ICON_SIZE_SMALL) . '</a> ';
}
$correction = '
<form
id="file_upload_' . $item_id . '"
class="work_correction_file_upload file_upload_small"
action="' . api_get_path(WEB_AJAX_PATH) . 'work.ajax.php?' . api_get_cidreq() . '&a=upload_correction_file&item_id=' . $item_id . '" method="POST" enctype="multipart/form-data"
>
<div class="button-load">