-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MBS-8974: Add repeating of cards #47
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,14 @@ | |
use core_form\dynamic_form; | ||
use mod_kanban\boardmanager; | ||
use mod_kanban\helper; | ||
use mod_kanban\constants; | ||
use moodle_url; | ||
|
||
/** | ||
* From for editing a card. | ||
* | ||
* @package mod_kanban | ||
* @copyright 2023-2024 ISB Bayern | ||
* @copyright 2023-2024 ISB Bayern | ||
* @author Stefan Hanauska | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
@@ -80,6 +81,33 @@ public function definition() { | |
|
||
$mform->addElement('date_time_selector', 'reminderdate', get_string('reminderdate', 'kanban'), ['optional' => true]); | ||
|
||
$repeatgroup = []; | ||
$repeatgroup[] = $mform->createElement('advcheckbox', 'repeat_enable', get_string('enable')); | ||
$repeatgroup[] = $mform->createElement('text', 'repeat_interval', get_string('repeat_interval', 'kanban'), ['size' => 3]); | ||
$repeatgroup[] = $mform->createElement('select', 'repeat_interval_type', get_string('repeat_interval_type', 'kanban'), [ | ||
constants::MOD_KANBAN_REPEAT_HOURS => get_string('hours'), | ||
constants::MOD_KANBAN_REPEAT_DAYS => get_string('days'), | ||
constants::MOD_KANBAN_REPEAT_WEEKS => get_string('weeks'), | ||
constants::MOD_KANBAN_REPEAT_MONTHS => get_string('months'), | ||
constants::MOD_KANBAN_REPEAT_YEARS => get_string('years'), | ||
]); | ||
$repeatgroup[] = $mform->createElement('select', 'repeat_newduedate', get_string('repeat_newduedate', 'kanban'), [ | ||
constants::MOD_KANBAN_REPEAT_NONEWDUEDATE => get_string('nonewduedate', 'kanban'), | ||
constants::MOD_KANBAN_REPEAT_NEWDUEDATE_AFTERDUE => get_string('afterdue', 'kanban'), | ||
constants::MOD_KANBAN_REPEAT_NEWDUEDATE_AFTERCOMPLETION => get_string('aftercompletion', 'kanban'), | ||
]); | ||
|
||
$mform->addElement('group', 'repeatgroup', get_string('repeat', 'kanban'), $repeatgroup, ' ', false); | ||
|
||
$mform->setType('repeat_interval', PARAM_INT); | ||
$mform->setType('repeat_interval_type', PARAM_INT); | ||
$mform->setDefault('repeat_enable', 0); | ||
$mform->setDefault('repeat_interval', 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bei mir ist der default leider 0 (also 0 Stunden). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Das kommt wohl daher, dass der Standard-Wert in der DB 0 ist. Ich habe das angepasst. |
||
$mform->disabledIf('repeatgroup', 'repeat_enable'); | ||
$mform->disabledIf('repeat_interval', 'repeat_newduedate', 'eq', constants::MOD_KANBAN_REPEAT_NONEWDUEDATE); | ||
$mform->disabledIf('repeat_interval_type', 'repeat_newduedate', 'eq', constants::MOD_KANBAN_REPEAT_NONEWDUEDATE); | ||
$mform->addHelpButton('repeatgroup', 'repeat', 'kanban'); | ||
|
||
$mform->addElement('filemanager', 'attachments', get_string('attachments', 'kanban')); | ||
|
||
$mform->addElement('color', 'color', get_string('color', 'mod_kanban'), ['size' => 5]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* mod_kanban db upgrades. | ||
* | ||
* @package mod_kanban | ||
* @copyright 2023-2024 ISB Bayern | ||
* @copyright 2023-2024 ISB Bayern | ||
* @author Stefan Hanauska | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
@@ -29,6 +29,60 @@ | |
* @param int $oldversion Version number the plugin is being upgraded from. | ||
*/ | ||
function xmldb_kanban_upgrade($oldversion) { | ||
// No upgrade steps until now. | ||
global $DB; | ||
$dbman = $DB->get_manager(); | ||
|
||
if ($oldversion < 2024121602) { | ||
// Define field repeat_enable to be added to kanban_card. | ||
$table = new xmldb_table('kanban_card'); | ||
$field = new xmldb_field('repeat_enable', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'timemodified'); | ||
|
||
// Conditionally launch add field repeat_enable. | ||
if (!$dbman->field_exists($table, $field)) { | ||
$dbman->add_field($table, $field); | ||
} | ||
|
||
$field = new xmldb_field('repeat_interval', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '1', 'repeat_enable'); | ||
|
||
// Conditionally launch add field repeat_interval. | ||
if (!$dbman->field_exists($table, $field)) { | ||
$dbman->add_field($table, $field); | ||
} | ||
|
||
$field = new xmldb_field( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warum wird hier eine unterschiedliche Formatierung genutzt? Oben inline, hier über mehrere Zeilen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wegen der maximalen Zeilenlänge von 132 Zeichen. |
||
'repeat_interval_type', | ||
XMLDB_TYPE_INTEGER, | ||
'11', | ||
null, | ||
XMLDB_NOTNULL, | ||
null, | ||
'0', | ||
'repeat_interval' | ||
); | ||
|
||
// Conditionally launch add field repeat_interval_type. | ||
if (!$dbman->field_exists($table, $field)) { | ||
$dbman->add_field($table, $field); | ||
} | ||
|
||
$field = new xmldb_field( | ||
'repeat_newduedate', | ||
XMLDB_TYPE_INTEGER, | ||
'5', | ||
null, | ||
XMLDB_NOTNULL, | ||
null, | ||
'0', | ||
'repeat_interval_type' | ||
); | ||
|
||
// Conditionally launch add field repeat_newduedate. | ||
if (!$dbman->field_exists($table, $field)) { | ||
$dbman->add_field($table, $field); | ||
} | ||
|
||
// Kanban savepoint reached. | ||
upgrade_mod_savepoint(true, 2024121602, 'kanban'); | ||
} | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(array) $newcard
fehlendes LeerzeichenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPCS moniert das nicht