From 74dfb6c07efa4c70c43282809e959c2434e100a0 Mon Sep 17 00:00:00 2001 From: tgloeggl <tgloeggl@uos.de> Date: Tue, 29 Oct 2013 13:56:29 +0100 Subject: [PATCH] first version of availability schedule --- AvailSchedule.class.php | 64 +++++++++++++++++++++++++++++++++++++++++ README.md | 6 ++-- plugin.manifest | 5 ++++ templates/schedule.php | 58 +++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 2 deletions(-) create mode 100755 AvailSchedule.class.php create mode 100755 plugin.manifest create mode 100755 templates/schedule.php diff --git a/AvailSchedule.class.php b/AvailSchedule.class.php new file mode 100755 index 0000000..9f1054e --- /dev/null +++ b/AvailSchedule.class.php @@ -0,0 +1,64 @@ +<?php +/* + * AvailSchedule.class.php + * + * 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. + * + * @author Till Glöggler <till.gloeggler@elan-ev.de> + * @copyright 2013 ELAN e.V. <http://www.elan-ev.de> + * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 + * @category Stud.IP + */ + +require_once 'lib/raumplan/draw_raumPlan.php'; +require_once 'lib/raumplan/ConflictCounter.class.php'; +require_once 'lib/classes/SemesterData.class.php'; + +class AvailSchedule extends StudipPlugin implements SystemPlugin +{ + + /** + * Initialize a new instance of the plugin. + */ + function __construct() + { + parent::__construct(); + + $seminar_id = Request::option('cid', $GLOBALS['SeminarSession']); + + $sem = Seminar::getInstance($seminar_id); + + if (in_array($sem->status, studygroup_sem_types()) === false) { + if (Navigation::hasItem('/course/members') && $GLOBALS['perm']->have_studip_perm('tutor', $seminar_id)) { + $navigation = Navigation::getItem('/course/members'); + $navigation->addSubNavigation('conflicts', new Navigation(_('Verfügbarkeit'), PluginEngine::getLink('availschedule/show'))); + } + } + } + + + function show_action() { + $seminar_id = Request::option('cid'); + + if (!$seminar_id || !$GLOBALS['perm']->have_studip_perm('tutor', $seminar_id)) { + die; + } + + PageLayout::setTitle($GLOBALS['SessSemName']['header_line'] . ' - ' . _('Verfügbarkeitsplan')); + Navigation::activateItem('/course/members/conflicts'); + + $template_path = $this->getPluginPath() . '/templates'; + $template_factory = new Flexi_TemplateFactory($template_path); + + $template = $template_factory->open('schedule'); + $layout = $GLOBALS['template_factory']->open('layouts/base'); + $template->set_layout($layout); + $template->set_attribute('really', Request::option('really')); + $template->set_attribute('semester_id', Request::option('semester_id')); + + echo $template->render(); + } +} diff --git a/README.md b/README.md index 81d2135..bc7dc2d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -studip-availability-schedule -============================ +Stud.IP Verfügbarkeitsplan +========================== + +Setzt spezielle Anpassungen voraus, die momentan nur an der Universität Osnabrück verfügbar sind. diff --git a/plugin.manifest b/plugin.manifest new file mode 100755 index 0000000..d473e0e --- /dev/null +++ b/plugin.manifest @@ -0,0 +1,5 @@ +pluginclassname=AvailSchedule +pluginname=AvailabilitySchedule +origin=elan-ev +version=0.1.1 +studipMinVersion=2.4 diff --git a/templates/schedule.php b/templates/schedule.php new file mode 100755 index 0000000..544fbe6 --- /dev/null +++ b/templates/schedule.php @@ -0,0 +1,58 @@ +<?php +/* +teilnehmer_conflicts.php - Verfügbarkeitsanzeige der Teilnehmer eines Seminares +Copyright (C) 2005-2013 Marco Diedrich <marco.diedrich@uni-osnabrueck.de>, Till Glöggler <till.gloeggler@uni-osnabrueck.de> + +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. +*/ + +?> +<table border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr> + <td class="blank" align="center"> + <br/> + <? + $semester = new SemesterData(); + $all_semester = $semester->getAllSemesterData(); + if (!$really) { ?> + <b> + Sie können sich einen sogenannten Verfügbarkeitsplan anzeigen lassen.<br/> + Es handelt sich dabei um eine Wochenübersicht, worauf sie erkennen können + wieviele ihrer Teilnehmer zu den jeweiligen Zeiten andere Veranstaltungen belegen.<br/> + <br/> + Klicken Sie auf ein Semester, um sich dafür diesen Verfügbarkeitsplan anzeigen zu lassen:<br/> + <? + foreach ($all_semester as $key => $val) { + if ($val['ende'] >= time()) { + echo '<a href="' . URLHelper::getLink('?really=yes&semester_id=' . $key) .'">' . $val['name'] . '</a>'; + echo ' | '; + } + } + ?> + </b><br/> + <br/> + <? } else { + flush(); + $plan = createPlanData(Request::get('cid'), $all_semester[$semester_id]['beginn']); + printTable($plan, $all_semester[$semester_id]['name']); + flush(); + echo "<br/><br/>"; + printList($plan); + } + ?> + <br/> + </td> + </tr> +</table> -- GitLab