本文整理汇总了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;
}