Browse Source

Merge pull request #35 from chamilo/1.9.x

1.9.x
ycastillo 11 years ago
parent
commit
247e9998b7

+ 51 - 34
main/admin/add_users_to_session.php

@@ -90,7 +90,7 @@ function search_users($needle, $type)
             $id_session = intval($id_session);
             // check id_user from session_rel_user table
             $sql = 'SELECT id_user FROM '.$tbl_session_rel_user.'
-            WHERE id_session ="'.$id_session.'" AND relation_type<>'.SESSION_RELATION_TYPE_RRHH.' ';
+                    WHERE id_session ="'.$id_session.'" AND relation_type<>'.SESSION_RELATION_TYPE_RRHH.' ';
             $res = Database::query($sql);
             $user_ids = array();
             if (Database::num_rows($res) > 0) {
@@ -106,20 +106,21 @@ function search_users($needle, $type)
         switch ($type) {
             case 'single':
                 // search users where username or firstname or lastname begins likes $needle
-                $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
+                $sql = 'SELECT user.user_id, username, lastname, firstname, official_code
+                        FROM '.$tbl_user.' user
                         WHERE (username LIKE "'.$needle.'%" OR firstname LIKE "'.$needle.'%"
                             OR lastname LIKE "'.$needle.'%") AND user.status<>6 AND user.status<>'.DRH.''.
                             $order_clause.
                             ' LIMIT 11';
                 break;
             case 'multiple':
-                $sql = 'SELECT user.user_id, username, lastname, firstname
+                $sql = 'SELECT user.user_id, username, lastname, firstname, official_code
                         FROM '.$tbl_user.' user
                         WHERE '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.status<>'.DRH.' AND user.status<>6 '.$cond_user_id.
                         $order_clause;
                 break;
             case 'any_session':
-                $sql = 'SELECT DISTINCT user.user_id, username, lastname, firstname
+                $sql = 'SELECT DISTINCT user.user_id, username, lastname, firstname, official_code
                         FROM '.$tbl_user.' user
                         LEFT OUTER JOIN '.$tbl_session_rel_user.' s ON (s.id_user = user.user_id)
                         WHERE   s.id_user IS null AND user.status<>'.DRH.' AND
@@ -134,7 +135,8 @@ function search_users($needle, $type)
             if ($access_url_id != -1) {
                 switch($type) {
                     case 'single':
-                        $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
+                        $sql = 'SELECT user.user_id, username, lastname, firstname, official_code
+                        FROM '.$tbl_user.' user
                         INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
                         WHERE access_url_id = '.$access_url_id.'  AND (username LIKE "'.$needle.'%"
                         OR firstname LIKE "'.$needle.'%"
@@ -143,7 +145,8 @@ function search_users($needle, $type)
                         ' LIMIT 11';
                         break;
                     case 'multiple':
-                        $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
+                        $sql = 'SELECT user.user_id, username, lastname, firstname , official_code
+                        FROM '.$tbl_user.' user
                         INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
                         WHERE access_url_id = '.$access_url_id.' AND
                             '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND
@@ -152,7 +155,7 @@ function search_users($needle, $type)
                         $order_clause;
                         break;
                     case 'any_session' :
-                        $sql = 'SELECT DISTINCT user.user_id, username, lastname, firstname
+                        $sql = 'SELECT DISTINCT user.user_id, username, lastname, firstname, official_code
                             FROM '.$tbl_user.' user
                             LEFT OUTER JOIN '.$tbl_session_rel_user.' s ON (s.id_user = user.user_id)
                             INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
@@ -173,8 +176,8 @@ function search_users($needle, $type)
             while ($user = Database :: fetch_array($rs)) {
                 $i++;
                 if ($i<=10) {
-                    $person_name = api_get_person_name($user['firstname'], $user['lastname']);
-                    $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
+                    $person_name = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') '.$user['official_code'];
+                    $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' '.'\')">'.$person_name.' </a><br />';
                 } else {
                     $return .= '...<br />';
                 }
@@ -185,8 +188,8 @@ function search_users($needle, $type)
             global $nosessionUsersList;
             $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
             while ($user = Database :: fetch_array($rs)) {
-                $person_name = api_get_person_name($user['firstname'], $user['lastname']);
-	            $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
+                $person_name = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') '.$user['official_code'];
+	            $return .= '<option value="'.$user['user_id'].'">'.$person_name.' </option>';
 			}
 			$return .= '</select>';
 			$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
@@ -277,25 +280,25 @@ $ajax_search = $add_type == 'unique' ? true : false;
 
 $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
 if ($ajax_search) {
-    $sql="SELECT user_id, lastname, firstname, username, id_session
+    $sql = "SELECT user_id, lastname, firstname, username, id_session, official_code
             FROM $tbl_user u
             INNER JOIN $tbl_session_rel_user
                 ON $tbl_session_rel_user.id_user = u.user_id AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
                 AND $tbl_session_rel_user.id_session = ".intval($id_session)."
-                WHERE u.status<>".DRH." AND u.status<>6 $order_clause";
+            WHERE u.status<>".DRH." AND u.status<>6 $order_clause";
 
     if (api_is_multiple_url_enabled()) {
         $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
-            $sql="SELECT u.user_id, lastname, firstname, username, id_session
+            $sql="SELECT u.user_id, lastname, firstname, username, id_session, official_code
             FROM $tbl_user u
             INNER JOIN $tbl_session_rel_user
                 ON $tbl_session_rel_user.id_user = u.user_id AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
                 AND $tbl_session_rel_user.id_session = ".intval($id_session)."
                 INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id)
-                WHERE access_url_id = $access_url_id AND u.status<>".DRH." AND u.status<>6
-                $order_clause";
+            WHERE access_url_id = $access_url_id AND u.status<>".DRH." AND u.status<>6
+            $order_clause";
         }
     }
     $result = Database::query($sql);
@@ -353,18 +356,22 @@ if ($ajax_search) {
     }
 
     if ($use_extra_fields) {
-        $sql = "SELECT  user_id, lastname, firstname, username, id_session
+        $sql = "SELECT  user_id, lastname, firstname, username, id_session, official_code
                FROM $tbl_user u
                     LEFT JOIN $tbl_session_rel_user
-                    ON $tbl_session_rel_user.id_user = u.user_id AND $tbl_session_rel_user.id_session = '$id_session' AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
-                    $where_filter AND u.status<>".DRH." AND u.status<>6
-                    $order_clause";
+                    ON $tbl_session_rel_user.id_user = u.user_id AND
+                    $tbl_session_rel_user.id_session = '$id_session' AND
+                    $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
+                $where_filter AND u.status<>".DRH." AND u.status<>6
+                $order_clause";
 
     } else {
-        $sql = "SELECT  user_id, lastname, firstname, username, id_session
+        $sql = "SELECT  user_id, lastname, firstname, username, id_session, official_code
                 FROM $tbl_user u
                 LEFT JOIN $tbl_session_rel_user
-                ON $tbl_session_rel_user.id_user = u.user_id AND $tbl_session_rel_user.id_session = '$id_session' AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
+                ON $tbl_session_rel_user.id_user = u.user_id AND
+                $tbl_session_rel_user.id_session = '$id_session' AND
+                $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
                 WHERE u.status<>".DRH." AND u.status<>6
                 $order_clause";
     }
@@ -372,42 +379,52 @@ if ($ajax_search) {
         $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
-            $sql = "SELECT  u.user_id, lastname, firstname, username, id_session
+            $sql = "SELECT  u.user_id, lastname, firstname, username, id_session, official_code
                     FROM $tbl_user u
                     LEFT JOIN $tbl_session_rel_user
-                        ON $tbl_session_rel_user.id_user = u.user_id AND $tbl_session_rel_user.id_session = '$id_session' AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
+                        ON $tbl_session_rel_user.id_user = u.user_id AND
+                        $tbl_session_rel_user.id_session = '$id_session' AND
+                        $tbl_session_rel_user.relation_type <> ".SESSION_RELATION_TYPE_RRHH."
                     INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id)
-                    WHERE access_url_id = $access_url_id  $where_filter AND u.status<>".DRH." AND u.status<>6
+                    WHERE access_url_id = $access_url_id $where_filter AND u.status<>".DRH." AND u.status<>6
                     $order_clause";
         }
     }
 
     $result   = Database::query($sql);
     $users    = Database::store_result($result,'ASSOC');
-
     foreach ($users as $uid => $user) {
         if ($user['id_session'] != $id_session) {
-            $nosessionUsersList[$user['user_id']] = array('fn'=>$user['firstname'],'ln'=>$user['lastname'],'un'=>$user['username']) ;
+            $nosessionUsersList[$user['user_id']] = array(
+                'fn' => $user['firstname'],
+                'ln' => $user['lastname'],
+                'un' => $user['username'],
+                'official_code' => $user['official_code']
+            ) ;
             unset($users[$uid]);
 	}
     }
     unset($users); //clean to free memory
 
     //filling the correct users in list
-    $sql="SELECT  user_id, lastname, firstname, username, id_session
+    $sql="SELECT  user_id, lastname, firstname, username, id_session, official_code
           FROM $tbl_user u
           LEFT JOIN $tbl_session_rel_user
-          ON $tbl_session_rel_user.id_user = u.user_id AND $tbl_session_rel_user.id_session = '$id_session' AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
+          ON $tbl_session_rel_user.id_user = u.user_id AND
+            $tbl_session_rel_user.id_session = '$id_session' AND
+            $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
           WHERE u.status<>".DRH." AND u.status<>6 $order_clause";
 
     if (api_is_multiple_url_enabled()) {
         $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
-            $sql="SELECT  u.user_id, lastname, firstname, username, id_session
+            $sql="SELECT  u.user_id, lastname, firstname, username, id_session, official_code
                 FROM $tbl_user u
                 LEFT JOIN $tbl_session_rel_user
-                    ON $tbl_session_rel_user.id_user = u.user_id AND $tbl_session_rel_user.id_session = '$id_session' AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
+                    ON $tbl_session_rel_user.id_user = u.user_id AND
+                    $tbl_session_rel_user.id_session = '$id_session' AND
+                    $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
                 INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id)
                 WHERE access_url_id = $access_url_id AND u.status<>".DRH." AND u.status<>6
                 $order_clause";
@@ -515,7 +532,7 @@ if (!empty($errorMsg)) {
               foreach ($nosessionUsersList as $uid => $enreg) {
               ?>
                   <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>>
-                      <?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?>
+                      <?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].') '.$enreg['official_code']; ?>
                   </option>
               <?php
               }
@@ -566,10 +583,10 @@ if (!empty($errorMsg)) {
         </div>
         <select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" class="span5">
         <?php
-        foreach($sessionUsersList as $enreg) {
+        foreach ($sessionUsersList as $enreg) {
         ?>
             <option value="<?php echo $enreg['user_id']; ?>">
-                <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?>
+                <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].') '.$enreg['official_code']; ?>
             </option>
         <?php
         }

+ 9 - 3
main/admin/add_users_to_usergroup.php

@@ -224,7 +224,10 @@ if (!empty($complete_user_list)) {
         }
 
         if (in_array($item['user_id'], $list_in)) {
-            $person_name = api_get_person_name($item['firstname'], $item['lastname']).' ('.$item['username'].')';
+            $person_name = api_get_person_name(
+                $item['firstname'],
+                $item['lastname']
+            ).' ('.$item['username'].') '.$item['official_code'];
             $elements_in[$item['user_id']] = $person_name;
         }
     }
@@ -253,7 +256,10 @@ if (!empty($user_list)) {
             }
         }
         if ($item['status'] == 6 ) continue; //avoid anonymous users
-        $person_name = api_get_person_name($item['firstname'], $item['lastname']).' ('.$item['username'].')';
+        $person_name = api_get_person_name(
+            $item['firstname'],
+            $item['lastname']
+        ).' ('.$item['username'].') '.$item['official_code'];
         if (in_array($item['user_id'], $list_in)) {
             //$elements_in[$item['user_id']] = $person_name;
         } else {
@@ -296,7 +302,7 @@ if ($add_type=='multiple') {
                 foreach ($new_field['data'] as $option) {
                     $checked='';
                     if (isset($_POST[$varname])) {
-                        if ($_POST[$varname]==$option[1]) {
+                        if ($_POST[$varname] == $option[1]) {
                             $checked = 'selected="true"';
                         }
                     }

+ 34 - 17
main/inc/lib/course.lib.php

@@ -3212,7 +3212,8 @@ class CourseManager
      * @param bool      Whether to show the document quick-loader or not
      * @return void
      */
-    public static function display_courses($user_id, $load_dirs = false) {
+    public static function display_courses($user_id, $load_dirs = false)
+    {
         $user_id = intval($user_id);
         if (empty($user_id)) {
             $user_id = api_get_user_id();
@@ -3224,12 +3225,16 @@ class CourseManager
         $result = Database::query($sql);
         $html = null;
         while ($row = Database::fetch_array($result)) {
-            $params = array();
             // We simply display the title of the category.
-            $params['icon'] = Display::return_icon('folder_yellow.png', $row['title'], array(), ICON_SIZE_LARGE);
-            $params['title'] = $row['title'];
-            $params['class'] = 'table_user_course_category';
-            $html .= self::course_item_parent(self::course_item_html($params, true), self :: display_courses_in_category($row['id'], $load_dirs));
+            $params = array(
+               'icon' => Display::return_icon('folder_yellow.png', $row['title'], array(), ICON_SIZE_LARGE),
+               'title' => $row['title'],
+               'class' => 'table_user_course_category'
+            );
+            $html .= self::course_item_parent(
+                self::course_item_html($params, true),
+                self :: display_courses_in_category($row['id'], $load_dirs)
+            );
         }
 
         // Step 2: We display the course without a user category.
@@ -3244,7 +3249,8 @@ class CourseManager
      * @param bool      Whether to show the document quick-loader or not
      *  @return void
      */
-    public static function display_courses_in_category($user_category_id, $load_dirs = false) {
+    public static function display_courses_in_category($user_category_id, $load_dirs = false)
+    {
         $user_id = api_get_user_id();
         // Table definitions
         $TABLECOURS                     = Database :: get_main_table(TABLE_MAIN_COURSE);
@@ -3261,17 +3267,29 @@ class CourseManager
         }
 
         //AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
-        $sql = "SELECT course.id, course.title, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,
-                                        course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat
-                                        FROM    $TABLECOURS      course,
-                                                $TABLECOURSUSER  course_rel_user, ".$TABLE_ACCESS_URL_REL_COURSE." url
-                                        WHERE   course.code = course_rel_user.course_code AND url.course_code = course.code AND
-                                                course_rel_user.user_id = '".$user_id."' AND
-                                                course_rel_user.user_course_cat='".$user_category_id."' $without_special_courses ";
+        $sql = "SELECT
+                course.id,
+                course.title,
+                course.code,
+                course.subscribe subscr,
+                course.unsubscribe unsubscr,
+                course_rel_user.status status,
+                course_rel_user.sort sort,
+                course_rel_user.user_course_cat user_course_cat
+                FROM $TABLECOURS      course,
+                     $TABLECOURSUSER  course_rel_user,
+                     $TABLE_ACCESS_URL_REL_COURSE url
+                WHERE
+                    course.code = course_rel_user.course_code AND
+                    url.course_code = course.code AND
+                    course_rel_user.user_id = '".$user_id."' AND
+                    course_rel_user.user_course_cat='".$user_category_id."'
+                    $without_special_courses ";
+
         // If multiple URL access mode is enabled, only fetch courses
         // corresponding to the current URL.
         if (api_get_multiple_access_url() && $current_url_id != -1) {
-            $sql .= " AND url.course_code=course.code AND access_url_id='".$current_url_id."'";
+            $sql .= " AND url.course_code = course.code AND access_url_id='".$current_url_id."'";
         }
         // Use user's classification for courses (if any).
         $sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
@@ -3288,7 +3306,6 @@ class CourseManager
             if ($course_info['visibility'] == COURSE_VISIBILITY_HIDDEN) {
                 continue;
             }
-            //$course['id_session'] = null;
             $course_info['id_session'] = null;
             $course_info['status'] = $course['status'];
 
@@ -3301,7 +3318,7 @@ class CourseManager
 
             // For each course, get if there is any notification icon to show
             // (something that would have changed since the user's last visit).
-            $show_notification = Display :: show_notification($course_info);
+            $show_notification = Display::show_notification($course_info);
 
             // New code displaying the user's status in respect to this course.
             $status_icon = Display::return_icon('blackboard.png', $course_info['title'], array(), ICON_SIZE_LARGE);

+ 35 - 25
main/inc/lib/display.lib.php

@@ -1036,23 +1036,25 @@ class Display {
      * @param array     Course information array, containing at least elements 'db' and 'k'
      * @return string   The HTML link to be shown next to the course
      */
-    public static function show_notification($course_info) {
+    public static function show_notification($course_info)
+    {
         $t_track_e_access 	= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
-        $user_id = api_get_user_id();
-
         $course_tool_table	= Database::get_course_table(TABLE_TOOL_LIST);
         $tool_edit_table 	= Database::get_course_table(TABLE_ITEM_PROPERTY);
-
         $course_code        = Database::escape_string($course_info['code']);
-        $course_id          = $course_info['real_id'];
 
+        $user_id = api_get_user_id();
+        $course_id = $course_info['real_id'];
         $course_info['id_session'] = intval($course_info['id_session']);
+
         // Get the user's last access dates to all tools of this course
-        $sqlLastTrackInCourse = "SELECT * FROM $t_track_e_access USE INDEX (access_cours_code, access_user_id)
-                                 WHERE  access_cours_code = '".$course_code."' AND
-                                        access_user_id = '$user_id' AND
-                                        access_session_id ='".$course_info['id_session']."'";
-        $resLastTrackInCourse = Database::query($sqlLastTrackInCourse);
+        $sql = "SELECT *
+                FROM $t_track_e_access USE INDEX (access_cours_code, access_user_id)
+                WHERE
+                    access_cours_code = '".$course_code."' AND
+                    access_user_id = '$user_id' AND
+                    access_session_id ='".$course_info['id_session']."'";
+        $resLastTrackInCourse = Database::query($sql);
 
         $oldestTrackDate = $oldestTrackDateOrig = '3000-01-01 00:00:00';
         while ($lastTrackInCourse = Database::fetch_array($resLastTrackInCourse)) {
@@ -1061,6 +1063,7 @@ class Display {
                 $oldestTrackDate = $lastTrackInCourse['access_date'];
             }
         }
+
         if ($oldestTrackDate == $oldestTrackDateOrig) {
             //if there was no connexion to the course ever, then take the
             // course creation date as a reference
@@ -1076,18 +1079,26 @@ class Display {
         }
 
         // Get the last edits of all tools of this course.
-        $sql = "SELECT tet.*, tet.lastedit_date last_date, tet.tool tool, tet.ref ref, ".
-                            " tet.lastedit_type type, tet.to_group_id group_id, ".
-                            " ctt.image image, ctt.link link ".
-                        " FROM $tool_edit_table tet, $course_tool_table ctt ".
-                        " WHERE tet.c_id = $course_id AND
-                                ctt.c_id = $course_id AND
-                                tet.lastedit_date > '$oldestTrackDate' ".
-                        // Special hack for work tool, which is called student_publication in c_tool and work in c_item_property :-/ BT#7104
-                        " AND (ctt.name = tet.tool OR (ctt.name = 'student_publication' AND tet.tool = 'work')) ".
-                        " AND ctt.visibility = '1' ".
-                        " AND tet.lastedit_user_id != $user_id AND tet.id_session = '".$course_info['id_session']."' ".
-                        " ORDER BY tet.lastedit_date";
+        $sql = "SELECT
+                    tet.*,
+                    tet.lastedit_date last_date,
+                    tet.tool tool,
+                    tet.ref ref,
+                    tet.lastedit_type type,
+                    tet.to_group_id group_id,
+                    ctt.image image,
+                    ctt.link link
+                FROM $tool_edit_table tet, $course_tool_table ctt
+                WHERE
+                    tet.c_id = $course_id AND
+                    ctt.c_id = $course_id AND
+                    tet.lastedit_date > '$oldestTrackDate' ".
+                    // Special hack for work tool, which is called student_publication in c_tool and work in c_item_property :-/ BT#7104
+                    " AND (ctt.name = tet.tool OR (ctt.name = 'student_publication' AND tet.tool = 'work')) ".
+                    " AND ctt.visibility = '1' ".
+                    " AND tet.lastedit_user_id != $user_id AND tet.id_session = '".$course_info['id_session']."'
+                 ORDER BY tet.lastedit_date";
+
         $res = Database::query($sql);
         // Get the group_id's with user membership.
         $group_ids = GroupManager :: get_group_ids($course_info['real_id'], $user_id);
@@ -1097,7 +1108,7 @@ class Display {
         while ($res && ($item_property = Database::fetch_array($res))) {
             // First thing to check is if the user never entered the tool
             // or if his last visit was earlier than the last modification.
-            if ((!isset ($lastTrackInCourseDate[$item_property['tool']])
+            if ((!isset($lastTrackInCourseDate[$item_property['tool']])
                  || $lastTrackInCourseDate[$item_property['tool']] < $item_property['lastedit_date'])
                 // Drop the tool elements that are part of a group that the
                 // user is not part of.
@@ -1130,10 +1141,9 @@ class Display {
                 // If it's a learning path, ensure it is currently visible to the user
                 if ($item_property['tool'] == TOOL_LEARNPATH) {
                     require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
-                    if (!learnpath::is_lp_visible_for_student($item_property['ref'],$user_id, $course_code)) {
+                    if (!learnpath::is_lp_visible_for_student($item_property['ref'], $user_id, $course_code)) {
                         continue;
                     }
-
                 }
                 if ($item_property['tool'] == 'work' && $item_property['type'] == 'DirectoryCreated') {
                     $item_property['lastedit_type'] = 'WorkAdded';

+ 2 - 1
main/inc/lib/userportal.lib.php

@@ -935,7 +935,8 @@ class IndexManager {
 	 * The most important function here, prints the session and course list (user_portal.php)
 	 *
 	 * */
-	function return_courses_and_sessions($user_id) {
+	function return_courses_and_sessions($user_id)
+    {
         $session_categories = array();
         $load_history = (isset($_GET['history']) && intval($_GET['history']) == 1) ? true : false;
 

+ 15 - 6
main/newscorm/learnpath.class.php

@@ -2114,12 +2114,14 @@ class learnpath
      * @param   string  Course code (optional)
      * @return	bool	True if
      */
-    public static function is_lp_visible_for_student($lp_id, $student_id, $course = null) {
+    public static function is_lp_visible_for_student($lp_id, $student_id, $courseCode = null) {
         $lp_id = (int)$lp_id;
-        $course = api_get_course_info($course);
-        $tbl_learnpath = Database :: get_course_table(TABLE_LP_MAIN);
+        $course = api_get_course_info($courseCode);
+        $tbl_learnpath = Database::get_course_table(TABLE_LP_MAIN);
         // Get current prerequisite
-        $sql = "SELECT id, prerequisite, publicated_on, expired_on FROM $tbl_learnpath WHERE c_id = ".$course['real_id']." AND id = $lp_id";
+        $sql = "SELECT id, prerequisite, publicated_on, expired_on
+                FROM $tbl_learnpath
+                WHERE c_id = ".$course['real_id']." AND id = $lp_id";
         $rs  = Database::query($sql);
         $now = time();
         if (Database::num_rows($rs)>0) {
@@ -2129,7 +2131,14 @@ class learnpath
             $progress = 0;
 
             if (!empty($prerequisite)) {
-                $progress = self::get_db_progress($prerequisite,$student_id,'%', '', false, api_get_session_id());
+                $progress = self::get_db_progress(
+                    $prerequisite,
+                    $student_id,
+                    '%',
+                    $courseCode,
+                    false,
+                    api_get_session_id()
+                );
                 $progress = intval($progress);
                 if ($progress < 100) {
                     $is_visible = false;
@@ -2139,7 +2148,7 @@ class learnpath
             // Also check the time availability of the LP
 
             if ($is_visible) {
-	            //Adding visibility reestrinctions
+	            //Adding visibility restrictions
 	            if (!empty($row['publicated_on']) && $row['publicated_on'] != '0000-00-00 00:00:00') {
 	            	if ($now < api_strtotime($row['publicated_on'], 'UTC')) {
 	            		//api_not_allowed();

+ 18 - 0
main/template/default/layout/footer.tpl

@@ -81,6 +81,7 @@ $(document).ready( function() {
      * </div>
      * */
     $(".advanced_options").on("click", function() {
+        event.preventDefault();
         var id = $(this).attr('id') + '_options';
         var button = $(this);
         $("#"+id).toggle(function() {
@@ -88,6 +89,23 @@ $(document).ready( function() {
         });
     });
 
+    /**
+     * <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
+     * <a class="advanced_options_close" href="http://" rel="div_id">Close</a>
+     * <div id="div_id">Div content</div>
+     * */
+    $(".advanced_options_open").on("click", function() {
+        event.preventDefault();
+        var id = $(this).attr('rel');
+        $("#"+id).show();
+    });
+
+    $(".advanced_options_close").on("click", function() {
+        event.preventDefault();
+        var id = $(this).attr('rel');
+        $("#"+id).hide();
+    });
+
     // Chosen select
     $(".chzn-select").chosen({
         disable_search_threshold: 10

+ 23 - 18
main/work/downloadfolder.inc.php

@@ -22,7 +22,7 @@ if (empty($work_data)) {
     exit;
 }
 
-//prevent some stuff
+// Prevent some stuff.
 if (empty($path)) {
     $path = '/';
 }
@@ -42,7 +42,8 @@ $temp_zip_file = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
 $zip_folder = new PclZip($temp_zip_file);
 
 $tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
-$prop_table              = Database::get_course_table(TABLE_ITEM_PROPERTY);
+$prop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
+$tableUser = Database::get_main_table(TABLE_MAIN_USER);
 
 // Put the files in the zip
 // 2 possibilities: admins get all files and folders in the selected folder (except for the deleted ones)
@@ -51,6 +52,7 @@ $prop_table              = Database::get_course_table(TABLE_ITEM_PROPERTY);
 //admins are allowed to download invisible files
 $files = array();
 $course_id = api_get_course_int_id();
+$sessionId = api_get_session_id();
 
 $filenameCondition = null;
 if (array_key_exists('filename', $work_data)) {
@@ -61,17 +63,21 @@ if (api_is_allowed_to_edit()) {
     //Search for all files that are not deleted => visibility != 2
     $sql = "SELECT DISTINCT url, title, description, insert_user_id, insert_date, contains_file $filenameCondition
             FROM $tbl_student_publication AS work INNER JOIN $prop_table AS props
-                ON (
-                    props.c_id = $course_id AND
-                    work.c_id = $course_id AND
-                    work.id = props.ref
-                  )
- 			WHERE   props.tool='work' AND
- 			        work.parent_id = $work_id AND
- 			        work.filetype = 'file' AND
- 			        props.visibility<>'2' AND
- 			        work.active = 1 AND
- 			        work.post_group_id = $groupId
+            INNER JOIN $tableUser as u
+            ON (
+                props.c_id = $course_id AND
+                work.c_id = $course_id AND
+                work.id = props.ref AND
+                props.tool='work' AND
+                work.user_id = u.user_id
+            )
+ 			WHERE
+                work.parent_id = $work_id AND
+                work.filetype = 'file' AND
+                props.visibility <> '2' AND
+                work.active IN (0, 1) AND
+                work.post_group_id = $groupId AND
+                session_id = $sessionId
             ";
 
 } else {
@@ -113,7 +119,7 @@ while ($not_deleted_file = Database::fetch_assoc($query)) {
 
     $user_info = api_get_user_info($not_deleted_file['insert_user_id']);
     $insert_date = api_get_local_time($not_deleted_file['insert_date']);
-    $insert_date = str_replace(array(':','-', ' '), '_', $insert_date);
+    $insert_date = str_replace(array(':', '-', ' '), '_', $insert_date);
 
     $title = basename($not_deleted_file['title']);
     if (!empty($filenameCondition)) {
@@ -123,7 +129,7 @@ while ($not_deleted_file = Database::fetch_assoc($query)) {
     }
 
     $filename = $insert_date.'_'.$user_info['username'].'_'.$title;
-
+    // File exists
     if (file_exists($sys_course_path.$_course['path'].'/'.$not_deleted_file['url']) && !empty($not_deleted_file['url'])) {
         $files[basename($not_deleted_file['url'])] = $filename;
         $addStatus = $zip_folder->add(
@@ -133,10 +139,9 @@ while ($not_deleted_file = Database::fetch_assoc($query)) {
             PCLZIP_CB_PRE_ADD,
             'my_pre_add_callback'
         );
-    }
-
+    } else {
     // Convert texts in html files
-    if ($not_deleted_file['contains_file'] == 0) {
+    //if ($not_deleted_file['contains_file'] == 0) {
         $filename = trim($filename).".html";
         $work_temp = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().'_'.$filename;
         file_put_contents($work_temp, $not_deleted_file['description']);

+ 78 - 39
main/work/work.lib.php

@@ -242,7 +242,7 @@ function get_work_count_by_student($user_id, $work_id)
                 c_id = $course_id AND
                 parent_id = $work_id AND
                 user_id = $user_id AND
-                active = 1 AND
+                active IN (0, 1) AND
                 session_id = $session_id ";
 	$result = Database::query($sql);
 	$return = 0;
@@ -283,7 +283,7 @@ function get_work_assignment_by_id($id, $courseId = null)
  * @param string $add_in_where_query
  * @return array
  */
-function getWorkList($id, $my_folder_data, $add_in_where_query)
+function getWorkList($id, $my_folder_data, $add_in_where_query = null)
 {
     $work_table      = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
 
@@ -313,7 +313,13 @@ function getWorkList($id, $my_folder_data, $add_in_where_query)
     if ($is_allowed_to_edit) {
         $active_condition = ' active IN (0, 1)';
         $sql = "SELECT *  FROM  $work_table
-                WHERE c_id = $course_id $add_in_where_query $condition_session AND $active_condition AND (parent_id = 0) $contains_file_query ";
+                WHERE
+                  c_id = $course_id
+                  $add_in_where_query
+                  $condition_session AND
+                  $active_condition AND
+                  (parent_id = 0)
+                  $contains_file_query ";
         if (!empty($group_id)) {
             $sql .= " AND post_group_id = '".$group_id."' ";
         }
@@ -328,9 +334,13 @@ function getWorkList($id, $my_folder_data, $add_in_where_query)
             $subdirs_query = "AND parent_id = 0";
         }
         //@todo how we can active or not an assignment?
-        $active_condition = ' AND active IN (1,0)';
+        $active_condition = ' AND active IN (1, 0)';
         $sql = "SELECT * FROM  $work_table
-                $group_query $subdirs_query $add_in_where_query $active_condition $condition_session
+                $group_query
+                $subdirs_query
+                $add_in_where_query
+                $active_condition
+                $condition_session
                 ORDER BY title";
     }
 
@@ -732,7 +742,7 @@ function showStudentWorkGrid()
 
     $html = '<script>
     $(function() {
-        '.Display::grid_js('workList', $url, $columns, $columnModel, $params, array(), array(), true).'
+        '.Display::grid_js('workList', $url, $columns, $columnModel, $params, array(), null, true).'
     });
     </script>';
 
@@ -992,7 +1002,6 @@ function deleteDirWork($id)
 	$course_id = api_get_course_int_id();
 
 	if (!empty($work_data['url'])) {
-
         if ($check) {
 
             // Deleting all contents inside the folder
@@ -1209,7 +1218,7 @@ function insert_all_directory_in_course_table($base_work_dir)
                title        = '',
                description 	= '',
                author      	= '',
-               active		= '0',
+               active		= '1',
                accepted		= '1',
                filetype		= 'folder',
                post_group_id = '".$group_id."',
@@ -1446,8 +1455,7 @@ function get_count_work($work_id, $onlyMeUserId = null, $notMeUserId = null)
     $user_table      = Database::get_main_table(TABLE_MAIN_USER);
 
     $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
-
-    $session_id     = api_get_session_id();
+    $session_id = api_get_session_id();
     $condition_session  = api_get_session_condition($session_id);
 
     $course_id      = api_get_course_int_id();
@@ -1464,7 +1472,7 @@ function get_count_work($work_id, $onlyMeUserId = null, $notMeUserId = null)
     if ($is_allowed_to_edit) {
         $extra_conditions .= ' AND work.active IN (0, 1) ';
     } else {
-        $extra_conditions .= ' AND work.active = 1 AND accepted = 1';
+        $extra_conditions .= ' AND work.active IN (0, 1) AND accepted = 1';
         if (isset($course_info['show_score']) && $course_info['show_score'] == 1) {
             $extra_conditions .= " AND work.user_id = ".api_get_user_id()." ";
         } else {
@@ -1484,13 +1492,19 @@ function get_count_work($work_id, $onlyMeUserId = null, $notMeUserId = null)
         $where_condition .= " AND u.user_id =  ".intval($onlyMeUserId);
     }
 
-    $sql = "SELECT count(*) as count ".
-           " FROM ".$iprop_table." prop INNER JOIN ".$work_table." work ".
-           " ON (prop.ref=work.id AND prop.c_id = $course_id ".
-           " AND prop.tool='work' AND work.active = 1 ".
-           " AND prop.visibility <> 2 AND work.c_id = $course_id ) ".
-           "   INNER JOIN $user_table u  ON (work.user_id = u.user_id) ".
-           " WHERE $extra_conditions $where_condition $condition_session ";
+    $sql = "SELECT count(*) as count
+            FROM $iprop_table prop
+            INNER JOIN $work_table work
+            ON (
+                prop.ref = work.id AND
+                prop.c_id = $course_id AND
+                prop.tool='work' AND
+                prop.visibility <> 2 AND
+                work.c_id = $course_id
+            )
+            INNER JOIN $user_table u ON (work.user_id = u.user_id)
+            WHERE $extra_conditions $where_condition $condition_session";
+
     $result = Database::query($sql);
 
     $users_with_work = 0;
@@ -1657,7 +1671,6 @@ function getWorkListTeacher($start, $limit, $column, $direction, $where_conditio
                 $work['title'] = basename($work['url']);
             }
             $work['title'] = Display::url($work['title'], $url.'&id='.$workId);
-
             $work['title'] .= ' '.Display::label(get_count_work($work['id']), 'success');
             $work['sent_date'] = date_to_str_ago($work['sent_date']).' <br />'.api_get_local_time($work['sent_date']);
 
@@ -1736,7 +1749,7 @@ function get_work_user_list_from_documents(
 
     $sql = "    (
                     $select1 FROM $userTable u
-                    INNER JOIN $workTable w ON (u.user_id = w.user_id AND w.active = 1 AND w.filetype = 'file')
+                    INNER JOIN $workTable w ON (u.user_id = w.user_id AND w.active IN (0, 1) AND w.filetype = 'file')
                     WHERE
                         w.c_id = $courseId
                         $userCondition
@@ -1746,7 +1759,7 @@ function get_work_user_list_from_documents(
 
                 ) UNION (
                     $select2 FROM $workTable w
-                    INNER JOIN $workRelDocument w_rel ON (w_rel.work_id = w.id AND w.active = 1)
+                    INNER JOIN $workRelDocument w_rel ON (w_rel.work_id = w.id AND w.active IN (0, 1))
                     INNER JOIN $documentTable d ON (w_rel.document_id = d.id AND d.c_id = w.c_id)
                     INNER JOIN $userTable u ON (u.user_id = $studentId)
                     WHERE
@@ -1759,7 +1772,7 @@ function get_work_user_list_from_documents(
                                 user_id = $studentId AND
                                 c_id = $courseId AND
                                 filetype = 'file' AND
-                                active = 1
+                                active IN (0, 1)
                                 $sessionCondition
                                 $workParentCondition
                             )
@@ -1905,7 +1918,7 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
     $group_id       = api_get_group_id();
     $course_info    = api_get_course_info(api_get_course_id());
 
-    $work_id       = intval($work_id);
+    $work_id        = intval($work_id);
     $column         = !empty($column) ? Database::escape_string($column) : 'sent_date';
     $start          = intval($start);
     $limit          = intval($limit);
@@ -1932,23 +1945,40 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
             $extra_conditions .= ' AND work.active IN (0, 1) ';
         } else {
             if (isset($course_info['show_score']) &&  $course_info['show_score'] == 1) {
-                $extra_conditions .= " AND (u.user_id = ".api_get_user_id()." AND work.active IN (0, 1) OR work.active = 1) ";
+                $extra_conditions .= " AND (u.user_id = ".api_get_user_id()." AND work.active IN (0, 1)) ";
             } else {
-                $extra_conditions .= ' AND work.active = 1 ';
+                $extra_conditions .= ' AND work.active IN (0, 1) ';
             }
         }
 
-        $extra_conditions .= " AND parent_id  = ".$work_id."  ";
-
-        $select = 'SELECT DISTINCT u.user_id, work.id as id, title as title, description, url, sent_date, contains_file, has_properties, view_properties,
-                    qualification, weight, allow_text_assignment, u.firstname, u.lastname, u.username, parent_id, accepted, qualificator_id';
-
+        $extra_conditions .= " AND parent_id  = ".$work_id." ";
+
+        $select = 'SELECT DISTINCT
+                        u.user_id,
+                        work.id as id,
+                        title as title,
+                        description,
+                        url,
+                        sent_date,
+                        contains_file,
+                        has_properties,
+                        view_properties,
+                        qualification,
+                        weight,
+                        allow_text_assignment,
+                        u.firstname,
+                        u.lastname,
+                        u.username,
+                        parent_id,
+                        accepted,
+                        qualificator_id';
         if ($getCount) {
             $select = "SELECT DISTINCT count(u.user_id) as count ";
         }
 
         $user_condition = "INNER JOIN $user_table u  ON (work.user_id = u.user_id) ";
-        $work_condition = "$iprop_table prop INNER JOIN $work_table work ON (prop.ref = work.id AND prop.c_id = $course_id AND work.c_id = $course_id ) ";
+        $work_condition = "$iprop_table prop INNER JOIN $work_table work
+                           ON (prop.ref = work.id AND prop.c_id = $course_id AND work.c_id = $course_id ) ";
 
         $work_assignment = get_work_assignment_by_id($work_id);
 
@@ -1958,9 +1988,9 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
 
         $sql = " $select
                 FROM $work_condition  $user_condition
-                WHERE $extra_conditions $where_condition $condition_session ";
-        $sql .= " ORDER BY $column $direction ";
-        $sql .= " LIMIT $start, $limit";
+                WHERE $extra_conditions $where_condition $condition_session
+                ORDER BY $column $direction
+                LIMIT $start, $limit";
 
         $result = Database::query($sql);
         $works = array();
@@ -2024,7 +2054,7 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
 
             if (
                 ($can_read && $work['accepted'] == '1') ||
-                ($is_author && in_array($work['accepted'], array('1','0'))) ||
+                ($is_author && in_array($work['accepted'], array('1', '0'))) ||
                 $is_allowed_to_edit
             ) {
 
@@ -2044,8 +2074,8 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
 
                 // File name.
                 $link_to_download = null;
-
-                if ($work['contains_file']) {
+                // 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="download.php?id='.$item_id.'">'.Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
                 } else {
                    //$link_to_download = '<a href="view.php?id='.$item_id.'">'.Display::return_icon('save_na.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
@@ -2362,9 +2392,18 @@ function get_list_users_without_publication($task_id, $studentId = null)
 	$task_id = intval($task_id);
 
 	if ($session_id == 0) {
-		$sql = "SELECT user_id as id FROM $work_table WHERE c_id = $course_id AND parent_id='$task_id' AND active = 1";
+		$sql = "SELECT user_id as id FROM $work_table
+		        WHERE
+		            c_id = $course_id AND
+		            parent_id='$task_id' AND
+		            active IN (0, 1)";
 	} else {
-		$sql = "SELECT user_id as id FROM $work_table WHERE c_id = $course_id AND parent_id='$task_id' and session_id='".$session_id."' AND active = 1";
+		$sql = "SELECT user_id as id FROM $work_table
+		        WHERE
+		            c_id = $course_id AND
+		            parent_id='$task_id' AND
+		            session_id='".$session_id."' AND
+		            active IN (0, 1)";
 	}
 
 	$result = Database::query($sql);

+ 5 - 3
main/work/work.php

@@ -129,8 +129,10 @@ if (!empty($group_id)) {
         } else {
             $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('StudentPublications'));
         }
-        $url_dir = 'work.php?id=' . $work_id;
-        $interbreadcrumb[] = array ('url' => $url_dir,'name' =>  $my_folder_data['title']);
+
+        if (!empty($my_folder_data)) {
+            $interbreadcrumb[] = array ('url' => 'work.php?id=' . $work_id, 'name' =>  $my_folder_data['title']);
+        }
 
         if ($action == 'upload_form') {
             $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('UploadADocument'));
@@ -267,7 +269,7 @@ switch ($action) {
 
         $work_parents = array();
         if (empty($my_folder_data)) {
-            $work_parents = getWorkList($work_id, $my_folder_data, $add_query);
+            $work_parents = getWorkList($work_id, $my_folder_data, null);
         }
 
         if (api_is_allowed_to_edit()) {

+ 5 - 4
main/work/work_list_all.php

@@ -102,9 +102,9 @@ if ($is_allowed_to_edit && $action == 'make_invisible') {
 $documentsAddedInWork = getAllDocumentsFromWorkToString($workId, $courseInfo);
 
 echo '<div class="actions">';
-echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
+echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
 if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
-    echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'&gradebook='.$gradebook.'">';
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'">';
     echo Display::return_icon('upload_file.png', get_lang('UploadADocument'), '', ICON_SIZE_MEDIUM).'</a>';
     if (ADD_DOCUMENT_TO_WORK) {
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
@@ -114,11 +114,12 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
         echo Display::return_icon('user.png', get_lang('AddUsers'), '', ICON_SIZE_MEDIUM).'</a>';
     }
 
-    $display_output .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/work_missing.php?'.api_get_cidreq().'&amp;id='.$workId.'&amp;curdirpath='.$cur_dir_path.'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;list=without">'.
+    $display_output = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work_missing.php?'.api_get_cidreq().'&amp;id='.$workId.'&amp;list=without">'.
     Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'), '', ICON_SIZE_MEDIUM)."</a>";
     $count = get_count_work($workId);
     if ($count > 0) {
-        $display_output .= '<a href="downloadfolder.inc.php?id='.$workId.'">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_MEDIUM).'</a>';
+        $display_output .= '<a href="downloadfolder.inc.php?id='.$workId.'">'.
+            Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_MEDIUM).'</a>';
     }
     echo $display_output;
 }

+ 1 - 1
main/work/work_list_others.php

@@ -62,7 +62,7 @@ $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list
 Display :: display_header(null);
 
 echo '<div class="actions">';
-echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'">'.
+echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'>'.
         Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';