Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Update module template
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Jun 11, 2014
1 parent cd5475b commit db57943
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 65 deletions.
26 changes: 16 additions & 10 deletions utils/moduleTemplate/AppController.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<?php

/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 20 rue de la Villette. All rights reserved.
69328 Lyon, FRANCE.
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
See Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

/** App controller for the @MN@ module */
class @MN_CAP@_AppController extends MIDAS_GlobalModule
{
public $moduleName = '@MN@';
} //end class
?>
}
30 changes: 23 additions & 7 deletions utils/moduleTemplate/Notification.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
<?php
/** notification manager*/
/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

/** Notification manager for the @MN@ module */
class @MN_CAP@_Notification extends MIDAS_Notification
{
public $moduleName = '@MN@';

/** init notification process */
/** Init notification process */
public function init()
{
$fc = Zend_Controller_Front::getInstance();
Expand All @@ -14,13 +33,10 @@ public function init()
$this->addCallBack('CALLBACK_CORE_ITEM_DELETED', 'handleItemDeleted');
}

/**
* STUB: example of receiving a callback when an item is deleted
*/
/** STUB: Example of receiving a callback when an item is deleted */
public function handleItemDeleted($params)
{
$itemDao = $params['item'];
// TODO do something about this item dao
// TODO: Do something with this item DAO
}
}
?>
24 changes: 15 additions & 9 deletions utils/moduleTemplate/constant/module.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<?php
/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 20 rue de la Villette. All rights reserved.
69328 Lyon, FRANCE.
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
See Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
?>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
30 changes: 24 additions & 6 deletions utils/moduleTemplate/controllers/ThingController.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,57 @@
<?php
/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

/** Controller template for the @MN@ module */
class @MN_CAP@_ThingController extends @MN_CAP@_AppController
{
{
public $_models = array();
public $_moduleModels = array();

// STUB
/** STUB: Example get action */
function getAction()
{
$id = $this->_getParam('id');
$this->view->id = $id;
}

// STUB
/** STUB: Example create action */
function createAction()
{
$this->disableLayout();
$this->disableView();
echo JsonComponent::encode(array('status' => 'ok', 'message' => 'Done'));
}

// STUB
/** STUB: Example update action */
function updateAction()
{
$this->disableLayout();
$this->disableView();
echo JsonComponent::encode(array('status' => 'ok', 'message' => 'Done'));
}

// STUB
/** STUB: Example delete action */
function deleteAction()
{
$this->disableLayout();
$this->disableView();
echo JsonComponent::encode(array('status' => 'ok', 'message' => 'Done'));
}
}//end class
}
3 changes: 1 addition & 2 deletions utils/moduleTemplate/database/mysql/1.0.0.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

CREATE TABLE IF NOT EXISTS `@MN@_thing` (
`thing_id` bigint(20) NOT NULL AUTO_INCREMENT,
`creation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`thing_id`),
PRIMARY KEY (`thing_id`)
);
1 change: 0 additions & 1 deletion utils/moduleTemplate/database/pgsql/1.0.0.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

CREATE TABLE @MN@_thing (
thing_id serial PRIMARY KEY,
creation_date timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP
Expand Down
23 changes: 20 additions & 3 deletions utils/moduleTemplate/models/AppDao.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
<?php
/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
/** App dao for @MN@ module */
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

/** App DAO for the @MN@ module */
class @MN_CAP@_AppDao extends MIDAS_GlobalDao
{
public $_module = '@MN@';
} //end class
?>
}
27 changes: 17 additions & 10 deletions utils/moduleTemplate/models/AppModel.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
<?php
/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 20 rue de la Villette. All rights reserved.
69328 Lyon, FRANCE.
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
See Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

/** Base model class for the @MN@ module */
class @MN_CAP@_AppModel extends MIDASModel
{
{
public $moduleName = '@MN@';
}
?>
}
9 changes: 5 additions & 4 deletions utils/moduleTemplate/models/base/ThingModelBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

/** Base model class template for the @MN@ module */
abstract class @MN_CAP@_ThingModelBase extends @MN_CAP@_AppModel
{
/** constructor */
{
/** Constructor */
public function __construct()
{
parent::__construct();
Expand All @@ -32,5 +34,4 @@ public function __construct()
);
$this->initialize();
}
}
?>
}
4 changes: 2 additions & 2 deletions utils/moduleTemplate/models/dao/ThingDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
/** Dao for @MN@ thing */

/** DAO template for the @MN@ module */
class @MN_CAP@_ThingDao extends @MN_CAP@_AppDao
{
public $_model = 'Thing';
public $_module = '@MN@';
}
?>
8 changes: 4 additions & 4 deletions utils/moduleTemplate/models/pdo/ThingModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

require_once BASE_PATH.'/modules/@MN@/models/base/ThingModelBase.php';

/** Thing model pdo implementation */
/** PDO model template for the @MN@ module */
class @MN_CAP@_ThingModel extends @MN_CAP@_ThingModelBase
{
}
?>
{
}
18 changes: 18 additions & 0 deletions utils/moduleTemplate/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#=============================================================================
# MIDAS Server
# Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
# All rights reserved.
# More information http://www.kitware.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
22 changes: 15 additions & 7 deletions utils/moduleTemplate/views/thing/get.phtml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<?php
/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 20 rue de la Villette. All rights reserved.
69328 Lyon, FRANCE.
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
See Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
?>

Expand Down

0 comments on commit db57943

Please sign in to comment.