% cvhplan.sty - LaTeX Settings for Time Schedules
% Copyright (C) 2012-2013, 2017-2020, 2024, 2026  Peter Gerwinski
%
% This document 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 3
% of the License, or (at your option) any later version.
%
% This document 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 document.  If not, see <http://www.gnu.org/licenses/>.

\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{helvet}
\renewcommand*\familydefault{\sfdefault}
\usepackage[paper=a4paper,landscape]{geometry}
\usepackage[dvipsnames]{xcolor}
\usepackage{rotating}

\usepackage[colorlinks,allcolors=blue]{hyperref}
\urlstyle{sf}

\setlength{\pdfpagewidth}{29.7cm}
\setlength{\pdfpageheight}{21.0cm}
\setlength{\textwidth}{28cm}
\setlength{\textheight}{20cm}
\setlength{\hoffset}{-3.75cm}
%\setlength{\voffset}{-3.75cm}
\setlength{\voffset}{-1.95cm}

\setcounter{secnumdepth}{0}

\pagestyle{empty}
\setlength{\parindent}{0pt}
\setlength{\unitlength}{1cm}

\newcommand{\notfixed}{{\boldmath$\Updownarrow$}}

\newif\ifoptionalfootnote
\newif\ifenglish

\newcommand{\mon}{1}
\newcommand{\tue}{6.4}
\newcommand{\wed}{11.8}
\newcommand{\thu}{17.2}
\newcommand{\fri}{22.6}

\input{semester.tex}
\newcommand{\planname}{\shortstack[r]{
                         \ifenglish
                           Bochum University of Applied Sciences -- Campus Velbert/Heiligenhaus -- \semesteren\ -- effective: \lastchangeen
                         \else
                           Hochschule Bochum -- Campus Velbert/Heiligenhaus -- \semester\ -- Stand: \lastchange
%                         Weitere Informationen zu den Online-Veranstaltungen:
%                         \url{https://www.hs-bochum.de/cvh-digitalveranstaltungen}
%                         \strut
                         \fi
                      }}

\newcommand{\drawquarters}{%
  {
    \put(28,19.9){\makebox(0,0)[tr]{\planname}}
%    \color{red}
%    \put(5.5,18.3){\makebox(0,0){\begin{rotate}{10}
%                     \Huge\textbf{--- Entwurf ---}
%                   \end{rotate}}}
%    \put(5.0,19.5){\begin{minipage}[t]{6.5cm}
%                   \small\par
%                   Dieser Plan enthält noch keine Raumangaben.
%                   Bitte überprüfen Sie die Webseiten regelmäßig bzgl.\ Aktualisierungen.
%                 \end{minipage}}
%    \put(7.34,19.25){\begin{minipage}[t]{21cm}
%                       \color{black}
%                       \small\par
%                       Bei den Raumangaben handelt es sich um\\
%                       \textbf{virtuelle Räume} für die jeweils eingesetzten Online-Werkzeuge.\\
%                       \hspace*{-2.5cm}Siehe auch: \url{https://www.hochschule-bochum.de/die-bo/hochschule/campus-velbert-heiligenhaus/aktuelles/infos-zu-den-digitalen-lehrangeboten-im-coronasemester/}
%                     \end{minipage}}
%    \put(6,18.3){\makebox(0,0){\begin{rotate}{5}
%                 \Huge\textbf{--- unvollständige Vorabversion ---}
%               \end{rotate}}}
%    \put(8,19.5){\begin{minipage}[t]{9cm}
%                   \small\par
%                   Dieser Plan gilt vorbehaltlich des geplanten personellen Aufbaus am CVH.
%                   Bitte überprüfen Sie die Webseiten regelmäßig bzgl.\ Aktualisierungen.
%                 \end{minipage}}
    \color[rgb]{0.8,0.8,0.8}
    \multiput(1,0)(0,0.4){45}{\line(1,0){27}}
  }
}

\newcommand{\drawhours}{%
  \multiput(1,0)(0,1.6){12}{\line(1,0){27}}
  \multiput(1,-0.4)(5.4,0){6}{\line(0,1){18.0}}
  \put(1,-0.4){\line(1,0){27}}
  \put(0.9,17.6){\makebox(0,0)[r]{8:00}}
  \put(0.9,16.0){\makebox(0,0)[r]{9:00}}
  \put(0.9,14.4){\makebox(0,0)[r]{10:00}}
  \put(0.9,12.8){\makebox(0,0)[r]{11:00}}
  \put(0.9,11.2){\makebox(0,0)[r]{12:00}}
  \put(0.9,9.6){\makebox(0,0)[r]{13:00}}
  \put(0.9,8.0){\makebox(0,0)[r]{14:00}}
  \put(0.9,6.4){\makebox(0,0)[r]{15:00}}
  \put(0.9,4.8){\makebox(0,0)[r]{16:00}}
  \put(0.9,3.2){\makebox(0,0)[r]{17:00}}
  \put(0.9,1.6){\makebox(0,0)[r]{18:00}}
  \put(0.9,0.0){\makebox(0,0)[r]{19:00}}
  \put(3.70,17.7){\makebox(0,0)[b]{\ifenglish Monday\else Montag\fi}}
  \put(9.10,17.7){\makebox(0,0)[b]{\ifenglish Tuesday\else Dienstag\fi}}
  \put(14.50,17.7){\makebox(0,0)[b]{\ifenglish Wednesday\else Mittwoch\fi}}
  \put(19.90,17.7){\makebox(0,0)[b]{\ifenglish Thursday\else Donnerstag\fi}}
  \put(25.30,17.7){\makebox(0,0)[b]{\ifenglish Friday\else Freitag\fi}}
}

\newlength{\colwidth}
\setlength{\colwidth}{5.4\unitlength}
\newlength{\hours}
\setlength{\hours}{0.4\unitlength}
\newlength{\quarters}
\setlength{\quarters}{0.1\unitlength}
\newlength{\minutes}
\setlength{\minutes}{0.0266666\unitlength}

\newcommand{\halfcol}[1]{\makebox[0.49\colwidth]{\hss#1\hss}}

\newcommand{\activity}[5]{%
  \put(#2,17.6){% ab 8:00 Uhr: 17.6; ab 7:00 Uhr: 19.2
    \begin{minipage}[t]{\colwidth}%
      \vspace*{#3\minutes}%
      \def\testl{#5}%
      \def\testr{\Crecreation}%
      \ifx\testl\testr
        \strut\vspace*{-11\minutes}%
      \else
        \makebox(0,0)[tl]{\color{#5}\rule{\colwidth}{#4\minutes}}%
      \fi
      \begin{center}
        \setlength{\baselineskip}{15\minutes}\vspace*{-13.5\minutes}\par
        #1
      \end{center}
    \end{minipage}
  }
}

\definecolor{LightPeriwinkle}{rgb}{0.65,0.6,0.85}
\definecolor{LightGray}{rgb}{0.85,0.85,0.85}
\definecolor{DirtyYellow}{rgb}{0.90 0.88 0.45}
\definecolor{LightOrange}{rgb}{1.0 0.85 0.45}
\definecolor{LightBlue}{rgb}{0.725 0.875 1.0}

\newcommand{\Clecture}{SkyBlue}
\newcommand{\Cexercises}{SpringGreen}
\newcommand{\Ccombined}{YellowGreen}
\newcommand{\Claboratory}{Salmon}
\newcommand{\Creview}{LightPeriwinkle}
\newcommand{\Cexpertise}{YellowOrange}
\newcommand{\Celective}{YellowOrange}
\newcommand{\Coptional}{Yellow}
\newcommand{\Cseminar}{LightOrange}
\newcommand{\Cother}{LightGray}
\newcommand{\Crecreation}{white}
\newcommand{\Cauxlecture}{LightBlue}
\newcommand{\Crecommended}{LightBlue}
\newcommand{\Cpersonal}{LightBlue}

\newcommand{\Llecture}{\colorbox{\Clecture}{\ifenglish lecture\else Vorlesung\fi\strut}}
\newcommand{\Lexercises}{\colorbox{\Cexercises}{\ifenglish exercise\else Übung\fi\strut}}
\newcommand{\Lcombined}{\colorbox{\Ccombined}{\ifenglish lecture and exercise\else kombiniert\fi\strut}}
\newcommand{\Llaboratory}{\colorbox{\Claboratory}{\ifenglish practical course\else Praktikum\fi\strut}}
\newcommand{\Lreview}{\colorbox{\Creview}{\ifenglish review\else Repetitorium\fi\strut}}
\newcommand{\Lexpertise}{\colorbox{\Cexpertise}{Pflichtfach\strut}}
\newcommand{\Lelective}{\colorbox{\Cexpertise}{Wahlpflichtfach\strut}}
\newcommand{\Loptional}{%
  \ifx\planowner\planownerstudent
    \global\optionalfootnotetrue\colorbox{\Coptional}{Wahlfach*\strut}%
  \else
    \colorbox{\Coptional}{Wahlfach}%
  \fi}
\newcommand{\Lseminar}{\colorbox{\Cseminar}{Seminar\strut}}
\newcommand{\Lother}{}
\newcommand{\Lrecreation}{}
\newcommand{\Lauxlecture}{\colorbox{\Cauxlecture}{online asynchron\strut}}
\newcommand{\Lrecommended}{\colorbox{\Cauxlecture}{empfohlen\strut}}
\newcommand{\Lpersonal}{\colorbox{\Cpersonal}{privat\strut}}

\newcommand{\legend}[1]{%
  \put(28,19.00){\makebox(0,0)[r]{#1}}
  \ifoptionalfootnote
    \put(28,18.38){\makebox(0,0)[r]{\footnotesize *\,Diese Auflistung dient als unverbindliche Planungshilfe.
                                    Zur Wählbarkeit konkreter Module in Ihrem Studienverlauf siehe Modulhandbuch.}}

  \fi
}

\def\lecture#1#2     #3 #4{\activity{#4}{#1}{#2}{#3}{\Clecture}}
\def\exercises#1#2   #3 #4{\activity{#4}{#1}{#2}{#3}{\Cexercises}}
\def\block#1#2       #3 #4{\activity{#4}{#1}{#2}{#3}{\Cblock}}  % @@@
\def\combined#1#2    #3 #4{\activity{#4}{#1}{#2}{#3}{\Ccombined}}
\def\laboratory#1#2  #3 #4{\activity{#4}{#1}{#2}{#3}{\Claboratory}}
\def\review#1#2      #3 #4{\activity{#4}{#1}{#2}{#3}{\Creview}}
\def\expertise#1#2   #3 #4{\activity{#4}{#1}{#2}{#3}{\Cexpertise}}
\def\elective#1#2    #3 #4{\activity{#4}{#1}{#2}{#3}{\Celective}}
\def\optional#1#2    #3 #4{\activity{#4}{#1}{#2}{#3}{\Coptional}}
\def\seminar#1#2     #3 #4{\activity{#4}{#1}{#2}{#3}{\Cseminar}}
\def\other#1#2       #3 #4{\activity{#4}{#1}{#2}{#3}{\Cother}}
\def\recreation#1#2  #3 #4{\activity{#4}{#1}{#2}{#3}{\Crecreation}}
\def\auxlecture#1#2  #3 #4{\activity{#4}{#1}{#2}{#3}{\Cauxlecture}}
\def\recommended#1#2 #3 #4{\activity{#4}{#1}{#2}{#3}{\Crecommended}}
\def\personal#1#2    #3 #4{\activity{#4}{#1}{#2}{#3}{\Cpersonal}}

\def\planownerstudent{students}

\newenvironment{plan}[2]{%
  \optionalfootnotefalse
  \def\testl{#2}%
  \def\testr{Master M}%
  \ifx\testl\testr
    \englishtrue
    \def\groups##1{##1 groups in alternation}%
    \def\events##1{##1 events per semester}%
    \def\seenotice{See notice board.}%
    \def\lunchbreak{lunch break}
  \else
    \englishfalse
    \def\groups##1{##1 Gruppen im Wechsel}%
    \def\events##1{##1 Termine im Semester}%
    \def\seenotice{Bitte Aushang beachten!}%
    \def\lunchbreak{Mittagspause}
  \fi
  \def\planowner{#1}
  \section[\arabic{page} -- #2]{#2\strut}
  \begin{picture}(28,18.5)
    \drawquarters
}{%
    \drawhours
  \end{picture}
  \clearpage
}
