Fixing tools

1.10.x
Julio Montoya 10 years ago
parent d8907493a4
commit 6f31661f55
  1. 94
      main/inc/lib/course.lib.php
  2. 41
      main/inc/lib/text.lib.php
  3. 16
      main/inc/lib/urlmanager.lib.php
  4. 1
      src/ChamiloLMS/CoreBundle/Admin/CourseAdmin.php
  5. 14
      src/ChamiloLMS/CoreBundle/EventListener/LegacyListener.php
  6. 24
      src/ChamiloLMS/CourseBundle/Resources/config/services.yml
  7. 16
      src/ChamiloLMS/CourseBundle/Tool/Agenda.php
  8. 2
      src/ChamiloLMS/CourseBundle/Tool/Announcements.php
  9. 16
      src/ChamiloLMS/CourseBundle/Tool/BaseTool.php
  10. 7
      src/ChamiloLMS/CourseBundle/Tool/CourseDescription.php
  11. 86
      web/bundles/nelmioapidoc/css/screen.css

@ -1569,7 +1569,7 @@ class CourseManager
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_course_class = Database::get_main_table(TABLE_MAIN_COURSE_CLASS);
//$table_course_class = Database::get_main_table(TABLE_MAIN_COURSE_CLASS);
$table_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -1621,8 +1621,8 @@ class CourseManager
}
// Unsubscribe all classes from the course
$sql = "DELETE FROM $table_course_class WHERE course_code='".$code."'";
Database::query($sql);
/*$sql = "DELETE FROM $table_course_class WHERE course_code='".$code."'";
Database::query($sql);*/
// Unsubscribe all users from the course
$sql = "DELETE FROM $table_course_user WHERE c_id ='".$courseId."'";
Database::query($sql);
@ -1632,7 +1632,7 @@ class CourseManager
$sql = "DELETE FROM $table_session_course_user WHERE c_id='".$courseId."'";
Database::query($sql);
// Delete from Course - URL
$sql = "DELETE FROM $table_course_rel_url WHERE c_id = '".$code."'";
$sql = "DELETE FROM $table_course_rel_url WHERE c_id = '".$courseId."'";
Database::query($sql);
$sql = 'SELECT survey_id FROM '.$table_course_survey.' WHERE course_code="'.$code.'"';
@ -1680,9 +1680,6 @@ class CourseManager
UrlManager::delete_url_rel_course($courseId, $url_id);
}
// Delete the course from the database
$sql = "DELETE FROM $table_course WHERE id = '".$courseId."'";
Database::query($sql);
// delete extra course fields
$t_cf = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
@ -1722,6 +1719,10 @@ class CourseManager
}
}
// Delete the course from the database
$sql = "DELETE FROM $table_course WHERE id = '".$courseId."'";
Database::query($sql);
// Add event to system log
$user_id = api_get_user_id();
Event::addEvent(LOG_COURSE_DELETE, LOG_COURSE_CODE, $code, api_get_utc_datetime(), $user_id, $code);
@ -4117,8 +4118,8 @@ class CourseManager
$tables[]= 'group_rel_user';
$tables[]= 'group_rel_tutor';
$tables[]= 'item_property';
$tables[]= 'userinfo_content';
$tables[]= 'userinfo_def';
//$tables[]= 'userinfo_content';
//$tables[]= 'userinfo_def';
$tables[]= 'course_description';
$tables[]= 'calendar_event';
$tables[]= 'calendar_event_repeat';
@ -4126,7 +4127,7 @@ class CourseManager
$tables[]= 'calendar_event_attachment';
$tables[]= 'announcement';
$tables[]= 'announcement_attachment';
$tables[]= 'resource';
//$tables[]= 'resource';
$tables[]= 'student_publication';
$tables[]= 'student_publication_assignment';
$tables[]= 'document';
@ -4173,10 +4174,10 @@ class CourseManager
$tables[]= 'permission_group';
$tables[]= 'permission_user';
$tables[]= 'permission_task';
$tables[]= 'role';
/*$tables[]= 'role';
$tables[]= 'role_group';
$tables[]= 'role_permissions';
$tables[]= 'role_user';
$tables[]= 'role_user';*/
$tables[]= 'survey';
$tables[]= 'survey_question';
$tables[]= 'survey_question_option';
@ -4254,9 +4255,8 @@ class CourseManager
/**
* Fills the course database with some required content and example content.
* @version 1.2
*/
static function fill_db_course($course_id, $course_repository, $language, $fill_with_exemplary_content = null)
public static function fill_db_course($course_id, $course_repository, $language, $fill_with_exemplary_content = null)
{
if (is_null($fill_with_exemplary_content)) {
$fill_with_exemplary_content = api_get_setting('example_material_course_creation') != 'false';
@ -4268,7 +4268,7 @@ class CourseManager
}
$now = api_get_utc_datetime(time());
$tbl_course_homepage = Database::get_course_table(TABLE_TOOL_LIST);
$toolTable = Database::get_course_table(TABLE_TOOL_LIST);
$TABLEINTROS = Database::get_course_table(TABLE_TOOL_INTRO);
$TABLEGROUPCATEGORIES = Database::get_course_table(TABLE_GROUP_CATEGORY);
$TABLEITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
@ -4290,62 +4290,58 @@ class CourseManager
$TABLEGRADEBOOKLINK = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$TABLEGRADEBOOKCERT = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
/*include api_get_path(SYS_CODE_PATH).'lang/english/create_course.inc.php';
$file_to_include = api_get_path(SYS_CODE_PATH).'lang/'.$language.'/create_course.inc.php';
if (file_exists($file_to_include)) {
include $file_to_include;
}*/
$visible_for_all = 1;
$visible_for_course_admin = 0;
$visible_for_platform_admin = 2;
/* Course tools */
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_COURSE_DESCRIPTION . "','course_description/','info.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'course_description')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_CALENDAR_EVENT . "','calendar/agenda.php','agenda.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'agenda')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_DOCUMENT . "','document/document.php','folder_document.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'documents')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_LEARNPATH . "','newscorm/lp_controller.php','scorms.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'learning_path')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_LINK . "','link/link.php','links.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'links')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_QUIZ . "','exercice/exercice.php','quiz.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'quiz')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_ANNOUNCEMENT . "','announcements/announcements.php','valves.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'announcements')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_FORUM . "','forum/index.php','forum.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'forums')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_DROPBOX . "','dropbox/index.php','dropbox.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'dropbox')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_USER . "','user/user.php','members.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'users')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_GROUP . "','group/group.php','group.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'groups')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_CHAT . "','chat/chat.php','chat.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'chat')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_STUDENTPUBLICATION . "','work/work.php','works.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'student_publications')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_SURVEY."','survey/survey_list.php','survey.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'survey')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_WIKI ."','wiki/index.php','wiki.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'wiki')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_GRADEBOOK."','gradebook/index.php','gradebook.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'gradebook')). "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_GLOSSARY."','glossary/index.php','glossary.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'glossary')). "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'notebook'))."','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'attendances'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'course_progress'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_CURRICULUM."','curriculum','cv.png','".Text::string2binary(api_get_setting('course_create_active_tools', 'curriculum'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_COURSE_DESCRIPTION . "','course_description/','info.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'course_description')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_CALENDAR_EVENT . "','calendar/agenda.php','agenda.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'agenda')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_DOCUMENT . "','document/document.php','folder_document.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'documents')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_LEARNPATH . "','newscorm/lp_controller.php','scorms.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'learning_path')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_LINK . "','link/link.php','links.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'links')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_QUIZ . "','exercice/exercice.php','quiz.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'quiz')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_ANNOUNCEMENT . "','announcements/announcements.php','valves.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'announcements')) . "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_FORUM . "','forum/index.php','forum.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'forums')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_DROPBOX . "','dropbox/index.php','dropbox.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'dropbox')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_USER . "','user/user.php','members.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'users')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_GROUP . "','group/group.php','group.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'groups')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_CHAT . "','chat/chat.php','chat.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'chat')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_STUDENTPUBLICATION . "','work/work.php','works.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'student_publications')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_SURVEY."','survey/survey_list.php','survey.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'survey')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_WIKI ."','wiki/index.php','wiki.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'wiki')) . "','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_GRADEBOOK."','gradebook/index.php','gradebook.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'gradebook')). "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_GLOSSARY."','glossary/index.php','glossary.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'glossary')). "','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'notebook'))."','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'attendances'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'course_progress'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_CURRICULUM."','curriculum','cv.png','".Text::string2binary(api_get_setting('course_create_active_tools', 'curriculum'))."','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
if (api_get_setting('service_visio', 'active') == 'true') {
$mycheck = api_get_setting('service_visio', 'visio_host');
if (!empty($mycheck)) {
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_VISIO_CONFERENCE . "','conference/index.php?type=conference','visio_meeting.gif','1','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_VISIO_CLASSROOM . "','conference/index.php?type=classroom','visio.gif','1','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_VISIO_CONFERENCE . "','conference/index.php?type=conference','visio_meeting.gif','1','0','squaregrey.gif','NO','_self','interaction','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_VISIO_CLASSROOM . "','conference/index.php?type=classroom','visio.gif','1','0','squaregrey.gif','NO','_self','authoring','0', '', '')");
}
}
if (api_get_setting('search_enabled') == 'true') {
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_SEARCH. "','search/','info.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'enable_search')) . "','0','search.gif','NO','_self','authoring','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '" . TOOL_SEARCH. "','search/','info.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'enable_search')) . "','0','search.gif','NO','_self','authoring','0', '', '')");
}
// Blogs (Kevin Van Den Haute :: kevin@develop-it.be)
$sql = "INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL,'" . TOOL_BLOGS . "','blog/blog_admin.php','blog_admin.gif','" . Text::string2binary(api_get_setting('course_create_active_tools', 'blogs')) . "','1','squaregrey.gif','NO','_self','admin','0', '', '')";
$sql = "INSERT INTO $toolTable VALUES ($course_id, NULL,'" . TOOL_BLOGS . "','blog/blog_admin.php','blog_admin.gif','" . Text::string2binary(api_get_setting('course_create_active_tools', 'blogs')) . "','1','squaregrey.gif','NO','_self','admin','0', '', '')";
Database::query($sql);
/* Course homepage tools for course admin only */
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '".TOOL_TRACKING . "','tracking/courseLog.php','statistics.gif','$visible_for_course_admin','1','', 'NO','_self','admin','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '".TOOL_COURSE_SETTING . "','course_info/infocours.php','reference.gif','$visible_for_course_admin','1','', 'NO','_self','admin','0', '', '')");
Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '".TOOL_COURSE_MAINTENANCE."','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','','NO','_self', 'admin','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '".TOOL_TRACKING . "','tracking/courseLog.php','statistics.gif','$visible_for_course_admin','1','', 'NO','_self','admin','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '".TOOL_COURSE_SETTING . "','course_info/infocours.php','reference.gif','$visible_for_course_admin','1','', 'NO','_self','admin','0', '', '')");
Database::query("INSERT INTO $toolTable VALUES ($course_id, NULL, '".TOOL_COURSE_MAINTENANCE."','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','','NO','_self', 'admin','0', '', '')");
/* Course_setting table (courseinfo tool) */

@ -630,47 +630,6 @@ class Text
return ($number < 10) ? '0'.$number : $number;
}
/**
* Transform the file size in a human readable format.
*
* @param int Size of the file in bytes
* @return string A human readable representation of the file size
*/
function format_file_size($file_size) {
$file_size = intval($file_size);
if($file_size >= 1073741824) {
$file_size = round($file_size / 1073741824 * 100) / 100 . 'G';
} elseif($file_size >= 1048576) {
$file_size = round($file_size / 1048576 * 100) / 100 . 'M';
} elseif($file_size >= 1024) {
$file_size = round($file_size / 1024 * 100) / 100 . 'k';
} else {
$file_size = $file_size . 'B';
}
return $file_size;
}
function return_datetime_from_array($array) {
$year = '0000';
$month = $day = $hours = $minutes = $seconds = '00';
if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
$year = $array['Y'];
$month = isset($array['F'])?$array['F']:$array['M'];
if (intval($month) < 10 ) $month = '0'.$month;
$day = $array['d'];
if (intval($day) < 10 ) $day = '0'.$day;
$hours = $array['H'];
if (intval($hours) < 10 ) $hours = '0'.$hours;
$minutes = $array['i'];
if (intval($minutes) < 10 ) $minutes = '0'.$minutes;
}
if (checkdate($month,$day,$year)) {
$datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds;
}
return $datetime;
}
/**
* Converts an string CLEANYO[admin][amann,acostea]
* into an array:

@ -403,9 +403,10 @@ class UrlManager
public static function relation_url_course_exist($course_id, $url_id)
{
$table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql= "SELECT course_code FROM $table_url_rel_course
WHERE access_url_id = ".Database::escape_string($url_id)." AND
course_code = '".Database::escape_string($course_id)."'";
$sql= "SELECT c_id FROM $table_url_rel_course
WHERE
access_url_id = ".Database::escape_string($url_id)." AND
c_id = '".Database::escape_string($course_id)."'";
$result = Database::query($sql);
$num = Database::num_rows($result);
return $num;
@ -663,7 +664,7 @@ class UrlManager
}
/**
* @param string $course_code
* @param int $courseId
* @param int $url_id
* @return resource
*/
@ -676,10 +677,9 @@ class UrlManager
$count = UrlManager::relation_url_course_exist($courseId, $url_id);
$result = false;
if (empty($count)) {
$sql = "INSERT INTO $table_url_rel_course
SET c_id = '".Database::escape_string(
$courseId
)."', access_url_id = ".Database::escape_string($url_id);
$sql = "INSERT INTO $table_url_rel_course SET
c_id = '".Database::escape_string($courseId)."',
access_url_id = ".Database::escape_string($url_id);
$result = Database::query($sql);
}

@ -132,6 +132,7 @@ class CourseAdmin extends Admin
$toolEntity = new CTool();
$toolEntity->setCId($course->getId());
$toolEntity->setImage($tool->getImage());
$toolEntity->setName($tool->getName());
$toolEntity->setLink($tool->getLink());
$toolEntity->setTarget($tool->getTarget());

@ -30,6 +30,7 @@ class LegacyListener
{
$kernel = $event->getKernel();
$request = $event->getRequest();
$session = $request->getSession();
$container = $this->container;
// Loading legacy variables
@ -69,9 +70,10 @@ class LegacyListener
$courseCodeFromRequest = $request->get('cidReq');
$courseCode = $courseCodeFromRequest;
}
/** @var \Doctrine\ORM\EntityManager $em */
$em = $this->container->get('doctrine')->getManager();
if (!empty($courseCode)) {
$em = $this->container->get('doctrine')->getManager();
$course = $em->getRepository('ChamiloLMSCoreBundle:Course')->findOneByCode($courseCode);
if ($course) {
$courseInfo = api_get_course_info($course->getCode());
@ -83,15 +85,17 @@ class LegacyListener
}
// Loading portal settings from DB.
$settingsRefreshInfo = api_get_settings_params_simple(array('variable = ?' => 'settings_latest_update'));
$settingsLatestUpdate = $settingsRefreshInfo ? $settingsRefreshInfo['selected_value'] : null;
$settingsRefreshInfo = $em->getRepository('ChamiloLMSCoreBundle:SettingsCurrent')->findOneByVariable('settings_latest_update');
$settingsLatestUpdate = !empty($settingsRefreshInfo) ? $settingsRefreshInfo->getSelectedValue() : null;
$settings = Session::read('_setting');
$settings = $session->get('_setting');
if (empty($settings)) {
api_set_settings_and_plugins();
} else {
if (isset($settings['settings_latest_update']) && $settings['settings_latest_update'] != $settingsLatestUpdate) {
if (isset($settings['settings_latest_update']) &&
$settings['settings_latest_update'] != $settingsLatestUpdate
) {
api_set_settings_and_plugins();
}
}

@ -1,23 +1,28 @@
parameters:
tool_chain.class: ChamiloLMS\CourseBundle\ToolChain
services:
chamilolms.tool_chain:
class: %tool_chain.class%
chamilolms.coursebundle.tool.announcements.class:
class: ChamiloLMS\CourseBundle\Tool\Announcements
chamilolms.coursebundle.tool.agenda.class:
class: ChamiloLMS\CourseBundle\Tool\Agenda
arguments:
- document
- agenda
- calendar_event
- calendar/agenda.php
- agenda.gif
tags:
- { name: chamilolm.course.tool }
chamilolms.coursebundle.tool.calendar.class:
class: ChamiloLMS\CourseBundle\Tool\Calendar
chamilolms.coursebundle.tool.announcements.class:
class: ChamiloLMS\CourseBundle\Tool\Announcements
arguments:
- calendar
- document
tags:
- { name: chamilolm.course.tool }
chamilolms.coursebundle.tool.course_description.class:
class: ChamiloLMS\CourseBundle\Tool\CourseDescription
arguments:
@ -88,13 +93,6 @@ services:
tags:
- { name: chamilolm.course.tool }
chamilolms.coursebundle.tool.notebook.class:
class: ChamiloLMS\CourseBundle\Tool\Notebook
arguments:
- document
tags:
- { name: chamilolm.course.tool }
chamilolms.coursebundle.tool.survey.class:
class: ChamiloLMS\CourseBundle\Tool\Survey
arguments:

@ -4,19 +4,11 @@
namespace ChamiloLMS\CourseBundle\Tool;
/**
* Class Calendar
* Class Agenda
* @package ChamiloLMS\CourseBundle\Tool
*/
class Calendar extends BaseTool
class Agenda extends BaseTool
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Calendar';
}
/**
* {@inheritdoc}
*/
@ -25,10 +17,6 @@ class Calendar extends BaseTool
return 'calendar/agenda.php';
}
public function getTarget()
{
return '_self';
}
public function getCategory()
{

@ -14,7 +14,7 @@ class Announcements extends BaseTool
*/
public function getName()
{
return 'Exercise';
return 'announcement';
}
/**

@ -12,6 +12,7 @@ abstract class BaseTool implements ToolInterface
{
protected $name;
protected $link;
protected $image;
/**
* @param string $name
@ -29,6 +30,16 @@ abstract class BaseTool implements ToolInterface
return $this->name;
}
public function getTarget()
{
return '_self';
}
public function getImage()
{
return $this->image;
}
/**
* {@inheritdoc}
*/
@ -36,4 +47,9 @@ abstract class BaseTool implements ToolInterface
{
}
}

@ -14,7 +14,7 @@ class CourseDescription extends BaseTool
*/
public function getName()
{
return 'CourseDescription';
return 'course_description';
}
/**
@ -25,11 +25,6 @@ class CourseDescription extends BaseTool
return 'course_description/index.php';
}
public function getTarget()
{
return '_self';
}
public function getCategory()
{
return 'authoring';

@ -171,7 +171,7 @@ table tbody tr td {
font-size: 0.9em;
}
#section {
.section {
border: 1px solid #ddd;
background: #f8f8f8;
padding: 5px 20px;
@ -188,14 +188,14 @@ li.resource:last-child {
}
/* heading */
a.heading {
.heading {
border: 1px solid transparent;
float: none;
clear: both;
overflow: hidden;
display: block;
}
a.heading h2 {
.heading h2 {
color: #999999;
padding-left: 0;
display: block;
@ -204,7 +204,7 @@ a.heading h2 {
font-family: "Droid Sans", sans-serif;
font-weight: bold;
}
a.heading ul.options {
.heading ul.options {
overflow: hidden;
padding: 0;
display: block;
@ -212,7 +212,7 @@ a.heading ul.options {
float: right;
margin: 6px 10px 0 0;
}
a.heading ul.options li {
.heading ul.options li {
float: left;
clear: none;
margin: 0;
@ -221,12 +221,12 @@ a.heading ul.options li {
color: #666666;
font-size: 0.9em;
}
a.heading ul.options li:first-child,
a.heading ul.options li.first {
.heading ul.options li:first-child,
.heading ul.options li.first {
padding-left: 0;
}
a.heading ul.options li:last-child,
a.heading ul.options li.last {
.heading ul.options li:last-child,
.heading ul.options li.last {
padding-right: 0;
border-right: none;
}
@ -240,13 +240,13 @@ li.operation {
margin: 0 0 10px;
padding: 0 0 0 0;
}
li.operation a.heading {
li.operation .heading {
margin: 0 0 0 0;
padding: 0;
background-color: #f0f0f0;
border: 1px solid #ddd;
}
li.operation a.heading h3 {
li.operation .heading h3 {
display: block;
clear: none;
float: left;
@ -256,25 +256,25 @@ li.operation a.heading h3 {
line-height: 1.1em;
color: black;
}
li.operation a.heading h3 span {
li.operation .heading h3 span {
margin: 0;
padding: 0;
}
li.operation a.heading h3 span.icon {
li.operation .heading h3 span.icon {
display: inline-block;
height: 12px;
width: 12px;
margin-left: 3px;
background: no-repeat center center;
}
li.operation a.heading h3 span.lock {
li.operation .heading h3 span.lock {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUHEisepJ6ljAAAAJ5JREFUGNNt0LEOAUEUheEPuwkFtSg0old4Eo/imbQKiULpBZQSCtFoaIjSktXMxpjsSW5xzvnnZmb4aYMymg9WEq1Decc1zCNkyxisoFGUTXDGEZpR8cIp8jccKiaLigwDdMP9hughr8ptALtYoB18C+Pgd5KXlrhgX5P/mSfmmKVgM/mmDP1qQ1rEyjFFkYKNmtMF3uikYFGzOdXnC5FWMZNd2GfvAAAAAElFTkSuQmCC");
}
li.operation a.heading h3 span.keys {
li.operation .heading h3 span.keys {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAMCAYAAAC0qUeeAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUHEisb1PRRAwAAAN9JREFUKM9lz71KQ0EQhuEnJ7EIKhZWaRULu4htLLwDvYRgZWmTWoI3kAuIlVik0U5Io4USRMFOUGwU7cQ/kAQMajMHDpuBZWd235lvPtjHDT4xxhuu0ZJEhhXU8YAG7rCKBWyn8EnkVSxjOuoPbKTT1/GXnCd0YqWt4uQrk3GLGcxiswgPcRgG4QsDzKMSKtUc/kUbFwEf4BlrUdeCk8WOj3jBO+5xhGOMwmQzh6Ec9zemwtgOLuN9D4tZYqwUSvnuu3jFHLpZASqHUqXQfIZe5PX8Y4RTLKGfqLVwjp9/HR4zOkGnnAoAAAAASUVORK5CYII=");
}
li.operation a.heading h3 span.http_method i, li.operation a.heading h3 span.deprecated i {
li.operation .heading h3 span.http_method i, li.operation .heading h3 span.deprecated i {
text-transform: uppercase;
text-decoration: none;
color: white;
@ -288,15 +288,15 @@ li.operation a.heading h3 span.http_method i, li.operation a.heading h3 span.dep
border-radius: 2px;
background-color: #ccc;
}
li.operation a.heading h3 span.deprecated i {
li.operation .heading h3 span.deprecated i {
width: 75px;
background-color: #F00;
}
li.operation a.heading h3 span.path {
li.operation .heading h3 span.path {
padding-left: 5px;
}
li.operation a.heading h3 span.tag {
li.operation .heading h3 span.tag {
color: #FFFFFF;
font-size: 0.7em;
vertical-align: baseline;
@ -333,14 +333,14 @@ li.operation div.content form input[type='text'].error {
}
/* GET operations */
li.operation.get a.heading {
li.operation.get .heading {
border-color: #c3d9ec;
background-color: #e7f0f7;
}
li.operation.get a.heading h3 span.http_method i {
li.operation.get .heading h3 span.http_method i {
background-color: #0f6ab4;
}
li.operation.get a.heading ul.options li {
li.operation.get .heading ul.options li {
border-right-color: #c3d9ec;
color: #0f6ab4;
}
@ -354,14 +354,14 @@ li.operation.get div.content h4 {
}
/* POST operations */
li.operation.post a.heading {
li.operation.post .heading {
border-color: #a7e1a1;
background-color: #d4f7cd;
}
li.operation.post a.heading h3 span.http_method i{
li.operation.post .heading h3 span.http_method i{
background-color: #10a54a;
}
li.operation.post a.heading ul.options li {
li.operation.post .heading ul.options li {
border-right-color: #c3e8d1;
color: #10a54a;
}
@ -375,14 +375,14 @@ li.operation.post div.content h4 {
}
/* ANY operations */
li.operation.any a.heading {
li.operation.any .heading {
background-color: lightgray;
border-color: gray;
}
li.operation.any a.heading h3 span.http_method i {
li.operation.any .heading h3 span.http_method i {
background-color: #000;
}
li.operation.any a.heading ul.options li {
li.operation.any .heading ul.options li {
color: #000;
border-right-color: gray;
}
@ -396,14 +396,14 @@ li.operation.any div.content h4 {
}
/* PUT operations */
li.operation.put a.heading {
li.operation.put .heading {
background-color: #f9f2e9;
border-color: #f0e0ca;
}
li.operation.put a.heading h3 span.http_method i {
li.operation.put .heading h3 span.http_method i {
background-color: #c5862b;
}
li.operation.put a.heading ul.options li {
li.operation.put .heading ul.options li {
border-right-color: #f0e0ca;
color: #c5862b;
}
@ -417,14 +417,14 @@ li.operation.put div.content h4 {
}
/* DELETE operations */
li.operation.delete a.heading {
li.operation.delete .heading {
background-color: #f5e8e8;
border-color: #e8c6c7;
}
li.operation.delete a.heading h3 span.http_method i {
li.operation.delete .heading h3 span.http_method i {
background-color: #a41e22;
}
li.operation.delete a.heading ul.options li {
li.operation.delete .heading ul.options li {
border-right-color: #e8c6c7;
color: #a41e22;
}
@ -438,14 +438,14 @@ li.operation.delete div.content h4 {
}
/* PATCH operations */
li.operation.patch a.heading {
li.operation.patch .heading {
background-color: #f5e8e8;
border-color: #e8c6e7;
}
li.operation.patch a.heading h3 span.http_method i {
li.operation.patch .heading h3 span.http_method i {
background-color: #a41ee2;
}
li.operation.patch a.heading ul.options li {
li.operation.patch .heading ul.options li {
border-right-color: #e8c6c7;
color: #a41ee2;
}
@ -459,13 +459,13 @@ li.operation.patch div.content h4 {
}
/* LINK operations */
li.operation.link a.heading {
li.operation.link .heading {
background-color: #F7F7D5;
}
li.operation.link a.heading h3 span.http_method i {
li.operation.link .heading h3 span.http_method i {
background-color: #C3D448;
}
li.operation.link a.heading ul.options li {
li.operation.link .heading ul.options li {
color: #C3D448;
}
@ -477,13 +477,13 @@ li.operation.link div.content h4 {
}
/* UNLINK operations */
li.operation.unlink a.heading {
li.operation.unlink .heading {
background-color: #FFEBDE;
}
li.operation.unlink a.heading h3 span.http_method i {
li.operation.unlink .heading h3 span.http_method i {
background-color: #FF8438;
}
li.operation.unlink a.heading ul.options li {
li.operation.unlink .heading ul.options li {
color: #FF8438;
}

Loading…
Cancel
Save