This commit is contained in:
Andreas Österreicher
2008-09-05 13:48:36 +00:00
parent 1d9f18d922
commit c8a41db207
4 changed files with 178 additions and 2 deletions
+1
View File
@@ -26,6 +26,7 @@
require_once('../../../include/studiensemester.class.php');
require_once('../../../include/lehrveranstaltung.class.php');
require_once('../../../include/studiengang.class.php');
require_once('../../../include/moodle_course.class.php');
//Connection Herstellen
if(!$sql_conn = pg_pconnect(CONN_STRING))
+104
View File
@@ -0,0 +1,104 @@
<?php
/* Copyright (C) 2006 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: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/*
*
*/
require_once('../../config.inc.php');
require_once('../../../include/functions.inc.php');
require_once('../../../include/moodle_course.class.php');
require_once('../../../include/moodle_user.class.php');
if(!$conn = pg_pconnect(CONN_STRING))
die('Fehler beim Connecten zur DB');
//$conn_moodle='';
if(!$conn_moodle = pg_pconnect(CONN_STRING_MOODLE))
die('Fehler beim Connecten zur DB');
$user = get_uid();
if(isset($_GET['lvid']))
$lvid=$_GET['lvid'];
else
die('lvid muss uebergeben werden');
if(isset($_GET['stsem']))
$stsem = $_GET['stsem'];
else
die('Es wurde kein Studiensemester uebergeben');
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../../skin/style.css.php" rel="stylesheet" type="text/css">
<script language="Javascript">
<!--
function togglediv()
{
var block = "table-row";
if (navigator.appName.indexOf("Microsoft") > -1)
block = "block";
if(document.getElementById("radiole").checked)
document.getElementById("lehreinheitencheckboxen").style.display = block;
else
document.getElementById("lehreinheitencheckboxen").style.display = "none";
}
-->
</script>
</head>
<body onload="togglediv()">
<table class="tabcontent" height="100%" id="inhalt">
<tr>
<td class="tdwidth10">&nbsp;</td>
<td class="ContentHeader"><font class="ContentHeader">MOODLE Kurse</font></td>
</tr>
<tr>
<td class="tdvertical">&nbsp;</td>
<td></td>
</tr>
<tr>
<td class="tdvertical">&nbsp;</td>
<td class="tdvertical">
<table width="100%">
<tr>
<td>';
$mdlcourse = new moodle_course($conn, $conn_moodle);
$mdlcourse->getAll($lvid, $stsem);
foreach ($mdlcourse->result as $row)
{
echo "<a href='".MOODLE_PATH."course/view.php?id=".$row->mdl_course_id."' class='Item'>$row->mdl_fullname</a><br>";
}
echo ' </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>';
?>
+36
View File
@@ -649,4 +649,40 @@ class moodle_course
return false;
}
}
// ****************************************************
// * Liefert alle Kurse dieser LV in denen der Student
// * zugeteilt ist
// ****************************************************
function getCourse($lehrveranstaltung_id, $studiensemester_kurzbz, $student_uid)
{
//alle betreffenden Kurse holen
$qry = "SELECT lehreinheit_id, mdl_course_id FROM lehre.tbl_moodle JOIN lehre.tbl_lehreinheit USING(lehrveranstaltung_id, studiensemester_kurzbz)
WHERE tbl_moodle.lehrveranstaltung_id='".addslashes($lehrveranstaltung_id)."'
AND tbl_moodle.studiensemester_kurzbz='".addslashes($studiensemester_kurzbz)."'
UNION
SELECT lehreinheit_id, mdl_course_id FROM lehre.tbl_moodle JOIN lehre.tbl_lehreinheit USING(lehreinheit_id)
WHERE tbl_lehreinheit.lehrveranstaltung_id='".addslashes($lehrveranstaltung_id)."' AND
tbl_lehreinheit.studiensemester_kurzbz='".addslashes($studiensemester_kurzbz)."'";
$courses = array();
if($result = pg_query($this->conn, $qry))
{
while($row = pg_fetch_object($result))
{
//schauen in welchen der Student ist
$qry = "SELECT 1 FROM campus.vw_student_lehrveranstaltung
WHERE uid='".addslashes($student_uid)."' AND lehreinheit_id='".addslashes($row->lehreinheit_id)."'";
if($result_vw = pg_query($this->conn, $qry))
{
if(pg_num_rows($result_vw)>0)
{
if(!array_key_exists($row->mdl_course_id, $courses))
$courses[]=$row->mdl_course_id;
}
}
}
}
return $courses;
}
}
+37 -2
View File
@@ -478,12 +478,47 @@
if($result = pg_query($sql_conn, $qry))
if(pg_num_rows($result)>0)
$showmoodle=false;
if(!$conn_moodle = pg_pconnect(CONN_STRING_MOODLE))
die('Fehler beim Verbinden zur MoodleDB');
$mdlcourse = new moodle_course($sql_conn, $conn_moodle);
$mdlcourse->getAll($lvid, $angezeigtes_stsem);
if(count($mdlcourse->result)>0)
$showmoodle=true;
if($showmoodle)
{
echo '<a href="'.MOODLE_PATH.'" target="_blank" class="Item" >
$link = "moodle_choice.php?lvid=$lvid&stsem=$angezeigtes_stsem";
if(count($mdlcourse->result)>0)
{
if(!$is_lector)
{
$course = $mdlcourse->getCourse($lvid, $angezeigtes_stsem, $user);
if(count($course)==1)
$link = MOODLE_PATH.'course/view.php?id='.$course[0];
else
$link = "moodle_choice.php?lvid=$lvid&stsem=$angezeigtes_stsem";
}
else
{
//$mdlcourse->getAll($lvid, $angezeigtes_stsem);
if(count($mdlcourse->result)==1)
$link = MOODLE_PATH.'course/view.php?id='.$mdlcourse->result[0]->mdl_course_id;
else
$link = "moodle_choice.php?lvid=$lvid&stsem=$angezeigtes_stsem";
}
echo '<a href="'.$link.'" target="_blank" class="Item" >
<img src="../../../skin/images/button_moodle.jpg" width="68" height="45"><br>
<strong>Moodle</strong></a><br>';
}
else
{
echo '<img src="../../../skin/images/button_moodle.jpg" width="68" height="45"><br>
<strong>Moodle</strong><br>';
}
if($is_lector)
echo '<a href="moodle_wartung.php?lvid='.$lvid.'&stsem='.$angezeigtes_stsem.'" class="Item">Wartung</a>';
}