本文整理汇总了PHP中FileManager::choose_image方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::choose_image方法的具体用法?PHP FileManager::choose_image怎么用?PHP FileManager::choose_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::choose_image方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_information
/**
* Get document information
*/
private function get_information($course_id, $doc_id)
{
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_path = $course_information['path'];
if (!empty($course_information)) {
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$doc_id = Database::escape_string($doc_id);
$sql = "SELECT * FROM {$doc_table}\n WHERE {$doc_table}.id = {$doc_id} AND c_id = {$course_id}\n LIMIT 1";
$dk_result = Database::query($sql);
$sql = "SELECT insert_user_id FROM {$item_property_table}\n WHERE ref = {$doc_id} AND tool = '" . TOOL_DOCUMENT . "' AND c_id = {$course_id}\n LIMIT 1";
$name = '';
if ($row = Database::fetch_array($dk_result)) {
$name = $row['title'];
$url = api_get_path(WEB_PATH) . 'courses/%s/document%s';
$url = sprintf($url, $course_path, $row['path']);
// Get the image path
$icon = FileManager::choose_image(basename($row['path']));
$thumbnail = api_get_path(WEB_IMG_PATH) . $icon;
$image = $thumbnail;
//FIXME: use big images
// get author
$author = '';
$item_result = Database::query($sql);
if ($row = Database::fetch_array($item_result)) {
$user_data = api_get_user_info($row['insert_user_id']);
$author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
}
}
return array($thumbnail, $image, $name, $author, $url);
// FIXME: is it posible to get an author here?
} else {
return array();
}
}
示例2: write_resources_tree
/**
* Generate and return an HTML list of resources based on a given array.
* This list is used to show the course creator a list of available resources to choose from
* when creating a learning path.
* @param array Array of elements to add to the list
* @param integer Enables the tree display by shifting the new elements a certain distance to the right
* @return string The HTML list
*/
public static function write_resources_tree($course_info, $session_id, $resources_sorted, $num = 0, $lp_id = false, $target = '', $add_move_button = false, $overwrite_url = null)
{
$img_path = api_get_path(WEB_IMG_PATH);
$img_sys_path = api_get_path(SYS_IMG_PATH);
$web_code_path = api_get_path(WEB_CODE_PATH);
$return = '';
if (count($resources_sorted) > 0) {
foreach ($resources_sorted as $key => $resource) {
$title = isset($resource['title']) ? $resource['title'] : null;
if (empty($title)) {
$title = $key;
}
if (isset($resource['id']) && is_int($resource['id'])) {
// It's a folder.
//hide some folders
if (in_array($key, array('shared_folder', 'chat_files', 'HotPotatoes_files', 'css', 'certificates'))) {
continue;
} elseif (preg_match('/_groupdocs/', $key)) {
continue;
} elseif (preg_match('/sf_user_/', $key)) {
continue;
} elseif (preg_match('/shared_folder_session_/', $key)) {
continue;
}
//trad some titles
if ($key == 'images') {
$key = get_lang('Images');
} elseif ($key == 'gallery') {
$key = get_lang('Gallery');
} elseif ($key == 'flash') {
$key = get_lang('Flash');
} elseif ($key == 'audio') {
$key = get_lang('Audio');
} elseif ($key == 'video') {
$key = get_lang('Video');
}
$onclick = '';
if ($lp_id) {
$onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
}
$return .= '<ul class="lp_resource">';
$return .= '<li class="doc_folder" id="doc_id_' . $resource['id'] . '" style="margin-left:' . $num * 18 . 'px; ">';
if ($lp_id) {
$return .= '<img style="cursor: pointer;" src="' . $img_path . 'nolines_plus.gif" align="absmiddle" id="img_' . $resource['id'] . '" ' . $onclick . ' >';
} else {
$return .= '<span style="margin-left:16px"> </span>';
}
$return .= '<img alt="" src="' . $img_path . 'lp_folder.gif" title="" align="absmiddle" /> ';
$return .= '<span ' . $onclick . ' style="cursor: pointer;" >' . $title . '</span>';
$return .= '</li>';
$return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >';
if (isset($resource['files'])) {
$return .= self::write_resources_tree($course_info, $session_id, $resource['files'], $num + 1, $lp_id, $target, $add_move_button, $overwrite_url);
}
$return .= '</div>';
$return .= '</ul>';
} else {
if (!is_array($resource)) {
$resource = base64_decode($resource);
// It's a file.
$icon = FileManager::choose_image($resource);
$position = strrpos($icon, '.');
$icon = substr($icon, 0, $position) . '_small.gif';
$file_info = explode('|@j@|', $resource);
$my_file_title = $file_info[0];
//If title is empty we try to use the path
if (empty($my_file_title)) {
$my_file_title = $file_info[1];
}
// Show the "image name" not the filename of the image.
if ($lp_id) {
//LP URL
$url = api_get_self() . '?cidReq=' . $course_info['code'] . '&action=add_item&type=' . TOOL_DOCUMENT . '&file=' . $key . '&lp_id=' . $lp_id;
if (!empty($overwrite_url)) {
$url = $overwrite_url . '&document_id=' . $key;
}
} else {
//Direct document URL
$url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $key;
if (!empty($overwrite_url)) {
$url = $overwrite_url . '&document_id=' . $key;
}
}
$img = $img_path . $icon;
if (!file_exists($img_sys_path . $icon)) {
$img = $img_path . 'icons/16/default_small.gif';
}
$link = Display::url('<img alt="" src="' . $img . '" title="" /> ' . $my_file_title, $url, array('target' => $target));
if ($lp_id == false) {
$return .= '<li class="doc_resource" data_id="' . $key . '" data_type="document" title="' . $my_file_title . '" >';
} else {
$return .= '<li class="doc_resource lp_resource_element" data_id="' . $key . '" data_type="document" title="' . $my_file_title . '" >';
//.........这里部分代码省略.........
示例3: rl_get_resource_name
/**
* Gets the name of a resource (generally used in learnpath when no name is provided)
*
* @author Yannick Warnier <ywarnier@beeznest.org>, Dokeos - rebranding
* @param string Course code
* @param string The tool type (using constants declared in api.lib.php)
* @param integer The resource ID
*/
function rl_get_resource_name($course_code, $learnpath_id, $id_in_path)
{
$_course = api_get_course_info($course_code);
$course_id = $_course['real_id'];
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sql_item = "SELECT item_type, title, ref FROM {$tbl_lp_item} WHERE c_id = {$course_id} AND lp_id = {$learnpath_id} AND id = {$id_in_path}";
$res_item = Database::query($sql_item);
if (Database::num_rows($res_item) < 1) {
return '';
//exit
}
$row_item = Database::fetch_array($res_item);
$type = strtolower($row_item['item_type']);
$id = $row_item['ref'];
$output = '';
switch ($type) {
case TOOL_CALENDAR_EVENT:
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$result = Database::query("SELECT * FROM {$TABLEAGENDA} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_ANNOUNCEMENT:
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = Database::query("SELECT * FROM {$tbl_announcement} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_LINK:
// Doesn't take $target into account.
$TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
$result = Database::query("SELECT * FROM {$TABLETOOLLINK} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_QUIZ:
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM {$TBL_EXERCICES} WHERE c_id = {$course_id} AND iid = {$id}");
$myrow = Database::fetch_array($result);
$output = $myrow['title'];
break;
case TOOL_FORUM:
$TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
$result = Database::query("SELECT * FROM {$TBL_FORUMS} WHERE c_id = {$course_id} AND forum_id={$id}");
$myrow = Database::fetch_array($result);
$output = $myrow['forum_name'];
break;
case TOOL_THREAD:
//=topics
$tbl_post = Database::get_course_table(TABLE_FORUM_POST);
// Grabbing the title of the post.
$sql_title = "SELECT * FROM {$tbl_post} WHERE c_id = {$course_id} AND post_id=" . $id;
$result_title = Database::query($sql_title);
$myrow_title = Database::fetch_array($result_title);
$output = $myrow_title['post_title'];
break;
case TOOL_POST:
$tbl_post = Database::get_course_table(TABLE_FORUM_POST);
//$tbl_post_text = Database::get_course_table(FORUM_POST_TEXT_TABLE);
$sql = "SELECT * FROM {$tbl_post} p WHERE c_id = {$course_id} AND p.post_id = {$id}";
$result = Database::query($sql);
$post = Database::fetch_array($result);
$output = $post['post_title'];
break;
case 'dokeos_chapter':
$title = $row_item['title'];
if (!empty($title)) {
$output = $title;
} else {
$output = '-';
}
break;
case TOOL_DOCUMENT:
$title = $row_item['title'];
if (!empty($title)) {
$output = $title;
} else {
$output = '-';
}
break;
case 'hotpotatoes':
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
$result = Database::query("SELECT * FROM {$tbl_doc} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
$pathname = explode('/', $myrow['path']);
// Making a correct name for the link.
$last = count($pathname) - 1;
// Making a correct name for the link.
$filename = $pathname[$last];
// Making a correct name for the link.
$image = FileManager::choose_image($filename);
$ext = explode('.', $filename);
//.........这里部分代码省略.........
示例4: build_document_icon_tag
/**
* Builds an img html tag for the filetype
*
* @param string $type (file/folder)
* @param string $path
* @return string img html tag
*/
function build_document_icon_tag($type, $path)
{
$basename = basename($path);
$current_session_id = api_get_session_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if ($type == 'file') {
$icon = FileManager::choose_image($basename);
if (preg_match('/_chnano_.wav$/i', $basename)) {
$icon = "jplayer_play.png";
$basename = 'wav' . ' ' . '(Nanogong)';
} else {
$basename = substr(strrchr($basename, '.'), 1);
}
} else {
if ($path == '/shared_folder') {
$icon = 'folder_users.gif';
if ($is_allowed_to_edit) {
$basename = get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders');
}
} elseif (strstr($basename, 'sf_user_')) {
$userinfo = api_get_user_info(substr($basename, 8));
$image_path = UserManager::get_user_picture_path_by_id(substr($basename, 8), 'web', false, true);
if ($image_path['file'] == 'unknown.jpg') {
$icon = $image_path['file'];
} else {
$icon = '../upload/users/' . substr($basename, 8) . '/' . $image_path['file'];
}
$basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
} elseif (strstr($path, 'shared_folder_session_')) {
if ($is_allowed_to_edit) {
$basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
}
$icon = 'folder_users.gif';
} else {
$icon = 'folder_document.gif';
if ($path == '/audio') {
$icon = 'folder_audio.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Audio');
}
} elseif ($path == '/flash') {
$icon = 'folder_flash.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Flash');
}
} elseif ($path == '/images') {
$icon = 'folder_images.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Images');
}
} elseif ($path == '/video') {
$icon = 'folder_video.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Video');
}
} elseif ($path == '/images/gallery') {
$icon = 'folder_gallery.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Gallery');
}
} elseif ($path == '/chat_files') {
$icon = 'folder_chat.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderChat');
} else {
$basename = get_lang('ChatFiles');
}
} elseif ($path == '/learning_path') {
$icon = 'folder_learningpath.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderLearningPaths');
} else {
$basename = get_lang('LearningPaths');
}
}
}
}
return Display::return_icon($icon, $basename, array());
}
示例5: display_addedresource_link_in_learnpath
//.........这里部分代码省略.........
} else {
echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>";
}
}
} else {
echo "<a href=\"../phpbb/viewtopic.php?topic=" . $myrow["topic_id"] . "&forum=" . $myrow["forum_id"] . "&md5=" . $myrow["md5"] . "\" class='{$completed}' target='_blank'>" . shorten($myrow_titel["post_title"], $length - 3 * $level) . "</a>";
}
break;
case "Document":
$dbTable = Database::get_course_table(TABLE_DOCUMENT, $_course['dbName']);
$result = Database::query("SELECT * FROM {$dbTable} WHERE id={$id}");
$myrow = Database::fetch_array($result);
$pathname = explode("/", $myrow["path"]);
// making a correct name for the link
$last = count($pathname) - 1;
// making a correct name for the link
$filename = $pathname[$last];
// making a correct name for the link
if ($builder != 'builder' and $icon != 'wrap') {
echo "<td>";
}
echo str_repeat(" >", $level);
if ($icon != 'nolink') {
if ($completed == 'completed') {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
} else {
echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
//echo " ";
}
}
if ($builder != 'builder' and $icon != 'wrap') {
echo "</td><td>";
}
$image = FileManager::choose_image($filename);
$sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}";
$result = Database::query($sql);
$row = Database::fetch_array($result);
if ($row['title'] != '') {
$filename = $row['title'];
}
$desc = $row['description'];
if ($myrow["path"] == '' and $filename == '') {
echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>";
return true;
}
if ($icon == 'nolink') {
return shorten($filename, $length);
}
if ($icon == 'icon') {
echo "<img src='../img/{$image}' align=\"absmiddle\" alt='{$image}'>";
}
if ($builder != 'builder') {
echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Document&origin={$origin}&docurl=" . $myrow["path"] . "#{$id_in_path}\" class='{$completed}'>" . shorten($filename, $length - 3 * $level) . "</a>";
if ($desc != '') {
if ($icon != 'wrap') {
echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>";
} else {
echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>";
}
}
$items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Document&origin={$origin}&docurl=" . $myrow["path"] . "#{$id_in_path}";
} else {
$enableDocumentParsing = 'yes';
if (!$enableDocumentParsing) {
//this is the solution for the non-parsing version in the builder
$file = urlencode($myrow["path"]);