我正在将PDF Viewer导入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');发布于 2019-06-08 13:10:46
根据您上面提供的代码,$cm_info对象在"pdfjsfolder_cm_info_view“函数的作用域中不可用。
用$cm替换$cm_info。
https://stackoverflow.com/questions/56141059
复制相似问题