Skip to content

Commit

Permalink
Moodle plugin CI Improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
raja-lmsace committed May 15, 2024
1 parent e5ea22e commit 0da8b71
Show file tree
Hide file tree
Showing 35 changed files with 213 additions and 75 deletions.
2 changes: 1 addition & 1 deletion amd/build/gradient.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions amd/build/gradienthandler.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions amd/build/gradienthandler.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/lc_color_picker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/lc_color_picker.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions amd/src/gradienthandler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(['jquery', 'core/str'], function (jQuery) {
define([], function () {
return {
init: function() {
alert('demo');
}
}
});
};
});
2 changes: 1 addition & 1 deletion block_dash.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function get_content() {
try {
$bb = block_builder::create($this);

if (!$bb->get_configuration()){
if (!$bb->get_configuration()) {
return $this->content->text = get_string('missingdatasource', 'block_dash');
}

Expand Down
2 changes: 1 addition & 1 deletion changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ Compatibility: Moodle 3.7, Moodle 3.8, Totara (12)
- Dashboards
- Dashboards data source

Compatibility: Moodle 3.7, Moodle 3.8, Totara (12)
Compatibility: Moodle 3.7, Moodle 3.8, Totara (12)
2 changes: 1 addition & 1 deletion classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static function get_block_content($blockinstanceid, $filterformdata, $pag
$blockinstance = $DB->get_record('block_instances', ['id' => $params['block_instance_id']]);
$block = block_instance($blockinstance->blockname, $blockinstance);
if (strpos($block->instance->pagetypepattern, 'dashaddon-dashboard') !== false) {
if ($dashboard = \dashaddon_dashboard\model\dashboard::get_record(
if ($dashboard = \dashaddon_dashboard\model\dashboard::get_record(
['shortname' => $block->instance->defaultregion])) {
if ($dashboard->get('permission') == \dashaddon_dashboard\model\dashboard::PERMISSION_PUBLIC) {
$public = true;
Expand Down
1 change: 1 addition & 0 deletions classes/local/dash_framework/structure/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class field implements field_interface {
* @param array $attributes Field attributes to be added immediately.
* @param array $options Arbitrary options belonging to this field.
* @param int $visibility Visibility of the field (if it should be displayed to the user).
* @param string $sortselect
*/
public function __construct(string $name,
lang_string $title,
Expand Down
2 changes: 1 addition & 1 deletion classes/local/dash_framework/structure/user_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function get_fields(): array {
new lang_string('customfield', 'block_dash', ['name' => format_string($customfield->name)]),
$this, "(SELECT profile$i.data FROM {user_info_data} profile$i
WHERE profile$i.userid = u.id AND profile$i.fieldid = $customfield->id)",
[], [],field_interface::VISIBILITY_VISIBLE , '',
[], [], field_interface::VISIBILITY_VISIBLE , '',
);

$i++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function transform_data($data, \stdClass $record) {
*
* @return array|null
*/
function get_category_files() {
public function get_category_files() {

static $list = null;

Expand Down
2 changes: 0 additions & 2 deletions classes/local/data_grid/field/attribute/image_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public function transform_data($data, \stdClass $record) {
]);
}



return $data;
}

Expand Down
1 change: 1 addition & 0 deletions classes/local/data_grid/field/field_definition_factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use block_dash\local\dash_framework\structure\field_interface;
use block_dash\local\data_grid\field\attribute\field_attribute_interface;

/**
* Responsible for building field definitions and retrieving them as needed.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

namespace block_dash\local\data_grid\field;

/**
* Responsible for creating field definitions on request.
*
Expand Down
2 changes: 1 addition & 1 deletion classes/local/data_source/abstract_data_source.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ final public function get_data() {
if (!$strategy = $this->get_layout()->get_data_strategy()) {
throw new coding_exception('Not fully configured.');
}

if ($this->is_widget()) {
$this->data = $this->get_widget_data();
} else {
$records = $this->get_query()->query();
$this->data = $strategy->convert_records_to_data_collection($records, $this->get_sorted_fields());

if ($modifieddata = $this->after_data($this->data)) {
$this->data = $modifieddata;
}
Expand Down
1 change: 0 additions & 1 deletion classes/local/data_source/data_source_factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public static function build_data_source($identifier, \context $context) {
*/
public static function get_data_source_form_options($type='') {
$options = [];

foreach (self::get_data_source_registry() as $identifier => $datasourceinfo) {
if ($type) {
if (isset($datasourceinfo['type']) && $datasourceinfo['type'] == $type) {
Expand Down
1 change: 1 addition & 0 deletions classes/local/data_source/data_source_interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function get_data();
*/
public function after_data(data_collection_interface $datacollection);


/**
* Explicitly set layout.
*
Expand Down
3 changes: 2 additions & 1 deletion classes/local/paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ public function export_for_template(renderer_base $output) {
'total' => $this->get_record_count(),
'per_page' => $this->get_per_page(),
'limit_from' => $this->get_limit_from() + 1,
'limit_to' => $limitto]);
'limit_to' => $limitto,
]);

return [
'pages' => $items,
Expand Down
9 changes: 7 additions & 2 deletions classes/local/widget/contacts/contacts_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,13 @@ public function build_widget() {
AND mua.id is NULL
GROUP BY m.useridfrom';
$unreadcounts = $DB->get_records_sql($unreadcountssql,
[$userid, \core_message\api::MESSAGE_ACTION_READ, \core_message\api::MESSAGE_ACTION_DELETED,
$userid, $userid]
[
$userid,
\core_message\api::MESSAGE_ACTION_READ,
\core_message\api::MESSAGE_ACTION_DELETED,
$userid,
$userid,
]
);
} else {
$unreadcountssql = 'SELECT useridfrom, count(*) as count
Expand Down
3 changes: 2 additions & 1 deletion classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ protected function get_mustache() {
// Don't allow the JavaScript helper to be executed from within another
// helper. If it's allowed it can be used by users to inject malicious
// JS into the page.
'blacklistednestedhelpers' => ['js']]);
'blacklistednestedhelpers' => ['js'],
]);

}

Expand Down
7 changes: 7 additions & 0 deletions classes/table/members.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
*/
class members extends \table_sql implements dynamic_table {

/**
* Group filter value.
*
* @var string
*/
protected $group;

/**
* Define table field definitions and filter data
*
Expand Down
9 changes: 7 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@ function block_dash_get_data_collection() {
? new block_dash\local\data_grid\data\data_collection() : new \block_dash\local\data_grid\data\data_collection_new();
}


/**
* Return the dash addon visible staus.
*
* @param int $id ID
* @return bool
*/
function block_dash_visible_addons($id) {
global $CFG;
preg_match('/(dashaddon_[a-zA-Z_]+)/', $id, $matches);
Expand All @@ -364,4 +369,4 @@ function block_dash_visible_addons($id) {
}
}
return true;
}
}
2 changes: 1 addition & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
// Category Icons for each category.
$name = 'block_dash/categoryimg';
$title = $value;
$description = get_string('categoryimgcategory', 'block_dash', array('category' => $value));
$description = get_string('categoryimgcategory', 'block_dash', ['category' => $value]);
$filearea = 'categoryimg';
$setting = new admin_setting_configstoredfile($name . $key, $title, $description, $default, $key);
$setting->set_updatedcallback('theme_reset_all_caches');
Expand Down
1 change: 0 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,6 @@ h5:before,
.block_dash .card-body .form-inline .col-md-3.col-form-label p {
font-weight: bold;
}
.block_dash .card-body .form-inline .col-md-9.form-inline .custom-addon,
.block_dash .card-body .form-inline .col-md-9.form-inline .datasource-content {
width: 100%;
display: flex;
Expand Down
Binary file added tests/assets/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/img-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/img-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assets/img-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion tests/behat/behat_block_dash.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,27 @@ public function i_open_the_dash_block($blockname) {
$this->execute("behat_blocks::i_open_the_blocks_action_menu", $this->escape($blockname));

$this->execute('behat_general::i_click_on_in_the',
array("Preference", "link", $this->escape($blockname), "block")
["Preference", "link", $this->escape($blockname), "block"]
);
}

/**
* Check that the focus mode enable.
*
* @Given /^I check dash css "(?P<value>(?:[^"]|\\")*)" "(?P<selector>(?:[^"]|\\")*)" "(?P<type>(?:[^"]|\\")*)"$/
* @param string $value
* @param string $selector
* @param string $type
* @throws ExpectationException
*/
public function i_check_dash_css($value, $selector, $type): void {
$stylejs = "
return (
Y.one('{$selector}').getComputedStyle('{$type}')
)
";
if (strpos($this->evaluate_script($stylejs), $value) === false) {
throw new ExpectationException("Doesn't working correct style", $this->getSession());
}
}
}
Loading

0 comments on commit 0da8b71

Please sign in to comment.