/** * Get the link object referring to an evaluation */ public function get_evaluation_link($eval_id) { $links = AbstractLink::load(null, null, $eval_id); foreach ($links as $link) { if (is_a($link, 'EvalLink')) { return $link; } } return null; }
/** * @param int $idevaluation */ public static function add_link_log($idevaluation) { $tbl_grade_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $dateobject = AbstractLink::load($idevaluation, null, null, null, null); $current_date_server = api_get_utc_datetime(); $arreval = get_object_vars($dateobject[0]); $description_log = isset($arreval['description']) ? $arreval['description'] : ''; if (isset($_POST['name_link'])) { $name_log = isset($_POST['name_link']) ? Security::remove_XSS($_POST['name_link']) : $arreval['course_code']; } elseif ($_POST['link_' . $idevaluation]) { $name_log = $_POST['link_' . $idevaluation]; } else { $name_log = $arreval['course_code']; } $sql = "INSERT INTO " . $tbl_grade_linkeval_log . "(id_linkeval_log,name,description,created_at,weight,visible,type,user_id_log)\n VALUES('" . Database::escape_string($arreval['id']) . "','" . Database::escape_string($name_log) . "','" . Database::escape_string($description_log) . "','" . Database::escape_string($current_date_server) . "','" . Database::escape_string($arreval['weight']) . "','" . Database::escape_string($arreval['visible']) . "','Link'," . api_get_user_id() . ")"; Database::query($sql); }
/** * @param int $idevaluation */ public static function add_link_log($idevaluation, $nameLog = null) { $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $dateobject = AbstractLink::load($idevaluation, null, null, null, null); $current_date_server = api_get_utc_datetime(); $arreval = get_object_vars($dateobject[0]); $description_log = isset($arreval['description']) ? $arreval['description'] : ''; if (empty($nameLog)) { if (isset($_POST['name_link'])) { $name_log = isset($_POST['name_link']) ? $_POST['name_link'] : $arreval['course_code']; } elseif (isset($_POST['link_' . $idevaluation]) && $_POST['link_' . $idevaluation]) { $name_log = $_POST['link_' . $idevaluation]; } else { $name_log = $arreval['course_code']; } } else { $name_log = $nameLog; } $params = ['id_linkeval_log' => $arreval['id'], 'name' => $name_log, 'description' => $description_log, 'created_at' => $current_date_server, 'weight' => $arreval['weight'], 'visible' => $arreval['visible'], 'type' => 'Link', 'user_id_log' => api_get_user_id()]; Database::insert($table, $params); }