Added idnumber and bugfix in invide name

This commit is contained in:
PMKuipers 2023-08-09 09:48:06 +02:00
parent 28f7b15503
commit e544ad1646
14 changed files with 54 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -65,6 +65,7 @@ export function init(contextid,categoryid) {
name: '', name: '',
shortname: '', shortname: '',
description: '', description: '',
idnumber: '',
slots : 4, slots : 4,
startdate: '2020-08-01', startdate: '2020-08-01',
enddate: '', enddate: '',

View File

@ -87,6 +87,8 @@ export default {
studyplan_shortname_ph: 'studyplan_shortname_ph', studyplan_shortname_ph: 'studyplan_shortname_ph',
studyplan_description: 'studyplan_description', studyplan_description: 'studyplan_description',
studyplan_description_ph: 'studyplan_description_ph', studyplan_description_ph: 'studyplan_description_ph',
studyplan_idnumber: 'studyplan_idnumber',
studyplan_idnumber_ph: 'studyplan_idnumber_ph',
studyplan_slots: 'studyplan_slots', studyplan_slots: 'studyplan_slots',
studyplan_startdate: 'studyplan_startdate', studyplan_startdate: 'studyplan_startdate',
studyplan_enddate: 'studyplan_enddate', studyplan_enddate: 'studyplan_enddate',
@ -134,6 +136,8 @@ export default {
studyplan_shortname_ph: 'studyplan_shortname_ph', studyplan_shortname_ph: 'studyplan_shortname_ph',
studyplan_description: 'studyplan_description', studyplan_description: 'studyplan_description',
studyplan_description_ph: 'studyplan_description_ph', studyplan_description_ph: 'studyplan_description_ph',
studyplan_idnumber: 'studyplan_idnumber',
studyplan_idnumber_ph: 'studyplan_idnumber_ph',
studyplan_context: 'studyplan_context', studyplan_context: 'studyplan_context',
studyplan_slots: 'studyplan_slots', studyplan_slots: 'studyplan_slots',
studyplan_startdate: 'studyplan_startdate', studyplan_startdate: 'studyplan_startdate',
@ -531,6 +535,7 @@ export default {
name: '', name: '',
shortname: '', shortname: '',
description: '', description: '',
idnumber: '',
context_id: this.contextid, context_id: this.contextid,
periods : 4, periods : 4,
startdate: (new Date()).getFullYear() + '-08-01', startdate: (new Date()).getFullYear() + '-08-01',
@ -691,6 +696,13 @@ export default {
</b-col> </b-col>
</b-row> </b-row>
<b-row> <b-row>
<b-col cols="4">{{ text.studyplan_idnumber}}</b-col>
<b-col cols="8">
<b-form-input v-model="editdata.idnumber"
:state='editdata.idnumber.length>0'
:placeholder="text.studyplan_idnumber_ph"></b-form-input>
</b-col>
</b-row> <b-row>
<b-col cols="4">{{ text.studyplan_description}}</b-col> <b-col cols="4">{{ text.studyplan_description}}</b-col>
<b-col cols="8"> <b-col cols="8">
<b-form-input v-model="editdata.description" <b-form-input v-model="editdata.description"

View File

@ -63,7 +63,7 @@ class reportinvite_form extends moodleform {
$date = new DateTime("now", core_date::get_user_timezone_object()); $date = new DateTime("now", core_date::get_user_timezone_object());
$date->setTime(0, 0, 0); $date->setTime(0, 0, 0);
$data->date = $date->getTimeStamp(); $data->idate = $date->getTimeStamp();
} }
if(empty($data->update)) if(empty($data->update))

View File

@ -113,6 +113,7 @@ class studyplan {
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'), "name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'), "shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"description"=> new \external_value(PARAM_TEXT, 'description of studyplan'), "description"=> new \external_value(PARAM_TEXT, 'description of studyplan'),
"idnumber"=> new \external_value(PARAM_TEXT, 'idnumber of curriculum'),
"context_id" => new \external_value(PARAM_INT, 'context_id of studyplan'), "context_id" => new \external_value(PARAM_INT, 'context_id of studyplan'),
"aggregation" => new \external_value(PARAM_TEXT, 'selected aggregator'), "aggregation" => new \external_value(PARAM_TEXT, 'selected aggregator'),
"aggregation_config" => new \external_value(PARAM_TEXT, 'config string for aggregator'), "aggregation_config" => new \external_value(PARAM_TEXT, 'config string for aggregator'),
@ -137,6 +138,7 @@ class studyplan {
'name' => $this->r->name, 'name' => $this->r->name,
'shortname' => $this->r->shortname, 'shortname' => $this->r->shortname,
'description' => $this->r->description, 'description' => $this->r->description,
'idnumber' => $this->r->idnumber,
'context_id' => $this->context()->id, 'context_id' => $this->context()->id,
"aggregation" => $this->r->aggregation, "aggregation" => $this->r->aggregation,
"aggregation_config" => $this->aggregator->config_string(), "aggregation_config" => $this->aggregator->config_string(),
@ -173,7 +175,7 @@ class studyplan {
public static function add($fields,$bare=false){ public static function add($fields,$bare=false){
global $CFG, $DB; global $CFG, $DB;
$addable = ['name','shortname','description','context_id','aggregation','aggregation_config']; $addable = ['name','shortname','description','idnumber','context_id','aggregation','aggregation_config'];
$info = ['enddate' => null ]; $info = ['enddate' => null ];
foreach($addable as $f){ foreach($addable as $f){
if(array_key_exists($f,$fields)){ if(array_key_exists($f,$fields)){
@ -213,7 +215,7 @@ class studyplan {
public function edit($fields){ public function edit($fields){
global $DB; global $DB;
$editable = ['name','shortname','description','context_id','periods','startdate','enddate','aggregation','aggregation_config']; $editable = ['name','shortname','description','idnumber','context_id','periods','startdate','enddate','aggregation','aggregation_config'];
$info = ['id' => $this->id,]; $info = ['id' => $this->id,];
foreach($editable as $f){ foreach($editable as $f){
if(array_key_exists($f,$fields)){ if(array_key_exists($f,$fields)){
@ -434,6 +436,7 @@ class studyplan {
"name" => new \external_value(PARAM_TEXT, 'name of studyplan'), "name" => new \external_value(PARAM_TEXT, 'name of studyplan'),
"shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'), "shortname"=> new \external_value(PARAM_TEXT, 'shortname of studyplan'),
"description"=> new \external_value(PARAM_TEXT, 'description of studyplan'), "description"=> new \external_value(PARAM_TEXT, 'description of studyplan'),
"idnumber"=> new \external_value(PARAM_TEXT, 'idnumber of curriculum'),
"pages" => new \external_multiple_structure(studyplanpage::user_structure()), "pages" => new \external_multiple_structure(studyplanpage::user_structure()),
"aggregation_info" => aggregator::basic_structure(), "aggregation_info" => aggregator::basic_structure(),
],'Studyplan with user info',$value); ],'Studyplan with user info',$value);
@ -447,6 +450,7 @@ class studyplan {
'name' => $this->r->name, 'name' => $this->r->name,
'shortname' => $this->r->shortname, 'shortname' => $this->r->shortname,
'description' => $this->r->description, 'description' => $this->r->description,
'idnumber' => $this->r->idnumber,
'pages' => [], 'pages' => [],
'aggregation_info' => $this->aggregator->basic_model(), 'aggregation_info' => $this->aggregator->basic_model(),
]; ];

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/treestudyplan/db" VERSION="20230803" COMMENT="XMLDB file for Moodle local/treestudyplan" <XMLDB PATH="local/treestudyplan/db" VERSION="20230809" COMMENT="XMLDB file for Moodle local/treestudyplan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
> >
@ -11,7 +11,7 @@
<FIELD NAME="name" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Name or description of invite recipient"/> <FIELD NAME="name" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Name or description of invite recipient"/>
<FIELD NAME="email" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="email address the invite was sent to"/> <FIELD NAME="email" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="email address the invite was sent to"/>
<FIELD NAME="invitekey" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Invitation key for this invite"/> <FIELD NAME="invitekey" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Invitation key for this invite"/>
<FIELD NAME="date" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="Date the invite was created"/> <FIELD NAME="idate" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="Date the invite was created"/>
<FIELD NAME="allow_details" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="allow_details" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="allow_calendar" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="allow_calendar" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="allow_badges" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="allow_badges" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/>
@ -27,6 +27,7 @@
<FIELD NAME="name" TYPE="text" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="name" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="shortname" TYPE="text" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="shortname" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="idnumber" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="aggregation" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="bistate" SEQUENCE="false"/> <FIELD NAME="aggregation" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="bistate" SEQUENCE="false"/>
<FIELD NAME="aggregation_config" TYPE="text" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="aggregation_config" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="context_id" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="context_id" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>

View File

@ -433,6 +433,27 @@ function xmldb_local_treestudyplan_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2023080300, 'local', 'treestudyplan'); upgrade_plugin_savepoint(true, 2023080300, 'local', 'treestudyplan');
} }
if ($oldversion < 2023080900) {
// Rename field date on table local_treestudyplan_invit to idate.
$table = new xmldb_table('local_treestudyplan_invit');
$field = new xmldb_field('date', XMLDB_TYPE_INTEGER, '20', null, null, null, null, 'invitekey');
// Launch rename field idate.
$dbman->rename_field($table, $field, 'idate');
// Define field idnumber to be added to local_treestudyplan.
$table = new xmldb_table('local_treestudyplan');
$field = new xmldb_field('idnumber', XMLDB_TYPE_TEXT, null, null, null, null, null, 'description');
// Conditionally launch add field idnumber.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Treestudyplan savepoint reached.
upgrade_plugin_savepoint(true, 2023080900, 'local', 'treestudyplan');
}
return true; return true;
} }

View File

@ -67,7 +67,7 @@ if(count($invites) > 0)
print "<tr data-id='{$invite->id}'>"; print "<tr data-id='{$invite->id}'>";
print "<td data-field='name'>{$invite->name}</td>"; print "<td data-field='name'>{$invite->name}</td>";
print "<td data-field='email'>{$invite->email}</td>"; print "<td data-field='email'>{$invite->email}</td>";
print "<td data-field='date'>".userdate($invite->date, "%x")."</td>"; print "<td data-field='date'>".userdate($invite->idate, "%x")."</td>";
print "<td data-field='control'>"; print "<td data-field='control'>";
print "<a class='m-action-view ' href='{$testlink}' title='".get_string('invite_tooltip_testlink','local_treestudyplan')."'><i class='fa fa-eye'></i></a>"; print "<a class='m-action-view ' href='{$testlink}' title='".get_string('invite_tooltip_testlink','local_treestudyplan')."'><i class='fa fa-eye'></i></a>";

View File

@ -95,6 +95,8 @@ $string['studyplan_name_ph'] = '';
$string['studyplan_context'] = 'Context'; $string['studyplan_context'] = 'Context';
$string['studyplan_shortname'] = 'Short name'; $string['studyplan_shortname'] = 'Short name';
$string['studyplan_shortname_ph'] = ''; $string['studyplan_shortname_ph'] = '';
$string['studyplan_idnumber'] = 'ID Number';
$string['studyplan_shortname_ph'] = '';
$string['studyplan_description'] = 'Description'; $string['studyplan_description'] = 'Description';
$string['studyplan_description_ph'] = ''; $string['studyplan_description_ph'] = '';
$string['studyplan_slots'] = 'Number of periods in plan'; $string['studyplan_slots'] = 'Number of periods in plan';

View File

@ -97,6 +97,8 @@ $string['studyplan_name_ph'] = '';
$string['studyplan_context'] = 'Context'; $string['studyplan_context'] = 'Context';
$string['studyplan_shortname'] = 'Korte naam'; $string['studyplan_shortname'] = 'Korte naam';
$string['studyplan_shortname_ph'] = ''; $string['studyplan_shortname_ph'] = '';
$string['studyplan_idnumber'] = 'Opleidings-ID';
$string['studyplan_shortname_ph'] = '';
$string['studyplan_description'] = 'Beschrijving'; $string['studyplan_description'] = 'Beschrijving';
$string['studyplan_description_ph'] = ''; $string['studyplan_description_ph'] = '';
$string['studyplan_slots'] = 'Aantal periodes in studieplan'; $string['studyplan_slots'] = 'Aantal periodes in studieplan';

View File

@ -1,6 +1,6 @@
<?php <?php
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494) $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
$plugin->version = 2023080700; // YYYYMMDDHH (year, month, day, iteration) $plugin->version = 2023080900; // YYYYMMDDHH (year, month, day, iteration)
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11) $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
$plugin->dependencies = [ $plugin->dependencies = [