Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Chronos
Commits
90e9a906
Commit
90e9a906
authored
6 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add calendar week select and toggle between smart plan und regular plan
parent
2ff57ef3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
biscuit/apps/chronos/templates/timetable/plan.html
+49
-1
49 additions, 1 deletion
biscuit/apps/chronos/templates/timetable/plan.html
biscuit/apps/chronos/urls.py
+4
-1
4 additions, 1 deletion
biscuit/apps/chronos/urls.py
biscuit/apps/chronos/views.py
+41
-3
41 additions, 3 deletions
biscuit/apps/chronos/views.py
with
94 additions
and
5 deletions
biscuit/apps/chronos/templates/timetable/plan.html
+
49
−
1
View file @
90e9a906
{% include 'partials/header.html' %}
<script
type=
"text/javascript"
>
{
%
if
smart
%
}
function
goToCalendarWeek
(
cw
)
{
window
.
location
.
href
=
"
{% url
"
timetable_smart_plan
"
raw_type id
"
smart
"
%}/{{ selected_year }}/
"
+
cw
;
}
function
onCalendarWeekChanged
()
{
goToCalendarWeek
(
$
(
"
#calendar-week
"
).
val
());
}
$
(
document
).
ready
(
function
()
{
$
(
"
#calendar-week
"
).
change
(
onCalendarWeekChanged
);
});
{
%
endif
%
}
</script>
<main>
<div
class=
"row"
>
<div
class=
"col s12 m6 l8 xl9"
>
<h3>
Stundenplan
<i>
{{ el }}
</i>
</h3>
</div>
<div
class=
"col s12 m6 l4 xl3 right align-right"
>
<div
class=
"
col s12 m6 l4 xl3 right align-right"
>
<a
class=
"waves-effect waves-teal btn-flat btn-flat-medium right"
id=
"print"
>
<i
class=
"material-icons center"
>
print
</i>
</a>
</div>
</div>
<div
class=
"row"
>
{% if smart %}
<div
class=
"col s12 m6"
>
<p
class=
"left"
style=
"margin: 0;"
><span
class=
"badge new primary-color left-align"
>
SMART PLAN
</span>
</p>
<a
class=
"waves-effect waves-light btn"
href=
"{% url "
timetable_plan
"
raw_type
id
%}"
>
<i
class=
"material-icons left"
>
slideshow
</i>
Regelplan anzeigen
</a>
</div>
<div
class=
"input-field col s12 m6 right"
>
<select
id=
"calendar-week"
>
{% for week in weeks %}
<option
value=
"{{ week.calendar_week }}"
{%
if
week.calendar_week =
=
selected_week
%}
selected
{%
endif
%}
>
KW {{ week.calendar_week }}
({{ week.first_day|date:"j. F Y" }}–{{ week.last_day|date:"j. F Y" }})
</option>
{% endfor %}
</select>
</div>
{% else %}
<a
class=
"waves-effect waves-light btn"
href=
"{% url "
timetable_smart_plan
"
raw_type
id
"
smart
"
%}"
>
<i
class=
"material-icons left"
>
slideshow
</i>
SMART PLAN
</a>
{% endif %}
</div>
<div
class=
"timetable-plan"
>
<div
class=
"row"
>
<div
class=
"col s2"
>
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/chronos/urls.py
+
4
−
1
View file @
90e9a906
...
...
@@ -4,7 +4,10 @@ from . import views
urlpatterns
=
[
path
(
''
,
views
.
all
,
name
=
'
timetable_admin_all
'
),
path
(
'
quick/
'
,
views
.
quicklaunch
,
name
=
'
timetable_quicklaunch
'
),
path
(
'
<str:plan_type>/<int:plan_id>/
'
,
views
.
plan
,
name
=
'
timetable_plan
'
),
path
(
'
<str:plan_type>/<int:plan_id>
'
,
views
.
plan
,
name
=
'
timetable_plan
'
),
path
(
'
<str:plan_type>/<int:plan_id>/<str:smart>
'
,
views
.
plan
,
name
=
'
timetable_smart_plan
'
),
path
(
'
<str:plan_type>/<int:plan_id>/<str:smart>/<int:year>/<int:calendar_week>
'
,
views
.
plan
,
name
=
'
timetable_smart_plan_week
'
),
path
(
'
substitutions/
'
,
views
.
substitutions
,
name
=
'
timetable_substitutions
'
),
path
(
'
substitutions/<int:year>/<int:month>/<int:day>/
'
,
views
.
substitutions
,
name
=
'
timetable_substitutions_date
'
),
path
(
'
class.pdf
'
,
views
.
sub_pdf
,
name
=
"
timetable_substitutions_pdf
"
)
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/chronos/views.py
+
41
−
3
View file @
90e9a906
...
...
@@ -46,9 +46,41 @@ def quicklaunch(request):
return
render
(
request
,
'
timetable/quicklaunch.html
'
,
context
)
def
get_calendar_weeks
():
weeks
=
[]
# Get first day of year > first calendar week
first_day_of_year
=
timezone
.
datetime
(
year
=
timezone
.
datetime
.
now
().
year
,
month
=
1
,
day
=
1
)
if
first_day_of_year
.
isoweekday
()
!=
1
:
days_to_next_monday
=
1
-
first_day_of_year
.
isoweekday
()
first_day_of_year
+=
datetime
.
timedelta
(
days
=
days_to_next_monday
)
# Go for all weeks in year and create week dict
first_day_of_week
=
first_day_of_year
for
i
in
range
(
52
):
calendar_week
=
i
+
1
last_day_of_week
=
first_day_of_week
+
datetime
.
timedelta
(
days
=
4
)
weeks
.
append
({
"
calendar_week
"
:
calendar_week
,
"
first_day
"
:
first_day_of_week
,
"
last_day
"
:
last_day_of_week
})
first_day_of_week
+=
datetime
.
timedelta
(
weeks
=
1
)
return
weeks
@login_required
@permission_required
(
"
timetable.show_plan
"
)
def
plan
(
request
,
plan_type
,
plan_id
):
def
plan
(
request
,
plan_type
,
plan_id
,
smart
=
""
,
year
=
None
,
calendar_week
=
None
):
if
smart
==
"
smart
"
:
smart
=
True
year
=
timezone
.
datetime
.
now
().
year
if
year
is
None
else
year
calendar_week
=
timezone
.
datetime
.
now
().
isocalendar
()[
1
]
if
calendar_week
is
None
else
calendar_week
print
(
get_calendar_weeks
())
else
:
smart
=
False
if
plan_type
==
'
teacher
'
:
_type
=
TYPE_TEACHER
el
=
get_teacher_by_id
(
plan_id
)
...
...
@@ -59,16 +91,22 @@ def plan(request, plan_type, plan_id):
_type
=
TYPE_ROOM
el
=
get_room_by_id
(
plan_id
)
else
:
raise
Http404
(
'
P
age
not found.
'
)
raise
Http404
(
'
P
lan
not found.
'
)
plan
=
get_plan
(
_type
,
plan_id
)
print
(
parse_lesson_times
())
context
=
{
"
smart
"
:
smart
,
"
type
"
:
_type
,
"
raw_type
"
:
plan_type
,
"
id
"
:
plan_id
,
"
plan
"
:
plan
,
"
el
"
:
el
,
"
times
"
:
parse_lesson_times
()
"
times
"
:
parse_lesson_times
(),
"
weeks
"
:
get_calendar_weeks
(),
"
selected_week
"
:
calendar_week
,
"
selected_year
"
:
year
}
return
render
(
request
,
'
timetable/plan.html
'
,
context
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment