';
+ if (isset($_GET['action']) && in_array($_GET['action'], array('add', 'modify','view'))) {
echo "
";
+ }
+ $show_actions = true;
} else {
if (in_array($_GET['action'], array('view'))) {
echo '
';
- unset($title_to_modify);
- $title_to_modify = null;
+ unset($title_to_modify);
+ $title_to_modify = null;
- if (!isset($announcement_to_modify) ) $announcement_to_modify ="";
- if (!isset($content_to_modify) ) $content_to_modify ="";
- if (!isset($title_to_modify)) $title_to_modify = "";
+ if (!isset($announcement_to_modify) ) $announcement_to_modify ="";
+ if (!isset($content_to_modify) ) $content_to_modify ="";
+ if (!isset($title_to_modify)) $title_to_modify = "";
- echo '
';
$oFCKeditor = new FCKeditor('newContent') ;
- $oFCKeditor->Width = '100%';
- $oFCKeditor->Height = '300';
+ $oFCKeditor->Width = '100%';
+ $oFCKeditor->Height = '300';
- if(!api_is_allowed_to_edit()) {
- $oFCKeditor->ToolbarSet = "AnnouncementsStudent";
- } else {
- $oFCKeditor->ToolbarSet = "Announcements";
- }
+ if(!api_is_allowed_to_edit()) {
+ $oFCKeditor->ToolbarSet = "AnnouncementsStudent";
+ } else {
+ $oFCKeditor->ToolbarSet = "Announcements";
+ }
- $oFCKeditor->Value = $content_to_modify;
+ $oFCKeditor->Value = $content_to_modify;
- echo '
+ echo '
';
- echo'
';
- echo '
';
-
- if (empty($group_id)) {
- echo ' ';
- echo ' ';
- echo ''.get_lang('ButtonPublishAnnouncement').' ';
- } else {
- echo ' ';
- echo ' ';
- echo ''.get_lang('ButtonPublishAnnouncement').' ';
- }
- echo '
';
- echo '
';
-
- if ((isset($_GET['action']) && isset($_GET['id']) && is_array($to))||isset($_GET['remindallinactives'])||isset($_GET['remind_inactive'])) {
- echo '';
- }
+ echo'
';
+ echo '
';
+
+ if (empty($group_id)) {
+ echo ' ';
+ echo ' ';
+ echo ''.get_lang('ButtonPublishAnnouncement').' ';
+ } else {
+ echo ' ';
+ echo ' ';
+ echo ''.get_lang('ButtonPublishAnnouncement').' ';
+ }
+ echo '
';
+ echo '
';
+
+ if ((isset($_GET['action']) && isset($_GET['id']) && is_array($to))||isset($_GET['remindallinactives'])||isset($_GET['remind_inactive'])) {
+ echo '';
+ }
} // end of displayform for announcement creation/edition
@@ -799,29 +796,29 @@ $course_id = api_get_course_int_id();
//if ($display_announcement_list && !$surveyid) {
if ($display_announcement_list) {
- // by default we use the id of the current user. The course administrator can see the announcement of other users by using the user / group filter
- //$user_id=$_user['user_id'];
- if (isset($_SESSION['user'])) {
- //$user_id=$_SESSION['user'];
- }
- $user_id = api_get_user_id();
+ // by default we use the id of the current user. The course administrator can see the announcement of other users by using the user / group filter
+ //$user_id=$_user['user_id'];
+ if (isset($_SESSION['user'])) {
+ //$user_id=$_SESSION['user'];
+ }
+ $user_id = api_get_user_id();
- if (isset($_SESSION['group'])) {
- //$group_id=$_SESSION['group'];
- }
- $group_id = api_get_group_id();
+ if (isset($_SESSION['group'])) {
+ //$group_id=$_SESSION['group'];
+ }
+ $group_id = api_get_group_id();
- $group_memberships = GroupManager::get_group_ids($course_id, api_get_user_id());
+ $group_memberships = GroupManager::get_group_ids($course_id, api_get_user_id());
- //$is_group_member = GroupManager :: is_tutor(api_get_user_id());
+ //$is_group_member = GroupManager :: is_tutor(api_get_user_id());
- if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
- // A.1. you are a course admin with a USER filter
- // => see only the messages of this specific user + the messages of the group (s)he is member of.
- if (!empty($_SESSION['user'])) {
+ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
+ // A.1. you are a course admin with a USER filter
+ // => see only the messages of this specific user + the messages of the group (s)he is member of.
+ if (!empty($_SESSION['user'])) {
- if (is_array($group_memberships) && count($group_memberships) > 0 ) {
- $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
+ if (is_array($group_memberships) && count($group_memberships) > 0 ) {
+ $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE announcement.c_id = $course_id AND
ip.c_id = $course_id AND
@@ -832,8 +829,8 @@ if ($display_announcement_list) {
ORDER BY display_order DESC";
- } else {
- $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
+ } else {
+ $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE announcement.c_id = $course_id AND
ip.c_id = $course_id AND
@@ -844,11 +841,11 @@ if ($display_announcement_list) {
$condition_session
ORDER BY display_order DESC";
- }
- } elseif (api_get_group_id() != 0 ) {
- // A.2. you are a course admin with a GROUP filter
- // => see only the messages of this specific group
- $sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
+ }
+ } elseif (api_get_group_id() != 0 ) {
+ // A.2. you are a course admin with a GROUP filter
+ // => see only the messages of this specific group
+ $sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE announcement.c_id = $course_id AND
ip.c_id = $course_id AND
@@ -859,14 +856,14 @@ if ($display_announcement_list) {
$condition_session
GROUP BY ip.ref
ORDER BY display_order DESC";
- } else {
+ } else {
- // A.3 you are a course admin without any group or user filter
- // A.3.a you are a course admin without user or group filter but WITH studentview
- // => see all the messages of all the users and groups without editing possibilities
+ // A.3 you are a course admin without any group or user filter
+ // A.3.a you are a course admin without user or group filter but WITH studentview
+ // => see all the messages of all the users and groups without editing possibilities
- if (isset($isStudentView) and $isStudentView=="true") {
- $sql="SELECT
+ if (isset($isStudentView) and $isStudentView=="true") {
+ $sql="SELECT
announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE announcement.c_id = $course_id AND
@@ -877,10 +874,10 @@ if ($display_announcement_list) {
$condition_session
GROUP BY ip.ref
ORDER BY display_order DESC";
- } else {
- // A.3.a you are a course admin without user or group filter and WTIHOUT studentview (= the normal course admin view)
- // => see all the messages of all the users and groups with editing possibilities
- $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
+ } else {
+ // A.3.a you are a course admin without user or group filter and WTIHOUT studentview (= the normal course admin view)
+ // => see all the messages of all the users and groups with editing possibilities
+ $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE announcement.c_id = $course_id AND
ip.c_id = $course_id AND
@@ -890,32 +887,32 @@ if ($display_announcement_list) {
$condition_session
GROUP BY ip.ref
ORDER BY display_order DESC";
- }
- }
- } else {
- //STUDENT
-
- if (is_array($group_memberships) && count($group_memberships)>0) {
- if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
- if (api_get_group_id() == 0) {
- //No group
- $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR ( ip.to_user_id='".$_user['user_id']."'" .
- " OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))) ";
- } else {
- $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."'
+ }
+ }
+ } else {
+ //STUDENT
+
+ if (is_array($group_memberships) && count($group_memberships)>0) {
+ if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
+ if (api_get_group_id() == 0) {
+ //No group
+ $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR ( ip.to_user_id='".$_user['user_id']."'" .
+ " OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))) ";
+ } else {
+ $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."'
OR ip.to_group_id IN (0, ".api_get_group_id()."))";
- }
- //$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") )) ";
-
- } else {
- if (api_get_group_id() == 0) {
- $cond_user_id = " AND (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) ";
- } else {
- $cond_user_id = " AND (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".api_get_group_id()."))";
- }
- }
-
- $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
+ }
+ //$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") )) ";
+
+ } else {
+ if (api_get_group_id() == 0) {
+ $cond_user_id = " AND (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) ";
+ } else {
+ $cond_user_id = " AND (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".api_get_group_id()."))";
+ }
+ }
+
+ $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE announcement.c_id = $course_id AND
ip.c_id = $course_id AND
@@ -925,15 +922,15 @@ if ($display_announcement_list) {
$condition_session
AND ip.visibility='1'
ORDER BY display_order DESC";
- } else {
- if ($_user['user_id']) {
- if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
- $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR (ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0')) ";
- } else {
- $cond_user_id = " AND (ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0') ";
- }
-
- $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
+ } else {
+ if ($_user['user_id']) {
+ if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
+ $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR (ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0')) ";
+ } else {
+ $cond_user_id = " AND (ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0') ";
+ }
+
+ $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE
announcement.c_id = $course_id AND
@@ -945,15 +942,15 @@ if ($display_announcement_list) {
AND ip.visibility='1'
AND announcement.session_id IN(0,".api_get_session_id().")
ORDER BY display_order DESC";
- } else {
+ } else {
- if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
- $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR ip.to_group_id='0' ) ";
- } else {
- $cond_user_id = " AND ip.to_group_id='0' ";
- }
+ if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
+ $cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR ip.to_group_id='0' ) ";
+ } else {
+ $cond_user_id = " AND ip.to_group_id='0' ";
+ }
- $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
+ $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE
announcement.c_id = $course_id AND
@@ -964,140 +961,140 @@ if ($display_announcement_list) {
$condition_session
AND ip.visibility='1'
AND announcement.session_id IN(0,".api_get_session_id().")";
- }
- }
- }
+ }
+ }
+ }
- $result = Database::query($sql);
- $num_rows = Database::num_rows($result);
+ $result = Database::query($sql);
+ $num_rows = Database::num_rows($result);
// DISPLAY: NO ITEMS
- if (!isset($_GET['action']) || !in_array($_GET['action'], array('add', 'modify','view')))
- if ($num_rows == 0) {
- if ((api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) and (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath')) {
- echo '
';
- echo '
'.get_lang('Announcements').' ';
- echo Display::return_icon('valves.png', '', array(), 64);
- echo '
';
- echo Display::url(get_lang('AddAnnouncement'), api_get_self()."?".api_get_cidreq()."&action=add&origin=".$origin, array('class' => 'btn'));
- echo '
';
- echo '
';
- } else {
- //echo "
".Display::return_icon('new_announce.png',get_lang('AddAnnouncement'),'',ICON_SIZE_MEDIUM)." ";
- Display::display_warning_message(get_lang('NoAnnouncements'));
- }
+ if (!isset($_GET['action']) || !in_array($_GET['action'], array('add', 'modify','view')))
+ if ($num_rows == 0) {
+ if ((api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) and (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath')) {
+ echo '
';
+ echo '
'.get_lang('Announcements').' ';
+ echo Display::return_icon('valves.png', '', array(), 64);
+ echo '
';
+ echo Display::url(get_lang('AddAnnouncement'), api_get_self()."?".api_get_cidreq()."&action=add&origin=".$origin, array('class' => 'btn'));
+ echo '
';
+ echo '
';
+ } else {
+ //echo "
".Display::return_icon('new_announce.png',get_lang('AddAnnouncement'),'',ICON_SIZE_MEDIUM)." ";
+ Display::display_warning_message(get_lang('NoAnnouncements'));
+ }
- } else {
- $iterator = 1;
- $bottomAnnouncement = $announcement_number;
-
- echo '
';
- $ths = Display::tag('th', get_lang('Title'));
- $ths .= Display::tag('th', get_lang('By') );
- $ths .= Display::tag('th', get_lang('LastUpdateDate') );
- if (api_is_allowed_to_edit(false,true) OR (api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT,$myrow['id']))
- OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
- $ths .= Display::tag('th', get_lang('Modify'));
- }
+ } else {
+ $iterator = 1;
+ $bottomAnnouncement = $announcement_number;
+
+ echo '';
+ $ths = Display::tag('th', get_lang('Title'));
+ $ths .= Display::tag('th', get_lang('By') );
+ $ths .= Display::tag('th', get_lang('LastUpdateDate') );
+ if (api_is_allowed_to_edit(false,true) OR (api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT,$myrow['id']))
+ OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
+ $ths .= Display::tag('th', get_lang('Modify'));
+ }
- echo Display::tag('tr', $ths);
- $displayed = array();
+ echo Display::tag('tr', $ths);
+ $displayed = array();
- while ($myrow = Database::fetch_array($result, 'ASSOC')) {
- if (!in_array($myrow['id'], $displayed)) {
- $sent_to_icon = '';
- // the email icon
- if ($myrow['email_sent'] == '1') {
- $sent_to_icon = ' '.Display::return_icon('email.gif', get_lang('AnnounceSentByEmail'));
- }
+ while ($myrow = Database::fetch_array($result, 'ASSOC')) {
+ if (!in_array($myrow['id'], $displayed)) {
+ $sent_to_icon = '';
+ // the email icon
+ if ($myrow['email_sent'] == '1') {
+ $sent_to_icon = ' '.Display::return_icon('email.gif', get_lang('AnnounceSentByEmail'));
+ }
- $title = $myrow['title'].$sent_to_icon;
+ $title = $myrow['title'].$sent_to_icon;
- /* DATE */
- $last_post_datetime = $myrow['end_date'];
+ /* DATE */
+ $last_post_datetime = $myrow['end_date'];
- $item_visibility = api_get_item_visibility($_course, TOOL_ANNOUNCEMENT, $myrow['id'], $session_id);
- $myrow['visibility'] = $item_visibility;
+ $item_visibility = api_get_item_visibility($_course, TOOL_ANNOUNCEMENT, $myrow['id'], $session_id);
+ $myrow['visibility'] = $item_visibility;
- // the styles
- if ($myrow['visibility'] == '0') {
- $style='invisible';
- } else {
- $style = '';
- }
+ // the styles
+ if ($myrow['visibility'] == '0') {
+ $style='invisible';
+ } else {
+ $style = '';
+ }
- echo '';
+ echo ' ';
- // show attachment list
- $attachment_list = array();
- $attachment_list = AnnouncementManager::get_attachment($myrow['id']);
+ // show attachment list
+ $attachment_list = array();
+ $attachment_list = AnnouncementManager::get_attachment($myrow['id']);
- $attachment_icon = '';
- if (count($attachment_list)>0) {
- $attachment_icon = ' '.Display::return_icon('attachment.gif',get_lang('Attachment'));
- }
+ $attachment_icon = '';
+ if (count($attachment_list)>0) {
+ $attachment_icon = ' '.Display::return_icon('attachment.gif',get_lang('Attachment'));
+ }
- /* TITLE */
- $title = Display::url($title.$attachment_icon, api_get_self().'?'.api_get_cidreq().'&action=view&id='.$myrow['id']);
- echo Display::tag('td', Security::remove_XSS($title), array('class' => 'announcements-list-line-title '.$style));
-
- $user_info = api_get_user_info($myrow['insert_user_id']);
- $username = sprintf(get_lang("LoginX"), $user_info['username']);
- $username_span = Display::tag('span', api_get_person_name($user_info['firstName'], $user_info['lastName']), array('title'=>$username));
- echo Display::tag('td', $username_span, array('class' => 'announcements-list-line-by-user'));
- echo Display::tag('td', api_convert_and_format_date($myrow['insert_date'], DATE_TIME_FORMAT_LONG), array('class' => 'announcements-list-line-datetime'));
-
- // we can edit if : we are the teacher OR the element belongs to the session we are coaching OR the option to allow users to edit is on
- $modify_icons = '';
- if (api_is_allowed_to_edit(false,true) OR (api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $myrow['id']))
- OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
-
- $modify_icons = "".Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL)." ";
- if ($myrow['visibility']==1) {
- $image_visibility="visible";
- $alt_visibility=get_lang('Hide');
- } else {
- $image_visibility="invisible";
- $alt_visibility=get_lang('Visible');
- }
- $modify_icons .= "".
- Display::return_icon($image_visibility.'.png', $alt_visibility,'',ICON_SIZE_SMALL)." ";
-
- // DISPLAY MOVE UP COMMAND only if it is not the top announcement
- if ($iterator != 1) {
- $modify_icons .= "".Display::return_icon('up.gif', get_lang('Up'))." ";
- } else {
- $modify_icons .= Display::return_icon('up_na.gif', get_lang('Up'));
- }
- if ($iterator < $bottomAnnouncement) {
- $modify_icons .= "".Display::return_icon('down.gif', get_lang('Down'))." ";
- } else {
- $modify_icons .= Display::return_icon('down_na.gif', get_lang('Down'));
- }
- if (api_is_allowed_to_edit(false,true)) {
- $modify_icons .= "".
- Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).
- " ";
+ /* TITLE */
+ $title = Display::url($title.$attachment_icon, api_get_self().'?'.api_get_cidreq().'&action=view&id='.$myrow['id']);
+ echo Display::tag('td', Security::remove_XSS($title), array('class' => 'announcements-list-line-title '.$style));
+
+ $user_info = api_get_user_info($myrow['insert_user_id']);
+ $username = sprintf(get_lang("LoginX"), $user_info['username']);
+ $username_span = Display::tag('span', api_get_person_name($user_info['firstName'], $user_info['lastName']), array('title'=>$username));
+ echo Display::tag('td', $username_span, array('class' => 'announcements-list-line-by-user'));
+ echo Display::tag('td', api_convert_and_format_date($myrow['insert_date'], DATE_TIME_FORMAT_LONG), array('class' => 'announcements-list-line-datetime'));
+
+ // we can edit if : we are the teacher OR the element belongs to the session we are coaching OR the option to allow users to edit is on
+ $modify_icons = '';
+ if (api_is_allowed_to_edit(false,true) OR (api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $myrow['id']))
+ OR (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
+
+ $modify_icons = "".Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL)." ";
+ if ($myrow['visibility']==1) {
+ $image_visibility="visible";
+ $alt_visibility=get_lang('Hide');
+ } else {
+ $image_visibility="invisible";
+ $alt_visibility=get_lang('Visible');
+ }
+ $modify_icons .= "".
+ Display::return_icon($image_visibility.'.png', $alt_visibility,'',ICON_SIZE_SMALL)." ";
+
+ // DISPLAY MOVE UP COMMAND only if it is not the top announcement
+ if ($iterator != 1) {
+ $modify_icons .= "".Display::return_icon('up.gif', get_lang('Up'))." ";
+ } else {
+ $modify_icons .= Display::return_icon('up_na.gif', get_lang('Up'));
+ }
+ if ($iterator < $bottomAnnouncement) {
+ $modify_icons .= "".Display::return_icon('down.gif', get_lang('Down'))." ";
+ } else {
+ $modify_icons .= Display::return_icon('down_na.gif', get_lang('Down'));
+ }
+ if (api_is_allowed_to_edit(false,true)) {
+ $modify_icons .= "".
+ Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).
+ " ";
+ }
+ $iterator ++;
+ echo Display::tag('td', $modify_icons, array('class' => 'announcements-list-line-actions'));
}
- $iterator ++;
- echo Display::tag('td', $modify_icons, array('class' => 'announcements-list-line-actions'));
- }
- echo " ";
- }
- $displayed[]=$myrow['id'];
- } // end while
- echo "
";
- }
+ echo "";
+ }
+ $displayed[]=$myrow['id'];
+ } // end while
+ echo "
";
+ }
} // end: if ($displayAnnoucementList)
if (isset($_GET['action']) && $_GET['action'] == 'view') {
- AnnouncementManager::display_announcement($announcement_id);
+ AnnouncementManager::display_announcement($announcement_id);
}
/* FOOTER */
if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
- //we are not in learnpath tool
- Display::display_footer();
+ //we are not in learnpath tool
+ Display::display_footer();
}
diff --git a/main/announcements/download.php b/main/announcements/download.php
index 67ffa25045..cdefb0d93c 100755
--- a/main/announcements/download.php
+++ b/main/announcements/download.php
@@ -1,17 +1,13 @@
0) {
$row= Database::fetch_array($result);
$title = str_replace(' ','_', $row['filename']);
- if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/')) {
+ if (Security::check_abs_path($full_file_name,
+ api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/upload/announcements/')
+ ) {
DocumentManager::file_send_for_download($full_file_name,TRUE, $title);
}
}
-exit;
\ No newline at end of file
+exit;
diff --git a/main/gradebook/exercise_jump.php b/main/gradebook/exercise_jump.php
index 625c6505e7..7d8261548e 100755
--- a/main/gradebook/exercise_jump.php
+++ b/main/gradebook/exercise_jump.php
@@ -9,9 +9,6 @@
* @author Bert Steppé
* @package chamilo.gradebook
*/
-/**
- * Init
- */
require_once '../inc/global.inc.php';
api_block_anonymous_users();
@@ -39,12 +36,12 @@ $_course['name'] = $course_title;
$_course['official_code'] = $course_code;
if (isset($_GET['doexercise'])) {
- header('Location: '.$doExerciseUrl);
- exit;
+ header('Location: '.$doExerciseUrl);
+ exit;
} else {
- if (isset($_GET['gradebook'])) {
- $add_url = '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
- }
- header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq).'&'.$add_url);
- exit;
+ if (isset($_GET['gradebook'])) {
+ $add_url = '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
+ }
+ header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq).'&'.$add_url);
+ exit;
}
diff --git a/main/gradebook/gradebook.php b/main/gradebook/gradebook.php
index 2d254f3bc4..976e233086 100755
--- a/main/gradebook/gradebook.php
+++ b/main/gradebook/gradebook.php
@@ -4,9 +4,7 @@
* Script
* @package chamilo.gradebook
*/
-/**
- * Init
- */
+
$language_file= 'gradebook';
// $cidReset : This is the main difference with gradebook.php, here we say,
// basically, that we are inside a course, and many things depend from that
@@ -15,12 +13,12 @@ $_in_course = false;
//make sure the destination for scripts is index.php instead of gradebook.php
require_once '../inc/global.inc.php';
if (!empty($_GET['course'])) {
- $_SESSION['gradebook_dest'] = 'index.php';
- $this_section = SECTION_COURSES;
+ $_SESSION['gradebook_dest'] = 'index.php';
+ $this_section = SECTION_COURSES;
} else {
- $_SESSION['gradebook_dest'] = 'gradebook.php';
- $this_section = SECTION_MYGRADEBOOK;
- unset($_GET['course']);
+ $_SESSION['gradebook_dest'] = 'gradebook.php';
+ $this_section = SECTION_MYGRADEBOOK;
+ unset($_GET['course']);
}
require_once 'lib/be.inc.php';
require_once 'lib/scoredisplay.class.php';
@@ -60,541 +58,541 @@ $filter_warning_msg = true;
//this is called when there is no data for the course admin
if (isset ($_GET['createallcategories'])) {
- block_students();
- $coursecat= Category :: get_not_created_course_categories(api_get_user_id());
- if (!count($coursecat) == 0) {
- foreach ($coursecat as $row) {
- $cat= new Category();
- $cat->set_name($row[1]);
- $cat->set_course_code($row[0]);
- $cat->set_description(null);
- $cat->set_user_id(api_get_user_id());
- $cat->set_parent_id(0);
- $cat->set_weight(0);
- $cat->set_visible(0);
- $cat->add();
- unset ($cat);
- }
- }
- header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0');
- exit;
+ block_students();
+ $coursecat= Category :: get_not_created_course_categories(api_get_user_id());
+ if (!count($coursecat) == 0) {
+ foreach ($coursecat as $row) {
+ $cat= new Category();
+ $cat->set_name($row[1]);
+ $cat->set_course_code($row[0]);
+ $cat->set_description(null);
+ $cat->set_user_id(api_get_user_id());
+ $cat->set_parent_id(0);
+ $cat->set_weight(0);
+ $cat->set_visible(0);
+ $cat->add();
+ unset ($cat);
+ }
+ }
+ header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0');
+ exit;
}
//move a category
$selectcat=isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
if (isset ($_GET['movecat'])) {
- $move_cat=Security::remove_XSS($_GET['movecat']);
- block_students();
- $cats= Category :: load($move_cat);
- if (!isset ($_GET['targetcat'])) {
- $move_form= new CatForm(CatForm :: TYPE_MOVE,
- $cats[0],
- 'move_cat_form',
- null,
- api_get_self() . '?movecat=' . $move_cat
- . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
- if ($move_form->validate()) {
- header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
- . '&movecat=' . $move_cat
- . '&targetcat=' . $move_form->exportValue('move_cat'));
- exit;
- }
- } else {
- $get_target_cat=Security::remove_XSS($_GET['targetcat']);
- $targetcat= Category :: load($get_target_cat);
- $course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
+ $move_cat=Security::remove_XSS($_GET['movecat']);
+ block_students();
+ $cats= Category :: load($move_cat);
+ if (!isset ($_GET['targetcat'])) {
+ $move_form= new CatForm(CatForm :: TYPE_MOVE,
+ $cats[0],
+ 'move_cat_form',
+ null,
+ api_get_self() . '?movecat=' . $move_cat
+ . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ if ($move_form->validate()) {
+ header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
+ . '&movecat=' . $move_cat
+ . '&targetcat=' . $move_form->exportValue('move_cat'));
+ exit;
+ }
+ } else {
+ $get_target_cat=Security::remove_XSS($_GET['targetcat']);
+ $targetcat= Category :: load($get_target_cat);
+ $course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
- if (!($course_to_crsind && !isset($_GET['confirm']))) {
- $cats[0]->move_to_cat($targetcat[0]);
- header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
- exit;
- }
- unset ($targetcat);
- }
- unset ($cats);
+ if (!($course_to_crsind && !isset($_GET['confirm']))) {
+ $cats[0]->move_to_cat($targetcat[0]);
+ header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ exit;
+ }
+ unset ($targetcat);
+ }
+ unset ($cats);
}
//move an evaluation
if (isset ($_GET['moveeval'])) {
- block_students();
- $get_move_eval=Security::remove_XSS($_GET['moveeval']);
- $evals= Evaluation :: load($get_move_eval);
- if (!isset ($_GET['targetcat'])) {
+ block_students();
+ $get_move_eval=Security::remove_XSS($_GET['moveeval']);
+ $evals= Evaluation :: load($get_move_eval);
+ if (!isset ($_GET['targetcat'])) {
- $move_form= new EvalForm(EvalForm :: TYPE_MOVE,
- $evals[0],
- null,
- 'move_eval_form',
- null,
- api_get_self() . '?moveeval=' . $get_move_eval
- . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ $move_form= new EvalForm(EvalForm :: TYPE_MOVE,
+ $evals[0],
+ null,
+ 'move_eval_form',
+ null,
+ api_get_self() . '?moveeval=' . $get_move_eval
+ . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
- if ($move_form->validate()) {
- header('Location: ' .api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
- . '&moveeval=' . $get_move_eval
- . '&targetcat=' . $move_form->exportValue('move_cat'));
- exit;
- }
- } else {
- $get_target_cat=Security::remove_XSS($_GET['targetcat']);
- $targetcat= Category :: load($get_target_cat);
- $course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
+ if ($move_form->validate()) {
+ header('Location: ' .api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
+ . '&moveeval=' . $get_move_eval
+ . '&targetcat=' . $move_form->exportValue('move_cat'));
+ exit;
+ }
+ } else {
+ $get_target_cat=Security::remove_XSS($_GET['targetcat']);
+ $targetcat= Category :: load($get_target_cat);
+ $course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
- if (!($course_to_crsind && !isset($_GET['confirm']))) {
- $evals[0]->move_to_cat($targetcat[0]);
- header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
- exit;
- }
- unset ($targetcat);
- }
- unset ($evals);
+ if (!($course_to_crsind && !isset($_GET['confirm']))) {
+ $evals[0]->move_to_cat($targetcat[0]);
+ header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ exit;
+ }
+ unset ($targetcat);
+ }
+ unset ($evals);
}
//move a link
if (isset ($_GET['movelink'])) {
- block_students();
- $get_move_link=Security::remove_XSS($_GET['movelink']);
- $link= LinkFactory :: load($get_move_link);
- $move_form= new LinkForm(LinkForm :: TYPE_MOVE, null, $link[0], 'move_link_form', null, api_get_self() . '?movelink=' . $get_move_link . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
- if ($move_form->validate()) {
- $targetcat= Category :: load($move_form->exportValue('move_cat'));
- $link[0]->move_to_cat($targetcat[0]);
- unset ($link);
- header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
- exit;
- }
+ block_students();
+ $get_move_link=Security::remove_XSS($_GET['movelink']);
+ $link= LinkFactory :: load($get_move_link);
+ $move_form= new LinkForm(LinkForm :: TYPE_MOVE, null, $link[0], 'move_link_form', null, api_get_self() . '?movelink=' . $get_move_link . '&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ if ($move_form->validate()) {
+ $targetcat= Category :: load($move_form->exportValue('move_cat'));
+ $link[0]->move_to_cat($targetcat[0]);
+ unset ($link);
+ header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat']));
+ exit;
+ }
}
//parameters for categories
if (isset ($_GET['visiblecat'])) {
- block_students();
- if (isset ($_GET['set_visible'])) {
- $visibility_command= 1;
- } else {
- $visibility_command= 0;
- }
- $cats= Category :: load($_GET['visiblecat']);
- $cats[0]->set_visible($visibility_command);
- $cats[0]->save();
- $cats[0]->apply_visibility_to_children();
- unset ($cats);
- if ($visibility_command) {
- $confirmation_message = get_lang('ViMod');
- $filter_confirm_msg = false;
- } else {
- $confirmation_message = get_lang('InViMod');
- $filter_confirm_msg = false;
- }
+ block_students();
+ if (isset ($_GET['set_visible'])) {
+ $visibility_command= 1;
+ } else {
+ $visibility_command= 0;
+ }
+ $cats= Category :: load($_GET['visiblecat']);
+ $cats[0]->set_visible($visibility_command);
+ $cats[0]->save();
+ $cats[0]->apply_visibility_to_children();
+ unset ($cats);
+ if ($visibility_command) {
+ $confirmation_message = get_lang('ViMod');
+ $filter_confirm_msg = false;
+ } else {
+ $confirmation_message = get_lang('InViMod');
+ $filter_confirm_msg = false;
+ }
}
if (isset ($_GET['deletecat'])) {
- block_students();
- $cats= Category :: load($_GET['deletecat']);
- //delete all categories,subcategories and results
- if ($cats[0] != null) {
- if ($cats[0]->get_id() != 0) {
- // better don't try to delete the root...
- $cats[0]->delete_all();
- }
- }
- $confirmation_message = get_lang('CategoryDeleted');
- $filter_confirm_msg = false;
+ block_students();
+ $cats= Category :: load($_GET['deletecat']);
+ //delete all categories,subcategories and results
+ if ($cats[0] != null) {
+ if ($cats[0]->get_id() != 0) {
+ // better don't try to delete the root...
+ $cats[0]->delete_all();
+ }
+ }
+ $confirmation_message = get_lang('CategoryDeleted');
+ $filter_confirm_msg = false;
}
//parameters for evaluations
if (isset ($_GET['visibleeval'])) {
- block_students();
- if (isset ($_GET['set_visible'])) {
- $visibility_command= 1;
- } else {
- $visibility_command= 0;
- }
+ block_students();
+ if (isset ($_GET['set_visible'])) {
+ $visibility_command= 1;
+ } else {
+ $visibility_command= 0;
+ }
- $eval= Evaluation :: load($_GET['visibleeval']);
- $eval[0]->set_visible($visibility_command);
- $eval[0]->save();
- unset ($eval);
- if ($visibility_command) {
- $confirmation_message = get_lang('ViMod');
- $filter_confirm_msg = false;
- } else {
- $confirmation_message = get_lang('InViMod');
- $filter_confirm_msg = false;
- }
+ $eval= Evaluation :: load($_GET['visibleeval']);
+ $eval[0]->set_visible($visibility_command);
+ $eval[0]->save();
+ unset ($eval);
+ if ($visibility_command) {
+ $confirmation_message = get_lang('ViMod');
+ $filter_confirm_msg = false;
+ } else {
+ $confirmation_message = get_lang('InViMod');
+ $filter_confirm_msg = false;
+ }
}
if (isset ($_GET['deleteeval'])) {
- block_students();
- $eval= Evaluation :: load($_GET['deleteeval']);
- if ($eval[0] != null) {
- $eval[0]->delete_with_results();
- }
- $confirmation_message = get_lang('GradebookEvaluationDeleted');
- $filter_confirm_msg = false;
+ block_students();
+ $eval= Evaluation :: load($_GET['deleteeval']);
+ if ($eval[0] != null) {
+ $eval[0]->delete_with_results();
+ }
+ $confirmation_message = get_lang('GradebookEvaluationDeleted');
+ $filter_confirm_msg = false;
}
//parameters for links
if (isset ($_GET['visiblelink'])) {
- block_students();
- if (isset ($_GET['set_visible'])) {
- $visibility_command= 1;
- }else {
- $visibility_command= 0;
- }
- $link= LinkFactory :: load($_GET['visiblelink']);
- $link[0]->set_visible($visibility_command);
- $link[0]->save();
- unset ($link);
- if ($visibility_command) {
- $confirmation_message = get_lang('ViMod');
- $filter_confirm_msg = false;
- } else {
- $confirmation_message = get_lang('InViMod');
- $filter_confirm_msg = false;
- }
+ block_students();
+ if (isset ($_GET['set_visible'])) {
+ $visibility_command= 1;
+ }else {
+ $visibility_command= 0;
+ }
+ $link= LinkFactory :: load($_GET['visiblelink']);
+ $link[0]->set_visible($visibility_command);
+ $link[0]->save();
+ unset ($link);
+ if ($visibility_command) {
+ $confirmation_message = get_lang('ViMod');
+ $filter_confirm_msg = false;
+ } else {
+ $confirmation_message = get_lang('InViMod');
+ $filter_confirm_msg = false;
+ }
}
if (isset ($_GET['deletelink'])) {
- block_students();
- //fixing #5229
- if (!empty($_GET['deletelink'])) {
- $link= LinkFactory :: load($_GET['deletelink']);
- if ($link[0] != null) {
- $link[0]->delete();
- }
- unset ($link);
- $confirmation_message = get_lang('LinkDeleted');
- $filter_confirm_msg = false;
- }
+ block_students();
+ //fixing #5229
+ if (!empty($_GET['deletelink'])) {
+ $link= LinkFactory :: load($_GET['deletelink']);
+ if ($link[0] != null) {
+ $link[0]->delete();
+ }
+ unset ($link);
+ $confirmation_message = get_lang('LinkDeleted');
+ $filter_confirm_msg = false;
+ }
}
$course_to_crsind = isset ($course_to_crsind) ? $course_to_crsind : '';
if ($course_to_crsind && !isset($_GET['confirm'])) {
- block_students();
- if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) {
- die ('Error: movecat or moveeval not defined');
- }
- $button = '
';
- $warning_message = get_lang('MoveWarning').'
'.$button;
- $filter_warning_msg = false;
+ $warning_message = get_lang('MoveWarning').'
'.$button;
+ $filter_warning_msg = false;
}
//actions on the sortabletable
if (isset ($_POST['action'])) {
- block_students();
- $number_of_selected_items= count($_POST['id']);
- if ($number_of_selected_items == '0') {
- $warning_message = get_lang('NoItemsSelected');
- $filter_warning_msg = false;
- }
- else {
- switch ($_POST['action']) {
- case 'deleted' :
- $number_of_deleted_categories= 0;
- $number_of_deleted_evaluations= 0;
- $number_of_deleted_links= 0;
- foreach ($_POST['id'] as $indexstr) {
- if (api_substr($indexstr, 0, 4) == 'CATE') {
- $cats= Category :: load(api_substr($indexstr, 4));
- if ($cats[0] != null) {
- $cats[0]->delete_all();
- }
- $number_of_deleted_categories++;
- }
- if (api_substr($indexstr, 0, 4) == 'EVAL') {
- $eval= Evaluation :: load(api_substr($indexstr, 4));
- if ($eval[0] != null) {
- $eval[0]->delete_with_results();
- }
- $number_of_deleted_evaluations++;
- }
- if (api_substr($indexstr, 0, 4) == 'LINK') {
- $id = api_substr($indexstr, 4);
- if (!empty($id)) {
- $link= LinkFactory :: load();
- if ($link[0] != null) {
- $link[0]->delete();
- }
- $number_of_deleted_links++;
- }
- }
- }
- $confirmation_message = get_lang('DeletedCategories') . ' :
' . $number_of_deleted_categories . ' ' . get_lang('DeletedEvaluations') . ' :
' . $number_of_deleted_evaluations . ' ' . get_lang('DeletedLinks') . ' :
' . $number_of_deleted_links . ' ' . get_lang('TotalItems') . ' :
' . $number_of_selected_items . ' ';
- $filter_confirm_msg = false;
- break;
- case 'setvisible' :
- foreach ($_POST['id'] as $indexstr)
- {
- if (api_substr($indexstr, 0, 4) == 'CATE')
- {
- $cats= Category :: load(api_substr($indexstr, 4));
- $cats[0]->set_visible(1);
- $cats[0]->save();
- $cats[0]->apply_visibility_to_children();
- }
- if (api_substr($indexstr, 0, 4) == 'EVAL')
- {
- $eval= Evaluation :: load(api_substr($indexstr, 4));
- $eval[0]->set_visible(1);
- $eval[0]->save();
- }
- if (api_substr($indexstr, 0, 4) == 'LINK')
- {
- $link= LinkFactory :: load(api_substr($indexstr, 4));
- $link[0]->set_visible(1);
- $link[0]->save();
- }
- }
- $confirmation_message = get_lang('ItemsVisible');
- $filter_confirm_msg = false;
- break;
- case 'setinvisible' :
- foreach ($_POST['id'] as $indexstr)
- {
- if (api_substr($indexstr, 0, 4) == 'CATE')
- {
- $cats= Category :: load(api_substr($indexstr, 4));
- $cats[0]->set_visible(0);
- $cats[0]->save();
- $cats[0]->apply_visibility_to_children();
- }
- if (api_substr($indexstr, 0, 4) == 'EVAL')
- {
- $eval= Evaluation :: load(api_substr($indexstr, 4));
- $eval[0]->set_visible(0);
- $eval[0]->save();
- }
- if (api_substr($indexstr, 0, 4) == 'LINK')
- {
- $link= LinkFactory :: load(api_substr($indexstr, 4));
- $link[0]->set_visible(0);
- $link[0]->save();
- }
- }
- $confirmation_message = get_lang('ItemsInVisible');
- $filter_confirm_msg = false;
- break;
- }
- }
+ block_students();
+ $number_of_selected_items= count($_POST['id']);
+ if ($number_of_selected_items == '0') {
+ $warning_message = get_lang('NoItemsSelected');
+ $filter_warning_msg = false;
+ }
+ else {
+ switch ($_POST['action']) {
+ case 'deleted' :
+ $number_of_deleted_categories= 0;
+ $number_of_deleted_evaluations= 0;
+ $number_of_deleted_links= 0;
+ foreach ($_POST['id'] as $indexstr) {
+ if (api_substr($indexstr, 0, 4) == 'CATE') {
+ $cats= Category :: load(api_substr($indexstr, 4));
+ if ($cats[0] != null) {
+ $cats[0]->delete_all();
+ }
+ $number_of_deleted_categories++;
+ }
+ if (api_substr($indexstr, 0, 4) == 'EVAL') {
+ $eval= Evaluation :: load(api_substr($indexstr, 4));
+ if ($eval[0] != null) {
+ $eval[0]->delete_with_results();
+ }
+ $number_of_deleted_evaluations++;
+ }
+ if (api_substr($indexstr, 0, 4) == 'LINK') {
+ $id = api_substr($indexstr, 4);
+ if (!empty($id)) {
+ $link= LinkFactory :: load();
+ if ($link[0] != null) {
+ $link[0]->delete();
+ }
+ $number_of_deleted_links++;
+ }
+ }
+ }
+ $confirmation_message = get_lang('DeletedCategories') . ' :
' . $number_of_deleted_categories . ' ' . get_lang('DeletedEvaluations') . ' :
' . $number_of_deleted_evaluations . ' ' . get_lang('DeletedLinks') . ' :
' . $number_of_deleted_links . ' ' . get_lang('TotalItems') . ' :
' . $number_of_selected_items . ' ';
+ $filter_confirm_msg = false;
+ break;
+ case 'setvisible' :
+ foreach ($_POST['id'] as $indexstr)
+ {
+ if (api_substr($indexstr, 0, 4) == 'CATE')
+ {
+ $cats= Category :: load(api_substr($indexstr, 4));
+ $cats[0]->set_visible(1);
+ $cats[0]->save();
+ $cats[0]->apply_visibility_to_children();
+ }
+ if (api_substr($indexstr, 0, 4) == 'EVAL')
+ {
+ $eval= Evaluation :: load(api_substr($indexstr, 4));
+ $eval[0]->set_visible(1);
+ $eval[0]->save();
+ }
+ if (api_substr($indexstr, 0, 4) == 'LINK')
+ {
+ $link= LinkFactory :: load(api_substr($indexstr, 4));
+ $link[0]->set_visible(1);
+ $link[0]->save();
+ }
+ }
+ $confirmation_message = get_lang('ItemsVisible');
+ $filter_confirm_msg = false;
+ break;
+ case 'setinvisible' :
+ foreach ($_POST['id'] as $indexstr)
+ {
+ if (api_substr($indexstr, 0, 4) == 'CATE')
+ {
+ $cats= Category :: load(api_substr($indexstr, 4));
+ $cats[0]->set_visible(0);
+ $cats[0]->save();
+ $cats[0]->apply_visibility_to_children();
+ }
+ if (api_substr($indexstr, 0, 4) == 'EVAL')
+ {
+ $eval= Evaluation :: load(api_substr($indexstr, 4));
+ $eval[0]->set_visible(0);
+ $eval[0]->save();
+ }
+ if (api_substr($indexstr, 0, 4) == 'LINK')
+ {
+ $link= LinkFactory :: load(api_substr($indexstr, 4));
+ $link[0]->set_visible(0);
+ $link[0]->save();
+ }
+ }
+ $confirmation_message = get_lang('ItemsInVisible');
+ $filter_confirm_msg = false;
+ break;
+ }
+ }
}
if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
- header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
- . '&search='.Security::remove_XSS($_POST['keyword']));
- exit;
+ header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
+ . '&search='.Security::remove_XSS($_POST['keyword']));
+ exit;
}
// DISPLAY HEADERS AND MESSAGES -
if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
- if (isset ($_GET['studentoverview'])) {
- $interbreadcrumb[]= array (
- 'url' => $_SESSION['gradebook_dest'].'?selectcat=' . Security::remove_XSS($_GET['selectcat']),
- 'name' => get_lang('ToolGradebook')
- );
- Display :: display_header(get_lang('FlatView'));
- } elseif (isset ($_GET['search'])) {
- if ($_SESSION['gradebook_dest'] == 'index.php') {
- $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']).'?cidReq='.Security::remove_XSS($_GET['course']).'&';
- } else {
- $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']);
- }
-
- $interbreadcrumb[]= array ('url' => $gradebook_dest,'name' => get_lang('Gradebook'));
+ if (isset ($_GET['studentoverview'])) {
+ $interbreadcrumb[]= array (
+ 'url' => $_SESSION['gradebook_dest'].'?selectcat=' . Security::remove_XSS($_GET['selectcat']),
+ 'name' => get_lang('ToolGradebook')
+ );
+ Display :: display_header(get_lang('FlatView'));
+ } elseif (isset ($_GET['search'])) {
+ if ($_SESSION['gradebook_dest'] == 'index.php') {
+ $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']).'?cidReq='.Security::remove_XSS($_GET['course']).'&';
+ } else {
+ $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']);
+ }
- if ((isset($_GET['selectcat']) && $_GET['selectcat']>0)) {
- if (!empty($_GET['course'])) {
- $interbreadcrumb[]= array ('url' => $gradebook_dest.'selectcat='.Security::remove_XSS($_GET['selectcat']),'name' => get_lang('Details'));
- } else {
- $interbreadcrumb[]= array ('url' => $_SESSION['gradebook_dest'].'?selectcat=0','name' => get_lang('Details'));
- }
- }
- Display :: display_header('');
- } else {
- Display :: display_header('');
- }
+ $interbreadcrumb[]= array ('url' => $gradebook_dest,'name' => get_lang('Gradebook'));
+
+ if ((isset($_GET['selectcat']) && $_GET['selectcat']>0)) {
+ if (!empty($_GET['course'])) {
+ $interbreadcrumb[]= array ('url' => $gradebook_dest.'selectcat='.Security::remove_XSS($_GET['selectcat']),'name' => get_lang('Details'));
+ } else {
+ $interbreadcrumb[]= array ('url' => $_SESSION['gradebook_dest'].'?selectcat=0','name' => get_lang('Details'));
+ }
+ }
+ Display :: display_header('');
+ } else {
+ Display :: display_header('');
+ }
}
if (isset ($_GET['categorymoved'])) {
- Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
+ Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
}
if (isset ($_GET['evaluationmoved'])) {
- Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
+ Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
}
if (isset ($_GET['linkmoved'])) {
- Display :: display_confirmation_message(get_lang('LinkMoved'),false);
+ Display :: display_confirmation_message(get_lang('LinkMoved'),false);
}
if (isset ($_GET['addcat'])) {
- Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
+ Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
}
if (isset ($_GET['linkadded'])) {
- Display :: display_confirmation_message(get_lang('LinkAdded'),false);
+ Display :: display_confirmation_message(get_lang('LinkAdded'),false);
}
if (isset ($_GET['addresult'])) {
- Display :: display_confirmation_message(get_lang('ResultAdded'),false);
+ Display :: display_confirmation_message(get_lang('ResultAdded'),false);
}
if (isset ($_GET['editcat'])) {
- Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
+ Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
}
if (isset ($_GET['editeval'])) {
- Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
+ Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
}
if (isset ($_GET['linkedited'])) {
- Display :: display_confirmation_message(get_lang('LinkEdited'),false);
+ Display :: display_confirmation_message(get_lang('LinkEdited'),false);
}
if (isset ($_GET['nolinkitems'])) {
- Display :: display_warning_message(get_lang('NoLinkItems'),false);
+ Display :: display_warning_message(get_lang('NoLinkItems'),false);
}
if (isset ($_GET['addallcat'])) {
- Display :: display_normal_message(get_lang('AddAllCat'),false);
+ Display :: display_normal_message(get_lang('AddAllCat'),false);
}
if (isset ($confirmation_message)) {
- Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
+ Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
}
if (isset ($warning_message)) {
- Display :: display_warning_message($warning_message,$filter_warning_msg);
+ Display :: display_warning_message($warning_message,$filter_warning_msg);
}
if (isset ($move_form)) {
- Display :: display_normal_message($move_form->toHtml(),false);
+ Display :: display_normal_message($move_form->toHtml(),false);
}
// LOAD DATA & DISPLAY TABLE -
$is_platform_admin= api_is_platform_admin();
$is_course_admin= api_is_allowed_to_edit();
//load data for category, evaluation and links
if (!isset ($_GET['selectcat']) || empty ($_GET['selectcat'])) {
- $category= 0;
- } else {
- $category= Security::remove_XSS($_GET['selectcat']);
- }
+ $category= 0;
+} else {
+ $category= Security::remove_XSS($_GET['selectcat']);
+}
// search form
$simple_search_form= new UserForm(UserForm :: TYPE_SIMPLE_SEARCH, null, 'simple_search_form', null, api_get_self() . '?selectcat=' . $selectcat);
$values= $simple_search_form->exportValues();
$keyword = '';
if (isset($_GET['search']) && !empty($_GET['search'])) {
- $keyword = Security::remove_XSS($_GET['search']);
+ $keyword = Security::remove_XSS($_GET['search']);
}
if ($simple_search_form->validate() && (empty($keyword))) {
- $keyword = $values['keyword'];
+ $keyword = $values['keyword'];
}
if (!empty($keyword)) {
-
- $cats= Category :: load($category);
- $allcat= array ();
- if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
- $allcat= $cats[0]->get_subcategories(null);
- $allcat_info = Category :: find_category($keyword,$allcat);
- $alleval=array();
- $alllink=array();
- } else {
- $alleval = Evaluation :: find_evaluations($keyword, $cats[0]->get_id());
- $alllink = LinkFactory :: find_links($keyword, $cats[0]->get_id());
- }
+
+ $cats= Category :: load($category);
+ $allcat= array ();
+ if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
+ $allcat= $cats[0]->get_subcategories(null);
+ $allcat_info = Category :: find_category($keyword,$allcat);
+ $alleval=array();
+ $alllink=array();
+ } else {
+ $alleval = Evaluation :: find_evaluations($keyword, $cats[0]->get_id());
+ $alllink = LinkFactory :: find_links($keyword, $cats[0]->get_id());
+ }
} elseif (isset ($_GET['studentoverview'])) {
- //@todo this code seems to be deprecated because the gradebook tab is off
- $cats= Category :: load($category);
- $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
- $allcat= array ();
- $alleval= $cats[0]->get_evaluations($stud_id, true);
- $alllink= $cats[0]->get_links($stud_id, true);
- if (isset ($_GET['exportpdf'])) {
- $datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
- $header_names = array(get_lang('Name'),get_lang('Description'),get_lang('Weight'),get_lang('Date'),get_lang('Results'));
- $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
- $newarray = array();
- foreach ($data_array as $data) {
- $newarray[] = array_slice($data, 1);
- }
- $pdf= new Cezpdf();
- $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
- $pdf->ezSetMargins(30, 30, 50, 30);
- $pdf->ezSetY(810);
- $pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
- $pdf->line(50,790,550,790);
- $pdf->line(50,40,550,40);
- $pdf->ezSetY(750);
- $pdf->ezTable($newarray,$header_names,'',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1,'rowGap'=>3,'width'=> 500));
- $pdf->ezStream();
- exit;
- }
+ //@todo this code seems to be deprecated because the gradebook tab is off
+ $cats= Category :: load($category);
+ $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
+ $allcat= array ();
+ $alleval= $cats[0]->get_evaluations($stud_id, true);
+ $alllink= $cats[0]->get_links($stud_id, true);
+ if (isset ($_GET['exportpdf'])) {
+ $datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
+ $header_names = array(get_lang('Name'),get_lang('Description'),get_lang('Weight'),get_lang('Date'),get_lang('Results'));
+ $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
+ $newarray = array();
+ foreach ($data_array as $data) {
+ $newarray[] = array_slice($data, 1);
+ }
+ $pdf= new Cezpdf();
+ $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
+ $pdf->ezSetMargins(30, 30, 50, 30);
+ $pdf->ezSetY(810);
+ $pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
+ $pdf->line(50,790,550,790);
+ $pdf->line(50,40,550,40);
+ $pdf->ezSetY(750);
+ $pdf->ezTable($newarray,$header_names,'',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1,'rowGap'=>3,'width'=> 500));
+ $pdf->ezStream();
+ exit;
+ }
} elseif (!empty($_GET['export_certificate'])){
//@todo this code seems not to be used
- $user_id = strval(intval($_GET['user']));
- if (!api_is_allowed_to_edit(true,true)) {
- $user_id = api_get_user_id();
- }
- $category = Category :: load ($_GET['cat_id']);
- if ($category[0]->is_certificate_available($user_id)) {
- $user= get_user_info_from_id($user_id);
- $scoredisplay = ScoreDisplay :: instance();
- $scorecourse = $category[0]->calc_score($user_id);
- $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
+ $user_id = strval(intval($_GET['user']));
+ if (!api_is_allowed_to_edit(true,true)) {
+ $user_id = api_get_user_id();
+ }
+ $category = Category :: load ($_GET['cat_id']);
+ if ($category[0]->is_certificate_available($user_id)) {
+ $user= get_user_info_from_id($user_id);
+ $scoredisplay = ScoreDisplay :: instance();
+ $scorecourse = $category[0]->calc_score($user_id);
+ $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
- $cattotal = Category :: load(0);
- $scoretotal= $cattotal[0]->calc_score($user_id);
- $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
+ $cattotal = Category :: load(0);
+ $scoretotal= $cattotal[0]->calc_score($user_id);
+ $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
- //prepare all necessary variables:
- $organization_name = api_get_setting('Institution');
- $portal_name = api_get_setting('siteName');
- $stud_fn = $user['firstname'];
- $stud_ln = $user['lastname'];
- $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'),$organization_name,$stud_fn.' '.$stud_ln,$category[0]->get_name(),$scorecourse_display);
- $certif_text = str_replace("\\n","\n",$certif_text);
- $date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
+ //prepare all necessary variables:
+ $organization_name = api_get_setting('Institution');
+ $portal_name = api_get_setting('siteName');
+ $stud_fn = $user['firstname'];
+ $stud_ln = $user['lastname'];
+ $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'),$organization_name,$stud_fn.' '.$stud_ln,$category[0]->get_name(),$scorecourse_display);
+ $certif_text = str_replace("\\n","\n",$certif_text);
+ $date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
- $pdf= new Cezpdf('a4','landscape');
- $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
- $pdf->ezSetMargins(30, 30, 50, 50);
- //line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
- $pdf->line(50,50,790,50);
- $pdf->line(50,550,790,550);
- $pdf->ezSetY(450);
+ $pdf= new Cezpdf('a4','landscape');
+ $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
+ $pdf->ezSetMargins(30, 30, 50, 50);
+ //line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
+ $pdf->line(50,50,790,50);
+ $pdf->line(50,550,790,550);
+ $pdf->ezSetY(450);
//@todo replace image
- //$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center','');
- $pdf->ezSetY(480);
- $pdf->ezText($certif_text,28,array('justification'=>'center'));
- //$pdf->ezSetY(750);
- $pdf->ezSetY(50);
- $pdf->ezText($date,18,array('justification'=>'center'));
- $pdf->ezSetY(580);
- $pdf->ezText($organization_name,22,array('justification'=>'left'));
- $pdf->ezSetY(580);
- $pdf->ezText($portal_name,22,array('justification'=>'right'));
- $pdf->ezStream();
- }
- exit;
+ //$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center','');
+ $pdf->ezSetY(480);
+ $pdf->ezText($certif_text,28,array('justification'=>'center'));
+ //$pdf->ezSetY(750);
+ $pdf->ezSetY(50);
+ $pdf->ezText($date,18,array('justification'=>'center'));
+ $pdf->ezSetY(580);
+ $pdf->ezText($organization_name,22,array('justification'=>'left'));
+ $pdf->ezSetY(580);
+ $pdf->ezText($portal_name,22,array('justification'=>'right'));
+ $pdf->ezStream();
+ }
+ exit;
} else {
- $cats= Category :: load($category);
- $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
- $allcat= $cats[0]->get_subcategories($stud_id);
- $alleval= $cats[0]->get_evaluations($stud_id);
- $alllink= $cats[0]->get_links($stud_id);
+ $cats= Category :: load($category);
+ $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
+ $allcat= $cats[0]->get_subcategories($stud_id);
+ $alleval= $cats[0]->get_evaluations($stud_id);
+ $alllink= $cats[0]->get_links($stud_id);
}
$addparams = array ('selectcat' => $cats[0]->get_id());
if (isset($_GET['search'])) {
- $addparams['search'] = $keyword;
+ $addparams['search'] = $keyword;
}
if (isset ($_GET['studentoverview'])) {
- $addparams['studentoverview'] = '';
+ $addparams['studentoverview'] = '';
}
if (count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
- $allcat=$allcat_info;
+ $allcat=$allcat_info;
} else {
- $allcat=$allcat;
+ $allcat=$allcat;
}
$gradebooktable= new GradebookTable($cats[0], $allcat, $alleval, $alllink, $addparams);
if (((empty ($allcat)) && (empty ($alleval)) && (empty ($alllink)) && (!$is_platform_admin) && ($is_course_admin) && (!isset ($_GET['selectcat']))) && api_is_course_tutor()) {
- Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '
',false);
+ Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '
',false);
}
//here we are in a sub category
if ($category != '0') {
- DisplayGradebook :: display_header_gradebook($cats[0], 1, $_GET['selectcat'], $is_course_admin, $is_platform_admin, $simple_search_form);
+ DisplayGradebook :: display_header_gradebook($cats[0], 1, $_GET['selectcat'], $is_course_admin, $is_platform_admin, $simple_search_form);
} else {
- //this is the root category
- DisplayGradebook :: display_header_gradebook($cats[0], (((count($allcat) == '0') && (!isset ($_GET['search']))) ? 0 : 1), 0, $is_course_admin, $is_platform_admin, $simple_search_form);
+ //this is the root category
+ DisplayGradebook :: display_header_gradebook($cats[0], (((count($allcat) == '0') && (!isset ($_GET['search']))) ? 0 : 1), 0, $is_course_admin, $is_platform_admin, $simple_search_form);
}
$gradebooktable->display();
Display :: display_footer();
diff --git a/main/gradebook/gradebook_add_cat.php b/main/gradebook/gradebook_add_cat.php
index ccd3615b23..427581c036 100755
--- a/main/gradebook/gradebook_add_cat.php
+++ b/main/gradebook/gradebook_add_cat.php
@@ -1,18 +1,17 @@
set_parent_id($get_select_cat);
$catcourse = Category :: load ($get_select_cat);
if ($_in_course) {
- $catadd->set_course_code($course_code);
+ $catadd->set_course_code($course_code);
} else {
- $catadd->set_course_code($catcourse[0]->get_course_code());
+ $catadd->set_course_code($catcourse[0]->get_course_code());
}
$catadd->set_course_code(api_get_course_id());
@@ -109,44 +108,44 @@ $form = new CatForm(
);
if ($form->validate()) {
- $values = $form->exportValues();
- $select_course=isset($values['select_course']) ? $values['select_course'] : array();
- $cat = new Category();
- if ($values['hid_parent_id'] == '0') {
- if ($select_course == 'COURSEINDEPENDENT') {
- $cat->set_name($values['name']);
- $cat->set_course_code(null);
- } else {
- $cat->set_course_code($select_course);
- $cat->set_name($values['name']);
- }
- } else {
- $cat->set_name($values['name']);
- $cat->set_course_code($values['course_code']);
- }
+ $values = $form->exportValues();
+ $select_course=isset($values['select_course']) ? $values['select_course'] : array();
+ $cat = new Category();
+ if ($values['hid_parent_id'] == '0') {
+ if ($select_course == 'COURSEINDEPENDENT') {
+ $cat->set_name($values['name']);
+ $cat->set_course_code(null);
+ } else {
+ $cat->set_course_code($select_course);
+ $cat->set_name($values['name']);
+ }
+ } else {
+ $cat->set_name($values['name']);
+ $cat->set_course_code($values['course_code']);
+ }
$cat->set_session_id(api_get_session_id());
- //Always add the gradebook to the course
- $cat->set_course_code(api_get_course_id());
+ //Always add the gradebook to the course
+ $cat->set_course_code(api_get_course_id());
$cat->set_skills($values['skills']);
- $cat->set_description($values['description']);
- $cat->set_user_id($values['hid_user_id']);
- $cat->set_parent_id($values['hid_parent_id']);
- $cat->set_weight($values['weight']);
-
- if (empty ($values['visible'])) {
- $visible = 0;
- } else {
- $visible = 1;
- }
- $cat->set_visible($visible);
- $result = $cat->add();
- header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat=' . $cat->get_parent_id());
- exit;
+ $cat->set_description($values['description']);
+ $cat->set_user_id($values['hid_user_id']);
+ $cat->set_parent_id($values['hid_parent_id']);
+ $cat->set_weight($values['weight']);
+
+ if (empty ($values['visible'])) {
+ $visible = 0;
+ } else {
+ $visible = 1;
+ }
+ $cat->set_visible($visible);
+ $result = $cat->add();
+ header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat=' . $cat->get_parent_id());
+ exit;
}
if ( !$_in_course ) {
- $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat,'name' => get_lang('Gradebook'));
+ $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat,'name' => get_lang('Gradebook'));
}
$interbreadcrumb[]= array ( 'url' =>'index.php','name' => get_lang('ToolGradebook'));
Display :: display_header(get_lang('NewCategory'));
diff --git a/main/gradebook/gradebook_add_eval.php b/main/gradebook/gradebook_add_eval.php
index 7de17f09fd..e61bd06166 100755
--- a/main/gradebook/gradebook_add_eval.php
+++ b/main/gradebook/gradebook_add_eval.php
@@ -5,9 +5,7 @@
* Script
* @package chamilo.gradebook
*/
-/**
- * Init
- */
+
$language_file = 'gradebook';
require_once '../inc/global.inc.php';
require_once 'lib/be.inc.php';
@@ -50,7 +48,7 @@ if ($form->validate()) {
$parent_cat = Category :: load($values['hid_category_id']);
$global_weight = $cat[0]->get_weight();
- //$values['weight'] = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
+ //$values['weight'] = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
$values['weight'] = $values['weight_mask'];
@@ -88,25 +86,25 @@ if ($form->validate()) {
$interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $select_cat,
'name' => get_lang('Gradebook'
- ));
+ ));
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = '";
api_block_anonymous_users();
if (!api_is_allowed_to_edit()) {
- api_not_allowed(true);
+ api_not_allowed(true);
}
$cat_id = isset($_GET['cat_id']) ? (int)$_GET['cat_id'] : null;
@@ -182,25 +179,25 @@ if (count($certificate_list)==0) {
foreach ($certificate_list as $index=>$value) {
echo '
'.get_lang('Student').' : '.api_get_person_name($value['firstname'], $value['lastname']).' ('.$value['username'].') ';
- echo ' ';
+ echo '';
echo '
';
- $list_certificate = get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
- foreach ($list_certificate as $value_certificate) {
- echo '';
- echo ''.get_lang('Score').' : '.$value_certificate['score_certificate'].' ';
- echo ''.get_lang('Date').' : '.api_convert_and_format_date($value_certificate['created_at']).' ';
- echo '';
+ $list_certificate = get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
+ foreach ($list_certificate as $value_certificate) {
+ echo ' ';
+ echo ''.get_lang('Score').' : '.$value_certificate['score_certificate'].' ';
+ echo ''.get_lang('Date').' : '.api_convert_and_format_date($value_certificate['created_at']).' ';
+ echo '';
$url = api_get_path(WEB_PATH).'certificates/index.php?id='.$value_certificate['id'];
$certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn'));
echo $certificates;
- echo '
+ echo '
'.Display::return_icon('delete.png',get_lang('Delete')).'
';
- echo ' ';
- }
- echo '
';
+ echo ' ';
+ }
+ echo '';
echo '';
}
echo '';
diff --git a/main/gradebook/gradebook_edit_all.php b/main/gradebook/gradebook_edit_all.php
index 0be185a810..29e3d8899b 100755
--- a/main/gradebook/gradebook_edit_all.php
+++ b/main/gradebook/gradebook_edit_all.php
@@ -1,13 +1,11 @@
Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
- Display :: display_header(get_lang('FlatView'));
- } elseif (isset ($_GET['search'])) {
- $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
- Display :: display_header(get_lang('SearchResults'));
- } else {
- $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=1', 'name' => get_lang('Gradebook'));
- $interbreadcrumb[] = array ('url' => '#','name' => get_lang('EditAllWeights'));
- Display :: display_header('');
- }
+ if (isset ($_GET['studentoverview'])) {
+ $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
+ Display :: display_header(get_lang('FlatView'));
+ } elseif (isset ($_GET['search'])) {
+ $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $my_selectcat,'name' => get_lang('Gradebook'));
+ Display :: display_header(get_lang('SearchResults'));
+ } else {
+ $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=1', 'name' => get_lang('Gradebook'));
+ $interbreadcrumb[] = array ('url' => '#','name' => get_lang('EditAllWeights'));
+ Display :: display_header('');
+ }
}
$course_id = get_course_id_by_link_id($my_selectcat);
@@ -74,15 +72,15 @@ $table_evaluated[LINK_SURVEY] = array(TABLE_SURVEY, 'code', 'survey_
$submitted = isset($_POST['submitted'])?$_POST['submitted']:'';
if ($submitted==1) {
- Display :: display_confirmation_message(get_lang('GradebookWeightUpdated')) . '
';
- if (isset($_POST['evaluation'])) {
- require_once 'lib/be/evaluation.class.php';
- $eval_log = new Evaluation();
- }
- if(isset($_POST['link'])){
- require_once 'lib/be/abstractlink.class.php';
- //$eval_link_log = new AbstractLink();
- }
+ Display :: display_confirmation_message(get_lang('GradebookWeightUpdated')) . '
';
+ if (isset($_POST['evaluation'])) {
+ require_once 'lib/be/evaluation.class.php';
+ $eval_log = new Evaluation();
+ }
+ if(isset($_POST['link'])){
+ require_once 'lib/be/abstractlink.class.php';
+ //$eval_link_log = new AbstractLink();
+ }
}
$output='';
@@ -168,30 +166,30 @@ while ($row = Database ::fetch_array($sql)) {
//by iflorespaz
$my_api_cidreq = api_get_cidreq();
if ($my_api_cidreq=='') {
- $my_api_cidreq='cidReq='.$my_category['course_code'];
+ $my_api_cidreq='cidReq='.$my_category['course_code'];
}
?>
-
+
-
+
';
-
$catedit = Category::load($edit_cat);
-
$form = new CatForm(CatForm::TYPE_EDIT, $catedit[0], 'edit_cat_form');
if ($form->validate()) {
- $values = $form->getSubmitValues();
+ $values = $form->getSubmitValues();
$cat = new Category();
@@ -97,36 +94,36 @@ if ($form->validate()) {
}
}
- $cat->set_id($values['hid_id']);
- $cat->set_name($values['name']);
+ $cat->set_id($values['hid_id']);
+ $cat->set_name($values['name']);
- if (empty ($values['course_code'])) {
- $cat->set_course_code(null);
- }else {
- $cat->set_course_code($values['course_code']);
- }
+ if (empty ($values['course_code'])) {
+ $cat->set_course_code(null);
+ }else {
+ $cat->set_course_code($values['course_code']);
+ }
$cat->set_grade_model_id($values['grade_model_id']);
- $cat->set_description($values['description']);
- $cat->set_skills($values['skills']);
- $cat->set_user_id($values['hid_user_id']);
- $cat->set_parent_id($values['hid_parent_id']);
- $cat->set_weight($values['weight']);
-
- if ($values['hid_parent_id'] == 0 ) {
- $cat->set_certificate_min_score($values['certif_min_score']);
- }
+ $cat->set_description($values['description']);
+ $cat->set_skills($values['skills']);
+ $cat->set_user_id($values['hid_user_id']);
+ $cat->set_parent_id($values['hid_parent_id']);
+ $cat->set_weight($values['weight']);
+
+ if ($values['hid_parent_id'] == 0 ) {
+ $cat->set_certificate_min_score($values['certif_min_score']);
+ }
if (empty ($values['visible'])) {
- $visible = 0;
- } else {
- $visible = 1;
- }
+ $visible = 0;
+ } else {
+ $visible = 1;
+ }
$cat->set_visible($visible);
- $cat->save();
- header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id());
- exit;
+ $cat->save();
+ header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id());
+ exit;
}
$selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat,'name' => get_lang('Gradebook'));
diff --git a/main/gradebook/gradebook_edit_eval.php b/main/gradebook/gradebook_edit_eval.php
index 62e466938a..f269baf91f 100755
--- a/main/gradebook/gradebook_edit_eval.php
+++ b/main/gradebook/gradebook_edit_eval.php
@@ -1,12 +1,11 @@
-is_locked() && !api_is_platform_admin()) {
api_not_allowed();
}
-$form = new EvalForm(EvalForm :: TYPE_EDIT, $evaledit[0], null, 'edit_eval_form',null,api_get_self() . '?editeval=' . Security::remove_XSS($_GET['editeval']));
+$form = new EvalForm(
+ EvalForm :: TYPE_EDIT,
+ $evaledit[0],
+ null,
+ 'edit_eval_form',
+ null,
+ api_get_self() . '?editeval=' . Security::remove_XSS($_GET['editeval'])
+);
if ($form->validate()) {
- $values = $form->exportValues();
- $eval = new Evaluation();
- $eval->set_id($values['hid_id']);
- $eval->set_name($values['name']);
- $eval->set_description($values['description']);
- $eval->set_user_id($values['hid_user_id']);
- $eval->set_course_code($values['hid_course_code']);
- $eval->set_category_id($values['hid_category_id']);
-
- $parent_cat = Category :: load($values['hid_category_id']);
-
+ $values = $form->exportValues();
+ $eval = new Evaluation();
+ $eval->set_id($values['hid_id']);
+ $eval->set_name($values['name']);
+ $eval->set_description($values['description']);
+ $eval->set_user_id($values['hid_user_id']);
+ $eval->set_course_code($values['hid_course_code']);
+ $eval->set_category_id($values['hid_category_id']);
+
+ $parent_cat = Category :: load($values['hid_category_id']);
+
/*$final_weight = null;
if ($parent_cat[0]->get_parent_id() == 0) {
- $final_weight = $values['weight_mask'];
+ $final_weight = $values['weight_mask'];
} else {
$cat = Category :: load($parent_cat[0]->get_parent_id());
$global_weight = $cat[0]->get_weight();
- $final_weight = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
- }*/
+ $final_weight = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
+ }*/
$final_weight = $values['weight_mask'];
-
+
$eval->set_weight($final_weight);
-
- $eval->set_max($values['max']);
- if (empty ($values['visible'])) {
- $visible = 0;
- } else {
- $visible = 1;
- }
- $eval->set_visible($visible);
- $eval->save();
- header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat=' . $eval->get_category_id());
- exit;
+
+ $eval->set_max($values['max']);
+ if (empty ($values['visible'])) {
+ $visible = 0;
+ } else {
+ $visible = 1;
+ }
+ $eval->set_visible($visible);
+ $eval->save();
+ header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat=' . $eval->get_category_id());
+ exit;
}
$selectcat_inter=isset($_GET['selectcat'])?Security::remove_XSS($_GET['selectcat']):'';
$interbreadcrumb[] = array (
- 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter,
- 'name' => get_lang('Gradebook'
-));
+ 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter,
+ 'name' => get_lang('Gradebook'
+ ));
$htmlHeadXtra[] = '