Skip to content

Commit 5943cbf

Browse files
committed
Adição de blocos para exibir tempo que falta para aluno acabar curso
1 parent 947a4fe commit 5943cbf

26 files changed

+1667
-0
lines changed

blocks/enrol_duration/.gitattributes

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain

blocks/enrol_duration/README.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This plugin shows the remaining days in the users enrolment in the course. It also gives the date when the enrolment ends.
2+
==Future Features==
3+
Note: these features are subject to change.
4+
* Show remaining time in weeks, days, hours, minutes, or seconds
5+
* Add user defined text at bottom of block
6+
* Choose date style
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
3+
// This file is part of Moodle - http://moodle.org/
4+
//
5+
// Moodle is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// Moodle is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17+
18+
/**
19+
* Main code for Enrolment duration image block.
20+
*
21+
* @package block_enrol_duration
22+
* @copyright 2012 Nathan Robbins (https://github.com/nrobbins)
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
26+
class block_enrol_duration extends block_base {
27+
28+
function init() {
29+
$this->title = get_string('pluginname', 'block_enrol_duration');
30+
}
31+
32+
function applicable_formats() {
33+
return array(
34+
'all' => false,
35+
'course' => true
36+
);
37+
}
38+
39+
function specialization() {
40+
$this->title = isset($this->config->title) ? format_string($this->config->title) : format_string(get_string('pluginname', 'block_enrol_duration'));
41+
}
42+
43+
function instance_allow_multiple() {
44+
return false;
45+
}
46+
47+
function get_content() {
48+
global $CFG, $USER, $DB;
49+
require_once('lib.php');
50+
51+
if ($this->content !== null) {
52+
return $this->content;
53+
}
54+
55+
$userid = $USER->id;
56+
$courseid = $this->page->course->id;
57+
58+
$duration = $DB->get_record_sql('SELECT ue.timeend '.
59+
'FROM {user_enrolments} ue, {enrol} e '.
60+
'WHERE ue.userid = ? '.
61+
'AND ue.enrolid = e.id '.
62+
'AND e.courseid= ?', array($userid, $courseid));
63+
64+
$this->content = new stdClass;
65+
66+
if ($duration && ($duration->timeend > time())) {
67+
$days = ceil(($duration->timeend - time())/ 86400);
68+
$weeks = $days / 7;
69+
$date = getdate($duration->timeend);
70+
/* Future support for international date formats
71+
if($this->config->dateformat = 'mdy'){
72+
$fulldate = $date['month'] .' '. $date['mday'] .', '. $date['year'];
73+
} else {
74+
$fulldate = $date['mday'] .' '. $date['month'] .', '. $date['year'];
75+
}
76+
*/
77+
setlocale(LC_ALL,'pt_BR');
78+
$fulldate = $date['mday'] . ' de '. strftime('%B',$duration->timeend) .' de '. $date['year'];
79+
$coursename = $this->page->course->fullname;
80+
81+
$this->content->text = '<p>'.get_string('enrolmentin', 'block_enrol_duration').' <em>'.$coursename.'</em> '.
82+
get_string('expiresin', 'block_enrol_duration').'<br>';
83+
$this->content->text .= '<strong>'.$days.' '.get_string('days', 'block_enrol_duration').'</strong>';
84+
$this->content->text .= ': '.$fulldate.'.</p>'.'<p>Hor&aacute;rio de Bras&iacute;lia, DF.</p>';
85+
} else {
86+
$this->content->text = '<p>'.get_string('enrolmentin', 'block_enrol_duration').' <em>'.$this->page->course->fullname.
87+
'</em> '.get_string('noexpiration', 'block_enrol_duration').'.</p>'.'<p>Hor&aacute;rio de Bras&iacute;lia, DF.</p>';
88+
}
89+
$this->content->footer = '';
90+
91+
return $this->content;
92+
}
93+
}

blocks/enrol_duration/db/access.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
* Blog tags block caps.
19+
*
20+
* @package block_enrol_duration
21+
* @copyright 2012 Nathan Robbins (https://github.com/nrobbins)
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
25+
defined('MOODLE_INTERNAL') || die();
26+
27+
$capabilities = array(
28+
29+
'block/enrol_duration:addinstance' => array(
30+
'riskbitmask' => '',
31+
32+
'captype' => 'write',
33+
'contextlevel' => CONTEXT_BLOCK,
34+
'archetypes' => array(
35+
'editingteacher' => CAP_ALLOW,
36+
'manager' => CAP_ALLOW
37+
),
38+
39+
'clonepermissionsfrom' => 'moodle/site:manageblocks'
40+
),
41+
);

blocks/enrol_duration/edit_form.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
// This file is part of Moodle - http://moodle.org/
4+
//
5+
// Moodle is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// Moodle is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17+
18+
/**
19+
* Form for editing the Enrolment duration block instances.
20+
*
21+
* @package block_enrol_duration
22+
* @copyright 2012 Nathan Robbins (https://github.com/nrobbins)
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
class block_enrol_duration_edit_form extends block_edit_form {
26+
protected function specific_definition($mform) {
27+
// Fields for editing HTML block title and contents.
28+
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
29+
30+
$mform->addElement('text', 'config_title', get_string('configtitle', 'block_enrol_duration'));
31+
$mform->setType('config_title', PARAM_MULTILANG);
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
// This file is part of Moodle - http://moodle.org/
4+
//
5+
// Moodle is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// Moodle is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17+
18+
/**
19+
* Strings for component 'block_enrol_duration', language 'en', branch 'MOODLE_20_STABLE'
20+
*
21+
* @package block_enrol_duration
22+
* @copyright 2012 Nathan Robbins (https://github.com/nrobbins)
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
26+
$string['configtitle'] = 'Block title';
27+
$string['pluginname'] = 'Enrolment Duration';
28+
$string['enrolmentin'] = 'Your enrolment in';
29+
$string['expiresin'] = 'expires in';
30+
$string['days'] = 'days';
31+
$string['noexpiration'] = 'does not expire';
32+
$string['enrol_duration:addinstance'] = 'Add a new Enrolment Duration block';

blocks/enrol_duration/version.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
* Version details
19+
*
20+
* @package block
21+
* @subpackage enrol_duration
22+
* @copyright 2012 Nathan Robbins (https://github.com/nrobbins)
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
26+
defined('MOODLE_INTERNAL') || die();
27+
28+
$plugin->version = 2012111800; // The current plugin version (Date: YYYYMMDDXX)
29+
$plugin->requires = 2011112900; // Requires this Moodle version
30+
$plugin->component = 'block_enrol_duration'; // Full name of the plugin (used for diagnostics)
31+
$plugin->maturity = MATURITY_STABLE;
32+
$plugin->release = "1"; // User-friendly version number

blocks/enrolmenttimer/.travis.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
language: php
2+
3+
sudo: false
4+
5+
cache:
6+
directories:
7+
- $HOME/.composer/cache
8+
9+
php:
10+
- 5.6
11+
- 7.0
12+
13+
matrix:
14+
allow_failures:
15+
- php: 7.0
16+
17+
env:
18+
matrix:
19+
- DB=mysqli MOODLE_BRANCH=MOODLE_29_STABLE
20+
- DB=mysqli MOODLE_BRANCH=MOODLE_30_STABLE
21+
- DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE
22+
- DB=mysqli MOODLE_BRANCH=MOODLE_32_STABLE
23+
- DB=pgsql MOODLE_BRANCH=MOODLE_29_STABLE
24+
- DB=pgsql MOODLE_BRANCH=MOODLE_30_STABLE
25+
- DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE
26+
- DB=pgsql MOODLE_BRANCH=MOODLE_32_STABLE
27+
28+
29+
before_install:
30+
- cd ../..
31+
- composer selfupdate
32+
- composer create-project -n --no-dev moodlerooms/moodle-plugin-ci ci ^1
33+
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
34+
35+
install:
36+
- moodle-plugin-ci install
37+
38+
script:
39+
- moodle-plugin-ci phplint
40+
- moodle-plugin-ci phpcpd
41+
- moodle-plugin-ci phpmd
42+
- moodle-plugin-ci codechecker
43+
- moodle-plugin-ci csslint
44+
- moodle-plugin-ci shifter
45+
- moodle-plugin-ci jshint
46+
- moodle-plugin-ci phpunit
47+
- moodle-plugin-ci behat

0 commit comments

Comments
 (0)