|
@@ -106,7 +106,10 @@ abstract class AbstractLink implements GradebookItem
|
|
|
$this->user_id = $user_id;
|
|
|
}
|
|
|
|
|
|
- public function set_course_code ($course_code)
|
|
|
+ /**
|
|
|
+ * @param string $course_code
|
|
|
+ */
|
|
|
+ public function set_course_code($course_code)
|
|
|
{
|
|
|
$this->course_code = $course_code;
|
|
|
$course_info = api_get_course_info($course_code);
|
|
@@ -263,8 +266,15 @@ abstract class AbstractLink implements GradebookItem
|
|
|
public function add()
|
|
|
{
|
|
|
$this->add_linked_data();
|
|
|
- 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_main_table(TABLE_MAIN_GRADEBOOK_LINK);
|
|
|
+ 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_main_table(TABLE_MAIN_GRADEBOOK_LINK);
|
|
|
$sql = "SELECT count(*) FROM ".$tbl_grade_links."
|
|
|
WHERE
|
|
|
ref_id=".$this->get_ref_id()." AND
|
|
@@ -275,7 +285,7 @@ abstract class AbstractLink implements GradebookItem
|
|
|
$result = Database::query($sql);
|
|
|
$row_testing = Database::fetch_array($result);
|
|
|
|
|
|
- if ($row_testing[0]==0) {
|
|
|
+ if ($row_testing[0] == 0) {
|
|
|
$sql = 'INSERT INTO '.$tbl_grade_links.' (type, ref_id, user_id, course_code, category_id, weight, visible, created_at) VALUES ('
|
|
|
.intval($this->get_type())
|
|
|
.','.intval($this->get_ref_id())
|
|
@@ -501,14 +511,14 @@ abstract class AbstractLink implements GradebookItem
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- public function get_view_url ($stud_id)
|
|
|
+ public function get_view_url($stud_id)
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Locks a link
|
|
|
- * @param int locked 1 or unlocked 0
|
|
|
+ * @param int $locked 1 or unlocked 0
|
|
|
*
|
|
|
* */
|
|
|
public function lock($locked)
|