Skip to content

Commit

Permalink
Version 1.4 for MOODLE_404_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
hribeir0 committed Jul 1, 2024
1 parent 616bb36 commit 1116a42
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 165 deletions.
111 changes: 0 additions & 111 deletions .github/workflow/moodle-ci.yaml

This file was deleted.

67 changes: 67 additions & 0 deletions classes/local/hooks/navigation/primary_extend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace theme_stream\local\hooks\navigation;

/**
* Hook callbacks for theme_stream
*
* @package theme_stream
* @copyright 2024 Hugo Ribeiro <hugo@moodlar.pt>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class primary_extend {

/**
* Allows plugins to insert nodes into site primary navigation
*
* @param \core\hook\navigation\primary_extend $hook
*/
public static function callback(\core\hook\navigation\primary_extend $hook): void {
$primarynav = $hook->get_primaryview();

// If able to create users print new node branch.
$systemcontext = \context_system::instance();
// Allowed to create users.
if (has_capability('moodle/user:create', $systemcontext)) {
$node = $primarynav->add(
get_string('management', 'theme_stream'),
null,
\navigation_node::NODETYPE_BRANCH,
);

$node->add(
get_string('managecourses', 'theme_stream'),
new \moodle_url('/course/management.php'),
\navigation_node::TYPE_ROOTNODE,
);

$node->add(
get_string('manageusers', 'theme_stream'),
new \moodle_url('/admin/user.php'),
\navigation_node::TYPE_ROOTNODE,
);

$node4 = $node->add(
get_string('themesettings', 'theme_stream'),
new \moodle_url('/admin/settings.php', ['section' => 'themesettingstream']),
\navigation_node::TYPE_ROOTNODE,
);

$node4->preceedwithhr = true;
}
}
}
33 changes: 0 additions & 33 deletions classes/output/core_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,39 +195,6 @@ public function favicon() {
return $favicon;
}
}
/**
* Returns HTML attributes to use within the body tag. This includes an ID and classes.
* Returns admin menu in the header. hribeir0
*
* @since Moodle 2.5.1 2.6
* @param string|array $additionalclasses Any additional classes to give the body tag,
* @return string
*/
public function body_attributes($additionalclasses = []) {
global $CFG;

if (!is_array($additionalclasses)) {
$additionalclasses = explode(' ', $additionalclasses);
}

$systemcontext = \context_system::instance();
// Allowed to create users.
$manager = has_capability('moodle/user:create', $systemcontext);
// Quick menu nodes and URLs.
$quickmenu = get_string('management', 'theme_stream') . PHP_EOL;
$quickmenu .= '-'. get_string('managecourses', 'theme_stream') .'|/course/management.php'. PHP_EOL;
$quickmenu .= '-'. get_string('searchcourses', 'theme_stream') .'|/course'. PHP_EOL;
$quickmenu .= '-###'. PHP_EOL;
$quickmenu .= '-'. get_string('searchusers', 'theme_stream') .'|/admin/user.php'. PHP_EOL;
$quickmenu .= '-###'. PHP_EOL;
$quickmenu .= '-'. get_string('themesettings', 'admin') .'|/admin/settings.php?section=themesettingstream'. PHP_EOL;

// Prints a quick menu for some users by using the custommenuitems feature.
if ($manager) {
$CFG->custommenuitems .= $quickmenu;
}
return ' id="'. $this->body_id().'" class="'.$this->body_css_classes($additionalclasses).'"';
}
/**
* Reads external_fonts to use print them in head.mustache
* hribeiro 2023
Expand Down
34 changes: 34 additions & 0 deletions db/hooks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Hook callbacks for Stream
*
* @package theme_stream
* @copyright 2024 Hugo Ribeiro <hugo@moodlar.pt>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

$callbacks = [

[
'hook' => core\hook\navigation\primary_extend::class,
'callback' => 'theme_stream\local\hooks\navigation\primary_extend::callback',
'priority' => 0,
],
];
5 changes: 4 additions & 1 deletion lang/en/theme_stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

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

$string['manageusers'] = 'Manage users';
$string['pluginname'] = 'Stream';
$string['choosereadme'] = 'Stream theme';
$string['hiddencourse'] = 'This course is hidden from students.';
Expand All @@ -38,6 +39,7 @@
$string['facebookurl'] = 'Facebook URL';
$string['instagramurl'] = 'Instagram URL';
$string['pinteresturl'] = 'Pinterest URL';
$string['themesettings'] = 'Theme settings';
$string['youtubeurl'] = 'Youtube URL';
$string['linkedinurl'] = 'Linkedin URL';
$string['twitterurl'] = 'Twitter URL';
Expand Down Expand Up @@ -75,7 +77,8 @@
$string['maxcatnumber'] = 'Max categories to show';
$string['maxcatnumber_desc'] = 'Max number of categories we should show in the widget; Your query will be limited to this.';
$string['catwidgetimage'] = 'Category card image';
$string['catwidgetimage_desc'] = 'You can choose a defaut image to be showed if a givencategory is missing images from the courses. This image will be repeated if there more than one category missing images.';
$string['catwidgetimage_desc'] = 'You can choose a default image to be showed if a givencategory is missing images from the courses.
This image will be repeated if there are more than one category missing images.';
$string['bunnyfonts'] = 'External font to use';
$string['bunnyfonts_desc'] = 'Select which Bunny Font to use. This service is EU based and doesn\'t store any data. More info: https://bunny.net/fonts/';
$string['externalfonts'] = 'External fonts';
Expand Down
2 changes: 2 additions & 0 deletions lang/pt/theme_stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
defined('MOODLE_INTERNAL') || die();

$string['pluginname'] = 'Stream';
$string['manageusers'] = 'Gerir utilizadores';
$string['choosereadme'] = 'Tema Stream';
$string['hiddencourse'] = 'Este curso está oculto para estudantes.';
$string['frontendby'] = 'Através do tema Stream';
$string['generalsettings'] = 'Configurações gerais';
$string['courseheaderimg'] = 'Imagem standard de cabeçalho';
$string['courseheaderimg_desc'] = 'Imagem comum para ser usada nos cabeçalhos dos cursos caso não exista uma particular no contexto do curso';
$string['footersettings'] = 'Conteúdo para rodapé';
$string['themesettings'] = 'Configurações do tema';
$string['socialmedia'] = 'Redes Sociais';
$string['facebookurl'] = 'Endereço Facebook';
$string['instagramurl'] = 'Endereço Instagram';
Expand Down
1 change: 0 additions & 1 deletion layout/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@
'loginimg' => $loginimage,
];

$PAGE->requires->js_call_amd('theme_stream/togglepassword', 'init');
echo $OUTPUT->render_from_template('theme_stream/login', $templatecontext);

29 changes: 10 additions & 19 deletions scss/_interface.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,20 @@ footer {
background-color: $white;
}
#login {
input,
button {
input[name=username] {
width: 100%;
}
}
// Toogle password icon position.
.login-form-password {
position: relative;
.fa {
position: absolute;
right: 0.5rem;
top: 0.7rem;
cursor: pointer;
}
}
// .login-form-password {
// position: relative;
// .fa {
// position: absolute;
// right: 0.5rem;
// top: 0.7rem;
// cursor: pointer;
// }
// }
.login-image img {
object-fit: cover;
object-position: left;
Expand Down Expand Up @@ -196,14 +195,6 @@ header {

}
}
// Fixes courses deck width on the dashboard and my courses.
.dashboard-card-deck:not(.fixed-width-cards) {
@media (min-width: 840px) {
.dashboard-card {
width: calc(25% - #{$card-gutter});
}
}
}
// Back to top button.

#back-to-top {
Expand Down

0 comments on commit 1116a42

Please sign in to comment.