aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-05-16 11:05:47 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-05-16 11:05:47 +0000
commitefaeea07319c63be2f2c6a8bd076e4de8ac8f11d (patch)
treeb6c4f4f976cee1e156f8f9dd0fec39a9f09e6242 /lib
parentbb2278c43c4992c2cc0fc2d468ad98a395e13962 (diff)
relocate flexi, fixes #4101
Closes #4101 Merge request studip/studip!2977
Diffstat (limited to 'lib')
-rw-r--r--lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php4
-rw-r--r--lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php4
-rw-r--r--lib/admissionrules/limitedadmission/LimitedAdmission.class.php4
-rw-r--r--lib/admissionrules/lockedadmission/LockedAdmission.class.php6
-rw-r--r--lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php4
-rw-r--r--lib/admissionrules/passwordadmission/PasswordAdmission.class.php6
-rw-r--r--lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php4
-rw-r--r--lib/admissionrules/termsadmission/TermsAdmission.class.php16
-rw-r--r--lib/admissionrules/timedadmission/TimedAdmission.class.php4
-rw-r--r--lib/bootstrap-autoload.php9
-rw-r--r--lib/bootstrap.php5
-rw-r--r--lib/calendar/CalendarView.class.php2
-rw-r--r--lib/classes/Fullcalendar.class.php2
-rw-r--r--lib/classes/I18N.php4
-rw-r--r--lib/classes/QuestionType.interface.php7
-rw-r--r--lib/classes/Seminar.class.php2
-rw-r--r--lib/classes/Siteinfo.php4
-rw-r--r--lib/classes/StudipFileloader.php2
-rw-r--r--lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php2
-rw-r--r--lib/classes/coursewizardsteps/BasicDataWizardStep.php2
-rw-r--r--lib/classes/coursewizardsteps/LVGroupsWizardStep.php8
-rw-r--r--lib/classes/coursewizardsteps/StudyAreasWizardStep.php2
-rw-r--r--lib/classes/forms/Form.php2
-rw-r--r--lib/classes/librarysearch/LibraryDocument.class.php5
-rw-r--r--lib/classes/sidebar/TemplateWidget.php4
-rw-r--r--lib/filesystem/CourseDateFolder.php4
-rw-r--r--lib/filesystem/CoursePublicFolder.php2
-rw-r--r--lib/filesystem/FileType.php12
-rw-r--r--lib/filesystem/FolderType.php12
-rw-r--r--lib/filesystem/HiddenFolder.php2
-rw-r--r--lib/filesystem/InboxOutboxFolder.php8
-rw-r--r--lib/filesystem/PublicFolder.php2
-rw-r--r--lib/filesystem/RootFolder.php2
-rw-r--r--lib/filesystem/StandardFile.php8
-rw-r--r--lib/filesystem/StandardFolder.php10
-rw-r--r--lib/filesystem/TimedFolder.php4
-rw-r--r--lib/flexi/Factory.php243
-rw-r--r--lib/flexi/PhpTemplate.php111
-rw-r--r--lib/flexi/Template.php208
-rw-r--r--lib/flexi/TemplateNotFoundException.php12
-rw-r--r--lib/models/Courseware/BlockTypes/BlockType.php4
-rw-r--r--lib/models/Courseware/ContainerTypes/ContainerType.php4
-rw-r--r--lib/models/Freetext.php15
-rw-r--r--lib/models/LikertScale.php6
-rw-r--r--lib/models/OERMaterial.php2
-rw-r--r--lib/models/QuestionnaireInfo.php4
-rw-r--r--lib/models/RangeScale.php6
-rw-r--r--lib/models/Vote.php4
-rw-r--r--lib/models/calendar/CalendarDate.class.php2
-rw-r--r--lib/models/calendar/CalendarDateAssignment.class.php6
-rw-r--r--lib/models/resources/ResourceBooking.class.php4
-rw-r--r--lib/models/resources/ResourcePropertyDefinition.class.php2
-rw-r--r--lib/models/resources/ResourceRequest.class.php8
-rw-r--r--lib/modules/ScheduleWidget.php2
-rw-r--r--lib/modules/StudipModule.class.php4
-rw-r--r--lib/plugins/core/AdminCourseContents.class.php4
-rw-r--r--lib/plugins/core/DetailspagePlugin.class.php4
-rw-r--r--lib/plugins/core/ExternPagePlugin.php4
-rw-r--r--lib/plugins/core/FilesystemPlugin.class.php5
-rw-r--r--lib/plugins/core/HomepagePlugin.class.php4
-rw-r--r--lib/plugins/core/PortalPlugin.class.php4
-rw-r--r--lib/plugins/core/QuestionnaireAssignmentPlugin.class.php4
-rw-r--r--lib/raumzeit/SingleDate.class.php2
63 files changed, 729 insertions, 129 deletions
diff --git a/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php b/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php
index 63275f0..7fdbc00 100644
--- a/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php
+++ b/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php
@@ -207,7 +207,7 @@ class ConditionalAdmission extends AdmissionRule
// Open generic admission rule template.
$tpl = $GLOBALS['template_factory']->open('admission/rules/configure');
$tpl->set_attribute('rule', $this);
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(__DIR__ . '/templates/');
// Now open specific template for this rule and insert base template.
$tpl2 = $factory->open('configure');
$tpl2->set_attribute('rule', $this);
@@ -471,7 +471,7 @@ class ConditionalAdmission extends AdmissionRule
*/
public function toString()
{
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(__DIR__ . '/templates/');
$tpl = $factory->open('info');
$tpl->set_attribute('rule', $this);
return $tpl->render();
diff --git a/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php b/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php
index a502971..a3309e8 100644
--- a/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php
+++ b/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php
@@ -253,8 +253,8 @@ class CourseMemberAdmission extends AdmissionRule
return '';
}
- private function getTemplateFactory(): Flexi_TemplateFactory
+ private function getTemplateFactory(): Flexi\Factory
{
- return new Flexi_TemplateFactory(__DIR__ . '/templates/');
+ return new Flexi\Factory(__DIR__ . '/templates/');
}
}
diff --git a/lib/admissionrules/limitedadmission/LimitedAdmission.class.php b/lib/admissionrules/limitedadmission/LimitedAdmission.class.php
index b0cb1ca..a193bda 100644
--- a/lib/admissionrules/limitedadmission/LimitedAdmission.class.php
+++ b/lib/admissionrules/limitedadmission/LimitedAdmission.class.php
@@ -126,7 +126,7 @@ class LimitedAdmission extends AdmissionRule
// Open generic admission rule template.
$tpl = $GLOBALS['template_factory']->open('admission/rules/configure');
$tpl->set_attribute('rule', $this);
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
// Now open specific template for this rule and insert base template.
$tpl2 = $factory->open('configure');
$tpl2->set_attribute('rule', $this);
@@ -248,7 +248,7 @@ class LimitedAdmission extends AdmissionRule
* @return String
*/
public function toString() {
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
$tpl = $factory->open('info');
$tpl->set_attribute('rule', $this);
return $tpl->render();
diff --git a/lib/admissionrules/lockedadmission/LockedAdmission.class.php b/lib/admissionrules/lockedadmission/LockedAdmission.class.php
index c313d55..0ca324b 100644
--- a/lib/admissionrules/lockedadmission/LockedAdmission.class.php
+++ b/lib/admissionrules/lockedadmission/LockedAdmission.class.php
@@ -72,7 +72,7 @@ class LockedAdmission extends AdmissionRule
* @return String
*/
public function getTemplate() {
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
// Now open specific template for this rule and insert base template.
$tpl = $factory->open('configure');
$tpl->set_attribute('rule', $this);
@@ -125,7 +125,7 @@ class LockedAdmission extends AdmissionRule
* @return String
*/
public function toString() {
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
$tpl = $factory->open('info');
$tpl->set_attribute('rule', $this);
return $tpl->render();
@@ -133,4 +133,4 @@ class LockedAdmission extends AdmissionRule
} /* end of class LockedAdmission */
-?> \ No newline at end of file
+?>
diff --git a/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php b/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php
index a64b88a..28a910d 100644
--- a/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php
+++ b/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php
@@ -107,7 +107,7 @@ class ParticipantRestrictedAdmission extends AdmissionRule
*/
public function getTemplate()
{
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
// Open specific template for this rule and insert base template.
$tpl = $factory->open('configure');
$tpl->set_attribute('rule', $this);
@@ -199,7 +199,7 @@ class ParticipantRestrictedAdmission extends AdmissionRule
*/
public function toString()
{
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
$tpl = $factory->open('info');
$tpl->set_attribute('rule', $this);
return $tpl->render();
diff --git a/lib/admissionrules/passwordadmission/PasswordAdmission.class.php b/lib/admissionrules/passwordadmission/PasswordAdmission.class.php
index 6a99066..0650630 100644
--- a/lib/admissionrules/passwordadmission/PasswordAdmission.class.php
+++ b/lib/admissionrules/passwordadmission/PasswordAdmission.class.php
@@ -80,7 +80,7 @@ class PasswordAdmission extends AdmissionRule
* @return String A template-based input form.
*/
public function getInput() {
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
$tpl = $factory->open('input');
$tpl->set_attribute('rule', $this);
return $tpl->render();
@@ -111,7 +111,7 @@ class PasswordAdmission extends AdmissionRule
// Open generic admission rule template.
$tpl = $GLOBALS['template_factory']->open('admission/rules/configure');
$tpl->set_attribute('rule', $this);
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
// Now open specific template for this rule and insert base template.
$tpl2 = $factory->open('configure');
$tpl2->set_attribute('rule', $this);
@@ -214,7 +214,7 @@ class PasswordAdmission extends AdmissionRule
* @return String
*/
public function toString() {
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
$tpl = $factory->open('info');
$tpl->set_attribute('rule', $this);
return $tpl->render();
diff --git a/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php b/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php
index 6bb6ceb..bee3e19 100644
--- a/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php
+++ b/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php
@@ -338,7 +338,7 @@ class PreferentialAdmission extends AdmissionRule
*/
public function getTemplate()
{
- $factory = new Flexi_TemplateFactory(__DIR__.'/templates/');
+ $factory = new Flexi\Factory(__DIR__.'/templates/');
// Now open specific template for this rule and insert base template.
$tpl = $factory->open('configure');
$tpl->set_attribute('rule', $this);
@@ -503,7 +503,7 @@ class PreferentialAdmission extends AdmissionRule
*/
public function toString()
{
- $factory = new Flexi_TemplateFactory(__DIR__.'/templates/');
+ $factory = new Flexi\Factory(__DIR__.'/templates/');
$tpl = $factory->open('info');
$tpl->set_attribute('rule', $this);
return $tpl->render();
diff --git a/lib/admissionrules/termsadmission/TermsAdmission.class.php b/lib/admissionrules/termsadmission/TermsAdmission.class.php
index 112a12e..50c8712 100644
--- a/lib/admissionrules/termsadmission/TermsAdmission.class.php
+++ b/lib/admissionrules/termsadmission/TermsAdmission.class.php
@@ -61,16 +61,16 @@ class TermsAdmission extends AdmissionRule
/**
* Shows an input form
*
- * @return String A template-based input form.
- * @throws Flexi_TemplateNotFoundException
+ * @return string A template-based input form.
+ * @throws Flexi\TemplateNotFoundException
*/
public function getInput()
{
- $factory = new Flexi_TemplateFactory(__DIR__ . '/templates');
+ $factory = new Flexi\Factory(__DIR__ . '/templates');
$template = $factory->open('input');
$template->rule = $this;
- return MessageBox::info($template->render())->hideClose(true);
+ return (string) MessageBox::info($template->render())->hideClose();
}
/**
@@ -84,11 +84,11 @@ class TermsAdmission extends AdmissionRule
* Gets the template that provides a configuration GUI for this rule.
*
* @return String
- * @throws Flexi_TemplateNotFoundException
+ * @throws Flexi\TemplateNotFoundException
*/
public function getTemplate()
{
- $factory = new Flexi_TemplateFactory(__DIR__ . '/templates');
+ $factory = new Flexi\Factory(__DIR__ . '/templates');
$template = $factory->open('configure');
$template->rule = $this;
@@ -158,11 +158,11 @@ class TermsAdmission extends AdmissionRule
* A textual description of the current rule.
*
* @return String
- * @throws Flexi_TemplateNotFoundException
+ * @throws Flexi\TemplateNotFoundException
*/
public function toString()
{
- $factory = new Flexi_TemplateFactory(__DIR__ . '/templates/');
+ $factory = new Flexi\Factory(__DIR__ . '/templates/');
$template = $factory->open('info');
$template->rule = $this;
diff --git a/lib/admissionrules/timedadmission/TimedAdmission.class.php b/lib/admissionrules/timedadmission/TimedAdmission.class.php
index 735fdee..e167bd8 100644
--- a/lib/admissionrules/timedadmission/TimedAdmission.class.php
+++ b/lib/admissionrules/timedadmission/TimedAdmission.class.php
@@ -101,7 +101,7 @@ class TimedAdmission extends AdmissionRule
* @return String
*/
public function getTemplate() {
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
// Open specific template for this rule and insert base template.
$tpl = $factory->open('configure');
$tpl->set_attribute('rule', $this);
@@ -213,7 +213,7 @@ class TimedAdmission extends AdmissionRule
*/
public function toString()
{
- $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/');
+ $factory = new Flexi\Factory(dirname(__FILE__).'/templates/');
$tpl = $factory->open('info');
$tpl->set_attribute('rule', $this);
return $tpl->render();
diff --git a/lib/bootstrap-autoload.php b/lib/bootstrap-autoload.php
index 1f3f6d4..0bbad81 100644
--- a/lib/bootstrap-autoload.php
+++ b/lib/bootstrap-autoload.php
@@ -51,11 +51,18 @@ StudipAutoloader::addAutoloadPath('lib/raumzeit');
StudipAutoloader::addAutoloadPath('lib/resources');
StudipAutoloader::addAutoloadPath('lib/activities', 'Studip\\Activity');
-StudipAutoloader::addAutoloadPath('lib/extern');
StudipAutoloader::addAutoloadPath('lib/calendar/lib');
StudipAutoloader::addAutoloadPath('lib/elearning');
+StudipAutoloader::addAutoloadPath('lib/extern');
StudipAutoloader::addAutoloadPath('lib/ilias_interface');
+// Flexi
+StudipAutoloader::addAutoloadPath('lib/flexi', 'Flexi');
+class_alias(Flexi\PhpTemplate::class, 'Flexi_PhpTemplate');
+class_alias(Flexi\Template::class, 'Flexi_Template');
+class_alias(Flexi\Factory::class, 'Flexi_TemplateFactory');
+class_alias(Flexi\TemplateNotFoundException::class, 'Flexi_TemplateNotFoundException');
+
// Messy file names
StudipAutoloader::addClassLookups([
'email_validation_class' => 'lib/phplib/email_validation.class.php',
diff --git a/lib/bootstrap.php b/lib/bootstrap.php
index 0c66a97..e9c9bb5 100644
--- a/lib/bootstrap.php
+++ b/lib/bootstrap.php
@@ -54,7 +54,7 @@ $ABSOLUTE_URI_STUDIP = "";
if (isset($_SERVER['SERVER_NAME'])) {
// work around possible bug in lighttpd
if (mb_strpos($_SERVER['SERVER_NAME'], ':') !== false) {
- list($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']) =
+ [$_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']] =
explode(':', $_SERVER['SERVER_NAME']);
}
@@ -125,8 +125,7 @@ Assets::set_assets_url($GLOBALS['ASSETS_URL']);
Assets::set_assets_path($GLOBALS['ASSETS_PATH']);
// globale template factory anlegen
-require_once 'vendor/flexi/lib/flexi.php';
-$GLOBALS['template_factory'] = new Flexi_TemplateFactory("{$STUDIP_BASE_PATH}/templates");
+$GLOBALS['template_factory'] = new Flexi\Factory("{$STUDIP_BASE_PATH}/templates");
// set default pdo connection
try {
diff --git a/lib/calendar/CalendarView.class.php b/lib/calendar/CalendarView.class.php
index fc69127..3d89ef1 100644
--- a/lib/calendar/CalendarView.class.php
+++ b/lib/calendar/CalendarView.class.php
@@ -214,7 +214,7 @@ class CalendarView
'whole_height' => $this->getOverallHeight(),
'entry_height' => $this->getHeight()
];
- $factory = new Flexi_TemplateFactory(dirname(__file__).'/../../app/views');
+ $factory = new Flexi\Factory(dirname(__file__).'/../../app/views');
PageLayout::addStyle($factory->render('calendar/schedule/stylesheet', $style_parameters));
$template = $GLOBALS['template_factory']->open("calendar/calendar_view.php");
diff --git a/lib/classes/Fullcalendar.class.php b/lib/classes/Fullcalendar.class.php
index 467b583..db8364a 100644
--- a/lib/classes/Fullcalendar.class.php
+++ b/lib/classes/Fullcalendar.class.php
@@ -64,7 +64,7 @@ class Fullcalendar
public function render()
{
- $factory = new \Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/templates');
+ $factory = new \Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/templates');
$template = $factory->open('studip-fullcalendar.php');
$real_data_name = sprintf('data-%s', $this->data_name);
return $template->render(
diff --git a/lib/classes/I18N.php b/lib/classes/I18N.php
index d34ed0b..44252f3 100644
--- a/lib/classes/I18N.php
+++ b/lib/classes/I18N.php
@@ -61,10 +61,10 @@ class I18N
/**
* Protected constructor in order to always force a specific input type.
*
- * @param string|Flexi_Template $template Template to use
+ * @param string|Flexi\Template $template Template to use
* @param string $name Name of the element
* @param string|I18NString $value Value of the element
- * @param array $attributes Additional variables for the
+ * @param array $attributes Additional variables for the
* element
*/
final protected function __construct($template, $name, $value, array $attributes)
diff --git a/lib/classes/QuestionType.interface.php b/lib/classes/QuestionType.interface.php
index ada6005..03019fe 100644
--- a/lib/classes/QuestionType.interface.php
+++ b/lib/classes/QuestionType.interface.php
@@ -60,7 +60,8 @@ interface QuestionType {
*
* Try to prefix all your input variables at least with the id of the question,
* so that they will never conflict with other variables.
- * @return Flexi_Template
+ *
+ * @return Flexi\Template
*/
public function getDisplayTemplate();
@@ -82,11 +83,13 @@ interface QuestionType {
/**
* Returns a template with the results of this question.
+ *
* @param $only_user_ids : array\null array of user_ids that the results should be restricted to.
* this is used to show only a subset of results to the user for
* visible evaluation of the results. If the questionnaire is anonymous
* just do nothing.
- * @return Flexi_Template
+ *
+ * @return Flexi\Template
*/
public function getResultTemplate($only_user_ids = null);
diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php
index 8aa3d41..a2d69ea 100644
--- a/lib/classes/Seminar.class.php
+++ b/lib/classes/Seminar.class.php
@@ -1735,7 +1735,7 @@ class Seminar
*/
public function getDatesTemplate($template, $params = [])
{
- if (!$template instanceof Flexi_Template && is_string($template)) {
+ if (!$template instanceof Flexi\Template && is_string($template)) {
$template = $GLOBALS['template_factory']->open($template);
}
diff --git a/lib/classes/Siteinfo.php b/lib/classes/Siteinfo.php
index 0d849ca..4a969ee 100644
--- a/lib/classes/Siteinfo.php
+++ b/lib/classes/Siteinfo.php
@@ -281,7 +281,7 @@ class SiteinfoMarkupEngine {
function __construct() {
$this->db = DBManager::get();
- $this->template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/siteinfo/markup/');
+ $this->template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/siteinfo/markup/');
$this->siteinfoMarkup("/\(:version:\)/", [$this, 'version']);
$this->siteinfoMarkup("/\(:uniname:\)/", [$this, 'uniName']);
$this->siteinfoMarkup("/\(:unicontact:\)/", [$this, 'uniContact']);
@@ -659,7 +659,7 @@ function language_filter($input) {
}
function stripforeignlanguage($language, $text) {
- list($primary, $sub) = explode('_',$_SESSION['_language']);
+ [$primary, $sub] = explode('_',$_SESSION['_language']);
if ($language === $primary || $language === $_SESSION['_language']) {
return str_replace('\"', '"', $text);
} else {
diff --git a/lib/classes/StudipFileloader.php b/lib/classes/StudipFileloader.php
index 661c062..aab0b31 100644
--- a/lib/classes/StudipFileloader.php
+++ b/lib/classes/StudipFileloader.php
@@ -31,7 +31,7 @@ class StudipFileloader
!file_exists($file)
&& !stream_resolve_include_path($file)
) {
- continue;
+ throw new Exception('Missing file '. $file);
}
include $file;
}
diff --git a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php
index 780f837..cd33fd3 100644
--- a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php
+++ b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php
@@ -36,7 +36,7 @@ class AdvancedBasicDataWizardStep extends BasicDataWizardStep
}
// Load template from step template directory.
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps');
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps');
$template = $factory->open('advancedbasicdata/index');
$template = $this->setupTemplateAttributes($template, $values, $stepnumber, $temp_id);
diff --git a/lib/classes/coursewizardsteps/BasicDataWizardStep.php b/lib/classes/coursewizardsteps/BasicDataWizardStep.php
index 6a1438f..d47c4f3 100644
--- a/lib/classes/coursewizardsteps/BasicDataWizardStep.php
+++ b/lib/classes/coursewizardsteps/BasicDataWizardStep.php
@@ -28,7 +28,7 @@ class BasicDataWizardStep implements CourseWizardStep
public function getStepTemplate($values, $stepnumber, $temp_id)
{
// Load template from step template directory.
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
if (!empty($values[__CLASS__]['studygroup'])) {
$tpl = $factory->open('basicdata/index_studygroup');
$values[__CLASS__]['lecturers'][$GLOBALS['user']->id] = 1;
diff --git a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
index f343730..e79e1bd 100644
--- a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
+++ b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
@@ -39,7 +39,7 @@ class LVGroupsWizardStep implements CourseWizardStep
$values = $values[__CLASS__] ?? [];
// Load template from step template directory.
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
$tpl = $factory->open('lvgroups/index');
$tpl->set_attribute('values', $values);
@@ -226,7 +226,7 @@ class LVGroupsWizardStep implements CourseWizardStep
continue;
}
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views');
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views');
$html = $factory->render('course/wizard/steps/lvgroups/lvgroup_searchentry', compact('area'));
$data = [
'id' => $area->id,
@@ -288,7 +288,7 @@ class LVGroupsWizardStep implements CourseWizardStep
'Studiengang']);
$pathes = ModuleManagementModelTreeItem::getPathes($trails);
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views');
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views');
$html = $factory->render('course/lvgselector/entry_trails',
compact('area', 'pathes'));
@@ -308,7 +308,7 @@ class LVGroupsWizardStep implements CourseWizardStep
$mvvid = explode('-', $id);
$area = Lvgruppe::find($mvvid[0]);
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views');
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views');
$html = $factory->render('course/wizard/steps/lvgroups/lvgroup_entry', ['area' => $area, 'locked' => false, 'course_id' => '']);
$data = [
diff --git a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php
index 29de617..eac7e37 100644
--- a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php
+++ b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php
@@ -30,7 +30,7 @@ class StudyAreasWizardStep implements CourseWizardStep
// We only need our own stored values here.
$values = $values[get_class($this)] ?? [];
// Load template from step template directory.
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps');
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps');
$tpl = $factory->open('studyareas/index');
if (!empty($values['studyareas'])) {
$tree = $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findMany($values['studyareas'])));
diff --git a/lib/classes/forms/Form.php b/lib/classes/forms/Form.php
index 8977a37..36a2e7d 100644
--- a/lib/classes/forms/Form.php
+++ b/lib/classes/forms/Form.php
@@ -492,7 +492,7 @@ class Form extends Part
/**
* Renders the whole form as a string.
* @return string
- * @throws \Flexi_TemplateNotFoundException
+ * @throws \Flexi\TemplateNotFoundException
*/
public function render()
{
diff --git a/lib/classes/librarysearch/LibraryDocument.class.php b/lib/classes/librarysearch/LibraryDocument.class.php
index 4c90e0b4..46e11b2 100644
--- a/lib/classes/librarysearch/LibraryDocument.class.php
+++ b/lib/classes/librarysearch/LibraryDocument.class.php
@@ -14,7 +14,6 @@
* @since 4.6
*/
-
/**
* This class represents a document from a library.
*/
@@ -386,12 +385,12 @@ class LibraryDocument
/**
- * @returns Flexi_Template A template containing information about the
+ * @returns Flexi\Template A template containing information about the
* the document.
*/
public function getInfoTemplate($format = 'short')
{
- $factory = new Flexi_TemplateFactory(
+ $factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/templates/library/'
);
$template = $factory->open('library_document_info');
diff --git a/lib/classes/sidebar/TemplateWidget.php b/lib/classes/sidebar/TemplateWidget.php
index c937c3b..2ca2d70 100644
--- a/lib/classes/sidebar/TemplateWidget.php
+++ b/lib/classes/sidebar/TemplateWidget.php
@@ -15,10 +15,10 @@ class TemplateWidget extends SidebarWidget
* Constructor of the widget.
*
* @param String $title Title of the widget
- * @param Flexi_Template $template Template for the widget
+ * @param Flexi\Template $template Template for the widget
* @param array $variables Associated variables for the template
*/
- public function __construct($title, Flexi_Template $template, array $variables = [])
+ public function __construct($title, Flexi\Template $template, array $variables = [])
{
parent::__construct();
diff --git a/lib/filesystem/CourseDateFolder.php b/lib/filesystem/CourseDateFolder.php
index 2ab0435..7c91c87 100644
--- a/lib/filesystem/CourseDateFolder.php
+++ b/lib/filesystem/CourseDateFolder.php
@@ -92,7 +92,7 @@ class CourseDateFolder extends PermissionEnabledFolder implements FolderType
/**
* This method returns the special part for the edit template
*
- * @return Flexi_Template edit template
+ * @return Flexi\Template edit template
*/
public function getEditTemplate()
{
@@ -126,7 +126,7 @@ class CourseDateFolder extends PermissionEnabledFolder implements FolderType
/**
* Returns the description template
*
- * @return Flexi_Template description template
+ * @return Flexi\Template description template
*/
public function getDescriptionTemplate()
{
diff --git a/lib/filesystem/CoursePublicFolder.php b/lib/filesystem/CoursePublicFolder.php
index 463fe19..6fa722d 100644
--- a/lib/filesystem/CoursePublicFolder.php
+++ b/lib/filesystem/CoursePublicFolder.php
@@ -112,7 +112,7 @@ class CoursePublicFolder extends StandardFolder
/**
* Returns the edit template for this folder type.
*
- * @return Flexi_Template
+ * @return Flexi\Template
*/
public function getEditTemplate()
{
diff --git a/lib/filesystem/FileType.php b/lib/filesystem/FileType.php
index 5a53896..3dcd32f 100644
--- a/lib/filesystem/FileType.php
+++ b/lib/filesystem/FileType.php
@@ -177,10 +177,12 @@ interface FileType
public function convertToStandardFile();
/**
- * Returns the content for that additional column, if it exists. You can return null a string
- * or a Flexi_Template as the content.
+ * Returns the content for that additional column, if it exists. You can
+ * return null, a string or a Flexi\Template as the content.
+ *
* @param string $column_index
- * @return null|string|Flexi_Template
+ *
+ * @return null|string|Flexi\Template
*/
public function getContentForAdditionalColumn($column_index);
@@ -194,14 +196,14 @@ interface FileType
/**
- * Generates a Flexi_Template containing additional information that are
+ * Generates a Flexi\Template containing additional information that are
* displayes in the information dialog of a file.
*
* @param bool $include_downloadable_infos Whether to include information
* like file previews that can be downloaded (true) or to not
* include them (false). Defaults to false.
*
- * @returns Flexi_Template|null Either a Flexi_Template containing
+ * @returns Flexi\Template|null Either a Flexi\Template containing
* additional information or null if no such information shall be
* displayed in the information dialog.
*/
diff --git a/lib/filesystem/FolderType.php b/lib/filesystem/FolderType.php
index 94d8667..69dae30 100644
--- a/lib/filesystem/FolderType.php
+++ b/lib/filesystem/FolderType.php
@@ -119,7 +119,7 @@ interface FolderType
/**
* returns description of the folder
*
- * @return Flexi_Template | string
+ * @return Flexi\Template | string
*/
public function getDescriptionTemplate();
@@ -144,7 +144,7 @@ interface FolderType
/**
* returns template form, must not contain opening and closing <form> tags
*
- * @return Flexi_Template | string
+ * @return Flexi\Template | string
*/
public function getEditTemplate();
@@ -243,10 +243,12 @@ interface FolderType
public function getAdditionalColumns();
/**
- * Returns the content for that additional column, if it exists. You can return null a string
- * or a Flexi_Template as the content.
+ * Returns the content for that additional column, if it exists. You can
+ * return null, a string or a Flexi\Template as the content.
+ *
* @param string $column_index
- * @return null|string|Flexi_Template
+ *
+ * @return null|string|Flexi\Template
*/
public function getContentForAdditionalColumn($column_index);
diff --git a/lib/filesystem/HiddenFolder.php b/lib/filesystem/HiddenFolder.php
index b29f5fb..4daee0b 100644
--- a/lib/filesystem/HiddenFolder.php
+++ b/lib/filesystem/HiddenFolder.php
@@ -78,7 +78,7 @@ class HiddenFolder extends PermissionEnabledFolder
/**
* Returns the edit template for this folder type.
*
- * @return Flexi_Template
+ * @return Flexi\Template
*/
public function getEditTemplate()
{
diff --git a/lib/filesystem/InboxOutboxFolder.php b/lib/filesystem/InboxOutboxFolder.php
index 9386be4..6a8f2fd 100644
--- a/lib/filesystem/InboxOutboxFolder.php
+++ b/lib/filesystem/InboxOutboxFolder.php
@@ -269,10 +269,12 @@ class InboxOutboxFolder implements FolderType
}
/**
- * Returns the content for that additional column, if it exists. You can return null a string
- * or a Flexi_Template as the content.
+ * Returns the content for that additional column, if it exists. You can
+ * return null, a string or a Flexi\Template as the content.
+ *
* @param string $column_index
- * @return null|string|Flexi_Template
+ *
+ * @return null|string|Flexi\Template
*/
public function getContentForAdditionalColumn($column_index)
{
diff --git a/lib/filesystem/PublicFolder.php b/lib/filesystem/PublicFolder.php
index 6b06ac9..2dc4847 100644
--- a/lib/filesystem/PublicFolder.php
+++ b/lib/filesystem/PublicFolder.php
@@ -160,7 +160,7 @@ class PublicFolder extends StandardFolder
/**
* Returns the edit template for this folder type.
*
- * @return Flexi_Template
+ * @return Flexi\Template
*/
public function getEditTemplate()
{
diff --git a/lib/filesystem/RootFolder.php b/lib/filesystem/RootFolder.php
index 0727770..9771c32 100644
--- a/lib/filesystem/RootFolder.php
+++ b/lib/filesystem/RootFolder.php
@@ -86,7 +86,7 @@ class RootFolder extends StandardFolder
}
/**
- * @return Flexi_Template
+ * @return Flexi\Template
*/
public function getEditTemplate()
{
diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php
index 9d2d35c..4eb3140 100644
--- a/lib/filesystem/StandardFile.php
+++ b/lib/filesystem/StandardFile.php
@@ -460,9 +460,11 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
/**
* Returns the content for that additional column, if it exists. You can return null a string
- * or a Flexi_Template as the content.
+ * or a Flexi\Template as the content.
+ *
* @param string $column_index
- * @return null|string|Flexi_Template
+ *
+ * @return null|string|Flexi\Template
*/
public function getContentForAdditionalColumn($column_index)
{
@@ -497,7 +499,7 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
return null;
}
- $factory = new Flexi_TemplateFactory(
+ $factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/templates/filesystem/file_types/'
);
$template = $factory->open('standard_file_info');
diff --git a/lib/filesystem/StandardFolder.php b/lib/filesystem/StandardFolder.php
index a34ca4a..bbbb1fc 100644
--- a/lib/filesystem/StandardFolder.php
+++ b/lib/filesystem/StandardFolder.php
@@ -186,7 +186,7 @@ class StandardFolder implements FolderType
}
/**
- * @return string|Flexi_Template
+ * @return string|Flexi\Template
*/
public function getDescriptionTemplate()
{
@@ -194,7 +194,7 @@ class StandardFolder implements FolderType
}
/**
- * @return string|Flexi_Template
+ * @return string|Flexi\Template
*/
public function getEditTemplate()
{
@@ -509,9 +509,11 @@ class StandardFolder implements FolderType
/**
* Returns the content for that additional column, if it exists. You can return null a string
- * or a Flexi_Template as the content.
+ * or a Flexi\Template as the content.
+ *
* @param string $column_index
- * @return null|string|Flexi_Template
+ *
+ * @return null|string|Flexi\Template
*/
public function getContentForAdditionalColumn($column_index)
{
diff --git a/lib/filesystem/TimedFolder.php b/lib/filesystem/TimedFolder.php
index 442c084..d5f933b 100644
--- a/lib/filesystem/TimedFolder.php
+++ b/lib/filesystem/TimedFolder.php
@@ -132,7 +132,7 @@ class TimedFolder extends PermissionEnabledFolder
/**
* Returns the description template for a instance of a TimedFolder type.
*
- * @return Flexi_Template A description template for a instance of the type TimedFolder
+ * @return Flexi\Template A description template for a instance of the type TimedFolder
*/
public function getDescriptionTemplate()
{
@@ -155,7 +155,7 @@ class TimedFolder extends PermissionEnabledFolder
/**
* Returns the edit template for this folder type.
*
- * @return Flexi_Template
+ * @return Flexi\Template
*/
public function getEditTemplate()
{
diff --git a/lib/flexi/Factory.php b/lib/flexi/Factory.php
new file mode 100644
index 0000000..b6c30fd
--- /dev/null
+++ b/lib/flexi/Factory.php
@@ -0,0 +1,243 @@
+<?php
+/**
+ * Using this factory you can create new Template objects.
+ *
+ * @copyright 2008 Marcus Lunzenauer <mlunzena@uos.de>
+ * @author Marcus Lunzenauer <mlunzena@uos.de>
+ * @license MIT
+ */
+
+namespace Flexi;
+
+class Factory
+{
+ /**
+ * mapping of file extensions to supported template classes
+ */
+ protected array $handlers = [
+ 'php' => [PhpTemplate::class, []],
+ ];
+
+ /**
+ * Constructor of TemplateFactory.
+ *
+ * @param string $path the template include path
+ */
+ public function __construct(protected string $path)
+ {
+ $this->set_path($path);
+ }
+
+ /**
+ * Sets a new include path for the factory and returns the old one.
+ *
+ * @param string $path the new path
+ *
+ * @return string the old path
+ */
+ public function set_path(string $path): string
+ {
+ $old_path = $this->get_path();
+
+ if (!str_ends_with($path, '/')) {
+ $path .= '/';
+ }
+
+ $this->path = $path;
+
+ return $old_path;
+ }
+
+ /**
+ * Returns the include path of the factory
+ *
+ * @return string the current include path
+ */
+ public function get_path(): string
+ {
+ return $this->path;
+ }
+
+ /**
+ * Open a template of the given name using the factory method pattern.
+ * If a string was given, the path of the factory is searched for a matching
+ * template.
+ * If this string starts with a slash or with /\w+:\/\//, the string is
+ * interpreted as an absolute path. Otherwise the path of the factory will be
+ * prepended.
+ * After that the factory searches for a file extension in this string. If
+ * there is none, the directory where the template is supposed to live is
+ * searched for a file starting with the template string and a supported
+ * file extension.
+ * At last the factory instantiates a template object of the matching template
+ * class.
+ *
+ * Examples:
+ *
+ * $factory->open('/path/to/template')
+ * does not prepend the factory's path but searches for "template.*" in
+ * "/path/to"
+ *
+ * $factory->open('template')
+ * prepends the factory's path and searches there for "template.*"
+ *
+ * $factory->open('template.php')
+ * prepends the factory's path but does not search and instantiates a
+ * PHPTemplate instead
+ *
+ * This method returns it's parameter, if it is not a string. This
+ * functionality is useful for helper methods like #render_partial
+ *
+ * @param Template|string $template A name of a template.
+ * @return Template the factored object
+ * @throws TemplateNotFoundException if the template could not be found
+ */
+ public function open(Template|string $template): Template
+ {
+ # if it is not a string, this method behaves like identity
+ if ($template instanceof Template) {
+ return $template;
+ }
+
+ # get file
+ $file = $this->get_template_file($template);
+
+ # retrieve handler
+ [$class, $options] = $this->get_template_handler($file);
+
+ return new $class($file, $this, $options);
+ }
+
+ /**
+ * This method returns the absolute filename of the template
+ *
+ * @param string $template0 a template string
+ *
+ * @return string an absolute filename
+ *
+ * @throws TemplateNotFoundException if the template could not be found
+ */
+ public function get_template_file(string $template0): string
+ {
+ $template = $this->get_absolute_path($template0);
+ $extension = $this->get_extension($template);
+
+ # extension defined, is there a matching template class?
+ if ($extension !== null) {
+ if (file_exists($template)) {
+ return $template;
+ }
+ } # no extension defined, find it
+ else {
+ $file = $this->find_template($template);
+ if ($file !== null) {
+ return $file;
+ }
+ }
+
+ # falling through to throw exception
+ throw new TemplateNotFoundException(sprintf(
+ 'Missing template "%s" in "%s".',
+ $template0,
+ $this->path
+ ));
+ }
+
+ /**
+ * Matches an extension to a template handler.
+ *
+ * @param string $template the template
+ *
+ * @return array|null an array containing the class name and an array of
+ * options of the matched extension;
+ * or NULL if the extension did not match
+ */
+ public function get_template_handler(string $template): ?array
+ {
+ $extension = $this->get_extension($template);
+ return $this->handlers[$extension] ?? null;
+ }
+
+ /**
+ * Registers a handler for templates with a matching extension.
+ *
+ * @param string $extension the extension of the templates to handle
+ * @param class-string<Template> $class the name of the already loaded class
+ * @param array $options optional; an array of options which is used
+ * when constructing a new instance
+ */
+ public function add_handler(
+ string $extension,
+ string $class,
+ array $options = []
+ ): void {
+ $this->handlers[$extension] = [$class, $options];
+ }
+
+ /**
+ * Returns the absolute path to the template. If the given argument starts
+ * with a slash or with a protocoll, this method just returns its arguments.
+ *
+ * @param string $template an incomplete template name
+ *
+ * @return string an absolute path to the incomplete template name
+ */
+ public function get_absolute_path(string $template): string
+ {
+ return preg_match('#^(/|\w+://)#', $template)
+ ? $template
+ : $this->get_path() . $template;
+ }
+
+
+ /**
+ * Find template given w/o extension.
+ *
+ * @param string $template the template's filename w/o extension
+ * @return string|null null if there no such file could be found, a string
+ * containing the complete file name otherwise
+ */
+ public function find_template(string $template): ?string
+ {
+ foreach ($this->handlers as $ext => $handler) {
+ $file = "$template.$ext";
+ if (file_exists($file)) {
+ return $file;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the file extension if there is one.
+ *
+ * @param string $file an possibly incomplete template file name
+ * @return string|null a string containing the file extension if there is one,
+ * NULL otherwise
+ */
+ public function get_extension(string $file): ?string
+ {
+ return pathinfo($file, PATHINFO_EXTENSION) ?: null;
+ }
+
+ /**
+ * Class method to parse, render and return the presentation of a
+ * template.
+ *
+ * @param Template|string $template A name of a template or a template
+ * @param array $attributes An associative array of attributes and their
+ * associated values.
+ * @param string|null $layout A name of a layout template.
+ *
+ * @return string A string representing the rendered presentation.
+ *
+ * @throws TemplateNotFoundException
+ */
+ public function render(
+ Template|string $template,
+ array $attributes = [],
+ ?string $layout = null
+ ): string {
+ return $this->open($template)->render($attributes, $layout);
+ }
+}
diff --git a/lib/flexi/PhpTemplate.php b/lib/flexi/PhpTemplate.php
new file mode 100644
index 0000000..8110b50
--- /dev/null
+++ b/lib/flexi/PhpTemplate.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * A template engine that uses PHP to render templates.
+ *
+ * @copyright 2008 Marcus Lunzenauer <mlunzena@uos.de>
+ * @author Marcus Lunzenauer <mlunzena@uos.de>
+ * @license MIT
+ */
+
+namespace Flexi;
+
+class PhpTemplate extends Template
+{
+ /**
+ * Parse, render and return the presentation.
+ *
+ * @return string A string representing the rendered presentation.
+ * @throws TemplateNotFoundException
+ */
+ public function _render(): string
+ {
+ extract($this->get_attributes());
+
+ # include template, parse it and get output
+ try {
+ ob_start();
+ require $this->template;
+ $content_for_layout = ob_get_contents();
+ } catch (\Error $e) {
+ throw new TemplateNotFoundException(previous: $e);
+ } finally {
+ ob_end_clean();
+ }
+
+ # include layout, parse it and get output
+ if (isset($this->layout)) {
+ $defined = get_defined_vars();
+ unset($defined['this']);
+ $content_for_layout = $this->layout->render($defined);
+ }
+
+ return $content_for_layout;
+ }
+
+ /**
+ * Parse, render and return the presentation of a partial template.
+ *
+ * @param Template|string $partial A partial name or template
+ * @param array $attributes An optional associative array of attributes
+ * and their associated values.
+ * @return string A string representing the rendered presentation.
+ * @throws TemplateNotFoundException
+ */
+ public function render_partial(Template|string $partial, array $attributes = []): string
+ {
+ return $this->factory->render($partial, $attributes + $this->attributes);
+ }
+
+ /**
+ * Renders a partial template with every member of a collection. This member
+ * can be accessed by a template variable with the same name as the name of
+ * the partial template.
+ *
+ * Example:
+ *
+ * # template entry.php contains:
+ * <li><?= $entry ?></li>
+ *
+ *
+ * $entries = ['lorem', 'ipsum'];
+ * $template->render_partial_collection('entry', $entries);
+ *
+ * # results in:
+ * <li>lorem</li>
+ * <li>ipsum</li>
+ *
+ * If you want to use specific content between the rendered partials, you
+ * may define a spacer partial that will be used for that. The spacer will
+ * be rendered with the given attributes.
+ *
+ * @param string $partial A name of a partial template.
+ * @param array $collection The collection to be rendered.
+ * @param Template|string|null $spacer Optional a name of a partial template
+ * used as spacer.
+ * @param array $attributes An optional associative array of attributes
+ * and their associated values.
+ *
+ * @return string A string representing the rendered presentation.
+ * @throws TemplateNotFoundException
+ */
+ public function render_partial_collection(
+ string $partial,
+ array $collection,
+ Template|string|null $spacer = null,
+ array $attributes = []
+ ): string {
+ $template = $this->factory->open($partial);
+ $template->set_attributes($this->attributes);
+ $template->set_attributes($attributes);
+
+ $collected = [];
+ $iterator_name = pathinfo($partial, PATHINFO_FILENAME);
+ foreach ($collection as $element) {
+ $collected[] = $template->render([$iterator_name => $element]);
+ }
+
+ $spacer = isset($spacer) ? $this->render_partial($spacer, $attributes) : '';
+
+ return implode($spacer, $collected);
+ }
+}
diff --git a/lib/flexi/Template.php b/lib/flexi/Template.php
new file mode 100644
index 0000000..de2547e
--- /dev/null
+++ b/lib/flexi/Template.php
@@ -0,0 +1,208 @@
+<?php
+/**
+ * Abstract template class representing the presentation layer of an action.
+ * Output can be customized by supplying attributes, which a template can
+ * manipulate and display.
+ *
+ * @copyright 2008 Marcus Lunzenauer <mlunzena@uos.de>
+ * @author Marcus Lunzenauer <mlunzena@uos.de>
+ * @license MIT
+ */
+
+namespace Flexi;
+
+abstract class Template
+{
+ /**
+ * Parse, render and return the presentation.
+ *
+ * @return string A string representing the rendered presentation.
+ */
+ abstract public function _render(): string;
+
+ protected array $attributes = [];
+ protected Template|null $layout = null;
+
+ /**
+ * Constructor
+ *
+ * @param string $template the path of the template.
+ * @param Factory $factory the factory creating this template
+ * @param array $options optional array of options
+ */
+ public function __construct(
+ protected string $template,
+ protected Factory $factory,
+ protected array $options = []
+ ) {
+ }
+
+ /**
+ * __set() is a magic method run when writing data to inaccessible members.
+ * In this class it is used to set attributes for the template in a
+ * comfortable way.
+ *
+ * @param string $name the name of the member field
+ * @param mixed $value the value for the member field
+ *
+ * @see http://php.net/__set
+ */
+ public function __set(string $name, mixed $value): void
+ {
+ $this->set_attribute($name, $value);
+ }
+
+ /**
+ * __get() is a magic method utilized for reading data from inaccessible
+ * members.
+ * In this class it is used to get attributes for the template in a
+ * comfortable way.
+ *
+ * @param string $name the name of the member field
+ *
+ * @return mixed the value for the member field
+ * @see http://php.net/__get
+ */
+ public function __get(string $name): mixed
+ {
+ return $this->get_attribute($name);
+ }
+
+ /**
+ * __isset() is a magic method triggered by calling isset() or empty() on
+ * inaccessible members.
+ * In this class it is used to check for attributes for the template in a
+ * comfortable way.
+ *
+ * @param string $name the name of the member field
+ *
+ * @return bool TRUE if that attribute exists, FALSE otherwise
+ * @see http://php.net/__isset
+ */
+ public function __isset(string $name): bool
+ {
+ return isset($this->attributes[$name]);
+ }
+
+ /**
+ * __unset() is a magic method invoked when unset() is used on inaccessible
+ * members.
+ * In this class it is used to check for attributes for the template in a
+ * comfortable way.
+ *
+ * @param string $name the name of the member field
+ *
+ * @see http://php.net/__set
+ */
+ public function __unset(string $name): void
+ {
+ $this->clear_attribute($name);
+ }
+
+ /**
+ * Parse, render and return the presentation.
+ *
+ * @param array $attributes An optional associative array of attributes and
+ * their associated values.
+ * @param string|Template|null $layout A name of a layout template.
+ *
+ * @return string A string representing the rendered presentation.
+ * @throws TemplateNotFoundException
+ */
+ public function render(array $attributes = [], string|Template $layout = null): string
+ {
+ if (isset($layout)) {
+ $this->set_layout($layout);
+ }
+
+ # merge attributes
+ $this->set_attributes($attributes);
+
+ return $this->_render();
+ }
+
+ /**
+ * Returns the value of an attribute.
+ *
+ * @param string $name An attribute name.
+ * @return mixed An attribute value.
+ */
+ public function get_attribute(string $name)
+ {
+ return $this->attributes[$name] ?? null;
+ }
+
+ /**
+ * Set an array of attributes.
+ *
+ * @return array An associative array of attributes and their associated
+ * values.
+ */
+ public function get_attributes(): array
+ {
+ return $this->attributes;
+ }
+
+ /**
+ * Set an attribute.
+ *
+ * @param string $name An attribute name.
+ * @param mixed $value An attribute value.
+ */
+ public function set_attribute(string $name, mixed $value): void
+ {
+ $this->attributes[$name] = $value;
+ }
+
+ /**
+ * Set an array of attributes.
+ *
+ * @param array $attributes An associative array of attributes and their
+ * associated values.
+ */
+ public function set_attributes(array $attributes): void
+ {
+ $this->attributes = $attributes + $this->attributes;
+ }
+
+
+ /**
+ * Clear all attributes associated with this template.
+ */
+ public function clear_attributes(): void
+ {
+ $this->attributes = [];
+ }
+
+ /**
+ * Clear an attribute associated with this template.
+ *
+ * @param string $name The name of the attribute to be cleared.
+ */
+ public function clear_attribute(string $name): void
+ {
+ unset($this->attributes[$name]);
+ }
+
+ /**
+ * Set the template's layout.
+ *
+ * @param Template|string|null $layout A name of a layout template or a
+ * layout template.
+ * @throws TemplateNotFoundException
+ */
+ public function set_layout(Template|string|null $layout): void
+ {
+ $this->layout = $this->factory->open($layout);
+ }
+
+ /**
+ * Returns the template's layout.
+ *
+ * @return Template|null
+ */
+ public function get_layout(): ?Template
+ {
+ return $this->layout;
+ }
+}
diff --git a/lib/flexi/TemplateNotFoundException.php b/lib/flexi/TemplateNotFoundException.php
new file mode 100644
index 0000000..dbef2c6
--- /dev/null
+++ b/lib/flexi/TemplateNotFoundException.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * @copyright 2009 Marcus Lunzenauer <mlunzena@uos.de>
+ * @author Marcus Lunzenauer <mlunzena@uos.de>
+ * @license MIT
+ */
+
+namespace Flexi;
+
+class TemplateNotFoundException extends \Exception
+{
+}
diff --git a/lib/models/Courseware/BlockTypes/BlockType.php b/lib/models/Courseware/BlockTypes/BlockType.php
index b87a219..37e617b 100644
--- a/lib/models/Courseware/BlockTypes/BlockType.php
+++ b/lib/models/Courseware/BlockTypes/BlockType.php
@@ -438,9 +438,9 @@ abstract class BlockType
* It turns the classname into snakecase in order to find the
* template file in templates/courseware/block_types.
*
- * @return mixed the \Flexi_Template instance if exists, otherwise null.
+ * @return \Flexi\Template|null the \Flexi\Template instance if exists, otherwise null.
*/
- public function getPdfHtmlTemplate(): ?\Flexi_Template
+ public function getPdfHtmlTemplate(): ?\Flexi\Template
{
$template = null;
try {
diff --git a/lib/models/Courseware/ContainerTypes/ContainerType.php b/lib/models/Courseware/ContainerTypes/ContainerType.php
index baddaab..4e816be 100644
--- a/lib/models/Courseware/ContainerTypes/ContainerType.php
+++ b/lib/models/Courseware/ContainerTypes/ContainerType.php
@@ -249,9 +249,9 @@ abstract class ContainerType
* It turns the classname into snakecase in order to find the
* template file in templates/courseware/container_types.
*
- * @return mixed the \Flexi_Template instance if exists, otherwise null.
+ * @return \Flexi\Template|null the \Flexi\Template instance if exists, otherwise null.
*/
- public function getPdfHtmlTemplate(): ?\Flexi_Template
+ public function getPdfHtmlTemplate(): ?\Flexi\Template
{
$template = null;
try {
diff --git a/lib/models/Freetext.php b/lib/models/Freetext.php
index 52182de..66b93c5 100644
--- a/lib/models/Freetext.php
+++ b/lib/models/Freetext.php
@@ -65,12 +65,13 @@ class Freetext extends QuestionnaireQuestion implements QuestionType
/**
* Returns the template of this question to answer the question.
- * @return Flexi_Template
- * @throws Flexi_TemplateNotFoundException if there is no template.
+ *
+ * @return Flexi\Template
+ * @throws Flexi\TemplateNotFoundException if there is no template.
*/
public function getDisplayTemplate()
{
- $factory = new Flexi_TemplateFactory(realpath(__DIR__ . '/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__ . '/../../app/views'));
$template = $factory->open('questionnaire/question_types/freetext/freetext_answer.php');
$template->vote = $this;
return $template;
@@ -97,9 +98,11 @@ class Freetext extends QuestionnaireQuestion implements QuestionType
/**
* Returns the template with the answers of the question so far.
+ *
* @param null $only_user_ids : array of user_ids
- * @return Flexi_Template
- * @throws Flexi_TemplateNotFoundException if there is no template.
+ *
+ * @return Flexi\Template
+ * @throws Flexi\TemplateNotFoundException if there is no template.
*/
public function getResultTemplate($only_user_ids = null)
{
@@ -111,7 +114,7 @@ class Freetext extends QuestionnaireQuestion implements QuestionType
}
}
}
- $factory = new Flexi_TemplateFactory(realpath(__DIR__ . '/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__ . '/../../app/views'));
$template = $factory->open('questionnaire/question_types/freetext/freetext_evaluation.php');
$template->vote = $this;
$template->set_attribute('answers', $answers);
diff --git a/lib/models/LikertScale.php b/lib/models/LikertScale.php
index 8ac7823..833d794 100644
--- a/lib/models/LikertScale.php
+++ b/lib/models/LikertScale.php
@@ -53,7 +53,7 @@ class LikertScale extends QuestionnaireQuestion implements QuestionType
public function getDisplayTemplate()
{
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/likert/likert_answer');
$template->set_attribute('vote', $this);
return $template;
@@ -73,7 +73,7 @@ class LikertScale extends QuestionnaireQuestion implements QuestionType
public function getUserIdsOfFilteredAnswer($answer_option)
{
$user_ids = [];
- list($statement_key, $options_key) = explode('_', $answer_option);
+ [$statement_key, $options_key] = explode('_', $answer_option);
foreach ($this->answers as $answer) {
$answerData = $answer['answerdata']->getArrayCopy();
if ($answerData['answers'][$statement_key] == $options_key) {
@@ -93,7 +93,7 @@ class LikertScale extends QuestionnaireQuestion implements QuestionType
}
}
}
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/likert/likert_evaluation');
$template->set_attribute('vote', $this);
$template->set_attribute('answers', $answers);
diff --git a/lib/models/OERMaterial.php b/lib/models/OERMaterial.php
index 8411d14..604f845 100644
--- a/lib/models/OERMaterial.php
+++ b/lib/models/OERMaterial.php
@@ -198,7 +198,7 @@ class OERMaterial extends SimpleORMap
return $output;
}
- $tf = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH']."/app/views");
+ $tf = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH']."/app/views");
if ($material->hasValidPreviewUrl() || $material->isPDF()) {
$template = $tf->open("oer/embed/url");
} elseif ($material->isVideo()) {
diff --git a/lib/models/QuestionnaireInfo.php b/lib/models/QuestionnaireInfo.php
index fc6efc7..2bcf25d 100644
--- a/lib/models/QuestionnaireInfo.php
+++ b/lib/models/QuestionnaireInfo.php
@@ -50,7 +50,7 @@ class QuestionnaireInfo extends QuestionnaireQuestion implements QuestionType
public function getDisplayTemplate()
{
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/info/info');
$template->set_attribute('vote', $this);
return $template;
@@ -68,7 +68,7 @@ class QuestionnaireInfo extends QuestionnaireQuestion implements QuestionType
public function getResultTemplate($only_user_ids = null)
{
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/info/info');
$template->set_attribute('vote', $this);
return $template;
diff --git a/lib/models/RangeScale.php b/lib/models/RangeScale.php
index 78bc65b..44b946b 100644
--- a/lib/models/RangeScale.php
+++ b/lib/models/RangeScale.php
@@ -53,7 +53,7 @@ class RangeScale extends QuestionnaireQuestion implements QuestionType
public function getDisplayTemplate()
{
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/rangescale/rangescale_answer');
$template->set_attribute('vote', $this);
return $template;
@@ -72,7 +72,7 @@ class RangeScale extends QuestionnaireQuestion implements QuestionType
public function getUserIdsOfFilteredAnswer($answer_option)
{
$user_ids = [];
- list($statement_key, $options_key) = explode('_', $answer_option);
+ [$statement_key, $options_key] = explode('_', $answer_option);
foreach ($this->answers as $answer) {
$answerData = $answer['answerdata']->getArrayCopy();
if ($answerData['answers'][$statement_key] == $options_key) {
@@ -92,7 +92,7 @@ class RangeScale extends QuestionnaireQuestion implements QuestionType
}
}
}
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/rangescale/rangescale_evaluation');
$template->set_attribute('vote', $this);
$template->set_attribute('answers', $answers);
diff --git a/lib/models/Vote.php b/lib/models/Vote.php
index 0520401..ede0cea 100644
--- a/lib/models/Vote.php
+++ b/lib/models/Vote.php
@@ -53,7 +53,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType
public function getDisplayTemplate()
{
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/vote/vote_answer');
$template->set_attribute('vote', $this);
return $template;
@@ -100,7 +100,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType
}
}
}
- $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views'));
+ $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views'));
$template = $factory->open('questionnaire/question_types/vote/vote_evaluation');
$template->set_attribute('vote', $this);
$template->set_attribute('answers', $answers);
diff --git a/lib/models/calendar/CalendarDate.class.php b/lib/models/calendar/CalendarDate.class.php
index 7026ece..d901cf1 100644
--- a/lib/models/calendar/CalendarDate.class.php
+++ b/lib/models/calendar/CalendarDate.class.php
@@ -114,7 +114,7 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
public function cbSendDateModificationMail()
{
- $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
+ $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
foreach ($this->calendars as $calendar) {
if ($calendar->range_id === $this->editor_id) {
diff --git a/lib/models/calendar/CalendarDateAssignment.class.php b/lib/models/calendar/CalendarDateAssignment.class.php
index bd99dd3..e0bf467 100644
--- a/lib/models/calendar/CalendarDateAssignment.class.php
+++ b/lib/models/calendar/CalendarDateAssignment.class.php
@@ -79,7 +79,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event
return;
}
- $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
+ $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
setTempLanguage($this->range_id);
$lang_path = getUserLanguagePath($this->range_id);
@@ -112,7 +112,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event
return;
}
- $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
+ $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
setTempLanguage($this->range_id);
$lang_path = getUserLanguagePath($this->range_id);
@@ -160,7 +160,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event
return;
}
- $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
+ $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/');
setTempLanguage($this->range_id);
$lang_path = getUserLanguagePath($this->range_id);
diff --git a/lib/models/resources/ResourceBooking.class.php b/lib/models/resources/ResourceBooking.class.php
index f55b3b3..fadf92f 100644
--- a/lib/models/resources/ResourceBooking.class.php
+++ b/lib/models/resources/ResourceBooking.class.php
@@ -876,7 +876,7 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
$deleted_c = 0;
- $template_factory = new Flexi_TemplateFactory(
+ $template_factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/locale/'
);
@@ -1917,7 +1917,7 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
return;
}
- $template_factory = new Flexi_TemplateFactory(
+ $template_factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/locale/'
);
setTempLanguage($booking_user->id);
diff --git a/lib/models/resources/ResourcePropertyDefinition.class.php b/lib/models/resources/ResourcePropertyDefinition.class.php
index 82d29c9..450ec00 100644
--- a/lib/models/resources/ResourcePropertyDefinition.class.php
+++ b/lib/models/resources/ResourcePropertyDefinition.class.php
@@ -221,7 +221,7 @@ class ResourcePropertyDefinition extends SimpleORMap
);
}
} elseif ($type === 'position') {
- $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH']);
+ $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH']);
$template = $factory->open('templates/resources/position_attribute_form_part.php');
$template->set_attribute(
'input_name',
diff --git a/lib/models/resources/ResourceRequest.class.php b/lib/models/resources/ResourceRequest.class.php
index 6b22b44..9cad900 100644
--- a/lib/models/resources/ResourceRequest.class.php
+++ b/lib/models/resources/ResourceRequest.class.php
@@ -1963,7 +1963,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen
return;
}
- $factory = new Flexi_TemplateFactory(
+ $factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/locale/'
);
@@ -2020,7 +2020,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen
*/
public function sendCloseRequestMailToRequester($bookings = [])
{
- $factory = new Flexi_TemplateFactory(
+ $factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/locale/'
);
@@ -2110,7 +2110,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen
);
if ($lecturers) {
- $factory = new Flexi_TemplateFactory(
+ $factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/locale/'
);
@@ -2199,7 +2199,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen
}
//Load the mail template:
- $factory = new Flexi_TemplateFactory(
+ $factory = new Flexi\Factory(
$GLOBALS['STUDIP_BASE_PATH'] . '/locale/'
);
$user_lang_path = getUserLanguagePath($user->id);
diff --git a/lib/modules/ScheduleWidget.php b/lib/modules/ScheduleWidget.php
index 5adc801..c4ab769 100644
--- a/lib/modules/ScheduleWidget.php
+++ b/lib/modules/ScheduleWidget.php
@@ -35,7 +35,7 @@ class ScheduleWidget extends CorePlugin implements PortalPlugin
/**
* Return the template for the widget.
*
- * @return Flexi_PhpTemplate The template containing the widget contents
+ * @return Flexi\PhpTemplate The template containing the widget contents
*/
public function getPortalTemplate()
{
diff --git a/lib/modules/StudipModule.class.php b/lib/modules/StudipModule.class.php
index 6cbcaf9..c281d29 100644
--- a/lib/modules/StudipModule.class.php
+++ b/lib/modules/StudipModule.class.php
@@ -54,7 +54,7 @@ interface StudipModule
public function getMetadata();
/**
- * Return a template (an instance of the Flexi_Template class)
+ * Return a template (an instance of the Flexi\Template class)
* to be rendered on the course summary page. Return NULL to
* render nothing for this plugin.
*
@@ -66,7 +66,7 @@ interface StudipModule
* admin_url admin link for this plugin (if any)
* admin_title title for admin link (default: Administration)
*
- * @return object template object to render or NULL
+ * @return Flexi\Template|null template object to render or NULL
*/
public function getInfoTemplate($course_id);
}
diff --git a/lib/plugins/core/AdminCourseContents.class.php b/lib/plugins/core/AdminCourseContents.class.php
index 065cc9e..0e07b58 100644
--- a/lib/plugins/core/AdminCourseContents.class.php
+++ b/lib/plugins/core/AdminCourseContents.class.php
@@ -15,9 +15,11 @@ interface AdminCourseContents
/**
* Returns the value of the additional column for the course-overview table in the admin-area.
+ *
* @param Course $course : A Course-object of the given ... course
* @param string $index : the index that comes from adminAvailableContents to identify the column.
- * @return Flexi_Template | String : Either one will do, but string is preferred, because it can exported as CSV-file more easily.
+ *
+ * @return Flexi\Template | String : Either one will do, but string is preferred, because it can exported as CSV-file more easily.
*/
public function adminAreaGetCourseContent($course, $index);
}
diff --git a/lib/plugins/core/DetailspagePlugin.class.php b/lib/plugins/core/DetailspagePlugin.class.php
index 15eda09..36e6efa 100644
--- a/lib/plugins/core/DetailspagePlugin.class.php
+++ b/lib/plugins/core/DetailspagePlugin.class.php
@@ -12,7 +12,7 @@
interface DetailspagePlugin
{
/**
- * Return a template (an instance of the Flexi_Template class)
+ * Return a template (an instance of the Flexi\Template class)
* to be rendered on the details page. Return NULL to
* render nothing for this plugin or this course.
*
@@ -21,7 +21,7 @@ interface DetailspagePlugin
*
* title title to display, defaults to plugin name
*
- * @return object template object to render or NULL
+ * @return Flexi\Template|null template object to render or NULL
*/
public function getDetailspageTemplate($course);
}
diff --git a/lib/plugins/core/ExternPagePlugin.php b/lib/plugins/core/ExternPagePlugin.php
index 5b40775..d12efc5 100644
--- a/lib/plugins/core/ExternPagePlugin.php
+++ b/lib/plugins/core/ExternPagePlugin.php
@@ -42,10 +42,10 @@ interface ExternPagePlugin
public function getExternPage(ExternPageConfig $config): ExternPage;
/**
- * Returns a Flexi_Template or a path to the template file. This template contains the form
+ * Returns a Flexi\Template or a path to the template file. This template contains the form
* to configure the external page.
*
- * @return string|Flexi_Template
+ * @return string|Flexi\Template
*/
public function getConfigurationFormTemplate();
diff --git a/lib/plugins/core/FilesystemPlugin.class.php b/lib/plugins/core/FilesystemPlugin.class.php
index 6d4c46c..31b4b5b 100644
--- a/lib/plugins/core/FilesystemPlugin.class.php
+++ b/lib/plugins/core/FilesystemPlugin.class.php
@@ -34,11 +34,12 @@ interface FilesystemPlugin
/**
* This method is used to get a folder-object for this plugin.
- * Not recommended but still possible is to return a Flexi_Template for the folder, if you want to
+ * Not recommended but still possible is to return a Flexi\Template for the folder, if you want to
* take care of the frontend of displaying the folder as well.
*
* @param null $folder_id : folder_id of folder to get or null if you want the top-folder
- * @return FolderType|Flexi_Template
+ *
+ * @return FolderType|Flexi\Template
*/
public function getFolder($folder_id = null);
diff --git a/lib/plugins/core/HomepagePlugin.class.php b/lib/plugins/core/HomepagePlugin.class.php
index 74d0204..37efb54 100644
--- a/lib/plugins/core/HomepagePlugin.class.php
+++ b/lib/plugins/core/HomepagePlugin.class.php
@@ -15,7 +15,7 @@
interface HomepagePlugin
{
/**
- * Return a template (an instance of the Flexi_Template class)
+ * Return a template (an instance of the Flexi\Template class)
* to be rendered on the given user's home page. Return NULL to
* render nothing for this plugin.
*
@@ -27,7 +27,7 @@ interface HomepagePlugin
* admin_url admin link for this plugin (if any)
* admin_title title for admin link (default: Administration)
*
- * @return object template object to render or NULL
+ * @return Flexi\Template|null template object to render or NULL
*/
function getHomepageTemplate($user_id);
}
diff --git a/lib/plugins/core/PortalPlugin.class.php b/lib/plugins/core/PortalPlugin.class.php
index dce5774..cb5aca4 100644
--- a/lib/plugins/core/PortalPlugin.class.php
+++ b/lib/plugins/core/PortalPlugin.class.php
@@ -15,7 +15,7 @@
interface PortalPlugin
{
/**
- * Return a template (an instance of the Flexi_Template class)
+ * Return a template (an instance of the Flexi\Template class)
* to be rendered on the start or portal page. Return NULL to
* render nothing for this plugin.
*
@@ -27,7 +27,7 @@ interface PortalPlugin
* admin_url admin link for this plugin (if any)
* admin_title title for admin link (default: Administration)
*
- * @return ?Flexi_Template template object to render or NULL
+ * @return ?Flexi\Template template object to render or NULL
*/
function getPortalTemplate();
}
diff --git a/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php b/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php
index 6892f8a..cadaf52 100644
--- a/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php
+++ b/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php
@@ -39,8 +39,10 @@ interface QuestionnaireAssignmentPlugin
* This template will get displayed when someone at tools -> questionnaires
* wants to edit the contexts of the questionnaire. Maybe you don't want to provide a
* template here, so return null or just a readonly html-snippet.
+ *
* @param Questionnaire $questionnaire
- * @return null|Flexi_Template
+ *
+ * @return null|Flexi\Template
*/
public function getQuestionnaireAssignmentEditTemplate(Questionnaire $questionnaire);
diff --git a/lib/raumzeit/SingleDate.class.php b/lib/raumzeit/SingleDate.class.php
index 1a58695..3268935 100644
--- a/lib/raumzeit/SingleDate.class.php
+++ b/lib/raumzeit/SingleDate.class.php
@@ -861,7 +861,7 @@ class SingleDate
*/
function getDatesTemplate($template)
{
- if (!$template instanceof Flexi_Template && is_string($template)) {
+ if (!$template instanceof Flexi\Template && is_string($template)) {
$template = $GLOBALS['template_factory']->open($template);
}