Fix mysql errors

1.10.x
Julio Montoya 10 years ago
parent d9c71064cc
commit a0a274cb82
  1. 5
      main/gradebook/gradebook_edit_link.php
  2. 11
      main/gradebook/lib/be/forumthreadlink.class.php
  3. 12
      main/work/work.lib.php

@ -15,9 +15,10 @@ $course_id = GradebookUtils::get_course_id_by_link_id($_GET['editli
$tbl_forum_thread = Database :: get_course_table(TABLE_FORUM_THREAD);
$tbl_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$linkarray = LinkFactory :: load($_GET['editlink']);
/** @var AbstractLink $link */
$link = $linkarray[0];
if ($link->is_locked() && !api_is_platform_admin()) {
api_not_allowed();
}
@ -51,7 +52,7 @@ if ($form->validate()) {
if (!empty($values['select_gradebook'])) {
$link->set_category_id($values['select_gradebook']);
}
$link->set_visible(empty ($values['visible']) ? 0 : 1);
$link->set_visible(empty($values['visible']) ? 0 : 1);
$link->save();
//Update weight for attendance

@ -95,15 +95,15 @@ class ForumThreadLink extends AbstractLink
}
$sql = 'SELECT tl.thread_id, tl.thread_title, tl.thread_title_qualify
FROM '.$tbl_grade_links.' tl ,'.$tbl_item_property.' ip
FROM '.$tbl_grade_links.' tl INNER JOIN '.$tbl_item_property.' ip
ON (tl.thread_id = ip.ref AND tl.c_id = ip.c_id )
WHERE
tl.c_id = '.$this->course_id.' AND
ip.c_id = '.$this->course_id.' AND
tl.thread_id = ip.ref AND
ip.tool = "forum_thread" AND
ip.visibility<>2 AND
'.$session_condition.'
GROUP BY ip.ref ';
';
$result = Database::query($sql);
@ -357,7 +357,10 @@ class ForumThreadLink extends AbstractLink
$ref_id = $this->get_ref_id();
if (!empty($ref_id)) {
//Cleans forum
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify=""
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET
thread_qualify_max = 0,
thread_weight = 0,
thread_title_qualify = ""
WHERE c_id = '.$this->course_id.' AND thread_id= '.$ref_id;
Database::query($sql);
}

@ -1593,7 +1593,7 @@ function getWorkListTeacher(
}
// Remove Delete Work Button from action List
// Because removeXSS "removes" the onClick JS Event to do the action (See model.ajax.php - Line 1639)
// But still can use the another jqgrid button to remove works (trash icon)
// But still can use the another jqgrid button to remove works (trash icon)
//
// $deleteUrl = api_get_path(WEB_CODE_PATH).'work/work.php?id='.$workId.'&action=delete_dir&'.api_get_cidreq();
// $deleteLink = '<a href="#" onclick="showConfirmationPopup(this, \'' . $deleteUrl . '\' ) " >' .
@ -3783,14 +3783,16 @@ function addDir($formValues, $user_id, $courseInfo, $group_id, $session_id)
'filetype' => 'folder',
'post_group_id' => $group_id,
'sent_date' => $today,
'qualification' => $formValues['qualification'] != '' ? $formValues['qualification'] : '',
'parent_id' => '',
'qualificator_id' => '',
'weight' => $formValues['weight'],
'qualification' => $formValues['qualification'] != '' ? $formValues['qualification'] : 0,
'parent_id' => 0,
'qualificator_id' => 0,
'weight' => !empty($formValues['weight']) ? $formValues['weight'] : 0,
'session_id' => $session_id,
'allow_text_assignment' => $formValues['allow_text_assignment'],
'contains_file' => 0,
'user_id' => $user_id,
'has_properties' => 0,
'document_id' => 0
];
$id = Database::insert($work_table, $params);

Loading…
Cancel
Save