Skip to content

Commit 640c524

Browse files
committed
Adição de módulo para informar andamento do curso
1 parent 6150343 commit 640c524

18 files changed

+2304
-0
lines changed

blocks/completion_progress/README.txt

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The Completion Progress block is a time-management tool for students.
2+
It visually shows what activities/resources a student is supposed to interact with in a course.
3+
It is colour-coded so students can quickly see what they have and have not completed/viewed.
4+
The block shows activities with activity completion settings.
5+
6+
To Install
7+
1. Copy the completion_progress directory to the blocks/ directory of your Moodle instance
8+
2. Visit the notifications page
9+
10+
For more information, visit...
11+
http://docs.moodle.org/en/Installing_contributed_modules_or_plugins
12+
13+
Once the Completion Progress block is installed, you can use it in a course as follows.
14+
15+
1. Turn editing on
16+
2. Create your activities/resources as normal
17+
3. Set completion settings for each activity you want to appear in the bar, including an expected by date
18+
4. Add the Completion Progress block to your page
19+
5. Move your block into a prominent position
20+
6. (Optional) Configure how the block should appear
21+
22+
Hidden items will not appear in the Completion Progress block until they are visible to students.
23+
This is useful for a scheduled release of activities.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Backup task for the Completion Progress block
19+
*
20+
* @package block_completion_progress
21+
* @copyright 2016 Michael de Raadt
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
class restore_completion_progress_block_task extends restore_block_task {
25+
26+
/**
27+
* Translates the backed up configuration data for the target course modules.
28+
*
29+
* @global type $DB
30+
*/
31+
public function after_restore() {
32+
global $DB;
33+
34+
// Get the blockid.
35+
$id = $this->get_blockid();
36+
37+
// Get restored course id.
38+
$courseid = $this->get_courseid();
39+
40+
if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $id))) {
41+
$config = (array)unserialize(base64_decode($configdata));
42+
$newactivities = array();
43+
44+
// Translate the old config information to the target course values.
45+
foreach ($config['selectactivities'] as $index => $value) {
46+
$matches = array();
47+
preg_match('/(.+)-(\d+)/', $value, $matches);
48+
if (!empty($matches)) {
49+
$module = $matches[1];
50+
$instance = $matches[2];
51+
52+
// Find the mapped instance ID.
53+
if ($newinstance = restore_dbops::get_backup_ids_record($this->get_restoreid(), $module, $instance)) {
54+
$newinstanceid = $newinstance->newitemid;
55+
$newactivities[] = "$module-$newinstanceid";
56+
}
57+
}
58+
}
59+
60+
// Save everything back to DB.
61+
$config['selectactivities'] = $newactivities;
62+
$configdata = base64_encode(serialize((object)$config));
63+
$DB->set_field('block_instances', 'configdata', $configdata, array('id' => $id));
64+
}
65+
}
66+
67+
/**
68+
* There are no unusual settings for this restore
69+
*/
70+
protected function define_my_settings() {
71+
}
72+
73+
/**
74+
* There are no unusual steps for this restore
75+
*/
76+
protected function define_my_steps() {
77+
}
78+
79+
/**
80+
* There are no files associated with this block
81+
*
82+
* @return array An empty array
83+
*/
84+
public function get_fileareas() {
85+
return array();
86+
}
87+
88+
/**
89+
* There are no specially encoded attributes
90+
*
91+
* @return array An empty array
92+
*/
93+
public function get_configdata_encoded_attributes() {
94+
return array();
95+
}
96+
97+
/**
98+
* There is no coded content in the backup
99+
*
100+
* @return array An empty array
101+
*/
102+
static public function define_decode_contents() {
103+
return array();
104+
}
105+
106+
/**
107+
* There are no coded links in the backup
108+
*
109+
* @return array An empty array
110+
*/
111+
static public function define_decode_rules() {
112+
return array();
113+
}
114+
}

0 commit comments

Comments
 (0)