Changed build script to not remove existing files

This commit is contained in:
PMKuipers 2023-06-16 11:59:36 +02:00
parent 80187c7056
commit 7f9af86201
2 changed files with 18 additions and 5 deletions

View File

@ -39,8 +39,9 @@ if(!is_dir($builddir)){
}
}
if(is_file($zipfile)){
unlink($zipfile);
if(file_exists($zipfile)){
print("Zip file '{$zipfile}' already exists. Exiting...\n");
exit(1);
}
$cwd = getcwd();

View File

@ -1,6 +1,8 @@
<?php
require_once("../../config.php");
use \local_treestudyplan\courseservice;
require_once($CFG->libdir.'/weblib.php');
$systemcontext = context_system::instance();
@ -29,8 +31,19 @@ elseif($contextid > 0)
}
else
{
$categoryid = 0;
$studyplancontext = $systemcontext;
// If no context is selected, find the first available one
$available_contexts = courseservice::list_used_categories("view");
$contextid=1; // fallback to system context
foreach($available_contexts as $ctx){
if($ctx["studyplancount"] > 0){
$contextid = $ctx["context_id"];
break;
}
}
// reload page with selected category
$url = new \moodle_url('/local/treestudyplan/view-plan.php',["contextid" => $contextid]);
header('Location: '.$url->out(false), true, 302);
exit;
}
require_capability('local/treestudyplan:viewuserreports',$studyplancontext);
@ -72,7 +85,6 @@ print $OUTPUT->header();
:active="ctx.context_id == contextid" :class="(ctx.studyplancount > 0)?'font-weight-bold':''"
><span v-for="(p,i) in ctx.category.path"><span v-if="i>0"> / </span>{{ p }}</span> <span>({{ ctx.studyplancount }})</b-form-select-option>
</b-form-select>
</div>
<h3 v-else><?php print $contextname; ?></h3>
<div class="m-buttonbar" style="margin-bottom: 1em;">