- #6584: generates a new application from templates with script bin\tn.php
[tine20] / tine20 / Tool / Application / templates / Setup / Initialize.php
1 <?php
2 /**
3  * Tine 2.0
4  * 
5  * @package     ExampleApplication
6  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
7  * @author      Jonas Fischer <j.fischer@metaways.de>
8  * @copyright   Copyright (c) 2008-2011 Metaways Infosystems GmbH (http://www.metaways.de)
9  *
10  */
11
12 /**
13  * class for ExampleApplication initialization
14  * 
15  * @package     Setup
16  */
17 class ExampleApplication_Setup_Initialize extends Setup_Initialize
18 {
19     /**
20      * init key fields
21      */
22     protected function _initializeKeyFields()
23     {
24         // create status config
25         $cb = new Tinebase_Backend_Sql(array(
26             'modelName' => 'Tinebase_Model_Config', 
27             'tableName' => 'config',
28         ));
29         
30         $statusConfig = array(
31             'name'    => ExampleApplication_Config::EXAMPLE_STATUS,
32             'records' => array(
33                 array('id' => 'COMPLETED',    'value' => 'Completed',   'is_open' => 0, 'icon' => 'images/oxygen/16x16/actions/ok.png',                   'system' => true), //_('Completed')
34                 array('id' => 'CANCELLED',    'value' => 'Cancelled',   'is_open' => 0, 'icon' => 'images/oxygen/16x16/actions/dialog-cancel.png',        'system' => true), //_('Cancelled')
35                 array('id' => 'IN-PROCESS',   'value' => 'In process',  'is_open' => 1, 'icon' => 'images/oxygen/16x16/actions/view-refresh.png',         'system' => true), //_('In process')
36             ),
37         );
38         
39         $cb->create(new Tinebase_Model_Config(array(
40             'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('ExampleApplication')->getId(),
41             'name'              => ExampleApplication_Config::EXAMPLE_STATUS,
42             'value'             => json_encode($statusConfig),
43         )));
44     }    
45 }