[svn r17178] minor - style changes - defined variable

skala
Isaac Flores 16 years ago
parent bf5ecb14f1
commit cf1d92a6fa
  1. 31
      main/gradebook/lib/be/studentpublicationlink.class.php

@ -129,6 +129,7 @@ class StudentPublicationLink extends AbstractLink
while ($data=Database::fetch_array($result)) { while ($data=Database::fetch_array($result)) {
$cats[] = array ($data['id'], $data['url']); $cats[] = array ($data['id'], $data['url']);
} }
$cats=isset($cats) ? $cats : array();
return $cats; return $cats;
} }
@ -207,12 +208,17 @@ class StudentPublicationLink extends AbstractLink
* Lazy load function to get the database table of the student publications * Lazy load function to get the database table of the student publications
*/ */
private function get_studpub_table () { private function get_studpub_table () {
if (!isset($this->studpub_table)) { $course_info = Database :: get_course_info($this->get_course_code());
$course_info = Database :: get_course_info($this->get_course_code()); $database_name = isset($course_info['db_name']) ? $course_info['db_name'] : '';
$database_name = $course_info['db_name']; if ($database_name!='') {
$this->studpub_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION, $database_name); if (!isset($this->studpub_table)) {
} $this->studpub_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION, $database_name);
return $this->studpub_table; }
return $this->studpub_table;
} else {
return false;
}
} }
/** /**
@ -221,7 +227,7 @@ class StudentPublicationLink extends AbstractLink
private function get_itemprop_table () { private function get_itemprop_table () {
if (!isset($this->itemprop_table)) { if (!isset($this->itemprop_table)) {
$course_info = Database :: get_course_info($this->get_course_code()); $course_info = Database :: get_course_info($this->get_course_code());
$database_name = $course_info['db_name']; $database_name = isset($course_info['db_name']) ? $course_info['db_name'] : '';
$this->itemprop_table = Database :: get_course_table(TABLE_ITEM_PROPERTY, $database_name); $this->itemprop_table = Database :: get_course_table(TABLE_ITEM_PROPERTY, $database_name);
} }
return $this->itemprop_table; return $this->itemprop_table;
@ -256,10 +262,13 @@ class StudentPublicationLink extends AbstractLink
} }
private function get_exercise_data() { private function get_exercise_data() {
if (!isset($this->exercise_data)) { $tbl_name=$this->get_studpub_table();
$sql = 'SELECT * FROM '.$this->get_studpub_table()." WHERE id = '".$this->get_ref_id()."'"; if ($tbl_name=='') {
$query = api_sql_query($sql,__FILE__,__LINE__); return false;
$this->exercise_data = Database::fetch_array($query); } elseif (!isset($this->exercise_data)) {
$sql = 'SELECT * FROM '.$this->get_studpub_table()." WHERE id = '".$this->get_ref_id()."'";
$query = api_sql_query($sql,__FILE__,__LINE__);
$this->exercise_data = Database::fetch_array($query);
} }
return $this->exercise_data; return $this->exercise_data;
} }

Loading…
Cancel
Save