1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-13 17:46:20 +02:00
Files
php-monstra/plugins/sandbox/sandbox.admin.php
2012-09-25 19:09:50 +03:00

90 lines
2.4 KiB
PHP

<?php
// Admin Navigation: add new item
Navigation::add(__('Sandbox', 'sandbox'), 'content', 'sandbox', 10);
// Add actions
Action::add('admin_themes_extra_index_template_actions','SandboxAdmin::formComponent');
Action::add('admin_themes_extra_actions','SandboxAdmin::formComponentSave');
/**
* Sandbox admin class
*/
class SandboxAdmin extends Backend {
/**
* Main Sandbox admin function
*/
public static function main() {
//
// Do something here...
//
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Plugin action
// -------------------------------------
case "add":
//
// Do something here...
//
break;
// Plugin action
// -------------------------------------
case "delete":
//
// Do something here...
//
break;
}
} else {
// Display view
View::factory('sandbox/views/backend/index')->display();
}
}
/**
* Form Component Save
*/
public static function formComponentSave() {
if (Request::post('sandbox_component_save')) {
Option::update('sandbox_template', Request::post('sandbox_form_template'));
Request::redirect('index.php?id=themes');
}
}
/**
* Form Component
*/
public static function formComponent() {
$_templates = Themes::getTemplates();
foreach($_templates as $template) $templates[basename($template, '.template.php')] = basename($template, '.template.php');
echo (
Form::open().
Form::label('sandbox_form_template', __('Sandbox template')).
Form::select('sandbox_form_template', $templates, Option::get('sandbox_template')).
Html::br().
Form::submit('sandbox_component_save', __('Save'), array('class' => 'btn')).
Form::close()
);
}
}