- Checksystem: neue Tabelle tbl_paabgabe

- Moodle Globale Gast Accounts
This commit is contained in:
Andreas Österreicher
2009-01-09 07:56:16 +00:00
parent 6ed09e1d39
commit f3ef50b1b1
6 changed files with 115 additions and 6 deletions
+41
View File
@@ -208,6 +208,7 @@ class moodle_user
return false;
}
$this->createGlobaleGastrolle($this->mdl_user_id);
}
//Lektoren loeschen die nicht mehr zugeordnet sind
@@ -364,6 +365,9 @@ class moodle_user
$this->errormsg = 'Fehler beim Auslesen der Rollen';
return false;
}
//globale Gastrolle anlegen
$this->createGlobaleGastrolle($this->mdl_user_id);
//Gruppenzuteilung
if($gruppensync)
@@ -669,6 +673,43 @@ class moodle_user
}
}
// *********************************************
// * Fuegt dem User die globale Gastrolle hinzu
// * @param $mdl_user_id Moodle ID des Users der
// * die GastRolle bekommt
// * @return true wenn ok, false wenn Fehler
// *********************************************
function createGlobaleGastrolle($mdl_user_id)
{
//Nachschauen ob diese Person bereits eine globale Gastrolle hat
$qry = "SELECT 1 FROM public.mdl_role_assignments
WHERE
userid='".addslashes($mdl_user_id)."' AND
contextid='1' AND
roleid='6'";
if($result = pg_query($this->conn_moodle, $qry))
{
if(pg_num_rows($result)==0)
{
//noch nicht zugeteilt
if($this->createZuteilung($mdl_user_id, 1, 6))
{
$this->log.="\n$this->mdl_user_firstname $this->mdl_user_lastname wurde die globale Gastrolle zugeteilt";
$this->log_public.="\n$this->mdl_user_firstname $this->mdl_user_lastname wurde die globale Gastrolle zugeteilt";
}
else
$this->log.="\nFehler beim Anlegen der Gast-Zuteilung: $this->errormsg";
}
}
else
{
$this->errormsg = 'Fehler beim Auslesen der Rollen';
return false;
}
}
// *************************************************
// * Loescht die Zuteilung eines Users zu einem Kurs
// * @param $mdl_user_id MoodleID des Users