mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Bei neuen Moodlekursen wird jetzt das Startdatum gesetzt, Fehlermeldung bei der Notenübernahme aus dem Moodle behoben falls im Moodle noch keine Noten eingetragen sind, Script zur gleichzeitigen Zuteilung von einer Person zu mehreren Moodle Kursen
This commit is contained in:
@@ -941,7 +941,7 @@ echo '<table>';
|
||||
$moodle_course->errormsg=trim($moodle_course->errormsg);
|
||||
if(!$errorshown && !empty($moodle_course->errormsg) )
|
||||
{
|
||||
echo '<br><b>'.$moodle_course->errormsg.'</b><br>';
|
||||
//echo '<br><b>'.$moodle_course->errormsg.'</b><br>';
|
||||
$errorshown=true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/moodle.class.php');
|
||||
require_once(dirname(__FILE__).'/datum.class.php');
|
||||
require_once(dirname(__FILE__).'/studiensemester.class.php');
|
||||
|
||||
class moodle24_course extends basis_db
|
||||
{
|
||||
@@ -261,6 +263,11 @@ class moodle24_course extends basis_db
|
||||
$data->categoryid=$id_sem;
|
||||
$data->format='topics';
|
||||
|
||||
$stsem = new studiensemester();
|
||||
$stsem->load($this->studiensemester_kurzbz);
|
||||
$datum_obj = new datum();
|
||||
$data->startdate=$datum_obj->mktime_fromdate($stsem->start);
|
||||
|
||||
$response = $client->core_course_create_courses(array($data));
|
||||
if(isset($response[0]))
|
||||
{
|
||||
@@ -569,27 +576,33 @@ class moodle24_course extends basis_db
|
||||
|
||||
while($row_moodle = $this->db_fetch_object($result_moodle))
|
||||
{
|
||||
$client = new SoapClient($this->serverurl);
|
||||
$response = $client->fhcomplete_get_course_grades($row_moodle->mdl_course_id);
|
||||
|
||||
if (count($response)>0)
|
||||
try
|
||||
{
|
||||
$client = new SoapClient($this->serverurl);
|
||||
$response = $client->fhcomplete_get_course_grades($row_moodle->mdl_course_id);
|
||||
|
||||
foreach($response as $row)
|
||||
if (count($response)>0)
|
||||
{
|
||||
if($row['note']!='-')
|
||||
|
||||
foreach($response as $row)
|
||||
{
|
||||
$userobj = new stdClass();
|
||||
$userobj->mdl_course_id = $row_moodle->mdl_course_id;
|
||||
$userobj->vorname = $row['vorname'];
|
||||
$userobj->nachname = $row['nachname'];
|
||||
$userobj->idnummer = $row['idnummer'];
|
||||
$userobj->uid = $row['username'];
|
||||
$userobj->note = $row['note'];
|
||||
$this->result[]=$userobj;
|
||||
}
|
||||
}
|
||||
if($row['note']!='-')
|
||||
{
|
||||
$userobj = new stdClass();
|
||||
$userobj->mdl_course_id = $row_moodle->mdl_course_id;
|
||||
$userobj->vorname = $row['vorname'];
|
||||
$userobj->nachname = $row['nachname'];
|
||||
$userobj->idnummer = $row['idnummer'];
|
||||
$userobj->uid = $row['username'];
|
||||
$userobj->note = $row['note'];
|
||||
$this->result[]=$userobj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(SoapFault $e)
|
||||
{}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -615,4 +615,36 @@ class moodle24_user extends basis_db
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Teilt einen User zu mehreren Moodle Kursen gleichzeitig zu
|
||||
* @param $uid UID des Users
|
||||
* @param $mdl_course_id_array Array mit MoodleKursIDs
|
||||
* @param $role_id Moodle Rolle
|
||||
*/
|
||||
public function MassEnroll($uid, $mdl_course_id_array, $role_id)
|
||||
{
|
||||
//MoodleID des Users holen
|
||||
if(!$this->loaduser($uid))
|
||||
{
|
||||
$this->errormsg = "Fehler beim Laden des Users $uid: $this->errormsg";
|
||||
return false;
|
||||
}
|
||||
|
||||
$param=array();
|
||||
|
||||
foreach($mdl_course_id_array as $mdl_course_id)
|
||||
{
|
||||
$data = new stdClass();
|
||||
$data->roleid=$role_id;
|
||||
$data->userid=$this->mdl_user_id;
|
||||
$data->courseid=$mdl_course_id;
|
||||
|
||||
$param[]=$data;
|
||||
}
|
||||
$client = new SoapClient($this->serverurl);
|
||||
$client->enrol_manual_enrol_users($param);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,12 +77,13 @@ $menu=array
|
||||
|
||||
'Moodle'=>array
|
||||
(
|
||||
'name'=>'Moodle', 'permissions'=>array('admin','lv-plan','support'),
|
||||
'name'=>'Moodle', 'permissions'=>array('admin','lv-plan','support','basis/moodle'),
|
||||
'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'),
|
||||
'Account24'=>array('name'=>'Account Moodle 2.4', 'link'=>'moodle/account_verwaltung24.php', 'target'=>'main'),
|
||||
'Kursverwaltung24'=>array('name'=>'Kurs entfernen 2.4', 'link'=>'moodle/kurs_verwaltung24.php', 'target'=>'main'),
|
||||
'Rollenzuteilung24'=>array('name'=>'Rollenzuteilung 2.4', 'link'=>'moodle/rollenzuteilung24.php', 'target'=>'main'),
|
||||
),
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 fhcomplete.org
|
||||
*
|
||||
* 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> and
|
||||
*/
|
||||
/**
|
||||
* Script um eine Person gleichzeitig zu mehreren Moodle Kursen zuzuteilen
|
||||
*/
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/functions.inc.php');
|
||||
require_once('../../include/moodle.class.php');
|
||||
require_once('../../include/moodle24_user.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
|
||||
$user = get_uid();
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($user);
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/moodle'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
|
||||
echo '<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Moodle 2.4 Rollenzuteilung</title>
|
||||
<link rel="stylesheet" href="../../skin/fhcomplete.css" />
|
||||
<link rel="stylesheet" href="../../skin/vilesci.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Moodle Rollenzuteilung</h1>
|
||||
<form method="POST" action="'.$_SERVER['PHP_SELF'].'">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Moodle Kurs IDs getrennt mit \',\':</td>
|
||||
<td><input type="text" name="mdl_course_ids" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rolle</td>
|
||||
<td>
|
||||
<SELECT name="role">
|
||||
<OPTION value="3">Lektor/in</OPTION>
|
||||
<OPTION value="5">Student/in</OPTION>
|
||||
<OPTION value="4">Tutor/in</OPTION>
|
||||
<OPTION value="">----</OPTION>
|
||||
<OPTION value="1">Manager</OPTION>
|
||||
<OPTION value="2">Course Creator</OPTION>
|
||||
<OPTION value="6">Guest</OPTION>
|
||||
<OPTION value="7">User</OPTION>
|
||||
<OPTION value="8">frontpage</OPTION>
|
||||
</SELECT>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UID</td>
|
||||
<td><input type="text" name="uid" id="uid"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Zuteilen" name="add" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
';
|
||||
if(isset($_POST['add']))
|
||||
{
|
||||
if(isset($_POST['uid']) && $_POST['uid']!='' &&
|
||||
isset($_POST['role']) && $_POST['role']!='' &&
|
||||
isset($_POST['mdl_course_ids']) && $_POST['mdl_course_ids']!='')
|
||||
{
|
||||
$mdl_course_id_array = explode(',',$_POST['mdl_course_ids']);
|
||||
$uid = $_POST['uid'];
|
||||
$role_id=$_POST['role'];
|
||||
|
||||
$moodle = new moodle24_user();
|
||||
if($moodle->MassEnroll($uid, $mdl_course_id_array, $role_id))
|
||||
{
|
||||
echo 'Zuteilung erfolgreich';
|
||||
}
|
||||
else
|
||||
echo 'Fehler bei der Zuteilung:'.$moodle->errormsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Fehler: Bitte füllen Sie alle Felder aus';
|
||||
}
|
||||
}
|
||||
echo '</body>
|
||||
</html>';
|
||||
?>
|
||||
Reference in New Issue
Block a user