public static function render_instance(BlockInstance $instance, $editing = false) { global $exporter; require_once get_config('docroot') . 'artefact/lib.php'; safe_require('artefact', 'ilps'); $configdata = $instance->get('configdata'); $smarty = smarty_core(); if (isset($configdata['artefactid'])) { $units = ArtefactTypeunit::get_units($configdata['artefactid']); $template = 'artefact:ilps:unitrows.tpl'; $blockid = $instance->get('id'); if ($exporter) { $pagination = false; } else { $pagination = array('baseurl' => $instance->get_view()->get_url() . '&block=' . $blockid, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'unittable_' . $blockid, 'jsonscript' => 'artefact/ilps/viewunits.json.php'); } ArtefactTypeUnit::render_units($units, $template, $configdata, $pagination); if ($exporter && $units['count'] > $units['limit']) { $artefacturl = get_config('wwwroot') . 'view/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view'); $units['pagination'] = '<a href="' . $artefacturl . '">' . get_string('allunits', 'artefact.ilps') . '</a>'; } $smarty->assign('units', $units); } else { $smarty->assign('noilps', 'blocktype.ilps/ilps'); } $smarty->assign('blockid', $instance->get('id')); return $smarty->fetch('blocktype:ilps:content.tpl'); }
* * 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 artefact-ilps * @author Ross Dash * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2012 Ross Dash * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('artefact', 'ilps'); $ilp = param_integer('id'); $limit = param_integer('limit', 20); $offset = param_integer('offset', 0); $units = ArtefactTypeUnit::get_units($ilp, $offset, $limit); ArtefactTypeUnit::build_units_list_html($units); json_reply(false, (object) array('message' => false, 'data' => $units));
* @subpackage artefact-ilps * @author Ross Dash * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2012 Ross Dash * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('artefact', 'ilps'); require_once get_config('docroot') . 'blocktype/lib.php'; require_once get_config('docroot') . 'artefact/ilps/blocktype/ilps/lib.php'; $offset = param_integer('offset', 0); $limit = param_integer('limit', 20); if ($blockid = param_integer('block', null)) { $bi = new BlockInstance($blockid); $options = $configdata = $bi->get('configdata'); $units = ArtefactTypeUnit::get_units($configdata['artefactid'], $offset, $limit); $template = 'artefact:ilps:unitrows.tpl'; $pagination = array('baseurl' => $bi->get_view()->get_url() . '&block=' . $blockid, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'unittable_' . $blockid, 'jsonscript' => 'artefact/ilps/viewunits.json.php'); } else { $ilpid = param_integer('artefact'); $viewid = param_integer('view'); $options = array('viewid' => $viewid); $units = ArtefactTypeUnit::get_units($ilpid, $offset, $limit); $template = 'artefact:ilps:unitrows.tpl'; $baseurl = get_config('wwwroot') . 'view/artefact.php?artefact=' . $ilpid . '&view=' . $options['viewid']; $pagination = array('baseurl' => $baseurl, 'id' => 'unit_pagination', 'datatable' => 'unitlist', 'jsonscript' => 'artefact/ilps/viewunits.json.php'); } ArtefactTypeUnit::render_units($units, $template, $options, $pagination); json_reply(false, (object) array('message' => false, 'data' => $units));
/** * Builds the units list table for current ilp * * @param units (reference) */ public function build_units_list_html(&$units) { $summarypoints = ArtefactTypeUnit::get_summarypoints($units['id']); $smarty = smarty_core(); $smarty->assign_by_ref('units', $units); $smarty->assign_by_ref('summarypoints', $summarypoints); $units['tablerows'] = $smarty->fetch('artefact:ilps:unitslist.tpl'); $pagination = build_pagination(array('id' => 'unitlist_pagination', 'class' => 'center', 'url' => get_config('wwwroot') . 'artefact/ilps/ilp.php?id=' . $units['id'], 'jsonscript' => 'artefact/ilps/units.json.php', 'datatable' => 'unitslist', 'count' => $units['count'], 'limit' => $units['limit'], 'offset' => $units['offset'], 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'resultcounttextsingular' => get_string('unit', 'artefact.ilps'), 'resultcounttextplural' => get_string('units', 'artefact.ilps'))); $units['pagination'] = $pagination['html']; $units['pagination_js'] = $pagination['javascript']; }
* along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package mahara * @subpackage artefact-ilps * @author Ross Dash * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2012 Ross Dash * */ define('INTERNAL', 1); define('MENUITEM', 'content/ilps'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'ilps'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('artefact', 'ilps'); $id = param_integer('id', 0); if ($id) { $ilp = new ArtefactTypeIlp($id); if (!$USER->can_edit_artefact($ilp)) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } define('TITLE', get_string('newunit', 'artefact.ilps')); $form = ArtefactTypeUnit::get_form($id); } else { define('TITLE', get_string('newilp', 'artefact.ilps')); $form = ArtefactTypeIlp::get_form(); } $smarty =& smarty(); $smarty->assign_by_ref('form', $form); $smarty->assign_by_ref('PAGEHEADING', hsc(TITLE)); $smarty->display('artefact:ilps:new.tpl');