本文整理匯總了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]);
}
}
}
}
}