Changeset 341 for trunk/Modules/Project/Project.php
- Timestamp:
- Jan 17, 2012, 8:40:51 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Project/Project.php
r340 r341 2 2 3 3 include_once(dirname(__FILE__).'/../Module.php'); 4 include_once(dirname(__FILE__).'/../../Model.php'); 4 5 5 class Project extends Module 6 class 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 19 class ProjectComment extends Model 6 20 { 7 21 function __construct() 8 22 { 23 parent::__construct(); 24 $this->Name = 'ProjectComment'; 25 $this->AddPropertyOneToMany('Project', 'Project'); 26 $this->AddPropertyText('Text'); 27 } 28 } 29 30 class ModuleProject extends Module 31 { 32 function __construct($Database) 33 { 34 parent::__construct($Database); 9 35 $this->Name = 'Project'; 10 36 $this->Version = '1.0'; … … 13 39 $this->Description = 'Project and task management'; 14 40 $this->Dependencies = array('User'); 41 $this->Models = array('Project', 'ProjectComment'); 15 42 } 16 43 17 44 function Install() 18 45 { 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 ;';42 46 } 43 47 … … 50 54 } 51 55 56 52 57 ?>
Note:
See TracChangeset
for help on using the changeset viewer.