Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
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
cf142399
Commit
cf142399
authored
Dec 21, 2015
by
Daniel Neis Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix conding style
parent
ed1a6ee3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
block_featuredcourses.php
block_featuredcourses.php
+11
-16
No files found.
block_featuredcourses.php
View file @
cf142399
...
...
@@ -26,12 +26,12 @@ defined('MOODLE_INTERNAL') || die();
class
block_featuredcourses
extends
block_base
{
function
init
()
{
public
function
init
()
{
$this
->
title
=
get_string
(
'pluginname'
,
'block_featuredcourses'
);
}
function
get_content
()
{
global
$CFG
,
$OUTPUT
;
public
function
get_content
()
{
global
$CFG
;
if
(
$this
->
content
!==
null
)
{
return
$this
->
content
;
...
...
@@ -48,7 +48,7 @@ class block_featuredcourses extends block_base {
$this
->
content
->
footer
=
''
;
$this
->
content
->
text
=
''
;
// user/index.php expect course context, so get one if page has module context.
//
The
user/index.php expect course context, so get one if page has module context.
$currentcontext
=
$this
->
page
->
context
->
get_course_context
(
false
);
if
(
empty
(
$currentcontext
))
{
...
...
@@ -66,14 +66,11 @@ class block_featuredcourses extends block_base {
$content
=
''
;
// course name
$coursename
=
$chelper
->
get_course_formatted_name
(
$course
);
$coursenamelink
=
html_writer
::
link
(
new
moodle_url
(
'/course/view.php'
,
array
(
'id'
=>
$course
->
id
)),
$coursename
,
array
(
'class'
=>
$course
->
visible
?
''
:
'dimmed'
));
$content
.
=
html_writer
::
tag
(
'div'
,
$coursenamelink
,
array
(
'class'
=>
'coursename'
));
// display course summary
if
(
$course
->
has_summary
())
{
$content
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'summary'
));
$content
.
=
$chelper
->
get_course_formatted_summary
(
$course
,
...
...
@@ -85,7 +82,7 @@ class block_featuredcourses extends block_base {
$contentimages
=
$contentfiles
=
''
;
foreach
(
$course
->
get_course_overviewfiles
()
as
$file
)
{
$isimage
=
$file
->
is_valid_image
();
$url
=
file_encode_url
(
"
$CFG->wwwroot
/pluginfile.php"
,
$url
=
file_encode_url
(
"
{
$CFG
->
wwwroot
}
/pluginfile.php"
,
'/'
.
$file
->
get_contextid
()
.
'/'
.
$file
->
get_component
()
.
'/'
.
$file
->
get_filearea
()
.
$file
->
get_filepath
()
.
$file
->
get_filename
(),
!
$isimage
);
if
(
$isimage
)
{
...
...
@@ -103,7 +100,6 @@ class block_featuredcourses extends block_base {
}
$content
.
=
$contentimages
.
$contentfiles
;
$this
->
content
->
text
.
=
$content
.
'</div>'
;
}
}
...
...
@@ -111,24 +107,23 @@ class block_featuredcourses extends block_base {
return
$this
->
content
;
}
// my moodle can only have SITEID and it's redundant here, so take it away
public
function
applicable_formats
()
{
return
array
(
'all'
=>
false
,
'site'
=>
true
,
'site-index'
=>
true
);
return
array
(
'all'
=>
false
,
'site'
=>
true
,
'site-index'
=>
true
);
}
public
function
instance_allow_multiple
()
{
return
false
;
}
function
has_config
()
{
return
true
;}
public
function
has_config
()
{
return
true
;
}
public
function
cron
()
{
return
true
;
}
static
function
get_featured_courses
()
{
public
static
function
get_featured_courses
()
{
global
$DB
;
$sql
=
'SELECT c.id, c.shortname, c.fullname, fc.sortorder
...
...
@@ -139,7 +134,7 @@ class block_featuredcourses extends block_base {
return
$DB
->
get_records_sql
(
$sql
);
}
static
function
delete_featuredcourse
(
$courseid
)
{
public
static
function
delete_featuredcourse
(
$courseid
)
{
global
$DB
;
return
$DB
->
delete_records
(
'block_featuredcourses'
,
array
(
'courseid'
=>
$courseid
));
}
...
...
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