From 591dccf3caf1dca944fab167617fd9be496735dd Mon Sep 17 00:00:00 2001 From: David Bogner Date: Thu, 5 Sep 2024 08:42:55 +0200 Subject: [PATCH] Import class in view base, adapt behat tests --- classes/datalynx.php | 4 ++-- classes/view/base.php | 3 ++- rule/ftpsyncfiles/rule_class.php | 2 +- tests/behat/customfilter_multiselect.feature | 4 ++-- tests/behat/update_entrieswithfiles.feature | 3 ++- view/tabular/view_class.php | 1 + 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/classes/datalynx.php b/classes/datalynx.php index 099d0ed0..0878782b 100644 --- a/classes/datalynx.php +++ b/classes/datalynx.php @@ -788,7 +788,7 @@ public function display() { */ public static function get_content_inline(int $datalynxid, int $viewid = 0, ?int $eids = null, array $options = array('tohtml' => true)) { global $CFG; - require_once($CFG->dirroot . '/mod/datalynx/view/base.php'); + require_once($CFG->dirroot . '/mod/datalynx/classes/view/base.php'); $urlparams = new stdClass(); $datalynx = new datalynx($datalynxid); $urlparams->d = $datalynxid; @@ -814,7 +814,7 @@ public static function get_content_inline(int $datalynxid, int $viewid = 0, ?int 'completion' => true, 'comments' => true, 'urlparams' => $urlparams); $datalynx->set_page('external', $pageparams, $skiplogincheck); $type = $datalynx->views[$viewid]->type; - require_once($CFG->dirroot . "/mod/datalynx/view/$type/base.php"); + require_once($CFG->dirroot . "/mod/datalynx/view/$type/view_class.php"); $viewclass = "datalynxview_$type"; $datalynx->_currentview = $datalynx->get_current_view_from_id($viewid); diff --git a/classes/view/base.php b/classes/view/base.php index fe01cf3d..13f3c0b0 100644 --- a/classes/view/base.php +++ b/classes/view/base.php @@ -27,6 +27,7 @@ use datalynx_entries; use datalynx_filter; use datalynxfield__rating; +use datalynxfield__status; use datalynxview_entries_form; use datalynxview_patterns; use HTML_QuickForm; @@ -1576,7 +1577,7 @@ public function process_entries_data() { } else { $this->_editentries = 0; } - $this->_returntoentriesform = false; + $this->_returntoentriesform = true; return $processed; } } else { diff --git a/rule/ftpsyncfiles/rule_class.php b/rule/ftpsyncfiles/rule_class.php index 4533aa62..0d00e37d 100644 --- a/rule/ftpsyncfiles/rule_class.php +++ b/rule/ftpsyncfiles/rule_class.php @@ -141,7 +141,7 @@ public function trigger(base $event) { require_once("$CFG->dirroot/mod/datalynx/classes/datalynx.php"); require_once("$CFG->dirroot/mod/datalynx/field/entryauthor/field_class.php"); require_once("$CFG->dirroot/mod/datalynx/entries_class.php"); - require_once("$CFG->dirroot/mod/datalynx/view/csv/base.php"); + require_once("$CFG->dirroot/mod/datalynx/view/csv/view_class.php"); require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/completionlib.php'); diff --git a/tests/behat/customfilter_multiselect.feature b/tests/behat/customfilter_multiselect.feature index 75e54e5d..233e14cb 100644 --- a/tests/behat/customfilter_multiselect.feature +++ b/tests/behat/customfilter_multiselect.feature @@ -30,8 +30,8 @@ Feature: Create entry, add multiselect and use customfilter | multiselect | Select (multiple) | | Opt1,Opt2,Opt3,Opt4,Opt5 | | | And I add to "Datalynx Test Instance" datalynx the view of "Grid" type with: - | name | Gridview | - | description | Testgrid | + | name | description | + | Gridview | Testgrid | And I follow "Set as default view" And I follow "Set as edit view" diff --git a/tests/behat/update_entrieswithfiles.feature b/tests/behat/update_entrieswithfiles.feature index 9157f110..5298f4a5 100644 --- a/tests/behat/update_entrieswithfiles.feature +++ b/tests/behat/update_entrieswithfiles.feature @@ -40,7 +40,8 @@ Feature: In a datalynx instance create, update, and delete entries | number | Number | 3 | 2 | | | | file | File | My file | | 2 | | And I add to "Datalynx Test Instance" datalynx the view of "Tabular" type with: - | name | Tabular | + | name | description | + | Tabular | Tabular view | And I follow "Set as default view" And I follow "Set as edit view" And I am on "Course 1" course homepage diff --git a/view/tabular/view_class.php b/view/tabular/view_class.php index 808220a2..6957b2fa 100644 --- a/view/tabular/view_class.php +++ b/view/tabular/view_class.php @@ -150,6 +150,7 @@ public function display(array $options = []): string { global $PAGE; $PAGE->requires->js_init_call('M.datalynxview_tabular.init', array(), false, $this->get_js_module()); + return ''; } private function get_js_module() {