if ($row[0]<>$_user['user_id'] && $user_is_anonymous == false) {
if ($row[0] != $_user['user_id'] &&!$user_is_anonymous) {
// 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.
@ -1159,7 +1159,7 @@ if ($display_announcement_list && !$surveyid) {
ORDER BY display_order DESC";
}
} elseif (api_get_group_id() !=0 ) {
} 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
@ -1204,25 +1204,25 @@ if ($display_announcement_list && !$surveyid) {
} 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()."'
$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
@ -1234,7 +1234,7 @@ if ($display_announcement_list && !$surveyid) {
$condition_session
AND ip.visibility='1'
ORDER BY display_order DESC";
} else {
if ($_user['user_id']) {
@ -1276,7 +1276,7 @@ if ($display_announcement_list && !$surveyid) {
}
}
$result = Database::query($sql);
$num_rows = Database::num_rows($result);
@ -1342,10 +1342,10 @@ if ($display_announcement_list && !$surveyid) {
$form = new FormValidator('attendance_calendar_edit','POST','index.php?action=calendar_edit&attendance_id='.$attendance_id.'&calendar_id='.$calendar_id.'&'.api_get_cidreq().$param_gradebook,'');
// calendar edit form
echo '<divclass="attendance-calendar-edit">';
$form = new FormValidator('attendance_calendar_edit','POST','index.php?action=calendar_edit&attendance_id='.$attendance_id.'&calendar_id='.$calendar_id.'&'.api_get_cidreq().$param_gradebook,'');
//Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
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
@ -737,7 +737,7 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) {
$sql_select = "SELECT exe_id FROM $table_track_e_exercises
WHERE exe_cours_id = '".api_get_course_id()."' AND exe_exo_id = ".$this->id." AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = ".api_get_session_id()."";
$result = Database::query($sql_select);
$exe_list = Database::store_result($result);
//deleting TRACK_E_ATTEMPT table
$i = 0;
if (is_array($exe_list) && count($exe_list) > 0) {
foreach($exe_list as $item) {
$sql = "DELETE FROM $table_track_e_attempt WHERE exe_id = '".$item['exe_id']."'";
$sql = "DELETE FROM $table_track_e_attempt WHERE exe_id = '".$item['exe_id']."'";
Database::query($sql);
$i++;
$i++;
}
}
//delete TRACK_E_EXERCICES table
$sql = "DELETE FROM $table_track_e_exercises
WHERE exe_cours_id = '".api_get_course_id()."' AND exe_exo_id = ".$this->id." AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = ".api_get_session_id()."";
Database::query($sql);
return $i;
Database::query($sql);
return $i;
}
/**
* Copies an exercise (duplicate all questions and answers)
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".Database::escape_string($id)."' AND question_id= '".Database::escape_string($questionId)."'";
$resfill = Database::query($queryfill);
$str = Database::result($resfill,0,'answer');
preg_match_all('#\[([^[]*)\]#', $str, $arr);
$str = str_replace('\r\n', '', $str);
$choice = $arr[1];
$tmp=strrpos($choice[$j],' / ');
$choice[$j]=substr($choice[$j],0,$tmp);
$choice[$j]=trim($choice[$j]);
//Needed to let characters ' and " to work as part of an answer