我要将PDF查看器导入Moodle,以在线查看PDF文件而不下载它。当我尝试保存上传的文件时,出现此错误代码Exception - Call to a member function customdata() on null
。
我该如何解决?
function pdfjsfolder_cm_info_dynamic(cm_info $cm) {
// The field 'customdata' is filled in only if folder is to be
// shown inline.
if ($cm_info->customdata()) {
$cm->set_no_view_link();
}
}
/*** Overwrites the content in the course-module object with the folder files list
* if folder.display == FOLDER_DISPLAY_INLINE.
*
* @param cm_info $cm
*/
function pdfjsfolder_cm_info_view(cm_info $cm) {
global $PAGE, $DB;
if ($cm->uservisible &&
$cm_info->customdata() &&
has_capability('mod/pdfjsfolder:view', $cm->context)) {
require_once(dirname(__FILE__) . '/locallib.php');
答案 0 :(得分:0)
$ cm_info对象在“ pdfjsfolder_cm_info_view”函数的范围内不可用。
用$ cm替换$ cm_info。