diff --git a/infinitas/management/controllers/modules_controller.php b/infinitas/management/controllers/modules_controller.php index 7de6787f6..48795f54f 100644 --- a/infinitas/management/controllers/modules_controller.php +++ b/infinitas/management/controllers/modules_controller.php @@ -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) { diff --git a/infinitas/management/models/module.php b/infinitas/management/models/module.php index 2c5d25ab4..b5be045f8 100644 --- a/infinitas/management/models/module.php +++ b/infinitas/management/models/module.php @@ -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 + ) + ); } ?> \ No newline at end of file diff --git a/infinitas/management/models/route.php b/infinitas/management/models/route.php index 5efa7612b..3a9d61fa0 100644 --- a/infinitas/management/models/route.php +++ b/infinitas/management/models/route.php @@ -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'); diff --git a/infinitas/management/views/modules/admin_add.ctp b/infinitas/management/views/modules/admin_add.ctp new file mode 100644 index 000000000..bb2a557c0 --- /dev/null +++ b/infinitas/management/views/modules/admin_add.ctp @@ -0,0 +1,37 @@ +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' ); +?> \ No newline at end of file diff --git a/infinitas/management/views/modules/admin_edit.ctp b/infinitas/management/views/modules/admin_edit.ctp new file mode 100644 index 000000000..c5de9add5 --- /dev/null +++ b/infinitas/management/views/modules/admin_edit.ctp @@ -0,0 +1,32 @@ +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' ); + ?> \ No newline at end of file diff --git a/infinitas/management/views/modules/admin_index.ctp b/infinitas/management/views/modules/admin_index.ctp new file mode 100644 index 000000000..43cb8dca9 --- /dev/null +++ b/infinitas/management/views/modules/admin_index.ctp @@ -0,0 +1,116 @@ +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 ); +?> +
+ Core->adminTableHeadImages(); ?> + + + 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 ) + { + ?> + + + + + + + + + + + + + +
Form->checkbox( $module['Module']['id'] ); ?>  + Html->link( Inflector::humanize($module['Module']['name']), array('action' => 'edit', $module['Module']['id'])); ?>  + +   + + Html->link($module['Module']['author'], $module['Module']['url'], array('target' => '_blank')); + } + else + { + echo $module['Module']['author']; + } + ?>  + +   + +   + + Status->locked($module['Module']['locked']); ?>  + + Core->ordering($module['Module']['order']); ?>  + + Status->status( $theme['Theme']['core'] ); ?>  + + Status->status( $theme['Theme']['active'] ); ?>  +
+ Form->end(); ?> +
+element( 'pagination/navigation' ); ?> \ No newline at end of file