Import/Core_notify.php
[Pman.Core] / Import / Core_notify.php
1 <?php
2
3 require_once 'Pman/Roo.php';
4
5 class Pman_Core_Import_Core_notify extends Pman_Roo 
6 {
7     static $cli_desc = "Create Core.NotifyType from core notify"; 
8     
9     static $cli_opts = array(
10         
11     );
12     
13     function getAuth()
14     {
15         if (!HTML_FlexyFramework::get()->cli) {
16             return false;
17         }
18         
19         return true;
20         
21     }
22
23     function get()
24     {   
25         
26         $this->transObj = DB_DataObject::Factory('core_enum');
27         
28         $this->transObj->query('BEGIN');
29         
30         PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
31         
32         $this->modules = $this->modulesList();
33         
34         $this->config();
35         
36         $this->etype();
37         
38         
39         
40     }
41     
42     function etype()
43     {
44         $this->etype = DB_DataObject::factory('core_enum');
45         $this->etype->setFrom(array(
46             'etype' => '',
47             'name' => 'Core.NotifyType',
48             'display_name' => 'Core.NotifyType',
49             'active' => 1
50         ));
51         
52         if($this->etype->find(true)){
53             return;
54         }
55         
56         $this->etype->insert();
57     }
58     
59     function config()
60     {
61         foreach ($this->modules as $m){
62             $file = $this->rootDir. "/Pman/$m/NotifyType.json";
63         }
64     }
65     
66     function log($str)
67     {
68         echo "$str \n";
69     }
70 }