public static function render_instance(BlockInstance $instance, $editing = false) { global $exporter; require_once get_config('docroot') . 'artefact/lib.php'; safe_require('artefact', 'plans'); $configdata = $instance->get('configdata'); $smarty = smarty_core(); if (isset($configdata['artefactid'])) { $plan = artefact_instance_from_id($configdata['artefactid']); $tasks = ArtefactTypeTask::get_tasks($configdata['artefactid']); $template = 'artefact:plans:taskrows.tpl'; $blockid = $instance->get('id'); if ($exporter) { $pagination = false; } else { $baseurl = $instance->get_view()->get_url(); $baseurl .= (false === strpos($baseurl, '?') ? '?' : '&') . 'block=' . $blockid; $pagination = array('baseurl' => $baseurl, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'tasktable_' . $blockid, 'jsonscript' => 'artefact/plans/viewtasks.json.php'); } ArtefactTypeTask::render_tasks($tasks, $template, $configdata, $pagination); if ($exporter && $tasks['count'] > $tasks['limit']) { $artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view'); $tasks['pagination'] = '<a href="' . $artefacturl . '">' . get_string('alltasks', 'artefact.plans') . '</a>'; } $smarty->assign('owner', $plan->get('owner')); $smarty->assign('tags', $plan->get('tags')); $smarty->assign('tasks', $tasks); } else { $smarty->assign('noplans', 'blocktype.plans/plans'); } $smarty->assign('blockid', $instance->get('id')); return $smarty->fetch('blocktype:plans:content.tpl'); }
* along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package mahara * @subpackage artefact-plans * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); define('MENUITEM', 'myportfolio/plans'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'plans'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('artefact', 'plans'); $id = param_integer('id', 0); if ($id) { $plan = new ArtefactTypePlan($id); if (!$USER->can_edit_artefact($plan)) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } define('TITLE', get_string('newtask', 'artefact.plans')); $form = ArtefactTypeTask::get_form($id); } else { define('TITLE', get_string('newplan', 'artefact.plans')); $form = ArtefactTypePlan::get_form(); } $smarty =& smarty(); $smarty->assign_by_ref('form', $form); $smarty->assign_by_ref('PAGEHEADING', hsc(TITLE)); $smarty->display('artefact:plans:new.tpl');
/** * Set task parents */ public static function setup_relationships(SimpleXMLElement $entry, PluginImportLeap $importer) { if ($ancestorid = self::get_ancestor_entryid($entry, $importer)) { $ancestorids = $importer->get_artefactids_imported_by_entryid($ancestorid); $artefactids = $importer->get_artefactids_imported_by_entryid((string) $entry->id); if (empty($artefactids[0])) { throw new ImportException($importer, 'Task artefact not found: ' . (string) $entry->id); } if (empty($ancestorids[0])) { throw new ImportException($importer, 'Plan artefact not found: ' . $ancestorid); } $artefact = new ArtefactTypeTask($artefactids[0]); $artefact->set('parent', $ancestorids[0]); $artefact->commit(); } }
/** * * @package mahara * @subpackage artefact-plans * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', true); define('MENUITEM', 'content/plans'); require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php'; require_once 'pieforms/pieform.php'; require_once 'pieforms/pieform/elements/calendar.php'; require_once get_config('docroot') . 'artefact/lib.php'; safe_require('artefact', 'plans'); if (!PluginArtefactPlans::is_active()) { throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('plans', 'artefact.plans'))); } define('TITLE', get_string('edittask', 'artefact.plans')); $id = param_integer('id'); $task = new ArtefactTypeTask($id); if (!$USER->can_edit_artefact($task)) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } $form = ArtefactTypeTask::get_form($task->get('parent'), $task); $smarty = smarty(); $smarty->assign('editform', $form); $smarty->assign('PAGEHEADING', hsc(get_string("editingtask", "artefact.plans"))); $smarty->display('artefact:plans:edit.tpl');
public static function submit(Pieform $form, $values) { global $USER, $SESSION; if (!empty($values['task'])) { $id = (int) $values['task']; $artefact = new ArtefactTypeTask($id); } else { $artefact = new ArtefactTypeTask(); $artefact->set('owner', $USER->get('id')); $artefact->set('parent', $values['parent']); } $artefact->set('title', $values['title']); $artefact->set('description', $values['description']); $artefact->set('completed', $values['completed'] ? 1 : 0); $artefact->set('completiondate', $values['completiondate']); if (get_config('licensemetadata')) { $artefact->set('license', $values['license']); $artefact->set('licensor', $values['licensor']); $artefact->set('licensorurl', $values['licensorurl']); } $artefact->set('tags', $values['tags']); $artefact->commit(); $SESSION->add_ok_msg(get_string('plansavedsuccessfully', 'artefact.plans')); redirect('/artefact/plans/plan.php?id=' . $values['parent']); }
* @subpackage artefact-plans * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('artefact', 'plans'); require_once get_config('docroot') . 'blocktype/lib.php'; require_once get_config('docroot') . 'artefact/plans/blocktype/plans/lib.php'; $offset = param_integer('offset', 0); $limit = param_integer('limit', 10); if ($blockid = param_integer('block', null)) { $bi = new BlockInstance($blockid); $options = $configdata = $bi->get('configdata'); $tasks = ArtefactTypeTask::get_tasks($configdata['artefactid'], $offset, $limit); $template = 'artefact:plans:taskrows.tpl'; $pagination = array('baseurl' => $bi->get_view()->get_url() . '&block=' . $blockid, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'tasktable_' . $blockid, 'jsonscript' => 'artefact/plans/viewtasks.json.php'); } else { $planid = param_integer('artefact'); $viewid = param_integer('view'); $options = array('viewid' => $viewid); $tasks = ArtefactTypeTask::get_tasks($planid, $offset, $limit); $template = 'artefact:plans:taskrows.tpl'; $baseurl = get_config('wwwroot') . 'view/artefact.php?artefact=' . $planid . '&view=' . $options['viewid']; $pagination = array('baseurl' => $baseurl, 'id' => 'task_pagination', 'datatable' => 'tasklist', 'jsonscript' => 'artefact/plans/viewtasks.json.php'); } ArtefactTypeTask::render_tasks($tasks, $template, $options, $pagination); json_reply(false, (object) array('message' => false, 'data' => $tasks));
*/ define('INTERNAL', 1); define('MENUITEM', 'myportfolio/plans'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'plans'); define('SECTION_PAGE', 'plans'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('artefact', 'plans'); define('TITLE', get_string('tasks', 'artefact.plans')); $id = param_integer('id'); // offset and limit for pagination $offset = param_integer('offset', 0); $limit = param_integer('limit', 10); $plan = new ArtefactTypePlan($id); if (!$USER->can_edit_artefact($plan)) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } $tasks = ArtefactTypeTask::get_tasks($plan->get('id'), $offset, $limit); ArtefactTypeTask::build_tasks_list_html($tasks); $js = <<<EOF addLoadEvent(function () { {$tasks['pagination_js']} }); EOF; $smarty = smarty(array('paginator')); $smarty->assign_by_ref('tasks', $tasks); $smarty->assign_by_ref('plan', $id); $smarty->assign('strnotasksaddone', get_string('notasksaddone', 'artefact.plans', '<a href="' . get_config('wwwroot') . 'artefact/plans/new.php?id=' . $plan->get('id') . '">', '</a>')); $smarty->assign('PAGEHEADING', get_string("planstasks", "artefact.plans", $plan->get('title'))); $smarty->assign('INLINEJAVASCRIPT', $js); $smarty->display('artefact:plans:plan.tpl');