Changeset 891 for trunk/Modules/News/News.php
- Timestamp:
- Dec 30, 2020, 11:52:07 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/News.php
r887 r891 28 28 } 29 29 30 static function GetModels(): array 31 { 32 return array( 33 'NewsCategory', 34 'News', 35 ); 36 } 37 30 38 function DoInstall(): void 31 39 { 40 foreach (self::GetModels() as $Model) 41 { 42 $this->InstallModel($Model::GetDesc()); 43 } 32 44 } 33 45 34 46 function DoUnInstall(): void 35 47 { 48 foreach (array_reverse(self::GetModels()) as $Model) 49 { 50 $this->UninstallModel($Model::GetDesc()); 51 } 36 52 } 37 53 … … 284 300 } 285 301 } 302 303 class News extends Model 304 { 305 static function GetDesc(): ModelDesc 306 { 307 $Desc = new ModelDesc('News'); 308 $Desc->AddReference('Category', 'NewsCategory', true); 309 $Desc->AddString('Title'); 310 $Desc->AddText('Content'); 311 $Desc->AddDate('Date'); 312 $Desc->AddString('Author'); 313 $Desc->AddString('Enclosure'); 314 $Desc->AddReference('User', 'User'); 315 $Desc->AddString('IP'); 316 $Desc->AddString('Link'); 317 return $Desc; 318 } 319 } 320 321 class NewsCategory extends Model 322 { 323 static function GetDesc(): ModelDesc 324 { 325 $Desc = new ModelDesc('NewsCategory'); 326 $Desc->AddString('Caption'); 327 $Desc->AddString('RSS'); 328 $Desc->AddBoolean('Permission'); 329 $Desc->AddInteger('Sequence'); 330 $Desc->AddInteger('Group'); 331 return $Desc; 332 } 333 }
Note:
See TracChangeset
for help on using the changeset viewer.