本文整理汇总了PHP中assQuestion::_resolveInternalLink方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::_resolveInternalLink方法的具体用法?PHP assQuestion::_resolveInternalLink怎么用?PHP assQuestion::_resolveInternalLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assQuestion
的用法示例。
在下文中一共展示了assQuestion::_resolveInternalLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _resolveIntLinks
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]);
}
}
}
}
}