The Elearning Community • [Risolto] Bug Comando Cancellazione voce di menu in "Gestione Menu"
Page 1 of 1

[Risolto] Bug Comando Cancellazione voce di menu in "Gestione Menu"

Posted: Wed Mar 20, 2019 11:57 am
by wolk73
Volevo segnalarvi un brutto bag nella "Gestione dei menu".
Alla cancellazione della voce blank screen con fatal error di PHP:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Module_Conference::getAllToken(), 0 passed in /var/www/html/forma20/appLms/admin/modules/amanmenu/amanmenu.php on line 1090 and exactly 1 expected in /var/www/html/forma20/appLms/class.module/class.conference.php:33
Stack trace:
#0 /var/www/html/forma20/appLms/admin/modules/amanmenu/amanmenu.php(1090): Module_Conference->getAllToken()
#1 /var/www/html/forma20/appLms/admin/modules/amanmenu/amanmenu.php(1134): removeModule(22, 41, '11')
#2 /var/www/html/forma20/appLms/admin/modules/amanmenu/amanmenu.php(1257): delmodule()
#3 /var/www/html/forma20/appLms/admin/class.module/class.amanmenu.php(28): manmenuDispatch('delmodule')
#4 /var/www/html/forma20/appCore/index.php(80): Module_AManmenu->loadBody()
#5 {main} thrown in /var/www/html/forma20/appLms/class.module/class.conference.php on line 33

Credo che la classe si aspetti di passare altri parametri da specifiche funzioni.

Re: Bug Comando Cancellazione voce di menu in "Gestione Menu"

Posted: Wed Mar 20, 2019 12:33 pm
by alfa24
in appLms/admin/modules/amanmenu/amanmenu.php

sostituisci l'intera funzione removeModule con questa:

Code: Select all

function removeModule($id_module, $id_main, $id_custom) {
	
	
	$acl_man 		=& Docebo::user()->getAclManager();
	// Load module info
	$query_module = "
	SELECT module_name, default_name, file_name, class_name, default_op 
	FROM ".$GLOBALS['prefix_lms']."_module 
	WHERE idModule = '".$id_module."'";
	list($module_name, $name_db, $file_name, $class_name, $module_op) = sql_fetch_row(sql_query($query_module));
	$module_obj =& createLmsModule($module_name);
	
	$levels 			= CourseLevel::getLevels();
	$all_token 			= $module_obj->getAllToken($module_op);
	// corresponding of token -> idst role
	$map_idst_token 	=& getModuleRoleSt($module_name, $all_token);
	// corresponding of level -> idst level
	$map_idst_level	 	=& getCustomLevelSt($id_custom);
	// old permission of all module
	$actual_perm		=& getAllModulesPermissionSt($map_idst_level, array_flip($map_idst_token));
	
	$re = true;
	foreach($levels as $lv => $name_level) {
		
		$idlevel = $map_idst_level[$lv];
		foreach($actual_perm[$lv] as $idrole => $v) {
			
			$acl_man->removeFromRole( $idrole, $idlevel );
		}
	}
	if($re) {
		$re = sql_query("
		DELETE FROM ".$GLOBALS['prefix_lms']."_menucustom_under 
		WHERE idMain = '".(int)$id_main."' AND idModule = '".(int)$id_module."'");
	}
	return $re;
}

Re: Bug Comando Cancellazione voce di menu in "Gestione Menu"

Posted: Thu Mar 21, 2019 12:37 pm
by wolk73
Grazie alfa24, ora funziona!
Cambio status del Post.

This site uses cookies.

Some of the cookies we use are essential for parts of the site to operate and have already been set. We also use Google Analytics scripts, which all use cookies.
You may delete or block all cookies from this site in your browser options.