本文整理匯總了PHP中default_questiontype::find_file_links方法的典型用法代碼示例。如果您正苦於以下問題:PHP default_questiontype::find_file_links方法的具體用法?PHP default_questiontype::find_file_links怎麽用?PHP default_questiontype::find_file_links使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類default_questiontype
的用法示例。
在下文中一共展示了default_questiontype::find_file_links方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
function find_file_links($question, $courseid)
{
// find links in the question_match_sub table.
$urls = array();
if (isset($question->options->subquestions)) {
foreach ($question->options->subquestions as $subquestion) {
$urls += question_find_file_links_from_html($subquestion->questiontext, $courseid);
}
//set all the values of the array to the question object
if ($urls) {
$urls = array_combine(array_keys($urls), array_fill(0, count($urls), array($question->id)));
}
}
$urls = array_merge_recursive($urls, parent::find_file_links($question, $courseid));
return $urls;
}
示例2: array
function find_file_links($question, $courseid)
{
$urls = array();
// find links in the answers table.
$urls += question_find_file_links_from_html($question->options->correctfeedback, $courseid);
$urls += question_find_file_links_from_html($question->options->partiallycorrectfeedback, $courseid);
$urls += question_find_file_links_from_html($question->options->incorrectfeedback, $courseid);
foreach ($question->options->answers as $answer) {
$urls += question_find_file_links_from_html($answer->answer, $courseid);
}
//set all the values of the array to the question id
if ($urls) {
$urls = array_combine(array_keys($urls), array_fill(0, count($urls), array($question->id)));
}
$urls = array_merge_recursive($urls, parent::find_file_links($question, $courseid));
return $urls;
}
示例3: array
function find_file_links($question, $courseid)
{
$urls = array();
if ($question->options->backgroundmedia->media != '') {
if (substr(strtolower($question->options->backgroundmedia->media), 0, 7) == 'http://') {
$matches = array();
//support for older questions where we have a complete url in image field
if (preg_match('!^' . question_file_links_base_url($courseid) . '(.*)!i', $question->options->backgroundmedia->media, $matches)) {
if ($cleanedurl = question_url_check($urls[$matches[2]])) {
$urls[$cleanedurl] = null;
}
}
} else {
if ($question->options->backgroundmedia->media != '') {
if ($cleanedurl = question_url_check($question->options->backgroundmedia->media)) {
$urls[$cleanedurl] = null;
//will be set later
}
}
}
}
foreach ($question->options->media as $media) {
if ($media->media != '') {
if (substr(strtolower($media->media), 0, 7) == 'http://') {
$matches = array();
if (preg_match('!^' . question_file_links_base_url($courseid) . '(.*)!i', $media->media, $matches)) {
if ($cleanedurl = question_url_check($urls[$matches[2]])) {
$urls[$cleanedurl] = null;
}
}
} else {
if ($media->media != '') {
if ($cleanedurl = question_url_check($media->media)) {
$urls[$cleanedurl] = null;
//will be set later
}
}
}
}
$urls += question_find_file_links_from_html($media->questiontext, $courseid);
}
$urls += question_find_file_links_from_html($question->options->feedbackok, $courseid);
$urls += question_find_file_links_from_html($question->options->feedbackmissed, $courseid);
//set all the values of the array to the question object
if ($urls) {
$urls = array_combine(array_keys($urls), array_fill(0, count($urls), array($question->id)));
}
$urls = array_merge_recursive($urls, parent::find_file_links($question, $courseid));
return $urls;
}