forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-82351 block_social_activities: migrate to reactive course editor
This commit integrate and clean the social activities block to use the standard course format outputs and the course editor modules. The code is similar to the one used in the site_main_menu block and cleanup most of the ancient code.
- Loading branch information
1 parent
9f544e7
commit 3b7d05e
Showing
10 changed files
with
483 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?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 block_social_activities\output; | ||
|
||
use core_courseformat\base as courseformat; | ||
use renderable; | ||
use section_info; | ||
use templatable; | ||
|
||
/** | ||
* Class blocksection | ||
* | ||
* @package block_social_activities | ||
* @copyright 2024 Ferran Recio <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class blocksection implements renderable, templatable { | ||
|
||
/** | ||
* The class constructor. | ||
* | ||
* @param courseformat $format the course format instance | ||
* @param section_info $section the section to render | ||
*/ | ||
public function __construct( | ||
/** @var courseformat $format the course format instance. */ | ||
protected courseformat $format, | ||
/** @var section_info $section the section to render. */ | ||
protected section_info $section, | ||
) { | ||
} | ||
|
||
/** | ||
* Export for template. | ||
* | ||
* @param \renderer_base $output | ||
* @return array | ||
*/ | ||
public function export_for_template(\renderer_base $output) { | ||
$format = $this->format; | ||
$course = $format->get_course(); | ||
$section = $this->section; | ||
|
||
$sectionoutputclass = $format->get_output_classname('content\\section\\cmlist'); | ||
$sectionoutput = new $sectionoutputclass($format, $section); | ||
|
||
$cmlist = $output->render($sectionoutput); | ||
|
||
return [ | ||
'siteid' => $course->id, | ||
'cmlist' => $cmlist, | ||
'sectionid' => $section->id, | ||
'sectionname' => $format->get_section_name($section), | ||
'sectionnum' => $section->sectionnum, | ||
'editing' => $format->show_editor(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
.block_social_activities li { | ||
clear: both; | ||
/* Imitate mobile grid for activity card. */ | ||
.block_social_activities .activity-item .activity-grid { | ||
grid-template-columns: min-content 1fr min-content min-content min-content; | ||
grid-template-rows: 1fr repeat(4, min-content); | ||
grid-template-areas: | ||
"icon name actions" | ||
"visibility visibility visibility" | ||
"dates dates dates" | ||
"completion completion completion" | ||
"altcontent altcontent altcontent" | ||
"afterlink afterlink afterlink" | ||
"availability availability availability"; | ||
} | ||
|
||
.block_social_activities li .column { | ||
width: 100%; | ||
.block_social_activities .activity-item .activity-grid.noname-grid { | ||
grid-template-columns: 1fr min-content; | ||
grid-template-areas: | ||
"actions" | ||
"visibility" | ||
"altcontent" | ||
"groupmode" | ||
"afterlink" | ||
"completion" | ||
"availability"; | ||
} | ||
|
||
.block_social_activities li .buttons a img { | ||
vertical-align: text-bottom; | ||
.block_social_activities .activity-item .activity-grid.noname-grid .activity-actions { | ||
justify-self: end; | ||
} | ||
|
||
.block_social_activities .instancename { | ||
word-break: break-all; | ||
/* Hide extra edit elements in block space. */ | ||
.block_social_activities .activity-groupmode-info { | ||
display: none; | ||
} |
Oops, something went wrong.