Ignore:
Timestamp:
Jan 17, 2012, 8:40:51 AM (13 years ago)
Author:
chronos
Message:
  • Přesunuto: Jednotky code a error.
  • Přidáno: Třída ModularSystem pro správu modulů systému.
  • Přidáno: Synchronizace seznamu modulů na disku a v databázi.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Project/Project.php

    r340 r341  
    22
    33include_once(dirname(__FILE__).'/../Module.php');
     4include_once(dirname(__FILE__).'/../../Model.php');
    45
    5 class Project extends Module
     6class Project extends Model
     7{
     8  function __construct($Database)
     9  {
     10    parent::__construct($Database);
     11    $this->Name = 'Project';
     12    $this->AddPropertyDateTime('TimeSchedule');
     13    $this->AddPropertyOneToMany('UserAssignedTo', 'User');
     14    $this->AddPropertyManyToOne('Comments', 'ProjectComment', 'Project');
     15    $this->AddPropertyText('Description');
     16  }
     17}
     18
     19class ProjectComment extends Model
    620{
    721  function __construct()
    822  {
     23    parent::__construct();
     24    $this->Name = 'ProjectComment';
     25    $this->AddPropertyOneToMany('Project', 'Project');
     26    $this->AddPropertyText('Text');     
     27  }
     28}
     29
     30class ModuleProject extends Module
     31{
     32  function __construct($Database)
     33  {
     34    parent::__construct($Database);
    935    $this->Name = 'Project';
    1036    $this->Version = '1.0';
     
    1339    $this->Description = 'Project and task management';
    1440    $this->Dependencies = array('User');
     41    $this->Models = array('Project', 'ProjectComment');
    1542  }
    1643 
    1744  function Install()
    1845  {
    19      $Query = 'CREATE TABLE IF NOT EXISTS `Project` (
    20   `Id` int(11) NOT NULL AUTO_INCREMENT,
    21   `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    22   `TimeCreate` datetime NOT NULL,
    23   `UserCreate` int(11) NOT NULL,
    24   `Description` text COLLATE utf8_czech_ci NOT NULL,
    25   `UserAssignedTo` int(11) DEFAULT NULL,
    26   `TimeSchedule` datetime DEFAULT NULL,
    27   PRIMARY KEY (`Id`),
    28   KEY `UserCreate` (`UserCreate`),
    29   KEY `UserAssignedTo` (`UserAssignedTo`)
    30 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
    31 
    32 CREATE TABLE IF NOT EXISTS `ProjectComment` (
    33   `Id` int(11) NOT NULL AUTO_INCREMENT,
    34   `Project` int(11) NOT NULL,
    35   `Text` text COLLATE utf8_czech_ci NOT NULL,
    36   `TimeCreate` datetime NOT NULL,
    37   `UserCreate` int(11) NOT NULL,
    38   PRIMARY KEY (`Id`),
    39   KEY `Project` (`Project`),
    40   KEY `UserCreate` (`UserCreate`)
    41 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;';         
    4246  }
    4347 
     
    5054}
    5155
     56
    5257?>
Note: See TracChangeset for help on using the changeset viewer.