Skip to content

Commit

Permalink
Fixed the dash-1.14 issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasanthlmsace committed May 4, 2024
1 parent 4523e9e commit a9634b4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
24 changes: 16 additions & 8 deletions block_dash.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,14 @@ public function get_content() {
public function html_attributes() {
$attributes = parent::html_attributes();
if (isset($this->config->css_class)) {
$cssclasses = explode(",", $this->config->css_class);
$cssclasses = $this->config->css_class;
if (!is_array($cssclasses)) {
$cssclasses = explode(',', $cssclasses);
}
foreach ($cssclasses as $class) {
$attributes['class'] .= ' ' . trim($class);
}

}
if (isset($this->config->width)) {
$attributes['class'] .= ' dash-block-width-' . $this->config->width;
Expand Down Expand Up @@ -314,17 +318,21 @@ public function get_extra_css() {
if (isset($this->config->css) && is_array($this->config->css)) {
foreach ($this->config->css as $property => $value) {
if (!empty($value)) {
if ($property == 'border') {
if ($this->config->border_option) {
$blockcss[] = sprintf('%s: %s;', $property, $value);
}
} else {
$blockcss[] = sprintf('%s: %s;', $property, $value);
}
$blockcss[] = sprintf('%s: %s;', $property, $value);
}
}
}

if (isset($this->config->border_option)) {
if ($this->config->border_option) {
$bordervalue = isset($this->config->border) && ($this->config->border) ? $this->config->border
: "1px solid rgba(0,0,0,.125)";
$blockcss[] = sprintf('%s: %s;', 'border', $bordervalue);
} else {
$blockcss[] = sprintf('%s: %s;', 'border', "none");
}
}

$data['blockcss'] = implode(PHP_EOL, $blockcss);

return $OUTPUT->render_from_template('block_dash/extra_css', $data);
Expand Down
22 changes: 14 additions & 8 deletions edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ protected function specific_definition($mform) {
$mform->setType('config_hide_when_empty', PARAM_INT);
$mform->setDefault('config_hide_when_empty', get_config('block_dash', 'hide_when_empty'));

$mform->addElement('text', 'config_css_class', get_string('cssclass', 'block_dash'));
$attributes['tags'] = true;
$attributes['multiple'] = 'multiple';
$attributes['placeholder'] = get_string('enterclasses', 'block_dash');

$cssclassses = explode(',', get_config('block_dash', 'cssclass'));
$cssclassses = array_combine($cssclassses, $cssclassses);
$mform->addElement('autocomplete', 'config_css_class', get_string('cssclass', 'block_dash'), $cssclassses, $attributes);
$mform->setType('config_css_class', PARAM_TEXT);
$mform->setDefault('config_css_class', get_config('block_dash', 'cssclass'));
$mform->addHelpButton('config_css_class', 'cssclass', 'block_dash');

$mform->addElement('filemanager', 'config_backgroundimage', get_string('backgroundimage', 'block_dash'), null,
Expand Down Expand Up @@ -162,16 +167,17 @@ protected function specific_definition($mform) {
$mform->addHelpButton('config_headerfootercolor', 'fontcolor', 'block_dash');

$mform->addElement('select', 'config_border_option', get_string('border_option', 'block_dash'), [
0 => get_string('disable'),
1 => get_string('enable'),
0 => get_string('hidden', 'block_dash'),
1 => get_string('visible'),
]);
$mform->setType('config_border_option', PARAM_INT);
$mform->setDefault('config_border_option', 1);
$mform->addHelpButton('config_border_option', 'border_option', 'block_dash');

$mform->addElement('text', 'config_css[border]', get_string('bordervalue', 'block_dash'));
$mform->setType('config_css[border]', PARAM_TEXT);
$mform->addHelpButton('config_css[border]', 'border', 'block_dash');
$mform->hideIf('config_css[border]', 'config_border_option', 'eq', 0);
$mform->addElement('text', 'config_border', get_string('bordervalue', 'block_dash'));
$mform->setType('config_border', PARAM_TEXT);
$mform->addHelpButton('config_border', 'border', 'block_dash');
$mform->hideIf('config_border', 'config_border_option', 'eq', 0);

$mform->addElement('text', 'config_css[min-height]', get_string('minheight', 'block_dash'));
$mform->setType('config_css[min-height]', PARAM_TEXT);
Expand Down
13 changes: 9 additions & 4 deletions lang/en/block_dash.php
Original file line number Diff line number Diff line change
Expand Up @@ -849,17 +849,23 @@
$string['dashthumbnailimg_help'] = "This thumbnail image shows only in dashboards data source";
$string['dashbgimg'] = 'Background image';
$string['dashbgimg_help'] = 'This background image used as background for the dashboard.';
$string['coredashboard'] = "Core dashboard";
$string['coredashboard'] = "Main dashboard";
$string['backgroundimageurl'] = 'Background image URL';

$string['border_option'] = "Border";
$string['border_option'] = "Show border";
$string['border_option_help'] = "You can add the border of dash block.";
$string['bordervalue'] = "Border Value";


$string['managedashaddonplugins'] = "Manage Dash addon plugins";
$string['managedashaddonplugins'] = "Manage addons";
$string['dashaddonpluginname'] = 'Dash addon name';
$string['hideshow'] = 'Hide/Show';

$string['maindashboard'] = "Main dashboard";
$string['enterclasses'] = "Enter classes";
// Permissions role context.
$string['permissionsrolecontext'] = 'Role Context';
$string['permissionsrolecontext_help'] = 'Select the context for which the user\'s role should be checked (Any context or system context only)';
// ...Dashaddon skill graph strings.
$string['managecapabilitymissing'] = 'Require capability "moodle/competency:competencymanage" to access the page is missing';
$string['managecompentency'] = 'Manage competencies appearance';
Expand All @@ -870,4 +876,3 @@
$string['competencyheading'] = 'Setup competency appearance';
$string['competencycolor'] = 'Competency color';
$string['competencyimage'] = 'Competency image';
$string['datasource:competency_progress_widget'] = 'Competency breakdown progress widget';
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024042501; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024050400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021051700; // Requires this Moodle version.
$plugin->component = 'block_dash'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '1.13';
$plugin->release = '1.14';
$plugin->supported = [311, 401];

0 comments on commit a9634b4

Please sign in to comment.