115 lines
3.4 KiB
PHP
115 lines
3.4 KiB
PHP
<?php
|
|
namespace Crispage\DevSuite;
|
|
|
|
defined("ROOT") or die();
|
|
|
|
use \Crispage\Auth\CorePermissions;
|
|
|
|
class ClassManagerComponent extends \Crispage\Framework\Component {
|
|
public static function getExtensionInfo(): array {
|
|
return [
|
|
"id" => "crispage.devsuite.components.classmanager",
|
|
"version" => VERSION,
|
|
"package" => "crispage.devsuite",
|
|
"cache_policy" => \Crispage\Caching\CacheEngine::POL_NOCACHE
|
|
];
|
|
}
|
|
|
|
public function __construct(\Crispage $app, array $data) {
|
|
parent::__construct($app, $data);
|
|
}
|
|
|
|
public function render(): void {
|
|
?>
|
|
|
|
|
|
<form method="post" action="<?php echo WROOT; ?>/backend" class="cds_form">
|
|
<input type="hidden" name="route" value="cds_classmanager" />
|
|
<h1><?php ($this->app->i18n)("{%CDS_CLASS_MANAGER}"); ?></h1>
|
|
|
|
<h2><?php ($this->app->i18n)("{%REGISTER_CLASS}"); ?></h2>
|
|
<label for="type"><?php ($this->app->i18n)("{%TYPE}:"); ?></label>
|
|
<select name="type">
|
|
<option value="action">
|
|
<?php ($this->app->i18n)("{%ACTION}"); ?>
|
|
</option>
|
|
<option value="component">
|
|
<?php ($this->app->i18n)("{%COMPONENT}"); ?>
|
|
</option>
|
|
<option value="plugin">
|
|
<?php ($this->app->i18n)("{%PLUGIN}"); ?>
|
|
</option>
|
|
<option value="template">
|
|
<?php ($this->app->i18n)("{%TEMPLATE}"); ?>
|
|
</option>
|
|
<option value="translation">
|
|
<?php ($this->app->i18n)("{%TRANSLATION}"); ?>
|
|
</option>
|
|
</select>
|
|
<label for="classname"><?php ($this->app->i18n)("{%CLASS_NAME}:"); ?></label>
|
|
<input type="text" name="classname" />
|
|
<button type="submit" name="action" value="register">
|
|
<?php ($this->app->i18n)("{%REGISTER}"); ?>
|
|
</button>
|
|
<hr />
|
|
|
|
<h2><?php ($this->app->i18n)("{%REGISTERED_EXTENSIONS}"); ?></h2>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th><?php ($this->app->i18n)("{%PACKAGE}") ?></th>
|
|
<th><?php ($this->app->i18n)("{%ID}") ?></th>
|
|
<th><?php ($this->app->i18n)("{%VERSION}") ?></th>
|
|
<th><?php ($this->app->i18n)("{%TYPE}") ?></th>
|
|
<th><?php ($this->app->i18n)("{%CLASS_NAME}") ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($this->data["extensions"] as $ext) { ?>
|
|
<tr>
|
|
<td><input type="checkbox" name="exts[]" value="<?php echo $ext->id; ?>" /></td>
|
|
<td><?php echo $ext->package; ?></td>
|
|
<td><?php echo $ext->id; ?></td>
|
|
<td><?php echo $ext->version; ?></td>
|
|
<td><?php echo $ext->type; ?></td>
|
|
<td><?php echo $ext->classname; ?></td>
|
|
</tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
<button type="submit" name="action" value="unregister">
|
|
<?php ($this->app->i18n)("{%UNREGISTER}"); ?>
|
|
</button>
|
|
<hr />
|
|
|
|
<h2><?php ($this->app->i18n)("{%PLUGIN_MANAGEMENT}"); ?></h2>
|
|
<label for="ext">
|
|
<?php ($this->app->i18n)("{%ID}:"); ?>
|
|
</label>
|
|
<select name="ext">
|
|
<?php
|
|
foreach ($this->data["extensions"] as $ext) {
|
|
if ($ext->type != "plugin") continue;
|
|
echo "<option value=\"$ext->id\">$ext->id</option>";
|
|
}
|
|
?>
|
|
</select>
|
|
<label for="priority">
|
|
<?php ($this->app->i18n)("{%PRIORITY}:"); ?>
|
|
</label>
|
|
<input type="number" name="priority" min="-127" max="127" />
|
|
<button type="submit" name="action" value="plugin_create">
|
|
<?php ($this->app->i18n)("{%CREATE}"); ?>
|
|
</button>
|
|
<button type="submit" name="action" value="plugin_delete">
|
|
<?php ($this->app->i18n)("{%DELETE}"); ?>
|
|
</button>
|
|
<hr />
|
|
</form>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|