Changeset 350 for trunk/Modules/News/News.php
- Timestamp:
- Jan 18, 2012, 7:44:38 AM (13 years ago)
- Location:
- trunk/Modules/News
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/News.php
r348 r350 1 1 <?php 2 3 include_once('NewsPage.php'); 2 4 3 5 function CategoryItemCompare($Item1, $Item2) … … 7 9 } 8 10 9 class News extends OldModule 10 { 11 var $Dependencies = array('User', 'Log'); 12 var $NewsCountPerCategory = 3; 13 var $UploadedFilesFolder = 'aktuality/uploads/'; 14 11 class News extends Model 12 { 13 function __construct($Database, $System) 14 { 15 parent::__construct($Database, $System); 16 $this->Name = 'News'; 17 $this->AddPropertyString('Title'); 18 $this->AddPropertyText('Content'); 19 $this->AddPropertyDateTime('Date'); 20 $this->AddPropertyDateTime('TargetDate'); 21 $this->AddPropertyString('Author'); 22 $this->AddPropertyString('IP'); 23 $this->AddPropertyOneToMany('Category', 'NewsCategory'); 24 $this->AddPropertyString('Enclosure'); 25 $this->AddPropertyOneToMany('User', 'User'); 26 $this->AddPropertyString('Link'); 27 } 28 15 29 function ModifyContent($Content) 16 30 { … … 40 54 return($Result); 41 55 } 56 } 57 58 class NewsCategory extends Model 59 { 60 function __construct($Database, $System) 61 { 62 parent::__construct($Database, $System); 63 $this->Name = 'NewsCategory'; 64 $this->AddPropertyString('Caption'); 65 $this->AddPropertyInteger('Permission'); 66 $this->AddPropertyInteger('Sequence'); 67 $this->AddPropertyInteger('Group'); 68 $this->AddPropertyString('RSS'); 69 } 70 } 71 72 class ModuleNews extends Module 73 { 74 var $NewsCountPerCategory = 3; 75 var $UploadedFilesFolder = 'aktuality/uploads/'; 76 77 function __construct($Database, $System) 78 { 79 parent::__construct($Database, $System); 80 $this->Name = 'News'; 81 $this->Version = '1.0'; 82 $this->Creator = 'Chronos'; 83 $this->License = 'GNU/GPL'; 84 $this->Description = 'News and news groups management'; 85 $this->Dependencies = array('User', 'Log'); 86 $this->Models = array('News', 'NewsCategory'); 87 } 88 89 function Install() 90 { 91 parent::Install(); 92 } 93 94 function UnInstall() 95 { 96 parent::UnInstall(); 97 } 98 99 function Init() 100 { 101 $this->System->Pages['aktuality'] = 'NewsPage'; 102 } 42 103 43 104 function ShowNews($Category, $ItemCount, $DaysAgo) … … 50 111 $Row = $DbResult->fetch_array(); 51 112 $Output = '<div class="NewsPanel"><div class="Title">'.$Row['Caption']; 52 $Output .= '<div class="Action"><a href="aktuality/ index.php?category='.$Category.'">Zobrazit</a>';113 $Output .= '<div class="Action"><a href="aktuality/?category='.$Category.'">Zobrazit</a>'; 53 114 if($this->System->Models['User']->CheckPermission('News', 'Insert', 'Group', $Category)) 54 $Output .= ' <a href="aktuality/ index.php?action=add&category='.$Category.'">Přidat</a>';115 $Output .= ' <a href="aktuality/?action=add&category='.$Category.'">Přidat</a>'; 55 116 $Output .= '</div></div><div class="Content">'; 56 117 $DbResult = $Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`) ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount); … … 67 128 if($Row['Name'] == '') $Author = $Row['Author']; 68 129 else $Author = $Row['Name']; 69 $Output .= '<tr><td onclick="window.location=\'aktuality/ index.php?action=view&id='.$Row['Id'].'\'" onmouseover="zobraz('."'new".$Category.$Index."'".')" style="cursor: pointer; margin: 0px;"><table class="NewsItemFrame"><tr><td style="font-size: '.$FontSize.'pt"><strong>'.$Row['Title'].'</strong></td><td align="right" style="font-size: '.$FontSize.'pt">'.$Author.' ('.HumanDate($Row['Date']).')</td></tr></table>';130 $Output .= '<tr><td onclick="window.location=\'aktuality/?action=view&id='.$Row['Id'].'\'" onmouseover="zobraz('."'new".$Category.$Index."'".')" style="cursor: pointer; margin: 0px;"><table class="NewsItemFrame"><tr><td style="font-size: '.$FontSize.'pt"><strong>'.$Row['Title'].'</strong></td><td align="right" style="font-size: '.$FontSize.'pt">'.$Author.' ('.HumanDate($Row['Date']).')</td></tr></table>'; 70 131 $Output .= '<div id="new'.$Category.$Index.'" class="NewsTableItem">'.$this->ModifyContent($Row['Content']); 71 132 if($Row['Link'] != '') $Output .= '<br/><a href="'.$Row['Link'].'">Odkaz</a>'; … … 143 204 $Output .= '</tr></table>'; 144 205 145 $Output .= '<a href="aktuality/subscription .php"><img class="RSSIcon" src="images/rss20.png" alt="Aktuality přes RSS" /></a> <a href="aktuality/subscription.php">Automatické sledování novinek</a>';206 $Output .= '<a href="aktuality/subscription"><img class="RSSIcon" src="images/rss20.png" alt="Aktuality přes RSS" /></a> <a href="aktuality/subscription">Automatické sledování novinek</a>'; 146 207 $Output .= '</div>'; 147 208 return($Output); … … 197 258 setcookie('NewsSetting', $_COOKIE['NewsSetting'], time() + 60 * 60 * 24 * 365); 198 259 } 260 199 261 } 200 262
Note:
See TracChangeset
for help on using the changeset viewer.