Skip to content

Commit

Permalink
adding the views for modules and relating the modules to routes so yo…
Browse files Browse the repository at this point in the history
…u will eventualy show models based on the page you are on
  • Loading branch information
dogmatic69 committed Jan 18, 2010
1 parent 85f94b7 commit f50aef8
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 0 deletions.
4 changes: 4 additions & 0 deletions infinitas/management/controllers/modules_controller.php
Expand Up @@ -23,6 +23,10 @@ function admin_add() {
$this->redirect(array('action' => 'index'));
}
}

$positions = $this->Module->Position->find('list');
$groups = $this->Module->Group->find('list');
$this->set(compact('positions', 'groups'));
}

function admin_edit($id = null) {
Expand Down
29 changes: 29 additions & 0 deletions infinitas/management/models/module.php
Expand Up @@ -5,5 +5,34 @@
*/
class Module extends ManagementAppModel{
var $name = 'Module';

var $tablePrefix = 'core_';

var $actsAs = array(
'Libs.Ordered'
);

var $order = array(
'Module.position_id' => 'ASC',
'Module.ordering' => 'ASC'
);

var $belongsTo = array(
'Position' => array(
'className' => 'Core.ModulePosition',
'foreignKey' => 'position_id'
),
'Core.Group'
);

var $hasAndBelongsToMany = array(
'ModulesRoute' => array(
'className' => 'Core.ModulesRoute',
'joinTable' => 'modules_routes',
'foreignKey' => 'module_id',
'associationForeignKey' => 'routes_id',
'unique' => true
)
);
}
?>
10 changes: 10 additions & 0 deletions infinitas/management/models/route.php
Expand Up @@ -40,6 +40,16 @@ class Route extends ManagementAppModel {
'Management.Theme'
);

var $hasAndBelongsToMany = array(
'ModulesRoute' => array(
'className' => 'Core.ModulesRoute',
'joinTable' => 'modules_routes',
'foreignKey' => 'routes_id',
'associationForeignKey' => 'module_id',
'unique' => true
)
);

function getPlugins(){
$plugins = Configure::listObjects('plugin');

Expand Down
37 changes: 37 additions & 0 deletions infinitas/management/views/modules/admin_add.ctp
@@ -0,0 +1,37 @@
<?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( 'Module' );
echo $this->Form->input( 'name' );
echo $this->Form->input( 'module' );
echo $this->Form->input( 'position_id' );
echo $this->Form->input( 'group_id' );
echo $this->Form->input( 'active' );
echo $this->Form->input( 'show_heading' );
echo $this->Form->input( 'core' );
echo $this->Form->input( 'author' );
echo $this->Form->input( 'url' );
echo $this->Form->input( 'update_url' );
echo $this->Form->input( 'licence' );

echo $this->Form->input( 'content', array('class' => 'title') );
echo $this->Form->input( 'config', array('class' => 'title') );
echo $this->Form->end( 'Save Module' );
?>
32 changes: 32 additions & 0 deletions infinitas/management/views/modules/admin_edit.ctp
@@ -0,0 +1,32 @@
<?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( 'Theme' );
echo $this->Form->input( 'id' );
echo $this->Form->input( 'name' );
echo $this->Form->input( 'author' );
echo $this->Form->input( 'url' );
echo $this->Form->input( 'update_url' );
echo $this->Form->input( 'licence' );
echo $this->Form->input( 'active' );
echo $this->Form->input( 'core' );
echo $this->Core->wysiwyg( 'Theme.description' );
echo $this->Form->end( 'Save Theme' );
?>
116 changes: 116 additions & 0 deletions infinitas/management/views/modules/admin_index.ctp
@@ -0,0 +1,116 @@
<?php
/**
* Comment Template.
*
* @todo -c Implement .this needs to be sorted out.
*
* 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 sort
* @subpackage sort.comments
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @since 0.5a
*/

echo $this->Form->create( 'Module', array( 'url' => array( 'controller' => 'modules', 'action' => 'mass', 'admin' => 'true' ) ) );

$massActions = $this->Core->massActionButtons(
array(
'add',
'edit',
'copy',
'delete'
)
);
echo $this->Core->adminIndexHead( $this, $paginator, null, $massActions );
?>
<div class="table">
<?php echo $this->Core->adminTableHeadImages(); ?>
<?php ?>
<table class="listing" cellpadding="0" cellspacing="0">
<?php
echo $this->Core->adminTableHeader(
array(
$this->Form->checkbox( 'all' ) => array(
'class' => 'first',
'style' => 'width:25px;'
),
$this->Paginator->sort( 'name' ),
$this->Paginator->sort( 'author' ),
$this->Paginator->sort( 'licence' ),
$this->Paginator->sort( 'Position', 'Position.Name' ) => array(
'style' => 'width:75px;'
),
$this->Paginator->sort( 'Group', 'Group.Name' ) => array(
'style' => 'width:75px;'
),
$this->Paginator->sort( 'Locked', true ) => array(
'style' => 'width:50px;'
),
$this->Paginator->sort( 'Order', true ) => array(
'style' => 'width:50px;'
),
$this->Paginator->sort( 'core', true ) => array(
'style' => 'width:50px;'
),
$this->Paginator->sort( 'active', true ) => array(
'style' => 'width:50px;'
)
)
);

$i = 0;
foreach ( $modules as $module )
{
?>
<tr class="<?php echo $this->Core->rowClass( $i ); ?>">
<td><?php echo $this->Form->checkbox( $module['Module']['id'] ); ?>&nbsp;</td>
<td>
<?php echo $this->Html->link( Inflector::humanize($module['Module']['name']), array('action' => 'edit', $module['Module']['id'])); ?>&nbsp;
</td>
<td>
<?php echo $module['Position']['name']; ?>&nbsp;
</td>
<td>
<?php
if (!empty($module['Module']['url'])) {
echo $this->Html->link($module['Module']['author'], $module['Module']['url'], array('target' => '_blank'));
}
else
{
echo $module['Module']['author'];
}
?>&nbsp;
</td>
<td>
<?php echo $module['Module']['licence']; ?>&nbsp;
</td>
<td>
<?php echo $module['Group']['name']; ?>&nbsp;
</td>
<td>
<?php echo $this->Status->locked($module['Module']['locked']); ?>&nbsp;
</td>
<td>
<?php echo $this->Core->ordering($module['Module']['order']); ?>&nbsp;
</td>
<td>
<?php echo $this->Status->status( $theme['Theme']['core'] ); ?>&nbsp;
</td>
<td>
<?php echo $this->Status->status( $theme['Theme']['active'] ); ?>&nbsp;
</td>
</tr>
<?php
}
?>
</table>
<?php echo $this->Form->end(); ?>
</div>
<?php echo $this->element( 'pagination/navigation' ); ?>

0 comments on commit f50aef8

Please sign in to comment.