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
b6665125
Commit
b6665125
authored
Apr 04, 2018
by
Daniel Neis Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for 3.4
parent
6014a613
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
51 deletions
+45
-51
block_featuredcourses.php
block_featuredcourses.php
+40
-46
version.php
version.php
+5
-5
No files found.
block_featuredcourses.php
View file @
b6665125
...
...
@@ -24,6 +24,9 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
require_once
(
$CFG
->
libdir
.
'/coursecatlib.php'
);
require_once
(
$CFG
->
dirroot
.
'/course/renderer.php'
);
class
block_featuredcourses
extends
block_base
{
public
function
init
()
{
...
...
@@ -48,60 +51,51 @@ class block_featuredcourses extends block_base {
$this
->
content
->
footer
=
''
;
$this
->
content
->
text
=
''
;
// 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
))
{
return
$this
->
content
;
}
if
(
$this
->
page
->
course
->
id
==
SITEID
)
{
$courses
=
self
::
get_featured_courses
();
require_once
(
$CFG
->
libdir
.
'/coursecatlib.php'
);
$chelper
=
new
coursecat_helper
();
foreach
(
$courses
as
$course
)
{
$courses
=
self
::
get_featured_courses
();
$chelper
=
new
coursecat_helper
();
foreach
(
$courses
as
$course
)
{
$course
=
new
course_in_list
(
$course
);
$course
=
new
course_in_list
(
$course
);
$this
->
content
->
text
.
=
'<div class="container-fluid coursebox">'
;
$this
->
content
->
text
.
=
'<div class="container-fluid coursebox">'
;
$content
=
''
;
$content
=
''
;
$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'
));
$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'
));
if
(
$course
->
has_summary
())
{
$content
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'summary'
));
$content
.
=
$chelper
->
get_course_formatted_summary
(
$course
,
array
(
'overflowdiv'
=>
true
,
'noclean'
=>
true
,
'para'
=>
false
));
$content
.
=
html_writer
::
end_tag
(
'div'
);
}
if
(
$course
->
has_summary
())
{
$content
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'summary'
));
$content
.
=
$chelper
->
get_course_formatted_summary
(
$course
,
array
(
'overflowdiv'
=>
true
,
'noclean'
=>
true
,
'para'
=>
false
));
$content
.
=
html_writer
::
end_tag
(
'div'
);
}
// Display course overview files.
$contentimages
=
$contentfiles
=
''
;
foreach
(
$course
->
get_course_overviewfiles
()
as
$file
)
{
$isimage
=
$file
->
is_valid_image
();
$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
)
{
$contentimages
.
=
html_writer
::
tag
(
'div'
,
html_writer
::
empty_tag
(
'img'
,
array
(
'src'
=>
$url
,
'style'
=>
'max-height: 150px'
)),
array
(
'class'
=>
'courseimage'
));
}
else
{
$image
=
$this
->
output
->
pix_icon
(
file_file_icon
(
$file
,
24
),
$file
->
get_filename
(),
'moodle'
);
$filename
=
html_writer
::
tag
(
'span'
,
$image
,
array
(
'class'
=>
'fp-icon'
))
.
html_writer
::
tag
(
'span'
,
$file
->
get_filename
(),
array
(
'class'
=>
'fp-filename'
));
$contentfiles
.
=
html_writer
::
tag
(
'span'
,
html_writer
::
link
(
$url
,
$filename
),
array
(
'class'
=>
'coursefile fp-filename-icon'
));
}
// Display course overview files.
$contentimages
=
$contentfiles
=
''
;
foreach
(
$course
->
get_course_overviewfiles
()
as
$file
)
{
$isimage
=
$file
->
is_valid_image
();
$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
)
{
$contentimages
.
=
html_writer
::
tag
(
'div'
,
html_writer
::
empty_tag
(
'img'
,
array
(
'src'
=>
$url
,
'style'
=>
'max-height: 150px'
)),
array
(
'class'
=>
'courseimage'
));
}
else
{
$image
=
$this
->
output
->
pix_icon
(
file_file_icon
(
$file
,
24
),
$file
->
get_filename
(),
'moodle'
);
$filename
=
html_writer
::
tag
(
'span'
,
$image
,
array
(
'class'
=>
'fp-icon'
))
.
html_writer
::
tag
(
'span'
,
$file
->
get_filename
(),
array
(
'class'
=>
'fp-filename'
));
$contentfiles
.
=
html_writer
::
tag
(
'span'
,
html_writer
::
link
(
$url
,
$filename
),
array
(
'class'
=>
'coursefile fp-filename-icon'
));
}
$content
.
=
$contentimages
.
$contentfiles
;
$this
->
content
->
text
.
=
$content
.
'</div>'
;
}
$content
.
=
$contentimages
.
$contentfiles
;
$this
->
content
->
text
.
=
$content
.
'</div>'
;
}
return
$this
->
content
;
...
...
version.php
View file @
b6665125
...
...
@@ -18,14 +18,14 @@
* Version details
*
* @package block_featuredcourses
* @copyright Daniel Neis <danielneis@gmail.com>
* @copyright Daniel Neis
Araujo
<danielneis@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
version
=
2015042701
;
// The current plugin version (Date: YYYYMMDDXX)
$plugin
->
requires
=
201
4110400
;
// Requires this Moodle version
$plugin
->
release
=
2
;
$plugin
->
version
=
2015042701
;
// The current plugin version (Date: YYYYMMDDXX).
$plugin
->
requires
=
201
7111300
;
// Requires this Moodle version.
$plugin
->
release
=
3
;
$plugin
->
maturity
=
MATURITY_STABLE
;
$plugin
->
component
=
'block_featuredcourses'
;
// Full name of the plugin (used for diagnostics)
$plugin
->
component
=
'block_featuredcourses'
;
// Full name of the plugin (used for diagnostics)
.
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