Commit ab8cfc22 authored by mathieso's avatar mathieso

New config file set, views changes.

parent 8a2438e3
......@@ -7,6 +7,20 @@ dependencies:
- field.storage.skilling_history.field_response
- field.storage.user.field_first_name
- field.storage.user.field_last_name
- skilling_history.skilling_history_type.account_access
- skilling_history.skilling_history_type.badge_awarded
- skilling_history.skilling_history_type.fib_history
- skilling_history.skilling_history_type.log_in
- skilling_history.skilling_history_type.log_out
- skilling_history.skilling_history_type.mcq_history
- skilling_history.skilling_history_type.search
- skilling_history.skilling_history_type.sent_message
- skilling_history.skilling_history_type.store_reflection_note
- skilling_history.skilling_history_type.submission_access
- skilling_history.skilling_history_type.suggestion
- skilling_history.skilling_history_type.view_page
- skilling_history.skilling_history_type.view_view
- skilling_history.skilling_history_type.view_your_class
- user.role.administrator
- user.role.instructor
module:
......@@ -567,6 +581,69 @@ display:
entity_type: skilling_history
plugin_id: entity_link
filters:
bundle:
id: bundle
table: skilling_history
field: bundle
relationship: none
group_type: group
admin_label: ''
operator: in
value:
all: all
account_access: account_access
badge_awarded: badge_awarded
fib_history: fib_history
log_in: log_in
log_out: log_out
mcq_history: mcq_history
search: search
sent_message: sent_message
store_reflection_note: store_reflection_note
submission_access: submission_access
suggestion: suggestion
view_page: view_page
view_view: view_view
view_your_class: view_your_class
group: 1
exposed: true
expose:
operator_id: bundle_op
label: 'Event type'
description: 'Filter by event type. Required.'
use_operator: false
operator: bundle_op
operator_limit_selection: false
operator_list: { }
identifier: history_bundle
required: false
remember: false
multiple: true
remember_roles:
authenticated: authenticated
anonymous: '0'
student: '0'
grader: '0'
instructor: '0'
reviewer: '0'
author: '0'
administrator: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: skilling_history
entity_field: bundle
plugin_id: bundle
uid:
id: uid
table: users_field_data
......@@ -661,54 +738,6 @@ display:
default_group_multiple: { }
group_items: { }
plugin_id: string
bundle:
id: bundle
table: skilling_history
field: bundle
relationship: none
group_type: group
admin_label: ''
operator: in
value: { }
group: 1
exposed: true
expose:
operator_id: bundle_op
label: 'Event type'
description: 'Filter by event type. Optional.'
use_operator: false
operator: bundle_op
operator_limit_selection: false
operator_list: { }
identifier: history_bundle
required: false
remember: false
multiple: true
remember_roles:
authenticated: authenticated
anonymous: '0'
student: '0'
grader: '0'
instructor: '0'
reviewer: '0'
author: '0'
administrator: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: skilling_history
entity_field: bundle
plugin_id: bundle
sorts: { }
title: 'Student history'
header: { }
......
......@@ -2,10 +2,11 @@ langcode: en
status: true
dependencies:
config:
- system.menu.main
- user.role.student
module:
- skilling
- skilling_history
- user
id: history_student
label: 'History student'
module: views
......@@ -21,8 +22,10 @@ display:
position: 0
display_options:
access:
type: OwnUidInUrl
options: { }
type: role
options:
role:
student: student
cache:
type: tag
options: { }
......@@ -475,6 +478,7 @@ display:
- url
- url.query_args
- user
- user.roles
tags: { }
list:
display_plugin: page
......@@ -484,6 +488,15 @@ display:
display_options:
display_extenders: { }
path: history
menu:
type: normal
title: History
description: 'Your history'
expanded: false
parent: skilling.your_stuff
weight: 60
context: '0'
menu_name: main
cache_metadata:
max-age: -1
contexts:
......@@ -492,4 +505,5 @@ display:
- url
- url.query_args
- user
- user.roles
tags: { }
......@@ -27,11 +27,6 @@ When submit, can be slow, tell user that something is happening.
Same for showing the exercise in the first place.
# Subm
Add record selection thing?
# Starter content
- can't create paragraphs when adding exercises due to class.
- class - start date MT
......@@ -51,23 +46,6 @@ the value of the flag during install?
- check other config flag init code. Some things missing?
# Tokens
TEst no sub test for exer
Boolean ops work?
# History
Instructor can show history for student.
Students can see own history
# Exercises and f/b
Test when exercise not on timeline, how shows for student when inserted.
? Add multifield for exercises on due, even if just use first one.
# Testing
......
......@@ -7,6 +7,20 @@ dependencies:
- field.storage.skilling_history.field_response
- field.storage.user.field_first_name
- field.storage.user.field_last_name
- skilling_history.skilling_history_type.account_access
- skilling_history.skilling_history_type.badge_awarded
- skilling_history.skilling_history_type.fib_history
- skilling_history.skilling_history_type.log_in
- skilling_history.skilling_history_type.log_out
- skilling_history.skilling_history_type.mcq_history
- skilling_history.skilling_history_type.search
- skilling_history.skilling_history_type.sent_message
- skilling_history.skilling_history_type.store_reflection_note
- skilling_history.skilling_history_type.submission_access
- skilling_history.skilling_history_type.suggestion
- skilling_history.skilling_history_type.view_page
- skilling_history.skilling_history_type.view_view
- skilling_history.skilling_history_type.view_your_class
- user.role.administrator
- user.role.instructor
module:
......@@ -567,6 +581,69 @@ display:
entity_type: skilling_history
plugin_id: entity_link
filters:
bundle:
id: bundle
table: skilling_history
field: bundle
relationship: none
group_type: group
admin_label: ''
operator: in
value:
all: all
account_access: account_access
badge_awarded: badge_awarded
fib_history: fib_history
log_in: log_in
log_out: log_out
mcq_history: mcq_history
search: search
sent_message: sent_message
store_reflection_note: store_reflection_note
submission_access: submission_access
suggestion: suggestion
view_page: view_page
view_view: view_view
view_your_class: view_your_class
group: 1
exposed: true
expose:
operator_id: bundle_op
label: 'Event type'
description: 'Filter by event type. Required.'
use_operator: false
operator: bundle_op
operator_limit_selection: false
operator_list: { }
identifier: history_bundle
required: false
remember: false
multiple: true
remember_roles:
authenticated: authenticated
anonymous: '0'
student: '0'
grader: '0'
instructor: '0'
reviewer: '0'
author: '0'
administrator: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: skilling_history
entity_field: bundle
plugin_id: bundle
uid:
id: uid
table: users_field_data
......@@ -661,54 +738,6 @@ display:
default_group_multiple: { }
group_items: { }
plugin_id: string
bundle:
id: bundle
table: skilling_history
field: bundle
relationship: none
group_type: group
admin_label: ''
operator: in
value: { }
group: 1
exposed: true
expose:
operator_id: bundle_op
label: 'Event type'
description: 'Filter by event type. Optional.'
use_operator: false
operator: bundle_op
operator_limit_selection: false
operator_list: { }
identifier: history_bundle
required: false
remember: false
multiple: true
remember_roles:
authenticated: authenticated
anonymous: '0'
student: '0'
grader: '0'
instructor: '0'
reviewer: '0'
author: '0'
administrator: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: skilling_history
entity_field: bundle
plugin_id: bundle
sorts: { }
title: 'Student history'
header: { }
......
......@@ -2,10 +2,11 @@ langcode: en
status: true
dependencies:
config:
- system.menu.main
- user.role.student
module:
- skilling
- skilling_history
- user
id: history_student
label: 'History student'
module: views
......@@ -21,8 +22,10 @@ display:
position: 0
display_options:
access:
type: OwnUidInUrl
options: { }
type: role
options:
role:
student: student
cache:
type: tag
options: { }
......@@ -475,6 +478,7 @@ display:
- url
- url.query_args
- user
- user.roles
tags: { }
list:
display_plugin: page
......@@ -484,6 +488,15 @@ display:
display_options:
display_extenders: { }
path: history
menu:
type: normal
title: History
description: 'Your history'
expanded: false
parent: skilling.your_stuff
weight: 60
context: '0'
menu_name: main
cache_metadata:
max-age: -1
contexts:
......@@ -492,4 +505,5 @@ display:
- url
- url.query_args
- user
- user.roles
tags: { }
......@@ -31,3 +31,5 @@ skilling_history.admin.delete_all:
parent: skilling_history.admin.history
description: 'Delete all history records.'
weight: 40
......@@ -4,7 +4,7 @@ skilling_history.admin.history:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'History'
requirements:
_role: 'administrator'
_role: 'administrator+instructor'
options:
_admin_route: TRUE
......@@ -14,7 +14,7 @@ skilling_history.admin.list:
_controller: '\Drupal\skilling_history\Controller\StudentHistoryAdminController::studentHistoryAdmin'
_title: 'Student history'
requirements:
_role: 'administrator'
_role: 'administrator+instructor'
options:
_admin_route: TRUE
......@@ -43,3 +43,5 @@ skilling_history.history_controller_save_submission_access:
methods: [GET]
requirements:
_role: 'student'
......@@ -101,17 +101,19 @@ class StudentHistoryAdminController extends ControllerBase {
$view->execute();
// Filter records.
// Todo: Could cache the decisions for each user in a local array.
foreach ($view->result as $index => $row) {
/** @var \Drupal\skilling_history\Entity\SkillingHistoryInterface $historyEntity */
$historyEntity = $row->_entity;
$studentId = $historyEntity->getOwnerId();
$currentUserIsInstructor
= $this->checkUserRelationshipService->isUserUidInstructorOfUserUid(
$this->skillingSkillingCurrentUser->id(),
$studentId
);
if (!$currentUserIsInstructor) {
unset($view->result[$index]);
if (!$this->skillingSkillingCurrentUser->isAdministrator()) {
foreach ($view->result as $index => $row) {
/** @var \Drupal\skilling_history\Entity\SkillingHistoryInterface $historyEntity */
$historyEntity = $row->_entity;
$studentId = $historyEntity->getOwnerId();
$currentUserIsInstructor
= $this->checkUserRelationshipService->isUserUidInstructorOfUserUid(
$this->skillingSkillingCurrentUser->id(),
$studentId
);
if (!$currentUserIsInstructor) {
unset($view->result[$index]);
}
}
}
$result['view'] = $view->buildRenderable('list');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment