mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 07:52:16 +00:00
Accountverwaltung Moodle2.4
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
* Moodle 1.9 Kurs Verwaltung
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/moodle.class.php');
|
||||
|
||||
if (!function_exists('xu_load_extension'))
|
||||
include_once(dirname(__FILE__)."/xmlrpcutils/utils.php");
|
||||
@@ -2164,13 +2165,12 @@ class moodle19_course extends basis_db
|
||||
$this->errormsg ="Fehler xmlrpc call - Methode fehlt";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Aktuellen Moodle Server ermitteln.
|
||||
if (defined('MOODLE_PATH')) // Eintrag MOODLE_PATH in Vilesci config.inc.php. Hostname herausfiltern
|
||||
{
|
||||
$host = parse_url(MOODLE_PATH, PHP_URL_HOST);
|
||||
$path = parse_url(MOODLE_PATH, PHP_URL_PATH);
|
||||
}
|
||||
|
||||
$moodle = new moodle();
|
||||
$moodlepfad = $moodle->getPfad('1.9');
|
||||
|
||||
$host = parse_url($moodlepfad, PHP_URL_HOST);
|
||||
$path = parse_url($moodlepfad, PHP_URL_PATH);
|
||||
|
||||
$port = '';
|
||||
$uri = $path."xmlrpc/xmlrpc.php";
|
||||
|
||||
@@ -72,7 +72,8 @@ $menu=array
|
||||
'name'=>'Moodle', 'permissions'=>array('admin','lv-plan','support'),
|
||||
'Kursverwaltung'=>array('name'=>'Kurs entfernen', 'link'=>'moodle/kurs_verwaltung.php', 'target'=>'main'),
|
||||
'Account'=>array('name'=>'Account', 'link'=>'moodle/account_verwaltung.php', 'target'=>'main'),
|
||||
'Zuteilung Verwalten'=>array('name'=>'Zuteilung Verwalten', 'link'=>'moodle/zuteilung_verwaltung.php', 'target'=>'main')
|
||||
'Zuteilung Verwalten'=>array('name'=>'Zuteilung Verwalten', 'link'=>'moodle/zuteilung_verwaltung.php', 'target'=>'main'),
|
||||
'Account24'=>array('name'=>'Account Moodle 2.4', 'link'=>'moodle/account_verwaltung24.php', 'target'=>'main'),
|
||||
),
|
||||
|
||||
|
||||
@@ -273,4 +274,4 @@ $statistik = new statistik();
|
||||
$statistik = $statistik->getMenueArray(1);
|
||||
$menu['Auswertung']=array_merge($menu['Auswertung'],$statistik);
|
||||
//var_dump($menu['Auswertung']);
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 FH Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at >
|
||||
*/
|
||||
/**
|
||||
* Dieses Programm listet nach einem Suchbegriff bestehender Benutzer auf.
|
||||
* Fuer jede UserID wird geprueft ob dieser bereits einen Moodle ID besitzt.
|
||||
* Bestehende Moodle IDs werden angezeigt, fuer alle anderen wird die Moeglichkeit
|
||||
* der Neuanlage geboten.
|
||||
*/
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/basis_db.class.php');
|
||||
require_once('../../include/functions.inc.php');
|
||||
require_once('../../include/moodle24_user.class.php');
|
||||
|
||||
if (!$db = new basis_db())
|
||||
die('Fehler bei der Datenbankverbindung');
|
||||
|
||||
$uid = (isset($_REQUEST['uid'])?trim($_REQUEST['uid']):'');
|
||||
$mdl_user_id = (isset($_REQUEST['mdl_user_id'])?trim($_REQUEST['mdl_user_id']):'');
|
||||
$searchstr = (isset($_REQUEST['searchstr'])?trim($_REQUEST['searchstr']):'');
|
||||
$content='';
|
||||
$moodle = new moodle24_user();
|
||||
|
||||
if($uid!='')
|
||||
{
|
||||
// Check ob User nicht bereits angelegt ist
|
||||
if (!$moodle->loaduser($uid))
|
||||
{
|
||||
// User ist noch nicht in Moodle angelegt => Neuanlage
|
||||
if (!$moodle->createUser($uid))
|
||||
$content.=$moodle->errormsg;
|
||||
}
|
||||
}
|
||||
|
||||
$content.='
|
||||
<form name="search" method="GET" action="'.$_SERVER["PHP_SELF"].'" target="_self">
|
||||
Bitte Suchbegriff eingeben:
|
||||
<input type="text" name="searchstr" size="30" value="'.$db->convert_html_chars($searchstr).'">
|
||||
<input type="submit" value="Suchen">
|
||||
</form>
|
||||
<hr>';
|
||||
|
||||
if($searchstr!='' && $searchstr!='?' && $searchstr!='*')
|
||||
{
|
||||
// SQL Select-String
|
||||
$qry = "SELECT
|
||||
distinct tbl_person.person_id,tbl_person.nachname,tbl_person.vorname,
|
||||
tbl_person.aktiv,tbl_benutzer.uid
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer USING(person_id)
|
||||
WHERE
|
||||
tbl_person.nachname ~* ".$db->db_add_param($searchstr)." OR
|
||||
tbl_person.vorname ~* ".$db->db_add_param($searchstr)." OR
|
||||
tbl_benutzer.alias ~* ".$db->db_add_param($searchstr)." OR
|
||||
tbl_person.nachname || ' ' || tbl_person.vorname = ".$db->db_add_param($searchstr)." OR
|
||||
tbl_person.vorname || ' ' || tbl_person.nachname = ".$db->db_add_param($searchstr)." OR
|
||||
tbl_benutzer.uid ~* ".$db->db_add_param($searchstr)."
|
||||
ORDER BY nachname, vorname;";
|
||||
|
||||
if($result = $db->db_query($qry))
|
||||
{
|
||||
// Header Top mit Anzahl der gelisteten Kurse
|
||||
$content.= $db->db_num_rows($result).' Person(en) gefunden';
|
||||
|
||||
$content.='<table style="border: 1px outset #F7F7F7;">';
|
||||
|
||||
// Header Teil Information der Funktion
|
||||
$content.='<tr class="liste" align="center">';
|
||||
$content.='<td colspan="6"><b>Benutzer</b></td>';
|
||||
$content.='</tr>';
|
||||
|
||||
// Headerinformation der Tabellenfelder
|
||||
$content.='<tr class="liste" align="center">';
|
||||
$content.='<th> Nachname </th>';
|
||||
$content.='<th> Vorname </th>';
|
||||
$content.='<th> UserID </th>';
|
||||
$content.='<th> Status </th>';
|
||||
$content.='<th> MoodleAccount </th>';
|
||||
$content.='</tr>';
|
||||
|
||||
// Alle gefundenen User in einer Schleife anzeigen.
|
||||
$iTmpCounter=0;
|
||||
while($row = $db->db_fetch_object($result))
|
||||
{
|
||||
// ZeilenCSS (gerade/ungerade) zur besseren Ansicht
|
||||
$iTmpCounter++;
|
||||
if ($iTmpCounter%2)
|
||||
$showCSS=' style="text-align: left;border: 1px outset #F7F7F7;padding: 1px 5px 1px 5px; background:#FEFFEC" ';
|
||||
else
|
||||
$showCSS=' style="text-align: left;border: 1px outset #F7F7F7;padding: 1px 5px 1px 5px; background:#FCFCFC" ';
|
||||
|
||||
// Listenzeile
|
||||
$content.= '<tr '.$showCSS.'>';
|
||||
$content.= '<td '.$showCSS.'><a href="../personen/personen_details.php?person_id='.$db->convert_html_chars($row->person_id).'">'.$db->convert_html_chars($row->nachname).'</a></td>';
|
||||
$content.= '<td '.$showCSS.'>'.$db->convert_html_chars($row->vorname).'</td>';
|
||||
$content.= '<td '.$showCSS.'>'.$db->convert_html_chars($row->uid).'</td>';
|
||||
$content.= '<td '.$showCSS.'>'.(!empty($row->aktiv) && mb_strtoupper($row->aktiv)!='F' && mb_strtoupper($row->aktiv)!='FALSE' ?'aktiv':'deaktiviert').'</td>';
|
||||
|
||||
if (!$moodle->loaduser($row->uid))
|
||||
$moodle->mdl_user_id='';
|
||||
|
||||
// Es gibt noch keinen Moodle User - Anlage ermoeglichen
|
||||
if (!isset($moodle->mdl_user_id) || empty($moodle->mdl_user_id))
|
||||
{
|
||||
$content.= '<td style="vertical-align:bottom;cursor: pointer;" onclick="document.work'.$iTmpCounter.'.submit();">';
|
||||
$content.='<form style="display: inline;border:0px;" name="work'.$iTmpCounter.'" method="GET" target="_self" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$content.= '<input style="display:none" type="text" name="uid" value="'.$db->convert_html_chars($row->uid).'" />';
|
||||
$content.= '<input style="display:none" type="text" name="searchstr" value="'.$db->convert_html_chars($searchstr).'" />';
|
||||
$content.= '<img height="12" src="../../skin/images/table_row_insert.png" border="0" title="MoodleUser anlegen" alt="table_row_insert.png" />';
|
||||
$content.= 'anlegen';
|
||||
$content.='</form>';
|
||||
$content.= '</td>';
|
||||
}
|
||||
else // Anzeige bestehende Moodle User ID
|
||||
{
|
||||
$content.= '<td '.$showCSS.'>'.((isset($moodle->mdl_user_id) && !empty($moodle->mdl_user_id))?$moodle->mdl_user_id:'').'</td>';
|
||||
}
|
||||
$content.= '</tr>';
|
||||
}
|
||||
$content.= '</table>';
|
||||
}
|
||||
}
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Moodle 2.4 - Accountverwaltung</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<h2>Moodle 2.4 - Accountverwaltung</h2>
|
||||
'.$content.'
|
||||
</body>
|
||||
</html>';
|
||||
?>
|
||||
Reference in New Issue
Block a user