Skip to content

Commit

Permalink
adding method and view to add config variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Jan 3, 2010
1 parent 127caa1 commit 8387773
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
29 changes: 29 additions & 0 deletions plugins/management/controllers/configs_controller.php
Expand Up @@ -26,13 +26,42 @@ class ConfigsController extends ManagementAppController
'Text'
);

var $configOptions = array();

function beforeFilter()
{
parent::beforeFilter();

$this->configTypes = array(
'bool' => __( 'Boolean Value', true ),
'dropdown' => __( 'Selectable List', true ),
'integer' => __( 'Integer input', true ),
'string' => __( 'String input', true )
);
}

function admin_index()
{
$configs = $this->paginate( 'Config' );

$this->set( compact( 'configs' ) );
}

function admin_add()
{
if ( !empty( $this->data ) )
{
$this->Config->create();
if ( $this->Config->saveAll( $this->data ) )
{
$this->Session->setFlash( 'Your config setting has been saved.' );
$this->redirect( array( 'action' => 'index' ) );
}
}

$this->set( 'types', $this->configTypes );
}

function admin_edit( $id = null )
{
if ( !$id )
Expand Down
30 changes: 30 additions & 0 deletions plugins/management/views/configs/admin_add.ctp
@@ -0,0 +1,30 @@
<?php
/**
* Management Config admin edit post.
*
* this page is for admin to manage the setup of the site
*
* Copyright (c) 2009 Carl Sutton ( dogmatic69 )
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2009 Carl Sutton ( dogmatic69 )
* @link http://www.dogmatic.co.za
* @package management
* @subpackage management.views.configs.admin_edit
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/

echo $this->Core->adminOtherHead( $this );
echo $this->Form->create( 'Config' );
echo $this->Form->input( 'id' );
echo $this->Form->input( 'key' );
echo $this->Form->input( 'value' );
echo $this->Form->input( 'type' );
echo $this->Form->input( 'options' );
echo $this->Form->input( 'core' );
echo $this->Core->wysiwyg( 'Config.description' );
echo $this->Form->end( 'Save Configuration' );
?>

0 comments on commit 8387773

Please sign in to comment.