Skip to content

Commit

Permalink
New Conecta template
Browse files Browse the repository at this point in the history
  • Loading branch information
davidherney committed Oct 10, 2024
1 parent bc85a72 commit 133cd8e
Show file tree
Hide file tree
Showing 16 changed files with 1,812 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ and are based on the resources of: [RutaTIC](https://rutatic.udea.edu.co/crotalu
- **Powered by:** [BambuCo](https://bambuco.co/)

## In version ##
2024082101:
- New template: conecta. Funded by [Engagement](https://www.engagement.com.co/)
- Contacts feature with give coins.

2024082100:
- Compatibility with Moodle 4.3+

Expand Down
14 changes: 13 additions & 1 deletion classes/avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,19 @@ public function get_busturi() {
* @return string Image URI.
*/
public static function default_avatar() {
global $OUTPUT;
global $OUTPUT, $CFG;

$template = get_config('block_ludifica', 'templatetype');

if ($template != 'default') {
$exts = ['svg', 'png', 'jpg', 'jpeg', 'gif'];
foreach ($exts as $ext) {
$path = $CFG->dirroot . '/blocks/ludifica/templates/' . $template . '/defaultavatar.' . $ext;
if (file_exists($path)) {
return $CFG->wwwroot . '/blocks/ludifica/templates/' . $template . '/defaultavatar.' . $ext;
}
}
}

return (string)$OUTPUT->image_url('defaultavatar', 'block_ludifica');
}
Expand Down
3 changes: 2 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@

.block_ludifica .rankingprofile {
display: flex;
align-items: flex-start;
align-items: center;
}

.block_ludifica .rankingprofile p,
Expand All @@ -620,6 +620,7 @@
border-radius: 50%;
border: 1px solid #4c4c4c;
margin-right: 10px;
background-color: #fff8;
}

.lateralbar-ludifica > div > div,
Expand Down
86 changes: 86 additions & 0 deletions templates/conecta/avatars.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{{!
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/>.
}}
{{!
@template block_ludifica/conecta/avatars
This template renders the template content area for a resource.
Example context (json):
{
"avatars": [],
"baseurl": "https://moodle_wwwroot_url"
}
}}

{{>block_ludifica/storetabs}}
<div class="block_ludifica ludifica-page">
<button class="ludifica_help icon fa fa-question-circle" data-toggle="popover" data-container="body" data-placement="right" data-content="{{#str}}avatar_help, block_ludifica{{/str}}"></button>
{{>block_ludifica/conecta/buttonsbar}}
<div id="avatars-list" class="row">
{{#avatars}}
<div id="avatar-{{id}}" class="oneavatar {{^userhas}}usernothas{{/userhas}} {{#userhas}}userhas{{/userhas}} {{#inuse}}inuse{{/inuse}}">
<div class="card">
<strong class="card-header">
<i class="fa fa-check-circle used"></i> {{name}}
</strong>
<div class="avatarcontent">
<div class="picture-box">
<img class="thumbnail" src="{{uri}}" alt="{{name}}" />
<div class="cost">
{{#str}} numcoins, block_ludifica, {{cost}} {{/str}}</strong>
</div>
</div>
<div class="description">
{{{description}}}
</div>
</div>
<div class="card-footer">
{{#notenabledtext}}
<div class="alert alert-dismissible alert-danger">
{{notenabledtext}}
</div>
{{/notenabledtext}}
{{^notenabledtext}}
{{^userhas}}
<button type="button" class="btn btn-primary" data-action="buy" data-id="{{id}}">
{{#str}} buy, block_ludifica {{/str}}
</button>
{{/userhas}}
<button type="button" class="btn btn-primary" data-action="use" data-id="{{id}}">
{{#str}} use, block_ludifica {{/str}}
</button>
{{/notenabledtext}}
{{#canedit}}
<a href="{{baseurl}}/blocks/ludifica/avatar_edit.php?id={{id}}" class="btn btn-primary">{{#str}} edit {{/str}}</a>
<a href="{{baseurl}}/blocks/ludifica/avatars.php?delete={{id}}&sesskey={{sesskey}}" class="btn btn-danger">{{#str}} delete {{/str}}</a>
{{/canedit}}
</div>
</div>
</div>
{{/avatars}}
{{^avatars}}
<p class="notavailableyet">
{{#str}} noavatars, block_ludifica {{/str}}
</p>
{{/avatars}}
</div>
{{#canedit}}
<div>
<a href="{{baseurl}}/blocks/ludifica/avatar_edit.php" class="btn btn-primary btncanedit">{{#str}} avatarnew, block_ludifica {{/str}}</a>
</div>
{{/canedit}}
</div>
93 changes: 93 additions & 0 deletions templates/conecta/badges.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{{!
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/>.
}}
{{!
@template block_ludifica/conecta/badges
This template renders the template content area for a resource.
Example context (json):
{
"badges": [],
"baseurl": "https://moodle_wwwroot_url"
}
}}

{{>block_ludifica/storetabs}}
<div class="block_ludifica ludifica-page">
<button class="ludifica_help icon fa fa-question-circle" data-toggle="popover" data-container="body" data-placement="right" data-content="{{#str}}badges_help, block_ludifica{{/str}}"></button>
{{>block_ludifica/conecta/buttonsbar}}
<div id="badges-list" class="row">
{{#badges}}
<div id="badge-{{id}}" class="col-lg-6 onebadge {{unavailable}} {{#inactive}}notactive{{/inactive}}" data-name="{{name}}" data-uniquehash="{{uniquehash}}" data-year="{{year}}" data-month="{{month}}">
<div class="card">
<h3 class="card-header">
{{name}}
{{#unavailablewarning}}<span class="unavailablewarning">{{unavailablewarning}}</span>{{/unavailablewarning}}
</h3>
<div class="card-body badgecontent {{unavailable}}">
<div class="picture-box">
{{#url}}<a href="{{url}}" class="shareurl">{{/url}}
{{{thumbnail}}}
{{#url}}</a>{{/url}}
</div>
<div class="info-box">
<p>{{description}}</p>
{{^inactive}}
<button class="btn btn-secondary openshare" data-badgeid="{{id}}">
{{#pix}} i/publish, core {{/pix}} {{#str}} badge_share, block_ludifica {{/str}}
</button>
{{/inactive}}
<div class="share_badge_modal block_ludifica-modal" title="{{#str}} badge_share_title, block_ludifica {{/str}}"></div>
<div class="expirebadge">
{{#dateexpire}}
<hr>
<p><em>{{#str}} badge_expire, block_ludifica {{/str}} {{expire}}</em></p>
{{/dateexpire}}
</div>
</div>
</div>
{{#canedit}}
<div class="card-footer improvecriteria">
<h5>{{#str}} improvecriteria, block_ludifica {{/str}}</h5>
{{#currentcriteria}}
<span class="badge bg-primary rounded-pill" data-type="{{type}}">{{label}}</span>
{{/currentcriteria}}
{{^hascriteria}}
{{#str}} improvecriterianot, block_ludifica {{/str}}
{{/hascriteria}}
{{#inactive}}
<a class="btn btn-link" href="{{baseurl}}/blocks/ludifica/improvecriteria.php?badgeid={{id}}">
{{#pix}} i/settings, core {{/pix}}
</a>
{{/inactive}}
</div>
{{/canedit}}
</div>
</div>
{{/badges}}
{{^badges}}
<p class="notavailableyet">
{{#str}} notuserbadges, block_ludifica {{/str}}
</p>
{{/badges}}
</div>
{{#canedit}}
<div>
<a href="{{baseurl}}/badges/index.php?type=1" class="btn btn-primary btncanedit">{{#str}} badgemanage, block_ludifica {{/str}}</a>
</div>
{{/canedit}}
</div>
43 changes: 43 additions & 0 deletions templates/conecta/buttonsbar.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{!
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/>.
}}
{{!
@template block_ludifica/conecta/buttonsbar
This template renders the template content area for a resource.
Example context (json):
{
"player": {
"fullname": "Pepito Perez",
"avatarurl": "https://moodle_wwwroot_url/some_image"
},
"baseurl": "https://moodle_wwwroot_url"
}
}}

{{#myprofile}}
<div class="conecta-btns">
{{#player}}
{{#hashomeurl}}
<a href="{{homeurl}}" data-ludifica-tab="profile"><span>{{#str}} home, block_ludifica {{/str}}</span></a>
{{/hashomeurl}}
{{/player}}
<a href="{{baseurl}}/blocks/ludifica/avatars.php" class="avatars-btn {{#current}}current-user{{/current}}"><span>{{#str}} avatars, block_ludifica {{/str}}</span></a>
<a href="{{baseurl}}/blocks/ludifica/badges.php" class="badges-btn image-container"><span>{{#str}} badges, block_ludifica {{/str}}</span></a>
<a href="{{baseurl}}/blocks/ludifica/tickets.php" class="store-btn {{#current}}current-user{{/current}}"><span>{{#str}} benefits, block_ludifica {{/str}}</span></a>
</div>
{{/myprofile}}
5 changes: 5 additions & 0 deletions templates/conecta/defaultavatar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 133cd8e

Please sign in to comment.