Commit ab8cfc22 authored by mathieso's avatar mathieso

New config file set, views changes.

parent 8a2438e3
...@@ -7,6 +7,20 @@ dependencies: ...@@ -7,6 +7,20 @@ dependencies:
- field.storage.skilling_history.field_response - field.storage.skilling_history.field_response
- field.storage.user.field_first_name - field.storage.user.field_first_name
- field.storage.user.field_last_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.administrator
- user.role.instructor - user.role.instructor
module: module:
...@@ -567,6 +581,69 @@ display: ...@@ -567,6 +581,69 @@ display:
entity_type: skilling_history entity_type: skilling_history
plugin_id: entity_link plugin_id: entity_link
filters: 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: uid:
id: uid id: uid
table: users_field_data table: users_field_data
...@@ -661,54 +738,6 @@ display: ...@@ -661,54 +738,6 @@ display:
default_group_multiple: { } default_group_multiple: { }
group_items: { } group_items: { }
plugin_id: string 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: { } sorts: { }
title: 'Student history' title: 'Student history'
header: { } header: { }
......
...@@ -2,10 +2,11 @@ langcode: en ...@@ -2,10 +2,11 @@ langcode: en
status: true status: true
dependencies: dependencies:
config: config:
- system.menu.main
- user.role.student - user.role.student
module: module:
- skilling
- skilling_history - skilling_history
- user
id: history_student id: history_student
label: 'History student' label: 'History student'
module: views module: views
...@@ -21,8 +22,10 @@ display: ...@@ -21,8 +22,10 @@ display:
position: 0 position: 0
display_options: display_options:
access: access:
type: OwnUidInUrl type: role
options: { } options:
role:
student: student
cache: cache:
type: tag type: tag
options: { } options: { }
...@@ -475,6 +478,7 @@ display: ...@@ -475,6 +478,7 @@ display:
- url - url
- url.query_args - url.query_args
- user - user
- user.roles
tags: { } tags: { }
list: list:
display_plugin: page display_plugin: page
...@@ -484,6 +488,15 @@ display: ...@@ -484,6 +488,15 @@ display:
display_options: display_options:
display_extenders: { } display_extenders: { }
path: history 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: cache_metadata:
max-age: -1 max-age: -1
contexts: contexts:
...@@ -492,4 +505,5 @@ display: ...@@ -492,4 +505,5 @@ display:
- url - url
- url.query_args - url.query_args
- user - user
- user.roles
tags: { } tags: { }
...@@ -27,11 +27,6 @@ When submit, can be slow, tell user that something is happening. ...@@ -27,11 +27,6 @@ When submit, can be slow, tell user that something is happening.
Same for showing the exercise in the first place. Same for showing the exercise in the first place.
# Subm
Add record selection thing?
# Starter content # Starter content
- can't create paragraphs when adding exercises due to class. - can't create paragraphs when adding exercises due to class.
- class - start date MT - class - start date MT
...@@ -51,23 +46,6 @@ the value of the flag during install? ...@@ -51,23 +46,6 @@ the value of the flag during install?
- check other config flag init code. Some things missing? - 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 # Testing
......
...@@ -7,6 +7,20 @@ dependencies: ...@@ -7,6 +7,20 @@ dependencies:
- field.storage.skilling_history.field_response - field.storage.skilling_history.field_response
- field.storage.user.field_first_name - field.storage.user.field_first_name
- field.storage.user.field_last_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.administrator
- user.role.instructor - user.role.instructor
module: module:
...@@ -567,6 +581,69 @@ display: ...@@ -567,6 +581,69 @@ display:
entity_type: skilling_history entity_type: skilling_history
plugin_id: entity_link plugin_id: entity_link
filters: 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: uid:
id: uid id: uid
table: users_field_data table: users_field_data
...@@ -661,54 +738,6 @@ display: ...@@ -661,54 +738,6 @@ display:
default_group_multiple: { } default_group_multiple: { }
group_items: { } group_items: { }
plugin_id: string 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: { } sorts: { }
title: 'Student history' title: 'Student history'
header: { } header: { }
......
...@@ -2,10 +2,11 @@ langcode: en ...@@ -2,10 +2,11 @@ langcode: en
status: true status: true
dependencies: dependencies:
config: config:
- system.menu.main
- user.role.student - user.role.student
module: module:
- skilling
- skilling_history - skilling_history
- user
id: history_student id: history_student
label: 'History student' label: 'History student'
module: views module: views
...@@ -21,8 +22,10 @@ display: ...@@ -21,8 +22,10 @@ display:
position: 0 position: 0
display_options: display_options:
access: access:
type: OwnUidInUrl type: role
options: { } options:
role:
student: student
cache: cache:
type: tag type: tag
options: { } options: { }
...@@ -475,6 +478,7 @@ display: ...@@ -475,6 +478,7 @@ display:
- url - url
- url.query_args - url.query_args
- user - user
- user.roles
tags: { } tags: { }
list: list:
display_plugin: page display_plugin: page
...@@ -484,6 +488,15 @@ display: ...@@ -484,6 +488,15 @@ display:
display_options: display_options:
display_extenders: { } display_extenders: { }
path: history 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: cache_metadata:
max-age: -1 max-age: -1
contexts: contexts:
...@@ -492,4 +505,5 @@ display: ...@@ -492,4 +505,5 @@ display:
- url - url
- url.query_args - url.query_args
- user - user
- user.roles
tags: { } tags: { }
...@@ -31,3 +31,5 @@ skilling_history.admin.delete_all: ...@@ -31,3 +31,5 @@ skilling_history.admin.delete_all:
parent: skilling_history.admin.history parent: skilling_history.admin.history
description: 'Delete all history records.' description: 'Delete all history records.'
weight: 40 weight: 40
...@@ -4,7 +4,7 @@ skilling_history.admin.history: ...@@ -4,7 +4,7 @@ skilling_history.admin.history:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'History' _title: 'History'
requirements: requirements:
_role: 'administrator' _role: 'administrator+instructor'
options: options:
_admin_route: TRUE _admin_route: TRUE
...@@ -14,7 +14,7 @@ skilling_history.admin.list: ...@@ -14,7 +14,7 @@ skilling_history.admin.list:
_controller: '\Drupal\skilling_history\Controller\StudentHistoryAdminController::studentHistoryAdmin' _controller: '\Drupal\skilling_history\Controller\StudentHistoryAdminController::studentHistoryAdmin'
_title: 'Student history' _title: 'Student history'
requirements: requirements:
_role: 'administrator' _role: 'administrator+instructor'
options: options:
_admin_route: TRUE _admin_route: TRUE
...@@ -43,3 +43,5 @@ skilling_history.history_controller_save_submission_access: ...@@ -43,3 +43,5 @@ skilling_history.history_controller_save_submission_access:
methods: [GET] methods: [GET]
requirements: requirements:
_role: 'student' _role: 'student'
...@@ -101,17 +101,19 @@ class StudentHistoryAdminController extends ControllerBase { ...@@ -101,17 +101,19 @@ class StudentHistoryAdminController extends ControllerBase {
$view->execute(); $view->execute();
// Filter records. // Filter records.
// Todo: Could cache the decisions for each user in a local array. // Todo: Could cache the decisions for each user in a local array.
foreach ($view->result as $index => $row) { if (!$this->skillingSkillingCurrentUser->isAdministrator()) {
/** @var \Drupal\skilling_history\Entity\SkillingHistoryInterface $historyEntity */ foreach ($view->result as $index => $row) {
$historyEntity = $row->_entity; /** @var \Drupal\skilling_history\Entity\SkillingHistoryInterface $historyEntity */
$studentId = $historyEntity->getOwnerId(); $historyEntity = $row->_entity;
$currentUserIsInstructor $studentId = $historyEntity->getOwnerId();
= $this->checkUserRelationshipService->isUserUidInstructorOfUserUid( $currentUserIsInstructor
$this->skillingSkillingCurrentUser->id(), = $this->checkUserRelationshipService->isUserUidInstructorOfUserUid(
$studentId $this->skillingSkillingCurrentUser->id(),
); $studentId
if (!$currentUserIsInstructor) { );
unset($view->result[$index]); if (!$currentUserIsInstructor) {
unset($view->result[$index]);
}
} }
} }
$result['view'] = $view->buildRenderable('list'); $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