Made quite a few changes so that the code works in the server
[vanilla-miry.git] / themes / categories.php
blob105d52824a01c7b4a5310322942db60379bda5e3
1 <?php
2 // Note: This file is included from the library/Vanilla/Vanilla.Control.CategoryList.php class.
4 $SessionPostBackKey = $this->Context->Session->GetCsrfValidationKey();
6 $CategoryList = '<div class="ContentInfo Top">
7 <h1>'.$this->Context->PageTitle.'</h1>
8 </div>
9 <div id="ContentBody">
10 <ol id="Categories">';
11 $Category = $this->Context->ObjectFactory->NewObject($this->Context, 'Category');
12 $FirstRow = 1;
13 $Alternate = 0;
14 while ($Row = $this->Context->Database->GetRow($this->Data)) {
15 $Category->Clear();
16 $Category->GetPropertiesFromDataSet($Row);
17 $Category->FormatPropertiesForDisplay();
18 $CategoryList .= '<li id="Category_'.$Category->CategoryID.'" class="Category'.($Category->Blocked?' BlockedCategory':' UnblockedCategory').($FirstRow?' FirstCategory':'').' Category_'.$Category->CategoryID.($Alternate ? ' Alternate' : '').'">
19 <ul>
20 <li class="CategoryName">
21 <span>'.$this->Context->GetDefinition('Category').'</span> <a href="'.GetUrl($this->Context->Configuration, 'index.php', '', 'CategoryID', $Category->CategoryID).'">'.$Category->Name.'</a>
22 </li>
23 <li class="CategoryDescription">
24 <span>'.$this->Context->GetDefinition('CategoryDescription').'</span> '.$Category->Description.'
25 </li>
26 <li class="CategoryDiscussionCount">
27 <span>'.$this->Context->GetDefinition('Discussions').'</span> '.$Category->DiscussionCount.'
28 </li>';
29 if ($this->Context->Session->UserID > 0) {
30 $CategoryList .= '
31 <li class="CategoryOptions">
32 <span>'.$this->Context->GetDefinition('Options').'</span> ';
33 if ($Category->Blocked) {
34 $CategoryList .= '<a id="BlockCategory'.$Category->CategoryID.'" onclick="ToggleCategoryBlock('."'".$this->Context->Configuration['WEB_ROOT']."ajax/blockcategory.php', ".$Category->CategoryID.", 0, 'BlockCategory".$Category->CategoryID."', '".$SessionPostBackKey."');\">".$this->Context->GetDefinition('UnblockCategory').'</a>';
35 } else {
36 $CategoryList .= '<a id="BlockCategory'.$Category->CategoryID.'" onclick="ToggleCategoryBlock('."'".$this->Context->Configuration['WEB_ROOT']."ajax/blockcategory.php', ".$Category->CategoryID.", 1, 'BlockCategory".$Category->CategoryID."', '".$SessionPostBackKey."');\">".$this->Context->GetDefinition('BlockCategory').'</a>';
38 $CategoryList .= '</li>
41 $CategoryList .= '</ul>
42 </li>';
43 $FirstRow = 0;
44 $Alternate = FlipBool($Alternate);
46 echo $CategoryList
47 .'</ol>
48 </div>';