Skip to content
Snippets Groups Projects
Commit f423279e authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

- Show teacher, subject and room in PDF by template files

- Bug fix in selection of date for the second PDF
- Show logo again in PDF
parent 1fb500d8
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -10,7 +10,7 @@ from schoolapps.settings import BASE_DIR
# LaTeX constants
from untisconnect.sub import get_header_information
DIR = os.path.join(BASE_DIR, "static", "common", "logo.png")
LOGO_FILENAME = os.path.join(BASE_DIR, "static", "common", "logo.png")
TEX_HEADER_1 = """\\documentclass[11pt]{article}
\\usepackage[ngerman]{babel}
\\usepackage[sfdefault]{cabin}
......@@ -58,7 +58,7 @@ TEX_HEADER_2 = """}}
\\rfoot{\\small Umsetzung: © 2018--2019 by Computer-AG}
\\begin{document}"""
TEX_HEADER = TEX_HEADER_1 + DIR + TEX_HEADER_2
TEX_HEADER = TEX_HEADER_1 + LOGO_FILENAME + TEX_HEADER_2
TEX_FOOTER = '\end{document}'
......@@ -205,6 +205,7 @@ def generate_class_tex(subs, date, header_info):
context = {
"subs": subs,
"date": date,
"header_info": header_info
"header_info": header_info,
"LOGO_FILENAME": LOGO_FILENAME
}
return render_to_string("timetable/latex/substitutions.tex", context)
{% if sub.sub.type == 3 %}
{{ sub.sub.corridor.name }}
{% elif sub.sub.type == 1 or sub.sub.type == 2 %}
{% elif sub.sub.roow_new and sub.sub.room_old %}
\sout{ {{ sub.sub.room_old.shortcode }} }
$\rightarrow$
\textbf{ {{ sub.sub.room_new.shortcode }} }
{% elif sub.sub.room_new and not sub.sub.room_old %}
{{ sub.sub.room_new.shortcode }}
{% elif not sub.sub.room_new and not sub.sub.room_old %}
{% else %}
{{ sub.sub.room_old.shortcode }}
{% endif %}
\ No newline at end of file
{% if sub.sub.type == 3 %}
\textbf {Aufsicht }
{% elif not sub.sub.subject_new and not sub.sub.subject_old %}
{% elif sub.sub.type == 1 or sub.sub.type == 2 %}
\sout { {{ sub.sub.subject_old.shortcode }} }
{% elif sub.sub.subject_new and sub.sub.subject_old %}
\sout { {{ sub.sub.subject_old.shortcode }} } $\rightarrow$ \textbf { {{ sub.sub.subject_new.shortcode }} }
{% elif sub.sub.subject_new and not sub.sub.subject_old %}
\textbf { {{ sub.sub.subject_new.shortcode }} }
{% else %}
\textbf { {{ sub.sub.subject_old.shortcode }} }
{% endif %}
\ No newline at end of file
......@@ -40,7 +40,7 @@ enlarge bottom by=3pt,coltext=white}
\pagestyle{fancy}
% Left header: logo
%\lhead{\includegraphics[width=5cm]{}}
\lhead{\includegraphics[width=5cm]{% templatetag openbrace %}{{LOGO_FILENAME}}{% templatetag closebrace %}}
% Define footer
\lfoot{Katharineum zu Lübeck}
......@@ -114,23 +114,17 @@ Stand: {% now "j. F Y H:i" %}\\
\color{ {{c}} }
{{ sub.lesson }} &
\color{ {{c}} }
lehrer &
\color{ {{c}} } {% include "timetable/latex/teacher.tex" %} &
\color{ {{c}} }
fach &
\color{ {{c}} } {% include "timetable/latex/subject.tex" %} &
\color{ {{c}} }
raum &
\color{ {{c}} } {% include "timetable/latex/room.tex" %} &
{# Display badge (for cancellations) #}
{# Display badge (for cancellations) #} {# Display notice and new line #}
{% if sub.badge %}
\large\badge{ {{ sub.badge }} }
{% endif %}
{% endif %} \color{ {{c}} } \Large\textit{ {{sub.text|default:""}} } \\
{# Display notice and new line #}
\color{ {{c}} }
\Large\textit{ {{sub.text|default:""}} } \\
{% endwith %}
{% endfor %}
\end{longtable}
......
{% if sub.sub.type == 1 %}
\sout{ {{ sub.sub.teacher_old.shortcode }} }
{% elif sub.sub.teacher_new and sub.sub.teacher_old %}
\sout{ {{ sub.sub.teacher_old.shortcode }} }
$\rightarrow$
\textbf{ {{ sub.sub.teacher_new.shortcode }} }
{% elif sub.sub.teacher_new and not sub.sub.teacher_old %}
\textbf{ {{ sub.sub.teacher_new.shortcode }} }
{% elif sub.sub.teacher_old %}
\textbf{ {{ sub.sub.teacher_old.shortcode }} }
{% endif %}
\ No newline at end of file
......@@ -197,7 +197,7 @@ def sub_pdf(request):
today = timezone.datetime.now()
first_day = get_next_weekday(today)
second_day = get_next_weekday(today + datetime.timedelta(days=1))
second_day = get_next_weekday(first_day + datetime.timedelta(days=1))
# Get subs and generate table
for i, date in enumerate([first_day, second_day]):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment