Fixing Image Library when using the "Draw" ( document/create_draw.php) option in documents see #3927

skala
Julio Montoya 14 years ago
parent 87d15e0370
commit f5b9c8e49b
  1. 11
      main/forum/forumfunction.inc.php
  2. 15
      main/group/group.php
  3. 6
      main/group/group_category.php
  4. 3
      main/group/group_creation.php
  5. 4
      main/group/group_space.php
  6. 9
      main/inc/lib/course.lib.php
  7. 13
      main/inc/lib/document.lib.php
  8. 3
      main/inc/lib/image.lib.php
  9. 96
      main/inc/lib/main_api.lib.php
  10. 16
      main/inc/lib/sessionmanager.lib.php
  11. 70
      main/inc/lib/svg-edit/extensions/imagelib/groups.php
  12. 53
      main/inc/lib/svg-edit/extensions/imagelib/index.php
  13. 41
      main/inc/lib/svg-edit/extensions/imagelib/users.php
  14. 6
      main/user/user.php

@ -511,14 +511,15 @@ function store_forumcategory($values) {
function store_forum($values) {
global $_course;
global $_user;
$course_id = api_get_course_int_id();
$table_forums = Database::get_course_table(TABLE_FORUM);
// Find the max forum_order for the given category. The new forum is added at the end => max cat_order + &
if (is_null($values['forum_category'])) {
$new_max = null;
} else {
$sql = "SELECT MAX(forum_order) as sort_max FROM ".$table_forums." WHERE forum_category='".Database::escape_string(stripslashes($values['forum_category']))."'";
$sql = "SELECT MAX(forum_order) as sort_max FROM ".$table_forums."
WHERE c_id = $course_id AND forum_category='".Database::escape_string(stripslashes($values['forum_category']))."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$new_max = $row['sort_max'] + 1;
@ -611,8 +612,8 @@ function store_forum($values) {
".api_get_course_int_id().",
'".$clean_title."',
".$sql_image."
'".Database::escape_string(stripslashes(isset($values['forum_comment'])?$values['forum_comment']:null))."',
'".Database::escape_string(stripslashes(isset($values['forum_category'])?$values['forum_category']:null))."',
'".Database::escape_string(isset($values['forum_comment'])?$values['forum_comment']:null)."',
'".Database::escape_string(isset($values['forum_category'])?$values['forum_category']:null)."',
'".Database::escape_string(isset($values['allow_anonymous_group']['allow_anonymous'])?$values['allow_anonymous_group']['allow_anonymous']:null)."',
'".Database::escape_string(isset($values['students_can_edit_group']['students_can_edit'])?$values['students_can_edit_group']['students_can_edit']:null)."',
'".Database::escape_string(isset($values['approval_direct_group']['approval_direct'])?$values['approval_direct_group']['approval_direct']:null)."',
@ -623,9 +624,7 @@ function store_forum($values) {
'".Database::escape_string(isset($values['public_private_group_forum_group']['public_private_group_forum'])?$values['public_private_group_forum_group']['public_private_group_forum']:null)."',
'".Database::escape_string(isset($new_max)?$new_max:null)."',
".intval($session_id).")";
Database::query($sql);
$last_id = Database::insert_id();
if ($last_id > 0) {
api_item_property_update($_course, TOOL_FORUM, $last_id, 'ForumAdded', api_get_user_id());

@ -41,14 +41,18 @@ $nameTools = get_lang('GroupManagement');
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
$course_id = api_get_course_int_id();
// Create default category if it doesn't exist when group categories aren't allowed
if (api_get_setting('allow_group_categories') == 'false') {
$cat_table = Database::get_course_table(TABLE_GROUP_CATEGORY);
$sql = "SELECT * FROM $cat_table WHERE id = '".DEFAULT_GROUP_CATEGORY."'";
$sql = "SELECT * FROM $cat_table WHERE c_id = $course_id AND id = '".DEFAULT_GROUP_CATEGORY."'";
$res = Database::query($sql);
$num = Database::num_rows($res);
if ($num == 0) {
Database::query("INSERT INTO ".$cat_table." ( id , title , description , forum_state , wiki_state, max_student , self_reg_allowed , self_unreg_allowed , groups_per_user , display_order ) VALUES ('2', '".lang2db($DefaultGroupCategory)."', '', '1', '1', '8', '0', '0', '0', '0');");
$sql = "INSERT INTO ".$cat_table." ( c_id, id , title , description , forum_state, wiki_state, max_student, self_reg_allowed, self_unreg_allowed, groups_per_user, display_order)
VALUES ($course_id, '2', '".lang2db($DefaultGroupCategory)."', '', '1', '1', '8', '0', '0', '0', '0');";
Database::query ($sql);
}
}
@ -183,10 +187,12 @@ echo '</div>';
/*
* List all categories
*/
foreach ($group_cats as $index => $category) {
$group_list = array ();
$in_category = false;
if (api_get_setting('allow_group_categories') == 'true') {
if (isset ($_GET['show_all']) || (isset ($_GET['category']) && $_GET['category'] == $category['id'])) {
echo '<img src="../img/folder_group_category.gif" alt=""/>';
echo '<a href="group.php?'.api_get_cidreq().'&origin='.Security::remove_XSS($_GET['origin']).'">'.$category['title'].'</a>';
@ -215,11 +221,14 @@ foreach ($group_cats as $index => $category) {
}
//if (count($group_list) > 0 && $in_category)
if ($in_category) {
$totalRegistered = 0;
// Determine wether current user is tutor for this course
$user_is_tutor = GroupManager :: is_tutor($_user['user_id']);
$user_is_tutor = GroupManager :: is_tutor(api_get_user_id());
$group_data = array();
foreach ($group_list as $index => $this_group) {
// Validacion when belongs to a session

@ -55,6 +55,8 @@ if (api_get_setting('allow_group_categories') == 'true') {
$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups'));
$course_id = api_get_course_int_id();
// Build the form
if (isset ($_GET['id'])) {
// Update settings of existing category
@ -65,8 +67,8 @@ if (isset ($_GET['id'])) {
} else {
// Checks if the field was created in the table Category. It creates it if is neccesary
$table_category = Database :: get_course_table(TABLE_GROUP_CATEGORY);
if (!Database::query("SELECT wiki_state FROM $table_category")) {
Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1';");
if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) {
Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = $course_id");
}
// Create a new category
$action = 'add_category';

@ -15,7 +15,6 @@ $this_section = SECTION_COURSES;
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
/* Create the groups */
@ -45,7 +44,7 @@ if (isset ($_POST['action'])) {
} elseif ($_POST['same_category']) {
$group['category'] = $_POST['group_0_category'];
}
GroupManager :: create_group(strip_tags($group['name']), $group['category'], $group['tutor'], $group['places']);
GroupManager :: create_group($group['name'], $group['category'], $group['tutor'], $group['places']);
}
$msg = urlencode(count($groups).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);

@ -329,6 +329,8 @@ function get_group_user_data($from, $number_of_items, $column, $direction) {
// Database table definition
$table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id();
// Query
if (api_get_setting('show_email_addresses') == 'true') {
@ -343,7 +345,7 @@ function get_group_user_data($from, $number_of_items, $column, $direction) {
)."
user.email AS col3
FROM ".$table_user." user, ".$table_group_user." group_rel_user
WHERE group_rel_user.user_id = user.user_id
WHERE group_rel_user.c_id = $course_id group_rel_user.user_id = user.user_id
AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";

@ -220,6 +220,15 @@ class CourseManager {
);
return $result['status'];
}
public static function get_tutor_in_course_status($user_id, $course_code) {
$result = Database::fetch_array(Database::query(
"SELECT tutor_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
WHERE course_code = '".Database::escape_string($course_code)."' AND user_id = ".Database::escape_string($user_id))
);
return $result['tutor_id'];
}
/**
* Unsubscribe one or more users from a course

@ -533,19 +533,19 @@ return 'application/octet-stream';
AND last.visibility".$visibility_bit.$condition_session." AND
docs.c_id = {$_course['real_id']} AND
last.c_id = {$_course['real_id']} ";
}
}
$result = Database::query($sql);
$doc_list = array();
$document_data = array();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if ($result!==false && Database::num_rows($result) != 0) {
if ($result !== false && Database::num_rows($result) != 0) {
while ($row = Database::fetch_array($result, 'ASSOC')) {
if (api_is_coach()) {
//Looking for course items that are invisible to hide it in the session
//Looking for course items that are invisible to hide it in the session
if (in_array($row['id'], array_keys($doc_list))) {
if ($doc_list[$row['id']]['item_property_session_id'] == 0 && $doc_list[$row['id']]['session_id'] == 0) {
if ($doc_list[$row['id']]['visibility'] == 0) {
@ -554,10 +554,11 @@ return 'application/octet-stream';
}
}
}
$doc_list[$row['id']] = $row;
}
if (!api_is_coach() && !$is_allowed_to_edit) {
if (!api_is_coach() && !$is_allowed_to_edit) {
$doc_list[] = $row;
}
@ -572,8 +573,10 @@ return 'application/octet-stream';
$template_result = Database::query($sql_is_template);
$row['is_template'] = (Database::num_rows($template_result) > 0) ? 1 : 0;
}
//just filling $document_data
$document_data[$row['id']] = $row;
}
//Only for the student we filter the results see BT#1652

@ -199,6 +199,7 @@ class GDWrapper extends ImageWrapper {
public function set_image_wrapper() {
$handler = null;
$this->fill_image_info();
switch ($this->type) {
case 0:
$handler = false;
@ -233,7 +234,7 @@ class GDWrapper extends ImageWrapper {
public function fill_image_info() {
if (file_exists($this->path)) {
$image_info = getimagesize($this->path);
$image_info = getimagesize($this->path);
$this->width = $image_info[0];
$this->height = $image_info[1];
$this->type = $image_info[2];

@ -1867,6 +1867,86 @@ function api_is_course_tutor() {
return $_SESSION['is_courseTutor'];
}
function api_get_user_platform_status($user_id = false) {
$status = array();
$user_id = intval($user_id);
if (empty($user_id)) {
$user_id = api_get_user_id();
}
if (empty($user_id)) {
return false;
}
$group_id = api_get_group_id();
$course_id = api_get_course_int_id();
$course_code= api_get_course_id();
$session_id = api_get_session_id();
//Group (in course)
if ($group_id && $course_id) {
$group_status = array();
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
$is_subscribed = GroupManager::is_subscribed($user_id, $group_id);
if ($is_subscribed) {
$group_status = array('id'=> $group_id , 'status' => 'student');
$is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id);
if ($is_tutor) {
$group_status['status'] = 'tutor';
} else {
$group_status['status'] = 'student';
}
}
$status['group'] = $group_status;
}
//Session
if ($session_id && $course_id) {
$session_status = array();
$session_status = array('id' => $session_id, 'course_id' => $course_id);
$session_user_status = SessionManager::get_user_status_in_session($user_id, $course_code, $session_id);
switch ($session_user_status) {
case 0:
$session_status['status'] = 'student';
break;
case 2:
$session_status['status'] = 'coach';
break;
}
$is_general_coach = SessionManager::user_is_general_coach($user_id, $session_id);
if ($is_general_coach) {
$session_status['status'] = 'general_coach';
}
$status['session'] = $session_status;
} elseif($course_id) {
//Course
$course_status = array();
if ($course_id) {
$user_course_status = CourseManager::get_user_in_course_status($user_id, $course_code);
if ($user_course_status) {
$course_status = array('id'=> $course_id);
switch($user_course_status) {
case 1;
$course_status['status'] = 'teacher';
break;
case 5;
$course_status['status'] = 'student';
//check if tutor
$tutor_course_status = CourseManager::get_tutor_in_course_status($user_id, $course_code);
if ($tutor_course_status) {
$course_status['status'] = 'tutor';
}
break;
}
}
}
$status['course'] = $course_status;
}
return $status;
}
/**
* Checks whether the current user is a course or session coach
* @param int - optional, session id
@ -1889,17 +1969,16 @@ function api_is_coach($session_id = 0, $course_code = '') {
} else {
$course_code = api_get_course_id();
}
$session_table = Database::get_main_table(TABLE_MAIN_SESSION);
$session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$session_table = Database::get_main_table(TABLE_MAIN_SESSION);
$session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sessionIsCoach = null;
if (!empty($course_code)) {
$sql = "SELECT DISTINCT id, name, date_start, date_end
FROM $session_table INNER JOIN $session_rel_course_rel_user_table session_rc_ru
ON session_rc_ru.id_user = '".api_get_user_id()."'
WHERE session_rc_ru.course_code = '$course_code' AND session_rc_ru.status = 2 AND session_rc_ru.id_session = '$session_id'
ORDER BY date_start, date_end, name";
WHERE session_rc_ru.course_code = '$course_code' AND session_rc_ru.status = 2 AND session_rc_ru.id_session = '$session_id'";
$result = Database::query($sql);
$sessionIsCoach = Database::store_result($result);
}
@ -1907,8 +1986,7 @@ function api_is_coach($session_id = 0, $course_code = '') {
$sql = "SELECT DISTINCT id, name, date_start, date_end
FROM $session_table
WHERE session.id_coach = '".api_get_user_id()."' AND id = '$session_id'
ORDER BY date_start, date_end, name";
ORDER BY date_start, date_end, name";
$result = Database::query($sql);
if (!empty($sessionIsCoach)) {
$sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result));
@ -4690,7 +4768,7 @@ function api_getimagesize($path) {
* @return array Calculated new width and height
*/
function api_resize_image($image, $target_width, $target_height) {
$image_properties = api_getimagesize($image);
$image_properties = api_getimagesize($image);
return api_calculate_image_size($image_properties['width'], $image_properties['height'], $target_width, $target_height);
}
@ -5437,4 +5515,4 @@ function api_grading_model_functions($grading_model, $action = 'to_array') {
}
}
return $return;
}
}

@ -1391,7 +1391,7 @@ class SessionManager {
public function get_user_status_in_session($user_id, $course_code, $session_id) {
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT session_rcru.status
echo $sql = "SELECT session_rcru.status
FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
WHERE session_rcru.id_user = user.user_id AND
session_rcru.id_session = '".intval($session_id)."' AND
@ -1560,4 +1560,18 @@ class SessionManager {
}
return $sid;
}
function user_is_general_coach($user_id, $session_id) {
$session_id = intval($session_id);
$user_id = intval($user_id);
$session_table = Database::get_main_table(TABLE_MAIN_SESSION);
$sql = "SELECT DISTINCT id
FROM $session_table
WHERE session.id_coach = '".$user_id."' AND id = '$session_id'";
$result = Database::query($sql);
if ($result && Database::num_rows($result)) {
return true;
}
return false;
}
}

@ -1,6 +1,6 @@
<?php
/* Integrate svg-edit libraries with Chamilo default documents
* @author Juan Carlos Raña Trabado
* @author Juan Carlos Ra<EFBFBD>a Trabado
* @since 25/september/2010
*/
//Chamilo load libraries
@ -11,17 +11,19 @@ require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
//
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
$groupdirpath = $group_properties['directory'];
$group_disk_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$groupdirpath.'/';
$group_web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$groupdirpath.'/';
$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, $groupdirpath, $_SESSION['_gid'], null, $is_allowed_to_edit, false);
$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();
@ -45,31 +47,49 @@ if (is_array($all_files) && count($all_files) > 0) {
}
}
$style = '<style>';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).api_get_visual_theme().'/default.css";';
$style .='</style>';
?>
<!doctype html>
<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
<?php echo $style ?>
<body>
<?php
echo '<h2>'.get_lang('GroupSingle').': '.$group_properties['name'].'</h2>';
if(($group_properties['doc_state'] == 2 && ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid']))) || $group_properties['doc_state'] == 1){
echo '<h1>'.get_lang('GroupSingle').': '.$group_properties['name'].'</h1>';
echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$group_disk_path.$filename;
$new_sizes = api_resize_image($image, 60, 60);
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$group_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$group_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$group_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
if (($group_properties['doc_state'] == 2 && ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid']))) || $group_properties['doc_state'] == 1){
if (!empty($png_svg_files)) {
echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image = $group_disk_path.$filename;
//$new_sizes = api_resize_image($image, 60, 60); Bug when trying to load svg files
$new_sizes['width'] = 60;
$new_sizes['height'] = 60;
$pos = strpos($filename, "svg");
if ($pos === false) {
//no svg
echo '<li style="display:inline; padding:8px;">';
echo '<a href = "'.$group_web_path.$filename.'" alt="'.$filename.'" title="'.$filename.'">';
echo '<img src = "'.$group_web_path.$filename.'" width = "'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
} else {
//svg
echo '<li style="display:inline; padding:8px;">';
echo '<a href = "'.$group_web_path.$filename.'" alt="'.$filename.'" title="'.$filename.'">';
echo '<img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0">';
echo '</a></li>';
}
}
echo '</ul>';
}
echo '</ul>';
}
else{
echo '<h1>'.get_lang('OnlyAccessFromYourGroup').'</h1>';
} else {
echo Display::display_warning_message(get_lang('OnlyAccessFromYourGroup'));
}
?>
</body>

@ -1,11 +1,12 @@
<?php
/* Integrate svg-edit libraries with Chamilo default documents
* @author Juan Carlos Raña Trabado
* @author Juan Carlos Ra<EFBFBD>a Trabado
* @since 25/september/2010
*/
//Chamilo load libraries
require_once '../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
@ -14,11 +15,12 @@ $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, $curdirpath, 0, null, $is_allowed_to_edit, false);
//get all filenames
$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) {
@ -40,34 +42,44 @@ if (is_array($all_files) && count($all_files) > 0) {
}
}
$disk_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/images/gallery/';
$web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/images/gallery/';
$disk_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images/gallery/';
$web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document/images/gallery/';
$style = '<style>';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).api_get_visual_theme().'/default.css";';
$style .='</style>';
?>
<!doctype html>
<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
<?php echo $style ?>
<body>
<?php
echo '<h1>'.get_lang('Course').': '.$_course['name'].'</h1>';
echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$disk_path.$filename;
$new_sizes = api_resize_image($image, 60, 60);
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
echo '<h2>'.get_lang('Course').': '.$course_info['name'].'</h2>';
if (!empty($png_svg_files)) {
echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$disk_path.$filename;
//$new_sizes = api_resize_image($image, 60, 60);
$new_sizes['width'] = 60;
$new_sizes['height'] = 60;
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
}
echo '</ul>';
} else {
Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath'));
}
echo '</ul>';
?>
</body>
<script>
$('a').click(function() {
var href = this.href;
@ -116,5 +128,4 @@ $('a').click(function() {
}
return false;
});
</script>

@ -10,10 +10,9 @@ require_once '../../../../../inc/global.inc.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
//
$user_disk_path = api_get_path(SYS_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
$user_web_path = api_get_path(WEB_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
$user_web_path = api_get_path(WEB_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
//get all files and folders
$scan_files = scandir($user_disk_path);
@ -29,33 +28,44 @@ if (is_array($scan_files) && count($scan_files) > 0) {
}
}
}
$style = '<style>';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).api_get_visual_theme().'/default.css";';
$style .='</style>';
?>
<!doctype html>
<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
<?php echo $style ?>
<body>
<?php
echo '<h1>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h1>';
echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$user_disk_path.$filename;
$new_sizes = api_resize_image($image, 60, 60);
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
echo '<h2>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h2>';
if (!empty($png_svg_files)) {
echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$user_disk_path.$filename;
//$new_sizes = api_resize_image($image, 60, 60);
$new_sizes['width'] = 60;
$new_sizes['height'] = 60;
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
} else {
echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
}
echo '</ul>';
} else {
Display::display_warning_message(get_lang('NoSVGImages'));
}
echo '</ul>';
?>
</body>
<script>
$('a').click(function() {
var href = this.href;
@ -104,5 +114,4 @@ $('a').click(function() {
}
return false;
});
</script>

@ -655,12 +655,6 @@ if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
if (api_get_setting('allow_user_headings') == 'true' && $is_courseAdmin && api_is_allowed_to_edit() && $origin != 'learnpath') { // only course administrators see this line
echo "<div align=\"right\">", "<form method=\"post\" action=\"userInfo.php\">", get_lang("CourseAdministratorOnly"), " : ", "<input type=\"submit\" class=\"save\" name=\"viewDefList\" value=\"".get_lang("DefineHeadings")."\" />", "</form>", "</div>\n";
}
//User list of the virtual courses linked to this course.
//@todo
//show_users_in_virtual_courses($is_allowed_to_track);
/* FOOTER */
if ($origin != 'learnpath') {
Display::display_footer();
}
Loading…
Cancel
Save