Commit 1cfe7200 authored by Nigel McNie's avatar Nigel McNie
Browse files

Add a button to create a template on all View listing pages.

parent edbecdd6
......@@ -59,6 +59,7 @@ $smarty->assign('views', $data->data);
$smarty->assign('institution', 'mahara');
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('createviewform', pieform(create_view_form(null, 'mahara')));
$smarty->assign('createtemplateform', pieform(create_template_form(null, 'mahara')));
$smarty->display('view/index.tpl');
......
......@@ -30,6 +30,7 @@ $string['createview'] = 'Create View';
$string['createviewstepone'] = 'Create View Step One: Layout';
$string['createviewsteptwo'] = 'Create View Step Two: Details';
$string['createviewstepthree'] = 'Create View Step Three: Access';
$string['createtemplate'] = 'Create Template';
$string['editviewdetails'] = 'Edit Details for View "%s"';
$string['editblocksforview'] = 'Edit View "%s"';
$string['editaccessforview'] = 'Edit Access for View "%s"';
......
......@@ -2259,6 +2259,8 @@ function create_view_form($group=null, $institution=null, $template=null) {
function createview_submit(Pieform $form, $values) {
global $SESSION;
$values['template'] = !empty($values['istemplate']) ? 1 : 0; // Named 'istemplate' in the form to prevent confusion with 'usetemplate'
if (isset($values['usetemplate'])) {
$templateid = $values['usetemplate'];
unset($values['usetemplate']);
......@@ -2286,6 +2288,17 @@ function createview_cancel_submit(Pieform $form, $values) {
redirect(get_config('wwwroot') . 'view/');
}
function create_template_form($group=null, $institution=null) {
$form = create_view_form($group, $institution, null);
$form['name'] = 'createtemplate';
$form['elements']['istemplate'] = array(
'type' => 'hidden',
'value' => 1,
);
$form['elements']['submit']['value'] = get_string('createtemplate', 'view');
return $form;
}
function add_feedback_form($attachments=false) {
global $USER;
......
......@@ -5,6 +5,7 @@
<div>
<span class="addicon fr">
{$createviewform}
{$createtemplateform}
<form method="post" action="{$WWWROOT}view/choosetemplate.php">
<input type="submit" class="submit" value="{str tag="copyaview" section="view"}">
{if $GROUP}
......
......@@ -79,6 +79,7 @@ $smarty->assign('member', $member);
$smarty->assign('views', $data->data);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('createviewform', pieform(create_view_form($group->id)));
$smarty->assign('createtemplateform', pieform(create_template_form($group->id)));
if ($can_edit) { // && !$shared) {
$smarty->display('view/index.tpl');
......
......@@ -120,6 +120,7 @@ $smarty->assign('views', $data->data);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('heading', get_string('myviews'));
$smarty->assign('createviewform', pieform(create_view_form()));
$smarty->assign('createtemplateform', pieform(create_template_form()));
$smarty->display('view/index.tpl');
?>
......@@ -78,6 +78,7 @@ $smarty->assign('views', $data->data);
$smarty->assign('institution', $institution);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('createviewform', pieform(create_view_form(null, $institution)));
$smarty->assign('createtemplateform', pieform(create_template_form(null, $institution)));
$smarty->display('view/index.tpl');
......
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