[svn r14037] Updated database tables getter function call

skala
Yannick Warnier 18 years ago
parent 985b8637e8
commit 7b448fbcb2
  1. 8
      main/gradebook/lib/be/abstractlink.class.php
  2. 18
      main/gradebook/lib/be/category.class.php
  3. 22
      main/gradebook/lib/be/evaluation.class.php
  4. 4
      main/gradebook/lib/be/exerciselink.class.php
  5. 4
      main/gradebook/lib/be/learnpathlink.class.php
  6. 10
      main/gradebook/lib/be/result.class.php
  7. 4
      main/gradebook/lib/gradebook_functions_users.inc.php
  8. 4
      main/gradebook/lib/scoredisplay.class.php

@ -135,7 +135,7 @@ abstract class AbstractLink implements GradebookItem
*/
public function load ($id = null, $type = null, $ref_id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null)
{
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql='SELECT id,type,ref_id,user_id,course_code,category_id,date,weight,visible FROM '.$tbl_grade_links;
$paramcount = 0;
if (isset ($id))
@ -221,7 +221,7 @@ abstract class AbstractLink implements GradebookItem
if (isset($this->type) && isset($this->ref_id) && isset($this->user_id) && isset($this->course_code)
&& isset($this->category) && isset($this->weight) && isset($this->visible))
{
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'INSERT INTO '.$tbl_grade_links
.' (type,ref_id,user_id,course_code,category_id,weight,visible';
@ -251,7 +251,7 @@ abstract class AbstractLink implements GradebookItem
{
$this->save_linked_data();
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'UPDATE '.$tbl_grade_links
.' SET type = '.$this->get_type()
.', ref_id = '.$this->get_ref_id()
@ -277,7 +277,7 @@ abstract class AbstractLink implements GradebookItem
{
$this->delete_linked_data();
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'DELETE FROM '.$tbl_grade_links.' WHERE id = '.$this->id;
api_sql_query($sql, __FILE__, __LINE__);
}

@ -130,7 +130,7 @@ class Category implements GradebookItem
return $cats;
}
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql='SELECT id,name,description,user_id,course_code,parent_id,weight,visible FROM '.$tbl_grade_categories;
$paramcount = 0;
if (isset ($id))
@ -213,7 +213,7 @@ class Category implements GradebookItem
{
if (isset($this->name) && isset($this->user_id) && isset($this->weight) && isset($this->visible))
{
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'INSERT INTO '.$tbl_grade_categories
.' (name,user_id,weight,visible';
if (isset($this->description)) $sql .= ',description';
@ -240,7 +240,7 @@ class Category implements GradebookItem
*/
public function save()
{
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'UPDATE '.$tbl_grade_categories
." SET name = '".mysql_real_escape_string($this->get_name())."'"
.', description = ';
@ -274,7 +274,7 @@ class Category implements GradebookItem
*/
public function delete()
{
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'DELETE FROM '.$tbl_grade_categories.' WHERE id = '.$this->id;
api_sql_query($sql, __FILE__, __LINE__);
}
@ -294,7 +294,7 @@ class Category implements GradebookItem
$name = $this->name;
$parent = $this->parent;
}
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'SELECT count(id) AS number'
.' FROM '.$tbl_grade_categories
." WHERE name = '".$name."'";
@ -437,7 +437,7 @@ class Category implements GradebookItem
// courses
$main_course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'SELECT *'
.' FROM '.$tbl_grade_categories
@ -484,7 +484,7 @@ class Category implements GradebookItem
// courses
$main_course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'SELECT *'
.' FROM '.$tbl_grade_categories
@ -704,7 +704,7 @@ class Category implements GradebookItem
{
$tbl_main_courses = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_main_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'SELECT DISTINCT(code), title FROM '.$tbl_main_courses.' cc, '.$tbl_main_course_user.' cu'
.' WHERE cc.code = cu.course_code'
@ -736,7 +736,7 @@ class Category implements GradebookItem
{
$tbl_main_courses = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_main_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_grade_categories = Database :: get_gradebook_table(TABLE_GRADEBOOK_CATEGORY);
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'SELECT DISTINCT(code), title FROM '.$tbl_main_courses.' cc, '.$tbl_main_course_user.' cu'
.' WHERE cc.code = cu.course_code'

@ -143,7 +143,7 @@ class Evaluation implements GradebookItem
*/
public function load ($id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null)
{
$tbl_grade_evaluations = Database :: get_gradebook_table(TABLE_GRADEBOOK_EVALUATION);
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$sql='SELECT id,name,description,user_id,course_code,category_id,date,weight,max,visible FROM '.$tbl_grade_evaluations;
$paramcount = 0;
if (isset ($id))
@ -213,7 +213,7 @@ class Evaluation implements GradebookItem
{
if (isset($this->name) && isset($this->user_id) && isset($this->weight) && isset ($this->eval_max) && isset($this->visible))
{
$tbl_grade_evaluations = Database :: get_gradebook_table(TABLE_GRADEBOOK_EVALUATION);
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$sql = 'INSERT INTO '.$tbl_grade_evaluations
.' (name,user_id,weight,max,visible';
@ -244,7 +244,7 @@ class Evaluation implements GradebookItem
*/
public function save()
{
$tbl_grade_evaluations = Database :: get_gradebook_table(TABLE_GRADEBOOK_EVALUATION);
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$sql = 'UPDATE '.$tbl_grade_evaluations
." SET name = '".mysql_real_escape_string($this->get_name())."'"
.', description = ';
@ -284,7 +284,7 @@ class Evaluation implements GradebookItem
*/
public function delete()
{
$tbl_grade_evaluations = Database :: get_gradebook_table(TABLE_GRADEBOOK_EVALUATION);
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$sql = 'DELETE FROM '.$tbl_grade_evaluations.' WHERE id = '.$this->id;
api_sql_query($sql, __FILE__, __LINE__);
}
@ -303,7 +303,7 @@ class Evaluation implements GradebookItem
$name = $this->name;
$parent = $this->category;
}
$tbl_grade_evaluations = Database :: get_gradebook_table(TABLE_GRADEBOOK_EVALUATION);
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$sql = 'SELECT count(id) AS number'
.' FROM '.$tbl_grade_evaluations
." WHERE name = '".$name."'";
@ -343,7 +343,7 @@ class Evaluation implements GradebookItem
*/
public function has_results()
{
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql='SELECT count(id) AS number FROM '.$tbl_grade_results
.' WHERE evaluation_id = '.$this->id;
$result = api_sql_query($sql, __FILE__, __LINE__);
@ -359,7 +359,7 @@ class Evaluation implements GradebookItem
/* - not used anywhere (yet ?)
public function has_results_for_student($stud_id)
{
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql="SELECT count(id) AS number FROM ".$tbl_grade_results
." WHERE evaluation_id = ".$this->id." AND user_id = ".$stud_id;
$result = api_sql_query($sql, __FILE__, __LINE__);
@ -374,7 +374,7 @@ class Evaluation implements GradebookItem
*/
public function delete_results()
{
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'DELETE FROM '.$tbl_grade_results.' WHERE evaluation_id = '.$this->id;
api_sql_query($sql, __FILE__, __LINE__);
}
@ -512,8 +512,8 @@ class Evaluation implements GradebookItem
*/
public function get_evaluations_with_result_for_student ($cat_id = null, $stud_id)
{
$tbl_grade_evaluations = Database :: get_gradebook_table(TABLE_GRADEBOOK_EVALUATION);
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'SELECT * FROM '.$tbl_grade_evaluations
.' WHERE id IN'
@ -541,7 +541,7 @@ class Evaluation implements GradebookItem
public function get_not_subscribed_students ($first_letter_user = '')
{
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'SELECT user_id,lastname,firstname,username FROM '.$tbl_user
." WHERE lastname LIKE '".$first_letter_user."%'"

@ -36,7 +36,7 @@ class ExerciseLink extends AbstractLink
if (empty($this->course_code))
die('Error in get_not_created_links() : course code not set');
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT id,title from '.$this->get_exercise_table()
.' WHERE id NOT IN'
@ -64,7 +64,7 @@ class ExerciseLink extends AbstractLink
die('Error in get_not_created_links() : course code not set');
$course_info = api_get_course_info($this->course_code);
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK,$course_info['dbName']);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK,$course_info['dbName']);
$sql = 'SELECT id,title from '.$this->get_exercise_table();
$result = api_sql_query($sql, __FILE__, __LINE__);

@ -33,7 +33,7 @@ class LearnpathLink extends AbstractLink
if (empty($this->course_code))
die('Error in get_not_created_links() : course code not set');
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT id,name from '.$this->get_learnpath_table()
.' WHERE id NOT IN'
@ -61,7 +61,7 @@ class LearnpathLink extends AbstractLink
die('Error in get_not_created_links() : course code not set');
$course_info = api_get_course_info($this->course_code);
$tbl_grade_links = Database :: get_gradebook_table(TABLE_GRADEBOOK_LINK,$course_info['dbName']);
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK,$course_info['dbName']);
$sql = 'SELECT id,name from '.$this->get_learnpath_table();
$result = api_sql_query($sql, __FILE__, __LINE__);

@ -3,7 +3,7 @@
/**
* Defines a gradebook Result object
* @author Bert Steppé, Stijn Konings
* @author Bert Stepp<EFBFBD>, Stijn Konings
* @package dokeos.gradebook
*/
class Result
@ -86,7 +86,7 @@ class Result
*/
public function load ($id = null, $user_id = null, $evaluation_id = null)
{
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql='SELECT id,user_id,evaluation_id,date,score FROM '.$tbl_grade_results;
$paramcount = 0;
if (!empty ($id))
@ -131,7 +131,7 @@ class Result
{
if (isset($this->user_id) && isset($this->evaluation) && isset($this->creation_date) )
{
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'INSERT INTO '.$tbl_grade_results
.' (user_id, evaluation_id,
date';
@ -154,7 +154,7 @@ class Result
*/
public function save()
{
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'UPDATE '.$tbl_grade_results
.' SET user_id = '.$this->get_user_id()
.', evaluation_id = '.$this->get_evaluation_id()
@ -175,7 +175,7 @@ class Result
*/
public function delete()
{
$tbl_grade_results = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'DELETE FROM '.$tbl_grade_results.' WHERE id = '.$this->id;
api_sql_query($sql, __FILE__, __LINE__);
}

@ -64,7 +64,7 @@ function get_all_users ($evals = array(), $links = array())
else
{
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_res = Database :: get_gradebook_table(TABLE_GRADEBOOK_RESULT);
$tbl_res = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'SELECT user.user_id,lastname,firstname'
.' FROM '.$tbl_res.' as res, '.$tbl_user.' as user'
@ -95,7 +95,7 @@ function get_all_users ($evals = array(), $links = array())
/**
* Search students matching a given last name and/or first name
* @author Bert Steppé
* @author Bert Stepp<EFBFBD>
*/
function find_students($mask= '')
{

@ -187,7 +187,7 @@ class ScoreDisplay
$this->custom_display_conv = $this->convert_displays($this->custom_display);
// remove previous settings
$tbl_display = Database :: get_gradebook_table(TABLE_GRADEBOOK_SCORE_DISPLAY);
$tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
$sql = 'TRUNCATE TABLE '.$tbl_display;
api_sql_query($sql, __FILE__, __LINE__);
@ -353,7 +353,7 @@ class ScoreDisplay
*/
private function get_custom_displays()
{
$tbl_display = Database :: get_gradebook_table(TABLE_GRADEBOOK_SCORE_DISPLAY);
$tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
$sql = 'SELECT * FROM '.$tbl_display.' ORDER BY score';
//echo $sql;
$result = api_sql_query($sql, __FILE__, __LINE__);

Loading…
Cancel
Save