function _resolveIntLinks($question_id) { global $ilDB; $resolvedlinks = 0; $result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s", array('integer'), array($question_id)); if ($result->numRows()) { while ($row = $ilDB->fetchAssoc($result)) { $internal_link = $row["internal_link"]; include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $resolved_link = assQuestion::_resolveInternalLink($internal_link); if (strcmp($internal_link, $resolved_link) != 0) { // internal link was resolved successfully $affectedRows = $ilDB->manipulateF("UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s", array('text', 'integer'), array($resolved_link, $row["suggested_solution_id"])); $resolvedlinks++; } } } if ($resolvedlinks) { // there are resolved links -> reenter theses links to the database // delete all internal links from the database include_once "./Services/Link/classes/class.ilInternalLink.php"; ilInternalLink::_deleteAllLinksOfSource("qst", $question_id); $result = $ilDB->queryF("SELECT * FROM qpl_sol_sug WHERE question_fi = %s", array('integer'), array($question_id)); if ($result->numRows()) { while ($row = $ilDB->fetchAssoc($result)) { if (preg_match("/il_(\\d*?)_(\\w+)_(\\d+)/", $row["internal_link"], $matches)) { ilInternalLink::_saveLink("qst", $question_id, $matches[2], $matches[3], $matches[1]); } } } } }