diff --git a/main/admin/skills_profile.php b/main/admin/skills_profile.php
index 1acb5d7869..0eea83fa2f 100644
--- a/main/admin/skills_profile.php
+++ b/main/admin/skills_profile.php
@@ -30,7 +30,6 @@ $tpl = new Template(get_lang('Skills'));
$form = new FormValidator('profile_search');
-
$form->addElement('header', get_lang('SearchSkills'));
$form->addElement('select', 'skills', null, null, array('id'=>'skills'));
$form->addElement('style_submit_button', 'submit', get_lang('Search'), 'class="btn"');
@@ -56,10 +55,10 @@ if ($form->validate()) {
$_SESSION['skills'] = $skills;
} else {
- $skills = isset($_SESSION['skills']) ? $_SESSION['skills']: null ;
+ $skills = isset($_SESSION['skills']) ? $_SESSION['skills']: array();
}
} else {
- $skills = isset($_SESSION['skills']) ? $_SESSION['skills']: null ;
+ $skills = isset($_SESSION['skills']) ? $_SESSION['skills']: array();
}
$user_list = array();
@@ -96,8 +95,6 @@ if (!empty($users)) {
}
}
-
-
//$tpl->assign('user_list', $user_list);
$tpl->assign('order_user_list', $ordered_user_list);
$tpl->assign('total_search_skills', $count_skills);
@@ -125,7 +122,7 @@ $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
switch ($action) {
case 'remove_skill':
$new_skill = array();
- foreach($skills as $skill_id) {
+ foreach ($skills as $skill_id) {
if ($id != $skill_id) {
$new_skill[] = $skill_id;
}
diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php
index 6ed194006b..a2413ae2b0 100644
--- a/main/inc/lib/course.lib.php
+++ b/main/inc/lib/course.lib.php
@@ -97,18 +97,21 @@ define('NOT_VISIBLE_SUBSCRIPTION_ALLOWED', 1);
define('VISIBLE_SUBSCRIPTION_ALLOWED', 2);
define('VISIBLE_NO_SUBSCRIPTION_ALLOWED', 3);
+define('TEACHER_SEPARATOR_STRING', '|'); //Use to show teacher names in userportal.php
+
/**
* Variables
*/
-
+/*
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSDOMAIN = Database::get_main_table(TABLE_MAIN_CATEGORY);
$TABLEUSER = Database::get_main_table(TABLE_MAIN_USER);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLEANNOUNCEMENTS = 'announcement';
$coursesRepositories = $_configuration['root_sys'];
+*/
/**
* CourseManager Class
@@ -1374,7 +1377,7 @@ class CourseManager {
$list[]= api_get_person_name($teacher['firstname'], $teacher['lastname']);
}
if (!empty($list)) {
- $teacher_string = implode($separator.' ', $list);
+ $teacher_string = implode(' '.$separator.' ', $list);
}
}
return $teacher_string;
@@ -2713,7 +2716,8 @@ class CourseManager {
return self::course_code_exists($wanted_course_code);
}
- /* Builds the course block
+ /**
+ * Builds the course block in userportal.php
* @todo use smarty
*/
public function course_item_html($params, $is_sub_content = false) {
@@ -2829,7 +2833,7 @@ class CourseManager {
$course_title .= $course_info['visual_code'];
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
- $params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
+ $params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course['code'], TEACHER_SEPARATOR_STRING);
}
$course_title .= ' ';
$course_title .= Display::return_icon('klipper.png', get_lang('CourseAutoRegister'));
@@ -2971,7 +2975,7 @@ class CourseManager {
$course_title .= $course_info['visual_code'];
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
- $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
+ $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code'], TEACHER_SEPARATOR_STRING);
}
$params['icon'] = $status_icon;
@@ -3145,7 +3149,7 @@ class CourseManager {
if (api_get_setting('display_teacher_in_courselist') == 'true') {
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
- $teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
+ $teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code'], TEACHER_SEPARATOR_STRING);
$coachs_course = api_get_coachs_from_course($course_info['id_session'], $course['code']);
$course_coachs = array();
@@ -3286,7 +3290,7 @@ class CourseManager {
/**
- * Creates a new course code based in given code
+ * Creates a new course code based in a given code
*
* @param string wanted code
* $wanted_code = 'curse' if there are in the DB codes like curse1 curse2 the function will return: course3
@@ -3317,7 +3321,14 @@ class CourseManager {
}
-
+ /**
+ * Gets the status of the users agreement in a course course-session
+ *
+ * @param int user id
+ * @param string course code
+ * @param int session id
+ * @return boolean
+ */
function is_user_accepted_legal($user_id, $course_code, $session_id = null) {
$user_id = intval($user_id);
$course_code = Database::escape_string($course_code);
@@ -3350,6 +3361,12 @@ class CourseManager {
return false;
}
+ /**
+ * Saves the user-course legal agreement
+ * @param int user id
+ * @param string course code
+ * @param int session id
+ */
function save_user_legal($user_id, $course_code, $session_id = null) {
$user_id = intval($user_id);
@@ -3501,7 +3518,7 @@ class CourseManager {
* @param int vote [1..5]
* @param int course id
* @param int session id
- * @param int url id
+ * @param int url id (access_url_id)
* @return mixed 'added', 'updated' or 'nothing'
*
*/
@@ -3579,8 +3596,11 @@ class CourseManager {
}
}
- //Stats functions
-
+ /**
+ * Returns an array with the hottest courses
+ * @param int number of days
+ * @param int number of hottest courses
+ */
function return_hot_courses($days = 30, $limit = 5) {
$limit = intval($limit);
$table_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
diff --git a/main/inc/lib/javascript/skills.js b/main/inc/lib/javascript/skills.js
index 6ba55c4a9b..be3d31af9d 100644
--- a/main/inc/lib/javascript/skills.js
+++ b/main/inc/lib/javascript/skills.js
@@ -1,253 +1,261 @@
// Arrow settings
- var exampleDropOptions = {
- tolerance:'touch',
- hoverClass:'dropHover',
- activeClass:'dragActive'
- };
+var debug = 1;
- var connectorPaintStyle = {
+var exampleDropOptions = {
+ tolerance:'touch',
+ hoverClass:'dropHover',
+ activeClass:'dragActive'
+};
+
+var connectorPaintStyle = {
+ lineWidth:5,
+ strokeStyle:"#deea18",
+ joinstyle:"round"
+};
+// .. and this is the hover style.
+var connectorHoverStyle = {
+ lineWidth:7,
+ strokeStyle:"#2e2aF8"
+};
+
+//Admin arrows
+var edit_arrow_color = '#ccc';
+
+var editEndpoint = {
+ //connectorStyle:connectorPaintStyle,
+ connector:[ "Flowchart", { stub:28 } ],
+ hoverPaintStyle:connectorHoverStyle,
+ connectorHoverStyle:connectorHoverStyle,
+ anchors: ['BottomCenter','TopCenter'],
+ endpoint:"Rectangle",
+ paintStyle:{ width:10, height:10, fillStyle:edit_arrow_color },
+ isSource:true,
+ scope:'blue rectangle',
+ maxConnections:10,
+ connectorStyle : {
+ gradient:{
+ stops:[[0, edit_arrow_color], [0.5, edit_arrow_color], [1, edit_arrow_color]]
+ }, //gradient stuff
+ lineWidth:2,
+ strokeStyle: edit_arrow_color
+ },
+ isTarget:true,
+ dropOptions : exampleDropOptions
+};
+
+
+//Student arrows
+
+//If user does not completed the skill
+var default_arrow_color = '#ccc'; //gray
+var defaultEndpoint = {
+ connector:[ "Flowchart", { stub:28 } ],
+ anchors: ['BottomCenter','TopCenter'],
+ endpoint:"Rectangle",
+ paintStyle:{ width:1, height:1, fillStyle:default_arrow_color },
+ isSource:false,
+ scope:'blue rectangle',
+ maxConnections:10,
+ connectorStyle : {
+ gradient:{ stops:[[0, default_arrow_color], [0.5, default_arrow_color], [1, default_arrow_color]] },
lineWidth:5,
- strokeStyle:"#deea18",
- joinstyle:"round"
- };
- // .. and this is the hover style.
- var connectorHoverStyle = {
- lineWidth:7,
- strokeStyle:"#2e2aF8"
- };
-
-
- //Admin arrows
- var edit_arrow_color = '#ccc';
-
- var editEndpoint = {
- //connectorStyle:connectorPaintStyle,
- connector:[ "Flowchart", { stub:28 } ],
- hoverPaintStyle:connectorHoverStyle,
- connectorHoverStyle:connectorHoverStyle,
- anchors: ['BottomCenter','TopCenter'],
- endpoint:"Rectangle",
- paintStyle:{ width:10, height:10, fillStyle:edit_arrow_color },
- isSource:true,
- scope:'blue rectangle',
- maxConnections:10,
- connectorStyle : {
- gradient:{
- stops:[[0, edit_arrow_color], [0.5, edit_arrow_color], [1, edit_arrow_color]]
- }, //gradient stuff
- lineWidth:2,
- strokeStyle: edit_arrow_color
- },
- isTarget:true,
- dropOptions : exampleDropOptions
- };
-
-
- //Student arrows
-
- //If user does not completed the skill
- var default_arrow_color = '#ccc'; //gray
- var defaultEndpoint = {
- connector:[ "Flowchart", { stub:28 } ],
- anchors: ['BottomCenter','TopCenter'],
- endpoint:"Rectangle",
- paintStyle:{ width:1, height:1, fillStyle:default_arrow_color },
- isSource:false,
- scope:'blue rectangle',
- maxConnections:10,
- connectorStyle : {
- gradient:{ stops:[[0, default_arrow_color], [0.5, default_arrow_color], [1, default_arrow_color]] },
- lineWidth:5,
- strokeStyle:default_arrow_color
- },
- isTarget:false,
- setDraggableByDefault : false,
- };
-
- // If user completed the skill
- var done_arrow_color = '#73982C'; //green
- var doneEndpoint = {
- connector:[ "Flowchart", { stub:28 } ],
- anchors: ['BottomCenter','TopCenter'],
- endpoint:"Rectangle",
- paintStyle:{ width:1, height:1, fillStyle:done_arrow_color},
- isSource:false,
- scope:'blue rectangle',
- maxConnections:10,
- connectorStyle : {
- gradient:{ stops:[[0, done_arrow_color], [0.5, done_arrow_color], [1, done_arrow_color]] },
- lineWidth:5,
- strokeStyle:done_arrow_color
- },
- isTarget:false,
- setDraggableByDefault : false,
- };
-
-
-
-
- //Functions
-
+ strokeStyle:default_arrow_color
+ },
+ isTarget:false,
+ setDraggableByDefault : false,
+};
- /* Clean window block classes*/
- function cleanclass(obj) {
- obj.removeClass('first_window');
- obj.removeClass('second_window');
- obj.removeClass('third_window');
- }
-
- /* When clicking the red block */
- function open_parent(parent_id, id) {
- console.log("open_parent call : id " + id + " parent_id:" + parent_id);
- var numeric_parent_id = parent_id.split('_')[1];
- var numeric_id = id.split('_')[1];
- load_parent(numeric_parent_id, numeric_id);
- }
-
- /* When clicking a children block
- @param string block id i.e "block_1"
- * */
+// If user completed the skill
+var done_arrow_color = '#73982C'; //green
+var doneEndpoint = {
+ connector:[ "Flowchart", { stub:28 } ],
+ anchors: ['BottomCenter','TopCenter'],
+ endpoint:"Rectangle",
+ paintStyle:{ width:1, height:1, fillStyle:done_arrow_color},
+ isSource:false,
+ scope:'blue rectangle',
+ maxConnections:10,
+ connectorStyle : {
+ gradient:{ stops:[[0, done_arrow_color], [0.5, done_arrow_color], [1, done_arrow_color]] },
+ lineWidth:5,
+ strokeStyle:done_arrow_color
+ },
+ isTarget:false,
+ setDraggableByDefault : false,
+};
+
+//Functions
+
+/* Clean window block classes*/
+function cleanclass(obj) {
+ obj.removeClass('first_window');
+ obj.removeClass('second_window');
+ obj.removeClass('third_window');
+}
+
+/* When clicking the red block */
+function open_parent(parent_id, id) {
+ if (debug) console.log("open_parent call : id " + id + " parent_id:" + parent_id);
+ var numeric_parent_id = parent_id.split('_')[1];
+ var numeric_id = id.split('_')[1];
+ load_parent(numeric_parent_id, numeric_id);
+}
+
+/*
+ *
+ * When clicking a children block
+ @param string block id i.e "block_1"
+ @param int load user data or not
- function open_block(id, load_user_data) {
- console.log("open_block id : " + id);
- var numeric_id = id.split('_')[1];
- for (var i = 0; i < skills.length; i++) {
- //Remove everything except parents
- if (jQuery.inArray(skills[i].element, parents) == -1) {
- //console.log('deleting this'+ skills[i].element);
- jsPlumb.deleteEndpoint(skills[i].endp);
- $("#"+skills[i].element).remove();
- }
- }
-
- //Modifying current block position
- pos = $('#'+id).position();
- left_value = center_x;
-
- if (parents.length == 2) {
- top_value = space_between_blocks_y + offset_y;
- } else {
- top_value = 100;
- }
- jsPlumb.animate(id, { left: left_value, top:top_value }, { duration:duration_value });
-
- //Modifying root block position
- pos_parent = $('#'+parents[0]).position();
- jsPlumb.animate(parents[0], { left: center_x, top:offset_y }, { duration:duration_value });
-
- top_value = 2*space_between_blocks_y +offset_y ;
- load_children(numeric_id, top_value, load_user_data);
- }
+*/
+
+function open_block(id, load_user_data) {
+ if (debug) console.log("open_block id : " + id+" load_user_data: " +load_user_data);
+ var numeric_id = id.split('_')[1];
- function open_block_student(id) {
- open_block(id, 1)
- }
+ for (var i = 0; i < skills.length; i++) {
+ //Remove everything except parents
+ if (jQuery.inArray(skills[i].element, parents) == -1) {
+ if (debug) console.log('deleting this skill '+ skills[i].element + " id: " + i);
+ jsPlumb.deleteEndpoint(skills[i].endp);
+ $("#"+skills[i].element).remove();
+ }
+ }
+
+ //Modifying current block position
+ pos = $('#'+id).position();
+ left_value = center_x;
+
+ if (parents.length == 2) {
+ top_value = space_between_blocks_y + offset_y;
+ } else {
+ top_value = 100;
+ }
- /* Loads parent blocks */
- function load_parent(parent_id, id) {
- console.log("load_parent call : id " + id + " parent_id:" + parent_id);
- var ix= 0;
- $.ajax({
- url: url+'&a=load_direct_parents&id='+id,
- async: false,
- success: function(json) {
- var json = jQuery.parseJSON(json);
-
- $.each(json,function(i,item) {
- left_value = center_x + space_between_blocks_x * ix;
- top_value = offset_y;
-
- $('body').append('