Commit 8205ca80 authored by Son Nguyen's avatar Son Nguyen Committed by Robert Lyon

Add openbadgedisplayer plugin. Bug 1536393

behatnotneeded

Change-Id: I2bf98999f352747ecc5e16b5dbee34565f058573
parent 9b4927a3
<?php
defined('INTERNAL') || die();
function xmldb_blocktype_openbadgedisplayer_upgrade($oldversion = 0) {
if ($oldversion < 2015062301) {
$blocks = get_records_array('block_instance', 'blocktype', 'openbadgedisplayer');
if (is_array($blocks)) {
foreach ($blocks as $block) {
$configdata = unserialize($block->configdata);
if (isset($configdata['badgegroup'])) {
// Append source to legacy values
if (is_string($configdata['badgegroup'])) {
$configdata['badgegroup'] = 'backpack:' . $configdata['badgegroup'];
}
else if (is_array($configdata['badgegroup'])) {
foreach ($configdata['badgegroup'] as &$group) {
$group = str_replace('https://openbadgepassport.com/', 'passport', $group);
$group = str_replace('https://backpack.openbadges.org/', 'backpack', $group);
}
}
$block->configdata = serialize($configdata);
update_record('block_instance', $block, 'id');
}
}
}
}
return true;
}
\ No newline at end of file
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-openbadgedisplayer
* @author Discendum Oy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2012 Discedum Oy http://discendum.com
* @copyright (C) 2011 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['title'] = 'Open Badges';
$string['description'] = 'Display your Open Badges';
$string['issuerdetails'] = 'Issuer Details';
$string['badgedetails'] = 'Badge Details';
$string['issuancedetails'] = 'Issuance Details';
$string['name'] = 'Name';
$string['url'] = 'URL';
$string['organization'] = 'Organization';
$string['evidence'] = 'Evidence';
$string['issuedon'] = 'Issued On';
$string['expires'] = 'Expires';
$string['desc'] = 'Description';
$string['criteria'] = 'Criteria';
$string['nbadges'] = array('1 badge', '%s badges');
$string['nobackpack'] = 'No Backpack found.<br> Please add your <a href="%s" target="_blank">Backpack</a> email address to your <a href="%s">profile</a>.';
$string['nogroups'] = 'No public badge collections/badges found.<br> Please visit your <a href="%s" target="_blank">Backpack</a> and add your badges to some public collections.';
$string['confighelp'] = 'Select the badge collections to show in this block.<br/>Visit the following services to manage your collections and badges:<br/>%s';
$string['obppublicbadges'] = 'All public badges in Open Badge Passport';
$string['title_backpack'] = 'Mozilla Backpack';
$string['title_passport'] = 'Open Badge Passport';
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage lang
* @author Discendum Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2011 Discendum Ltd http://discendum.com
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['badgedetails'] = 'Merkin tiedot';
$string['confighelp'] = 'Valitse merkkiryhmät, joiden merkit näytetään tässä lohkossa.<br> Kirjaudu seuraaviin palveluihin hallitaksesi merkkejä ja merkkiryhmiä:<br/>%s';
$string['criteria'] = 'Kriteeri';
$string['desc'] = 'Kuvaus';
$string['description'] = 'Näytä Open Badget';
$string['evidence'] = 'Todiste';
$string['expires'] = 'Vanhenee';
$string['issuancedetails'] = 'Myöntämistiedot';
$string['issuedon'] = 'Myönnetty';
$string['issuerdetails'] = 'Myöntäjän tiedot';
$string['name'] = 'Nimi';
$string['nbadges'] = array(
0 => 'yksi merkki',
1 => '%s merkkiä',
);
$string['nobackpack'] = 'Backpackia ei löydy.<br> Lisää <a href="%s" target="_blank">Backpackiin</a> kytketty sähköpostiosoite <a hreft="%s">profiiliisi.</a>';
$string['nogroups'] = 'Julkisia merkkejä ei löydy.<br> Kirjaudu <a href="%s" target="_blank">Backpackiin</a> ja lisää merkkejä julkisiin merkkiryhmiin.';
$string['obppublicbadges'] = 'Kaikki julkiset merkit Open Badge Passportissa';
$string['organization'] = 'Organisaatio';
$string['title'] = 'Open Badge -merkit';
$string['title_backpack'] = 'Mozilla Backpack';
$string['title_passport'] = 'Open Badge Passport';
$string['url'] = 'URL';
\ No newline at end of file
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage lang
* @author Discendum Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2011 Discendum Ltd http://discendum.com
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['badgedetails'] = 'Badge Detaljer';
$string['confighelp'] = 'Välj badge samlingen som skall visas i detta block.<br> Gå till din <a href="%s" target="_blank">Ryggsäck</a> för att hantera samlingar och badges.';
$string['criteria'] = 'Kriterium';
$string['desc'] = 'Beskrivning';
$string['description'] = 'Visa Open Badges';
$string['evidence'] = 'Bevis';
$string['expires'] = 'Går ut';
$string['issuancedetails'] = 'Utfärdande Detaljer';
$string['issuedon'] = 'Beviljad På';
$string['issuerdetails'] = 'Utgivarens Detaljer';
$string['name'] = 'Namn';
$string['nbadges'] = array(
0 => '1 badge',
1 => '%s badges',
);
$string['nobackpack'] = 'Ingen ryggsäck hittades.<br> Lägg till din <a href="%s" target="_blank">Ryggsäcks</a> e-post adress till din <a href="%s">profil</a>.';
$string['nogroups'] = 'Inga allmänna badge samlingar hittades. <br> Gå till din <a href="%s" target="_blank">Ryggsäck</a> och lägg till dina badges till några allmänna samlingar.';
$string['organization'] = 'Organisation';
$string['title'] = 'Open Badges';
$string['url'] = 'URL';
This diff is collapsed.
{$sec = 'blocktype.openbadgedisplayer'}
<div class="badge-template badge-container">
<img class="badge-image" src="" />
<div class="openbadge-details">
<h3>{str tag=issuerdetails section=$sec}</h3>
<table>
<tbody>
<tr class="issuer-name"><td>{str tag=name section=$sec}</td><td class="value"></td></tr>
<tr class="issuer-url"><td>{str tag=url section=$sec}</td><td class="value"></td></tr>
<tr class="issuer-organization"><td>{str tag=organization section=$sec}</td><td class="value"></td></tr>
</tbody>
</table>
<h3>{str tag=badgedetails section=$sec}</h3>
<table>
<tbody>
<tr class="badge-name"><td>{str tag=name section=$sec}</td><td class="value"></td></tr>
<tr class="badge-description"><td>{str tag=desc section=$sec}</td><td class="value"></td></tr>
<tr class="badge-criteria"><td>{str tag=criteria section=$sec}</td><td class="value"></td></tr>
</tbody>
</table>
<h3>{str tag=issuancedetails section=$sec}</h3>
<table>
<tbody>
<tr class="issuance-evidence"><td>{str tag=evidence section=$sec}</td><td class="value"></td></tr>
<tr class="issuance-issuedon"><td>{str tag=issuedon section=$sec}</td><td class="value"></td></tr>
<tr class="issuance-expires"><td>{str tag=expires section=$sec}</td><td class="value"></td></tr>
</tbody>
</table>
</div>
</div>
\ No newline at end of file
<div id="openbadges{$id}" class="openbadgedisplayer">{$badgehtml|safe}</div>
<script type="text/javascript">
(function ($) {
var blockid = {$id};
var has_pagemodal = {$has_pagemodal};
{literal}
function shorten(str) {
var n = 40;
return str.substr(0, n - 1) + (str.length > n ? '...' : '');
}
function formatDate(date) {
if (!date) {
return '-';
}
if (date.toString().match(/^[0-9]+$/)) {
var d = new Date(0);
d.setUTCSeconds(date);
return d.toLocaleDateString();
}
return date;
}
function urlElement(url) {
if (!url) {
return '-';
}
return $('<a/>').attr({ href: url, title: url, target: '_blank' }).text(shorten(url));
}
function buildBadgeContent(assertion) {
var el = $('.badge-template').clone().removeClass('badge-template');
el.find('img.badge-image').attr('src', assertion.badge.image);
el.find('tr.issuer-name td.value').text(assertion.badge.issuer.name);
el.find('tr.issuer-url td.value').html(urlElement(assertion.badge.issuer.origin));
el.find('tr.issuer-organization td.value').text(assertion.badge.issuer.org || '-');
el.find('tr.badge-name td.value').text(assertion.badge.name);
el.find('tr.badge-description td.value').text(assertion.badge.description);
el.find('tr.badge-criteria td.value').html(urlElement(assertion.badge.criteria));
el.find('tr.issuance-evidence td.value').html(urlElement(assertion.evidence));
el.find('tr.issuance-issuedon td.value').text(formatDate(assertion.issued_on));
el.find('tr.issuance-expires td.value').text(formatDate(assertion.expires));
return el.prop('outerHTML');
}
$(function () {
$('#openbadges' + blockid).on('click', 'img', function () {
showPreview('small', {html: buildBadgeContent($(this).data('assertion'))});
// We don't have that shiny new pagemodal used in 15.10. Let's
// do this the old way.
if (!has_pagemodal) {
$('#viewpreviewinner').width('480px');
$("#viewpreview").removeClass('hidden');
$("#viewpreview").width('500px');
$("#viewpreview").show();
disconnectAll('viewpreviewcontent');
}
});
});
})(jQuery);
</script>
{/literal}
{* Include the template only if it exists. *}
{if $has_pagemodal}
{include file="pagemodal.tpl"}
{/if}
{include file="blocktype:openbadgedisplayer:badge.tpl"}
\ No newline at end of file
.openbadgedisplayer {
padding: 10px;
}
.openbadgedisplayer img {
cursor: pointer;
margin: 0 10px 10px 0;
width: 90px;
height: 90px;
}
.badge-template {
display: none;
}
.badge-container .badge-image {
width: 90px;
height: 90px;
float: left;
}
.badge-container .openbadge-details {
margin-left: 120px;
}
\ No newline at end of file
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-openbadgedisplayer
* @author Discendum Oy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2012 Discedum Oy http://discendum.com
* @copyright (C) 2011 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2015062301;
$config->release = '1.0.4';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment