Changed build script to not remove existing files
This commit is contained in:
parent
80187c7056
commit
7f9af86201
2 changed files with 18 additions and 5 deletions
|
@ -39,8 +39,9 @@ if(!is_dir($builddir)){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_file($zipfile)){
|
if(file_exists($zipfile)){
|
||||||
unlink($zipfile);
|
print("Zip file '{$zipfile}' already exists. Exiting...\n");
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cwd = getcwd();
|
$cwd = getcwd();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("../../config.php");
|
require_once("../../config.php");
|
||||||
|
|
||||||
|
use \local_treestudyplan\courseservice;
|
||||||
|
|
||||||
require_once($CFG->libdir.'/weblib.php');
|
require_once($CFG->libdir.'/weblib.php');
|
||||||
|
|
||||||
$systemcontext = context_system::instance();
|
$systemcontext = context_system::instance();
|
||||||
|
@ -29,8 +31,19 @@ elseif($contextid > 0)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$categoryid = 0;
|
// If no context is selected, find the first available one
|
||||||
$studyplancontext = $systemcontext;
|
$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);
|
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':''"
|
: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>
|
><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>
|
</b-form-select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<h3 v-else><?php print $contextname; ?></h3>
|
<h3 v-else><?php print $contextname; ?></h3>
|
||||||
<div class="m-buttonbar" style="margin-bottom: 1em;">
|
<div class="m-buttonbar" style="margin-bottom: 1em;">
|
||||||
|
|
Loading…
Reference in a new issue