[ Index ]

Source Code Reference for V1.00

title

Body

[close]

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

   1  <?php /* $Id: setup.php 40 2008-02-11 12:11:44Z 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: Links

   8   *  Directory: links

   9   *  Version 1.0

  10   *  Type: user

  11   *  UI Name: Links

  12   *  UI Icon: ?

  13   */
  14  
  15  $config = array();
  16  $config['mod_name'] = 'Links'; // name the module

  17  $config['mod_version'] = '1.0'; // add a version number

  18  $config['mod_directory'] = 'links'; // tell web2Project where to find this module

  19  $config['mod_setup_class'] = 'CSetupLinks'; // 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'] = 'Links'; // the name that is shown in the main menu of the User Interface

  22  $config['mod_ui_icon'] = 'communicate.gif'; // name of a related icon

  23  $config['mod_description'] = 'Links related to tasks'; // some description of the module

  24  $config['mod_config'] = false; // show 'configure' link in viewmods

  25  $config['mod_main_class'] = 'CLink'; // the name of the PHP class used by the module

  26  $config['permissions_item_table'] = 'links';
  27  $config['permissions_item_field'] = 'link_id';
  28  $config['permissions_item_label'] = 'link_name';
  29  
  30  if ($a == 'setup') {
  31      echo w2PshowModuleConfig($config);
  32  }
  33  
  34  // TODO: To be completed later as needed.

  35  class CSetupLinks {
  36  
  37  	function configure() {
  38          return true;
  39      }
  40  
  41  	function remove() {
  42          $q = new DBQuery();
  43          $q->dropTable('links');
  44          $q->exec();
  45  
  46          $q->clear();
  47          $q->setDelete('sysvals');
  48          $q->addWhere('sysval_title = \'LinkType\'');
  49          $q->exec();
  50      }
  51  
  52  	function upgrade($old_version) {
  53          return true;
  54      }
  55  
  56  	function install() {
  57          $q = new DBQuery();
  58          $q->createTable('links');
  59          $q->createDefinition('(
  60  link_id int( 11 ) NOT NULL AUTO_INCREMENT ,
  61  link_url varchar( 255 ) NOT NULL default "",
  62  link_project int( 11 ) NOT NULL default "0",
  63  link_task int( 11 ) NOT NULL default "0",
  64  link_name varchar( 255 ) NOT NULL default "",
  65  link_parent int( 11 ) default "0",
  66  link_description text,
  67  link_owner int( 11 ) default "0",
  68  link_date datetime default NULL ,
  69  link_icon varchar( 20 ) default "obj/",
  70  link_category int( 11 ) NOT NULL default "0",
  71  PRIMARY KEY ( link_id ) ,
  72  KEY idx_link_task ( link_task ) ,
  73  KEY idx_link_project ( link_project ) ,
  74  KEY idx_link_parent ( link_parent ) 
  75  ) TYPE = MYISAM ');
  76  
  77          $q->exec($sql);
  78  
  79          $q->clear();
  80          $q->addTable('sysvals');
  81          $q->addInsert('sysval_key_id', 1);
  82          $q->addInsert('sysval_title', 'LinkType');
  83          $q->addInsert('sysval_value', 'Unknown');
  84          $q->addInsert('sysval_value_id', '0');
  85          $q->exec();
  86  
  87          $q->clear();
  88          $q->addTable('sysvals');
  89          $q->addInsert('sysval_key_id', 1);
  90          $q->addInsert('sysval_title', 'LinkType');
  91          $q->addInsert('sysval_value', 'Document');
  92          $q->addInsert('sysval_value_id', '1');
  93          $q->exec();
  94  
  95          $q->clear();
  96          $q->addTable('sysvals');
  97          $q->addInsert('sysval_key_id', 1);
  98          $q->addInsert('sysval_title', 'LinkType');
  99          $q->addInsert('sysval_value', 'Application');
 100          $q->addInsert('sysval_value_id', '2');
 101          $q->exec();
 102          return null;
 103      }
 104  
 105  }
 106  ?>


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