[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/notebook/ -> setup.php (source)

   1  <?php /* $Id: setup.php 102 2008-03-18 19:52:59Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/links/setup.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  /**
   7   *  Name: Notebook
   8   *  Directory: notebook
   9   *  Version 1.0
  10   *  Type: user
  11   *  UI Name: Notebook
  12   *  UI Icon: ?
  13   */
  14  
  15  $config = array();
  16  $config['mod_name'] = 'Notebook'; // name the module
  17  $config['mod_version'] = '1.0'; // add a version number
  18  $config['mod_directory'] = 'notebook'; // tell web2Project where to find this module
  19  $config['mod_setup_class'] = 'CSetupNotebook'; // the name of the PHP setup class (used below)
  20  $config['mod_type'] = 'user'; // 'core' for modules distributed with w2P by standard, 'user' for additional modules from dotmods
  21  $config['mod_ui_name'] = 'Notebook'; // the name that is shown in the main menu of the User Interface
  22  $config['mod_ui_icon'] = 'notebook.png'; // name of a related icon
  23  $config['mod_description'] = 'User notes in a easy way'; // some description of the module
  24  $config['mod_config'] = false; // show 'configure' notebook in viewmods
  25  $config['mod_main_class'] = 'CNote'; // the name of the PHP class used by the module
  26  $config['permissions_item_table'] = 'notes';
  27  $config['permissions_item_field'] = 'note_id';
  28  $config['permissions_item_label'] = 'note_title';
  29  
  30  if ($a == 'setup') {
  31      echo w2PshowModuleConfig($config);
  32  }
  33  
  34  // TODO: To be completed later as needed.
  35  class CSetupNotebook {
  36  
  37  	function configure() {
  38          return true;
  39      }
  40  
  41  	function remove() {
  42          $q = new DBQuery();
  43          $q->dropTable('notes');
  44          $q->exec();
  45  
  46          $q->clear();
  47          $q->setDelete('sysvals');
  48          $q->addWhere('sysval_title = \'NoteCategory\'');
  49          $q->exec();
  50  
  51          $q->clear();
  52          $q->setDelete('sysvals');
  53          $q->addWhere('sysval_title = \'NoteStatus\'');
  54          $q->exec();
  55      }
  56  
  57  	function upgrade($old_version) {
  58          return true;
  59      }
  60  
  61  	function install() {
  62          $q = new DBQuery();
  63          $q->createTable('notes');
  64          $q->createDefinition('(
  65                                  `note_id` int(10) unsigned NOT NULL auto_increment,
  66                                  `note_parent` int(10) unsigned NOT NULL default \'0\',
  67                                  `note_company` int(10) unsigned NOT NULL default \'0\',
  68                                  `note_department` int(10) unsigned NOT NULL default \'0\',
  69                                  `note_project` int(10) unsigned NOT NULL default \'0\',
  70                                  `note_task` int(10) unsigned NOT NULL default \'0\',
  71                                  `note_file` int(10) unsigned NOT NULL default \'0\',
  72                                  `note_module` int(10) unsigned NOT NULL default \'0\',
  73                                  `note_module_name` varchar(64) NOT NULL default \'\',
  74                                  `note_record_id` int(10) unsigned NOT NULL default \'0\',
  75                                  `note_category` int(3) unsigned NOT NULL default \'0\',
  76                                  `note_status` int(3) unsigned NOT NULL default \'0\',
  77                                  `note_title` varchar(255) NOT NULL default \'\',
  78                                  `note_body` text NOT NULL,
  79                                  `note_doc_url` varchar(255) NOT NULL default \'\',
  80                                  `note_private` int(1) unsigned NOT NULL default \'0\',
  81                                  `note_creator` int(10) unsigned NOT NULL default \'0\',
  82                                  `note_created` datetime NOT NULL default \'0000-00-00 00:00:00\',
  83                                  `note_modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  84                                  `note_modified_by` int(10) unsigned NOT NULL default \'0\',
  85                                  PRIMARY KEY  (`note_id`), 
  86                                  KEY idx_note_company ( note_company ) ,
  87                                  KEY idx_note_project ( note_project ) ,
  88                                  KEY idx_note_task ( note_task ) ,
  89                                  KEY idx_note_user ( note_creator ) ,
  90                                  KEY idx_note_parent ( note_parent ) 
  91                                  ) TYPE = MYISAM ');
  92  
  93          $q->exec($sql);
  94  
  95          $q->clear();
  96          $q->addTable('sysvals');
  97          $q->addInsert('sysval_key_id', 1);
  98          $q->addInsert('sysval_title', 'NoteCategory');
  99          $q->addInsert('sysval_value', 'Unknown');
 100          $q->addInsert('sysval_value_id', '0');
 101          $q->exec();
 102  
 103          $q->clear();
 104          $q->addTable('sysvals');
 105          $q->addInsert('sysval_key_id', 1);
 106          $q->addInsert('sysval_title', 'NoteCategory');
 107          $q->addInsert('sysval_value', 'Idea');
 108          $q->addInsert('sysval_value_id', '1');
 109          $q->exec();
 110  
 111          $q->clear();
 112          $q->addTable('sysvals');
 113          $q->addInsert('sysval_key_id', 1);
 114          $q->addInsert('sysval_title', 'NoteCategory');
 115          $q->addInsert('sysval_value', 'Workflow');
 116          $q->addInsert('sysval_value_id', '2');
 117          $q->exec();
 118  
 119          $q->clear();
 120          $q->addTable('sysvals');
 121          $q->addInsert('sysval_key_id', 1);
 122          $q->addInsert('sysval_title', 'NoteCategory');
 123          $q->addInsert('sysval_value', 'Document');
 124          $q->addInsert('sysval_value_id', '3');
 125          $q->exec();
 126  
 127          $q->clear();
 128          $q->addTable('sysvals');
 129          $q->addInsert('sysval_key_id', 1);
 130          $q->addInsert('sysval_title', 'NoteStatus');
 131          $q->addInsert('sysval_value', 'Unknown');
 132          $q->addInsert('sysval_value_id', '0');
 133          $q->exec();
 134  
 135          $q->clear();
 136          $q->addTable('sysvals');
 137          $q->addInsert('sysval_key_id', 1);
 138          $q->addInsert('sysval_title', 'NoteStatus');
 139          $q->addInsert('sysval_value', 'Reference');
 140          $q->addInsert('sysval_value_id', '1');
 141          $q->exec();
 142  
 143          $q->clear();
 144          $q->addTable('sysvals');
 145          $q->addInsert('sysval_key_id', 1);
 146          $q->addInsert('sysval_title', 'NoteStatus');
 147          $q->addInsert('sysval_value', 'Read');
 148          $q->addInsert('sysval_value_id', '2');
 149          $q->exec();
 150  
 151          $q->clear();
 152          $q->addTable('sysvals');
 153          $q->addInsert('sysval_key_id', 1);
 154          $q->addInsert('sysval_title', 'NoteStatus');
 155          $q->addInsert('sysval_value', 'Review');
 156          $q->addInsert('sysval_value_id', '3');
 157          $q->exec();
 158  
 159          $q->clear();
 160          $q->addTable('sysvals');
 161          $q->addInsert('sysval_key_id', 1);
 162          $q->addInsert('sysval_title', 'NoteStatus');
 163          $q->addInsert('sysval_value', 'Do');
 164          $q->addInsert('sysval_value_id', '4');
 165          $q->exec();
 166  
 167          $q->clear();
 168          $q->addTable('sysvals');
 169          $q->addInsert('sysval_key_id', 1);
 170          $q->addInsert('sysval_title', 'NoteStatus');
 171          $q->addInsert('sysval_value', 'Important');
 172          $q->addInsert('sysval_value_id', '5');
 173          $q->exec();
 174  
 175          $q->clear();
 176          $q->addTable('sysvals');
 177          $q->addInsert('sysval_key_id', 1);
 178          $q->addInsert('sysval_title', 'NoteStatus');
 179          $q->addInsert('sysval_value', 'Requirement');
 180          $q->addInsert('sysval_value_id', '6');
 181          $q->exec();
 182          return null;
 183      }
 184  
 185  }
 186  ?>


Generated: Fri Jan 9 03:00:02 2009 Cross-referenced by PHPXref 0.7