0) {
$course_meta = new CourseMeta($int);
$result = $course_meta->exportAsTemplate();
if($result) {
$this->echoNoticeDiv(__('Template successfully exported', lepress_textdomain));
} else {
$this->echoNoticeDiv(__('Template could not be exported', lepress_textdomain), true);
}
}
}
//IF rm_tpl parameter found, proceed with removing
if(isSet($_GET['rm_tpl'])) {
$int = intval($_GET['rm_tpl']);
if($int > 0) {
$course_meta = new CourseMeta(false);
$result = $course_meta->deleteTemplate($int);
if($result) {
$this->echoNoticeDiv(__('Template successfully removed', lepress_textdomain));
} else {
$this->echoNoticeDiv(__('Error occured, could not remove template, try again...', lepress_textdomain), true);
}
}
}
//IF post request, this means we are handeling import
if(isSet($_POST['import_to']) && isSet($_POST['tpl_id'])) {
$cat_id = intval($_POST['import_to']);
if($cat_id > 0) {
$course_meta = new CourseMeta($cat_id);
if($course_meta->getIsCourse() && !$course_meta->getIsClosed()) {
$tpl_id = intval($_POST['tpl_id']);
if($tpl_id > 0) {
$result = $course_meta->importTemplate($tpl_id);
if($result) {
$this->echoNoticeDiv(__('Template successfully imported', lepress_textdomain));
} else {
$this->echoNoticeDiv(__('Could not import template, try again...', lepress_textdomain), true);
}
}
}
}
}
//File Template file upload
if(isSet($_POST['tpl_submit'])) {
if($_FILES["lepress_tpl_upload"]["error"] == 0) {
$tpl_xml = file_get_contents($_FILES['lepress_tpl_upload']['tmp_name']);
$course_meta = new CourseMeta(false);
$course_meta->importTemplateFromFile($tpl_xml);
}
}
?>