Compare commits

...

12 Commits

Author SHA1 Message Date
Andreas Österreicher 7ec1653dd4 Merge branch 'master' into feature-9893/Add_Link_to_ICAL 2021-01-29 15:33:28 +01:00
OliiverHacker 39d7fd9e5b fixed typo 2020-11-23 13:33:38 +01:00
OliiverHacker f3f66199c5 refactor moodle functionality for iCal and CalDav 2020-11-20 18:31:57 +01:00
OliiverHacker 0944f803d9 add title to exports 2020-11-09 11:29:47 +01:00
OliiverHacker 1d35e88542 add moodle link to caldav 2020-11-04 09:56:54 +01:00
OliiverHacker 34bed51ff7 include moodle link in iCal export if moodle addon is installed 2020-10-30 10:04:51 +01:00
OliiverHacker 6cce9781c8 make pop-up-window larger 2020-10-21 14:04:35 +02:00
OliiverHacker 7ba1e39110 send all courses in json 2020-10-21 10:00:58 +02:00
OliiverHacker cb67b2be64 cleanup 2020-10-20 16:20:22 +02:00
OliiverHacker 9adce4b491 add moodle links 2020-10-20 14:40:34 +02:00
OliiverHacker 83bb92e270 Merge branch 'master' of https://github.com/FH-Complete/FHC-Core into feature-9896/Add_Link_to_CIS_Details 2020-10-17 15:39:53 +02:00
OliiverHacker 0f43f630ad stash changes 2020-10-12 12:52:49 +02:00
5 changed files with 132 additions and 41 deletions
+42 -4
View File
@@ -181,11 +181,29 @@ $sql_query.=' ORDER BY titel LIMIT 100';
$erg_repl = $db->db_query($sql_query);
$num_rows_repl = $db->db_num_rows($erg_repl);
$courses=array();
?>
<?php include('../../../include/meta/jquery.php');?>
<?php
echo '<html>
<head>
<title>'.$p->t('lvplan/lehrveranstaltungsplanDetails').'</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../skin/style.css.php" type="text/css">
<script type="text/javascript" src="../../../vendor/components/jqueryui/jquery-ui.min.js"></script>';
// ADDONS laden
$addon_obj = new addon();
$addon_obj->loadAddons();
foreach($addon_obj->result as $addon)
{
if(file_exists('../../../addons/'.$addon->kurzbz.'/cis/init.js.php'))
echo '<script type="application/x-javascript" src="../../../addons/'.$addon->kurzbz.'/cis/init.js.php" ></script>';
}
echo '
</head>
<body id="inhalt">
<H2>'.$p->t('lvplan/lehrveranstaltungsplan').' &rArr; '.$p->t('abgabetool/details').'</H2>
@@ -198,7 +216,7 @@ if ($num_rows_stpl>0)
{
echo '
<table class="stdplan">
<tr>
<tr id="stdplantablerow">
<th>'.$p->t('lvplan/unr').'</th>
<th>'.$p->t('lvaliste/lektor').'</th>
<th>'.$p->t('lvplan/ort').'</th>
@@ -211,9 +229,11 @@ if ($num_rows_stpl>0)
$ort = new ort();
$i=0;
$moodlerow = -1;
while($row = $db->db_fetch_object($erg_stpl))
{
$i++;
$moodlerow++;
$unr = $row->unr;
$ortkurzbz = $row->ort_kurzbz;
$lehrfachkurzbz = $row->lehrfach;
@@ -235,6 +255,9 @@ if ($num_rows_stpl>0)
$gesamtanzahl = ($anzahl_grp!=0?$anzahl_grp:$anzahl_lvb);
$ort->load($ortkurzbz);
$lvdata = ['lvId'=> $row->lehrveranstaltung_id, 'leId'=>$row->lehreinheit_id];
array_push($courses, $lvdata);
// no profile link for fake Mitarbeiter like Dummylektor, Personalnr must be > 0
$profileLink = true;
$mitarbeiter = new mitarbeiter();
@@ -262,8 +285,8 @@ if ($num_rows_stpl>0)
<td><A class="Item" title="'.$anzahl_grp.' Studierende" href="mailto:'.mb_strtolower($gruppe_kurzbz).'@'.DOMAIN.'">
'.$db->convert_html_chars($gruppe_kurzbz).'</A></td>
<td>'.$db->convert_html_chars($titel).'</td>
</tr>';
<td id="moodlelink'.$moodlerow.'"></td>
</tr>';
}
echo '</table><BR>';
}
@@ -305,5 +328,20 @@ if ($num_rows_repl>0)
echo '</table><br>';
}
echo '<P>'.$p->t('lvplan/fehlerUndFeedback').' <A class="Item" href="mailto:'.MAIL_LVPLAN.'">'.$p->t('lvplan/lvKoordinationsstelle').'</A>.</P>
</body></html>';
</body>';
echo '
<script>
$( document ).ready(function()
{
if(typeof addon !== \'undefined\')
{
for(i in addon)
{
addon[i].init("cis/private/lvplan/stpl_detail.php", {courses:'.json_encode($courses).', stsem:\''.$db->convert_html_chars($stsem).'\'});
}
}
});
</script>
</html>';
?>
+1
View File
@@ -78,6 +78,7 @@ $target=(isset($_GET['target'])?$_GET['target']:null);
$stsem=(isset($_GET['stsem'])?$_GET['stsem']:'');
$lva=(isset($_GET['lva'])?$_GET['lva']:'');
$moodle=(isset($_GET['moodle'])?$_GET['moodle']:'');
if(isset($_GET["cal"]))
{
+9 -2
View File
@@ -106,6 +106,7 @@ else if (isset($_GET['gruppe_kurzbz']))
else
$gruppe_kurzbz=null;
if (isset($_POST['user_uid']))
$user_uid=$_POST['user_uid'];
if (isset($_POST['reserve']))
@@ -265,14 +266,18 @@ if (isset($_POST['titel']))
</script>
<?php
// ADDONS laden
$moolde='';
$addon_obj = new addon();
$addon_obj->loadAddons();
foreach($addon_obj->result as $addon)
{
if(file_exists('../../../addons/'.$addon->kurzbz.'/cis/init.js.php'))
echo '<script type="application/x-javascript" src="../../../addons/'.$addon->kurzbz.'/cis/init.js.php" ></script>';
if($addon->kurzbz === "moodle")
{
$moolde = 'true';
}
}
// Wenn Seite fertig geladen ist Addons aufrufen
echo '
<script>
@@ -489,13 +494,15 @@ $stdplan=new wochenplan($type);
if (!isset($datum))
$datum=time();
$stdplan->moodle=$moolde;
// Benutzergruppe
$stdplan->user=$user;
// aktueller Benutzer
$stdplan->user_uid=$uid;
// Zusaetzliche Daten laden
if (! $stdplan->load_data($type,$pers_uid,$ort_kurzbz,$stg_kz,$sem,$ver,$grp,$gruppe_kurzbz,null,$lva) )
if (! $stdplan->load_data($type, $pers_uid,$ort_kurzbz,$stg_kz,$sem,$ver,$grp,$gruppe_kurzbz,null,$lva) )
{
die(htmlentities($stdplan->errormsg));
}
+79 -35
View File
@@ -100,6 +100,8 @@ class wochenplan extends basis_db
public $errormsg;
public $fachbereich_kurzbz;
public $moodle;
public $raeume = array();
/**
@@ -508,7 +510,7 @@ class wochenplan extends basis_db
echo ' <tr><td style="padding:3px 15px 0px 15px; margin: 0,0,20px,0;" align="center">'.$this->crlf;
//Kalender
$this->kal_link.='&pers_uid='.$this->pers_uid.'&ort_kurzbz='.$this->ort_kurzbz.'&stg_kz='.$this->stg_kz.'&sem='.$this->sem.'&ver='.$this->ver.'&grp='.$this->grp.'&gruppe_kurzbz='.$this->gruppe_kurzbz.'&lva='.$this->lva;
$this->kal_link.='&pers_uid='.$this->pers_uid.'&ort_kurzbz='.$this->ort_kurzbz.'&stg_kz='.$this->stg_kz.'&sem='.$this->sem.'&ver='.$this->ver.'&grp='.$this->grp.'&gruppe_kurzbz='.$this->gruppe_kurzbz.'&lva='.$this->lva.'&moodle='.$this->moodle;
$kal_link_ws=$this->kal_link.'&begin='.$this->studiensemester_now->start.'&ende='.$this->studiensemester_now->ende;
$kal_link_ss=$this->kal_link.'&begin='.$this->studiensemester_next->start.'&ende='.$this->studiensemester_next->ende;
@@ -864,7 +866,7 @@ class wochenplan extends basis_db
echo '&ver='.$this->ver;
echo '&grp='.$this->grp;
echo '&ort_kurzbz='.$ort;
echo "','Details', 'height=320,width=550,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,dependent=yes');return false;";
echo "','Details', 'height=420,width=950,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,dependent=yes');return false;";
echo '" title="'.$this->convert_html_chars($titel).'" ';
echo ' href="#">';
@@ -936,7 +938,7 @@ class wochenplan extends basis_db
echo '&ver='.$this->ver;
echo '&grp='.$this->grp;
echo '&ort_kurzbz='.$uEinheit['ort'][0];
echo "','Details', 'height=320,width=550,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,dependent=yes');return false;";
echo "','Details', 'height=420,width=950,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,dependent=yes');return false;";
echo '" title="'.$this->convert_html_chars($uEinheit['titel'][0]).'" ';
echo ' href="#">';
@@ -2317,7 +2319,6 @@ class wochenplan extends basis_db
return true;
}
/**
* Funktion draw_week_csv Stundenplan im CSV-Format
*
@@ -2326,9 +2327,25 @@ class wochenplan extends basis_db
*/
public function draw_week_csv($target, $lvplan_kategorie)
{
//Check if moodle addon is active
$moodle_addon_active = false;
// ADDONS laden
$addon_obj = new addon();
$addon_obj->loadAddons();
foreach ($addon_obj->result as $addon)
{
if($addon->addon_name === 'Moodle')
{
$moodle_addon_active = true;
include_once(dirname(__FILE__) . '/../addons/moodle/lib/LogicCourses.php');
}
}
$return = array();
if (!date("w",$this->datum))
$this->datum=jump_day($this->datum,1);
$d = date("Y-m-d",$this->datum);
$stsem = getStudiensemesterFromDatum($d);
$num_rows_stunde=$this->db_num_rows($this->stunde);
for ($i=1; $i<=TAGE_PRO_WOCHE; $i++)
{
@@ -2417,6 +2434,33 @@ class wochenplan extends basis_db
for ($idx=0;$idx<count($this->std_plan[$i][$j]);$idx++)
{
$moodle_link = '';
if ($moodle_addon_active)
{
$leId = (isset($this->std_plan[$i][$j][$idx]->unr) ? $this->std_plan[$i][$j][$idx]->unr : '');
$lvId = (isset($this->std_plan[$i][$j][$idx]->lehrfach_id) ? $this->std_plan[$i][$j][$idx]->lehrfach_id : '');
$countLV = LogicCourses::coursesMdlCourseIDForLehrveranstaltungStudiensemesterExists($lvId, $stsem);
$countLE = LogicCourses::coursesMdlCourseIDExists($leId);
if (Database::fetchRow($countLV)->count > 0)
{
$moodle_courses = LogicCourses::getCoursesByLehrveranstaltungStudiensemester($lvId, $stsem);
while ($moodle_course = Database::fetchRow($moodle_courses))
{
$moodle_link .= 'moodle.technikum-wien.at/course/view.php?id=' . $moodle_course->mdl_course_id . '\n';
}
}
elseif (Database::fetchRow($countLE)->count > 0)
{
$moodle_course = LogicCourses::getCoursesByLehreinheit($leId);
$moodle_link .= 'moodle.technikum-wien.at/course/view.php?id=' . Database::fetchRow($moodle_course)->mdl_course_id . '\n';
}
}
if (!isset($this->std_plan[$i][$j][$idx]))
{
continue;
@@ -2561,8 +2605,8 @@ class wochenplan extends basis_db
echo $this->crlf.'BEGIN:VEVENT'.$this->crlf
.'UID:'.'FH'.str_replace(',',' ',$lvb.$this->std_plan[$i][$j][$idx]->ort.$this->std_plan[$i][$j][$idx]->lektor.$lehrfach[$idx].$start_date_time_ical.$end_date_time_ical.$this->crlf)
.'SUMMARY:'.str_replace(',',' ',$lehrfach[$idx].' '.$this->std_plan[$i][$j][$idx]->ort.' - '.$lvb.$this->crlf)
.'DESCRIPTION:'.str_replace(',',' ',$lehrfach[$idx].'\n'.$this->std_plan[$i][$j][$idx]->lektor.'\n'.$lvb.'\n'.$this->std_plan[$i][$j][$idx]->ort.(LVPLAN_ANMERKUNG_ANZEIGEN?'\n'.$this->std_plan[$i][$j][$idx]->anmerkung:'').$this->crlf)
.'SUMMARY:'.$this->convert_html_chars($titel).'\n'.str_replace(',',' ',$lehrfach[$idx].' '.$this->std_plan[$i][$j][$idx]->ort.' - '.$lvb.$this->crlf)
.'DESCRIPTION:'.$moodle_link.'\n'.str_replace(',',' ',$lehrfach[$idx].'\n'.$this->std_plan[$i][$j][$idx]->lektor.'\n'.$lvb.'\n'.$this->std_plan[$i][$j][$idx]->ort.(LVPLAN_ANMERKUNG_ANZEIGEN?'\n'.$this->std_plan[$i][$j][$idx]->anmerkung:'').$this->crlf)
.'LOCATION:'.$this->std_plan[$i][$j][$idx]->ort.$this->crlf
.'CATEGORIES:'.$lvplan_kategorie.$this->crlf
.'DTSTART;TZID=Europe/Vienna:'.$start_date_time_ical.$this->crlf
@@ -2603,41 +2647,41 @@ class wochenplan extends basis_db
$end_date_time_ical = $eda[2].$eda[1].$eda[0].'T'.sprintf('%02s',($eta[0])).$eta[1].$eta[2]; //neu gruppieren der Startzeit und des Startdatums
$UID = 'FH'.$lvb.$this->std_plan[$i][$j][$idx]->ort.$this->std_plan[$i][$j][$idx]->lektor.$lehrfach[$idx].$start_date_time_ical.$end_date_time_ical;
$Summary = $lehrfach[$idx].' '.$this->std_plan[$i][$j][$idx]->ort.' - '.$lvb;
$description = $lehrfach[$idx].'\n'.$this->std_plan[$i][$j][$idx]->lektor.'\n'.$lvb.'\n'.$this->std_plan[$i][$j][$idx]->ort.(LVPLAN_ANMERKUNG_ANZEIGEN?'\n'.$this->std_plan[$i][$j][$idx]->anmerkung:'');
$Summary = $this->convert_html_chars($titel).' '.$lehrfach[$idx].' '.$this->std_plan[$i][$j][$idx]->ort.' - '.$lvb;
$description = $moodle_link.'\n'.$lehrfach[$idx].'\n'.$this->std_plan[$i][$j][$idx]->lektor.'\n'.$lvb.'\n'.$this->std_plan[$i][$j][$idx]->ort.(LVPLAN_ANMERKUNG_ANZEIGEN?'\n'.$this->std_plan[$i][$j][$idx]->anmerkung:'');
$UID = str_replace(',',' ',$UID);
$Summary = str_replace(',',' ',$Summary);
$description = str_replace(',',' ',$description);
$return[]=array('UID'=>$UID,
'lehrfach_id'=>(isset($this->std_plan[$i][$j][$idx]->lehrfach_id)?$this->std_plan[$i][$j][$idx]->lehrfach_id:''),
'ort'=>$this->std_plan[$i][$j][$idx]->ort,
'lektor_uid'=>array_unique($lektor_uids),
'gruppen'=>array_unique($lehrverband),
'stunden'=>array_unique($stunden_arr),
'titel'=>$this->std_plan[$i][$j][$idx]->titel,
'unr'=>$unr,
'Summary'=>$Summary,
'Description'=>$description,
'start_date'=>$start_date,
'end_date'=>$end_date,
'start_time'=>$start_time,
'end_time'=>$end_time,
'dtstart'=>$start_date_time_ical,
'dtend'=>$end_date_time_ical,
'reservierung'=>$this->std_plan[$i][$j][$idx]->reservierung,
'reservierung_id'=>($this->std_plan[$i][$j][$idx]->reservierung?$this->std_plan[$i][$j][$idx]->stundenplan_id:''),
'updateamum'=>$this->std_plan[$i][$j][$idx]->updateamum,
'data'=>'BEGIN:VEVENT'.$this->crlf
.'UID:'.$UID.$this->crlf
.'SUMMARY:'.$Summary.$this->crlf
.'DESCRIPTION:'.$description.$this->crlf
.'LOCATION:'.$this->std_plan[$i][$j][$idx]->ort.$this->crlf
.'CATEGORIES:'.$lvplan_kategorie.$this->crlf
.'DTSTART;TZID=Europe/Vienna:'.$start_date_time_ical.$this->crlf
.'DTEND;TZID=Europe/Vienna:'.$end_date_time_ical.$this->crlf
.'END:VEVENT');
'lehrfach_id'=>(isset($this->std_plan[$i][$j][$idx]->lehrfach_id)?$this->std_plan[$i][$j][$idx]->lehrfach_id:''),
'ort'=>$this->std_plan[$i][$j][$idx]->ort,
'lektor_uid'=>array_unique($lektor_uids),
'gruppen'=>array_unique($lehrverband),
'stunden'=>array_unique($stunden_arr),
'titel'=>$this->std_plan[$i][$j][$idx]->titel,
'unr'=>$unr,
'Summary'=>$Summary,
'Description'=>$description,
'start_date'=>$start_date,
'end_date'=>$end_date,
'start_time'=>$start_time,
'end_time'=>$end_time,
'dtstart'=>$start_date_time_ical,
'dtend'=>$end_date_time_ical,
'reservierung'=>$this->std_plan[$i][$j][$idx]->reservierung,
'reservierung_id'=>($this->std_plan[$i][$j][$idx]->reservierung?$this->std_plan[$i][$j][$idx]->stundenplan_id:''),
'updateamum'=>$this->std_plan[$i][$j][$idx]->updateamum,
'data'=>'BEGIN:VEVENT'.$this->crlf
.'UID:'.$UID.$this->crlf
.'SUMMARY:'.$Summary.$this->crlf
.'DESCRIPTION:'.$description.$this->crlf
.'LOCATION:'.$this->std_plan[$i][$j][$idx]->ort.$this->crlf
.'CATEGORIES:'.$lvplan_kategorie.$this->crlf
.'DTSTART;TZID=Europe/Vienna:'.$start_date_time_ical.$this->crlf
.'DTEND;TZID=Europe/Vienna:'.$end_date_time_ical.$this->crlf
.'END:VEVENT');
}
else
{
+1
View File
@@ -207,6 +207,7 @@ class MySabre_CalDAV_Backend extends \Sabre\CalDAV\Backend\AbstractBackend
{
die($stdplan->errormsg);
}
$val = $stdplan->draw_week_csv('return', LVPLAN_KATEGORIE);
if(!is_null($objectUri))
{