objectManager: Fix lower-case letter in 'email Text'
[NewAppDB.git] / appbrowse.php
blobedf633e3f677ed86f85bee11f91e51ac73e3e2ab
1 <?php
2 /**
3 * Application browser.
5 * Optional parameters:
6 * - iCatId, shows applications that belong to the category identified by iCatId
7 */
9 // application environment
10 require("path.php");
11 require(BASE."include/"."incl.php");
12 require_once(BASE."include/"."appdb.php");
13 require_once(BASE."include/"."category.php");
15 function admin_menu()
17 global $aClean;
19 $m = new htmlmenu("Admin");
20 $m->add('Edit this Category', BASE."objectManager.php?iId=${aClean[iCatId]}&amp;sClass=category&amp;sAction=edit");
22 /* We only allow deletion of the category if it is empty */
23 $oCat = new category($aClean['iCatId']);
24 if(!sizeof($oCat->aApplicationsIds))
25 $m->add('Delete this Category', BASE."objectManager.php?iId=${aClean[iCatId]}&amp;sClass=category&amp;sAction=delete");
27 $m->done();
30 $iCatId = isset($aClean['iCatId']) ? $aClean['iCatId'] : 0;
31 // list sub categories
32 $oCat = new Category( $iCatId );
33 $sCatFullPath = Category::make_cat_path($oCat->getCategoryPath());
34 $subs = $oCat->aSubcatsIds;
36 //display admin box
37 if($_SESSION['current']->hasPriv("admin") && isset($aClean['iCatId']) && $aClean['iCatId'] != 0 )
38 apidb_sidebar_add("admin_menu");
40 //output header
41 apidb_header("Browse Applications");
43 echo "<div class='default_container'>\n";
45 if($subs)
47 echo html_frame_start("",'98%','',2);
48 echo "<p><b>Category: ". $sCatFullPath ."</b><br>\n";
49 echo html_frame_end();
51 echo html_frame_start("","98%","",0);
53 $oTable = new Table();
54 $oTable->SetWidth("100%");
55 $oTable->SetBorder(0);
56 $oTable->SetCellPadding(3);
57 $oTable->SetCellSpacing(1);
59 $oTableRow = new TableRow();
60 $oTableRow->SetClass("color4");
61 $oTableRow->AddTextCell("Sub Category");
62 $oTableRow->AddTextCell("Description");
63 $oTableRow->AddTextCell("No. Apps");
64 $oTable->SetHeader($oTableRow);
66 while(list($i,$iSubcatId) = each($subs))
68 $oSubCat= new Category($iSubcatId);
70 //set row color
71 $sColor = ($i % 2) ? "color0" : "color1";
73 $oTableRowHighlight = GetStandardRowHighlight($i);
75 $sUrl = "appbrowse.php?iCatId=$iSubcatId";
77 $oTableRowClick = new TableRowClick($sUrl);
78 $oTableRowClick->SetHighlight($oTableRowHighlight);
80 //get number of apps in this sub-category
81 $iAppcount = $oSubCat->getApplicationCount();
83 //format desc
84 $sDesc = substr(stripslashes($oSubCat->sDescription),0,70);
86 //display row
87 $oTableRow = new TableRow();
88 $oTableRow->SetClass($sColor);
89 $oTableRow->SetRowClick($oTableRowClick);
91 $oTableCell = new TableCell($oSubCat->sName);
92 $oTableCell->SetCellLink($sUrl);
93 $oTableRow->AddCell($oTableCell);
94 $oTableRow->AddTextCell("$sDesc &nbsp;");
95 $oTableRow->AddTextCell("$iAppcount &nbsp;");
97 $oTable->AddRow($oTableRow);
100 // output the table
101 echo $oTable->GetString();
103 echo html_frame_end( count($subs) . ' categories');
108 // list applications in this category
109 $apps = $oCat->aApplicationsIds;
110 if($apps)
112 echo html_frame_start("",'98%','',2);
113 echo "<p><b>Category: ". $sCatFullPath ."</b><br>\n";
114 echo html_frame_end();
116 echo html_frame_start("","98%","",0);
118 $oTable = new Table();
119 $oTable->SetWidth("100%");
120 $oTable->SetBorder(0);
121 $oTable->SetCellPadding(3);
122 $oTable->SetCellSpacing(1);
124 $oTableRow = new TableRow();
125 $oTableRow->SetClass("color4");
126 $oTableRow->AddTextCell("Application name");
127 $oTableRow->AddTextCell("Description");
128 $oTableRow->AddTextCell("No. Versions");
130 $oTable->SetHeader($oTableRow);
132 while(list($i, $iAppId) = each($apps))
134 $oApp = new Application($iAppId);
136 //set row color
137 $sColor = ($i % 2) ? "color0" : "color1";
139 $oTableRowHighlight = GetStandardRowHighlight($i);
141 $sUrl = $oApp->objectMakeUrl();
143 $oTableRowClick = new TableRowClick($sUrl);
144 $oTableRowClick->SetHighlight($oTableRowHighlight);
146 //format desc
147 $sDesc = util_trim_description($oApp->sDescription);
149 //display row
150 $oTableRow = new TableRow();
151 $oTableRow->SetRowClick($oTableRowClick);
152 $oTableRow->SetClass($sColor);
153 $oTableRow->AddTextCell($oApp->objectMakeLink());
154 $oTableRow->AddTextCell("$sDesc &nbsp;");
155 $oTableRow->AddTextCell(sizeof($oApp->aVersionsIds));
157 $oTable->AddRow($oTableRow);
160 // output table
161 echo $oTable->GetString();
163 echo html_frame_end( count($apps) . " applications in this category");
166 // Disabled for now
167 //if ($aClean['iCatId'] != 0)
169 // log_category_visit($cat->id);
172 echo p();
174 echo "</div>\n";
176 apidb_footer();