@ -505,8 +542,10 @@ function modify_filter($user_id,$url_params,$row)
}
if ($row[0]<>$_user['user_id'] && $user_is_anonymous == false) {
// you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
}elseif ($row['0']<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
// you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
// we want to remind inactive users. The $_GET['since'] parameter determines which users have to be warned (i.e the users who have been inactive for x days or more
FROM $tbl_announcement announcement, $tbl_item_property ip
@ -1232,17 +1203,30 @@ if ($display_announcement_list && !$surveyid) {
$condition_session
GROUP BY ip.ref
ORDER BY display_order DESC";
}
}
} else {
//STUDENT
//STUDENT
if (is_array($group_memberships) && count($group_memberships)>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_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") )) ";
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 {
$cond_user_id = " AND (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) ";
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
@ -1254,6 +1238,7 @@ if ($display_announcement_list && !$surveyid) {
$condition_session
AND ip.visibility='1'
ORDER BY display_order DESC";
} else {
if ($_user['user_id']) {
@ -1272,7 +1257,7 @@ if ($display_announcement_list && !$surveyid) {
$cond_user_id
$condition_session
AND ip.visibility='1'
AND announcement.session_id IN(0,".intval($_SESSION['id_session']).")
AND announcement.session_id IN(0,".api_get_session_id().")
ORDER BY display_order DESC";
} else {
@ -1290,14 +1275,14 @@ if ($display_announcement_list && !$surveyid) {
$cond_user_id
$condition_session
AND ip.visibility='1'
AND announcement.session_id IN(0,".intval($_SESSION['id_session']).")";
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
@ -1310,7 +1295,7 @@ if ($display_announcement_list && !$surveyid) {
if (isset($_POST['my_exe_exo_id']) && isset($_POST['student_id'])) {
$sql_lp='SELECT li.id as lp_item_id,li.lp_id,li.item_type,li.path,liv.id AS lp_view_id,liv.user_id,max(liv.view_count) AS view_count FROM '.$TBL_LP_ITEM.' li
INNER JOIN '.$TBL_LP_VIEW.' liv ON li.lp_id=liv.lp_id WHERE li.path="'.Database::escape_string(Security::remove_XSS($_POST['my_exe_exo_id'])).'" AND li.item_type="quiz" AND user_id="'.Database::escape_string(Security::remove_XSS($_POST['student_id'])).'" ';
INNER JOIN '.$TBL_LP_VIEW.' liv ON li.lp_id=liv.lp_id WHERE li.path="'.Database::escape_string(Security::remove_XSS($_POST['my_exe_exo_id'])).'" AND li.item_type="quiz" AND user_id="'.Database::escape_string($_POST['student_id']).'" ';
AND lp_view_id = (SELECT id from $TBL_LP_VIEW WHERE user_id = '" . (int) $student_id . "' and lp_id='" . (int) $lp_item_id . "') AND view_count = '$max_view_count'";
Database::query($sql_update_score);
$max_view_count = intval($row_max_view_count[0]);
//Only update if is the last attempt
if ($my_view_count == $_GET['exeid']) {
// update score and total_time from last attempt when you qualify the exercise in Learning path detail
AND lp_view_id = (SELECT id from $TBL_LP_VIEW WHERE user_id = '" . (int) $student_id . "' and lp_id='" . (int) $lp_item_id . "') AND view_count = '$max_view_count'";
Database::query($sql_update_score);
}
/*
/*
// update score and total_time from last attempt when you qualify the exercise in Learning path detail
AND lp_view_id = (SELECT id from $TBL_LP_VIEW WHERE user_id = '" . (int) $student_id . "' and lp_id='" . (int) $lp_item_id . "') AND view_count = '$max_view_count'";
Database::query($sql_update_score);*/
// update max_score from a exercise in lp
$sql_update_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '" . (float) $totalWeighting . "' WHERE id = '" . (int) $lp_item_view_id . "'";
//$sql_update_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '" . (float) $totalWeighting . "' WHERE id = '" . (int) $lp_item_view_id . "'";
@ -26,8 +26,8 @@ if (isset($current_thread['thread_id'])){
$leftclass='forum_message_left';
}
echo "\t<tr>\n";
echo "\t\t<tdrowspan=\"3\"class=\"$leftclass\">";
echo "<tr>";
echo "<tdrowspan=\"3\"class=\"$leftclass\">";
if ($row['user_id']=='0') {
$name=prepare4display($row['poster_name']);
} else {
@ -49,16 +49,16 @@ if (isset($current_thread['thread_id'])){
// The course admin him/herself can do this off course always
if (($current_forum['allow_edit']==1 AND $row['user_id']==$_user['user_id']) or (api_is_allowed_to_edit(false,true) && !(api_is_course_coach() && $current_forum['session_id']!=$_SESSION['id_session']))) {
@ -97,7 +97,7 @@ if (isset($current_thread['thread_id'])){
echo get_lang('ThreadLocked').'<br/>';
}
}
echo "</td>\n";
echo "</td>";
// show the
if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$row['thread_id']])) {
$post_image=icon('../img/forumpostnew.gif');
@ -108,13 +108,13 @@ if (isset($current_thread['thread_id'])){
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum
// The course admin him/herself can do this off course always
if (($current_forum['allow_edit']==1 AND $post['user_id']==$_user['user_id']) or (api_is_allowed_to_edit(false,true) && !(api_is_course_coach() && $current_forum['session_id']!=$_SESSION['id_session']))) {
// note: this can be removed here because it will be displayed in the tree
if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$post['thread_id']])) {
// The course admin him/herself can do this off course always
if (($current_forum['allow_edit']==1 AND $rows[$display_post_id]['user_id']==$_user['user_id']) or (api_is_allowed_to_edit(false,true) && !(api_is_course_coach() && $current_forum['session_id']!=$_SESSION['id_session'])))
// note: this can be removed here because it will be displayed in the tree
if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$rows[$display_post_id]['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$rows[$display_post_id]['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$rows[$display_post_id]['thread_id']]))
{
@ -278,13 +278,13 @@ if ($rows[$display_post_id]['post_notification']=='1' AND $rows[$display_post_id
@ -178,7 +178,8 @@ function event_access_tool($tool, $id_session=0)
global $_course;
global $TABLETRACK_LASTACCESS; //for "what's new" notification
$id_session = api_get_session_id();
$id_session = api_get_session_id();
$tool = Database::escape_string($tool);
$reallyNow = time();
$user_id = $_user['user_id'] ? "'".$_user['user_id']."'" : "0"; // no one
// record information
@ -201,7 +202,7 @@ function event_access_tool($tool, $id_session=0)
VALUES
(".$user_id.",".// Don't add ' ' around value, it's already done.
"'".$_cid."' ,
'".htmlspecialchars($tool, ENT_QUOTES)."',
'".$tool."',
FROM_UNIXTIME(".$reallyNow."),
'".$id_session."')";
$res = Database::query($sql);
@ -209,14 +210,11 @@ function event_access_tool($tool, $id_session=0)
// "what's new" notification
$sql = "UPDATE $TABLETRACK_LASTACCESS
SET access_date = FROM_UNIXTIME($reallyNow)
WHERE access_user_id = ".$user_id." AND access_cours_code = '".$_cid."' AND access_tool = '".htmlspecialchars($tool, ENT_QUOTES)."' AND access_session_id=".$id_session;
WHERE access_user_id = ".$user_id." AND access_cours_code = '".$_cid."' AND access_tool = '".$tool."' AND access_session_id=".$id_session;
" WHERE id='".Database::escape_string($_POST['id'])."'";
Database::query($sql);
// Update search enchine and its values table if enabled
@ -453,7 +460,7 @@ function editlinkcategory($type) {
// This is used to put the modified info of the category-form into the database
if ($submit_category) {
$sql = "UPDATE ".$tbl_categories." set category_title='".Database::escape_string(Security::remove_XSS($_POST['category_title']))."', description='".Database::escape_string(Security::remove_XSS($_POST['description']))."' WHERE id='".Database::escape_string(Security::remove_XSS($_POST['id']))."'";
$sql = "UPDATE ".$tbl_categories." set category_title='".Database::escape_string($_POST['category_title'])."', description='".Database::escape_string($_POST['description'])."' WHERE id='".Database::escape_string($_POST['id'])."'";
/////////////////////// more options /////////////////////// Juan Carlos Raña Trabado
//more for export to course document area. See display_wiki_entry
@ -1626,7 +1637,7 @@ if ($_GET['action']=='edit')
</select> %';
echo '<br/><br/>';
echo '<inputtype="hidden"name="wpost_id"value="'.md5(uniqid(rand(), true)).'">';//prevent double post
echo '<buttonclass="save"type="submit"name="SaveWikiChange">'.get_lang('langSave').'</button>';//for save button Don't change name (see fckeditor/editor/plugins/customizations/fckplugin_compressed.js and fckplugin.js
echo '<buttonclass="save"type="submit"name="SaveWikiChange">'.get_lang('Save').'</button>';//for save button Don't change name (see fckeditor/editor/plugins/customizations/fckplugin_compressed.js and fckplugin.js
echo '</div>';
echo '</form>';
}
@ -1839,18 +1850,14 @@ if ($_GET['action']=='history' or Security::remove_XSS($_POST['HistoryDifference
//rss feed. TODO:
//
if ($_GET['action']=='recentchanges')
{
if ($_GET['action']=='recentchanges') {
$_clean['group_id']=(int)$_SESSION['_gid'];
if ( api_is_allowed_to_session_edit(false,true) ) {
@ -1869,14 +1876,12 @@ if ($_GET['action']=='recentchanges')
$sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' WHERE '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND '.$tbl_wiki.'.'.$groupfilter.$condition_session.' ORDER BY dtime DESC'; // new version
}
else
{
} else {
$sql='SELECT * FROM '.$tbl_wiki.' WHERE '.$groupfilter.$condition_session.' AND visibility=1 ORDER BY dtime DESC'; // old version TODO: Replace by the bottom line
//$sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' WHERE '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND visibility=1 AND '.$tbl_wiki.'.'.$groupfilter.' ORDER BY dtime DESC'; // new version
}
$allpages=Database::query($sql);
//show table
@ -2348,12 +2353,6 @@ if ($_GET['action']=='discuss')
if($_clean['assignment']==2 || $_clean['assignment']==1) {// Unlike ordinary pages of pages of assignments. Allow create a ordinary page although there is a assignment with the same name