Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
M
moodle-block_featuredcourses
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel Neis Araujo
moodle-block_featuredcourses
Commits
47f0a3dd
Commit
47f0a3dd
authored
May 14, 2015
by
Daniel Neis Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
excluindo cursos em destaque
parent
ac978278
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
0 deletions
+127
-0
block_featuredcourses.php
block_featuredcourses.php
+5
-0
delete_featuredcourse.php
delete_featuredcourse.php
+69
-0
delete_featuredcourse_form.php
delete_featuredcourse_form.php
+47
-0
featuredcourses_form.php
featuredcourses_form.php
+3
-0
lang/en/block_featuredcourses.php
lang/en/block_featuredcourses.php
+3
-0
No files found.
block_featuredcourses.php
View file @
47f0a3dd
...
...
@@ -138,4 +138,9 @@ class block_featuredcourses extends block_base {
ORDER BY sortorder'
;
return
$DB
->
get_records_sql
(
$sql
);
}
static
function
delete_featuredcourse
(
$courseid
)
{
global
$DB
;
return
$DB
->
delete_records
(
'block_featuredcourses'
,
array
(
'courseid'
=>
$courseid
));
}
}
delete_featuredcourse.php
0 → 100644
View file @
47f0a3dd
<?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/>.
/**
* deletes a featured course
*
* @package block_featuredcourses
* @author Daniel Neis
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
require_once
(
"../../config.php"
);
require_once
(
$CFG
->
dirroot
.
'/blocks/featuredcourses/delete_featuredcourse_form.php'
);
$courseid
=
required_param
(
'courseid'
,
PARAM_INT
);
$PAGE
->
set_url
(
'/blocks/featuredcourses/delete_featuredcourse.php'
,
array
(
'courseid'
=>
$courseid
));
$context
=
context_system
::
instance
();
$PAGE
->
set_context
(
$context
);
require_login
();
require_capability
(
'block/featuredcourses:addinstance'
,
$context
);
$mform
=
new
block_featuredcourses_delete_featuredcourse_form
();
$newformdata
=
array
(
'courseid'
=>
$courseid
,
'confirmdelete'
=>
'1'
);
$mform
->
set_data
(
$newformdata
);
$formdata
=
$mform
->
get_data
();
if
(
$mform
->
is_cancelled
())
{
redirect
(
$CFG
->
wwwroot
.
'/blocks/featuredcourses/featuredcourses.php'
);
}
if
(
isset
(
$formdata
->
confirmdelete
)
AND
$formdata
->
confirmdelete
==
1
)
{
require_once
(
$CFG
->
dirroot
.
'/blocks/moodleblock.class.php'
);
require_once
(
$CFG
->
dirroot
.
'/blocks/featuredcourses/block_featuredcourses.php'
);
block_featuredcourses
::
delete_featuredcourse
(
$formdata
->
courseid
);
redirect
(
$CFG
->
wwwroot
.
'/blocks/featuredcourses/featuredcourses.php'
);
}
$title
=
get_string
(
'delete_featuredcourse'
,
'block_featuredcourses'
);
$PAGE
->
navbar
->
add
(
$title
);
$PAGE
->
set_heading
(
$title
);
$PAGE
->
set_title
(
$title
);
echo
$OUTPUT
->
header
(),
$OUTPUT
->
box_start
(
'generalbox errorboxcontent boxaligncenter boxwidthnormal'
),
html_writer
::
tag
(
'p'
,
get_string
(
'confirmdelete'
,
'block_featuredcourses'
),
array
(
'class'
=>
'bold'
));
$mform
->
display
();
echo
$OUTPUT
->
box_end
(),
$OUTPUT
->
footer
();
delete_featuredcourse_form.php
0 → 100644
View file @
47f0a3dd
<?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/>.
/**
* prints the form to confirm delete a featured course
*
* @package block_featuredcourses
* @author Daniel Neis
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
//It must be included from a Moodle page
if
(
!
defined
(
'MOODLE_INTERNAL'
))
{
die
(
'Direct access to this script is forbidden.'
);
}
require_once
(
$CFG
->
libdir
.
'/formslib.php'
);
class
block_featuredcourses_delete_featuredcourse_form
extends
moodleform
{
public
function
definition
()
{
$mform
=&
$this
->
_form
;
// hidden elements
$mform
->
addElement
(
'hidden'
,
'id'
);
$mform
->
setType
(
'id'
,
PARAM_INT
);
$mform
->
addElement
(
'hidden'
,
'courseid'
);
$mform
->
setType
(
'courseid'
,
PARAM_INT
);
$mform
->
addElement
(
'hidden'
,
'confirmdelete'
);
$mform
->
setType
(
'confirmdelete'
,
PARAM_INT
);
$this
->
add_action_buttons
(
true
,
get_string
(
'yes'
));
}
}
featuredcourses_form.php
View file @
47f0a3dd
...
...
@@ -13,6 +13,7 @@ class featuredcourses_form extends moodleform {
* Form definition.
*/
function
definition
()
{
global
$CFG
;
$mform
=
$this
->
_form
;
$availablecourses
=
$this
->
_customdata
[
'availablecourses'
];
// this contains the data of this form
...
...
@@ -35,6 +36,8 @@ class featuredcourses_form extends moodleform {
$mform
->
setType
(
'featured['
.
$c
->
id
.
'][sortorder]'
,
PARAM_INT
);
$mform
->
setDefault
(
'featured['
.
$c
->
id
.
'][sortorder]'
,
$c
->
sortorder
);
$mform
->
addElement
(
'static'
,
'link'
,
get_string
(
'deletelink'
,
'block_featuredcourses'
,
$CFG
->
wwwroot
.
'/blocks/featuredcourses/delete_featuredcourse.php?courseid='
.
$c
->
id
));
}
// Add a new featured course
...
...
lang/en/block_featuredcourses.php
View file @
47f0a3dd
...
...
@@ -37,3 +37,6 @@ $string['doadd'] = 'Check to add new featured course';
$string
[
'missingcourseid'
]
=
'You must select a course.'
;
$string
[
'sortorder'
]
=
'Sort order'
;
$string
[
'missingsortorder'
]
=
'You must set a sort order.'
;
$string
[
'deletelink'
]
=
'<a href="{$a}">Delete</a>'
;
$string
[
'delete_featuredcourse'
]
=
'Delete Featured Course'
;
$string
[
'confirmdelete'
]
=
'Are you sure you want to delete this course from the list of featured courses?'
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment