Installed apps as array instead of string

This commit is contained in:
Fabio Comuni 2011-08-31 16:17:32 +02:00
parent d0926240a8
commit 71d44d78ec
7 changed files with 23 additions and 13 deletions

View File

@ -17,7 +17,7 @@ function calc_uninstall() {
} }
function calc_app_menu($a,&$b) { function calc_app_menu($a,&$b) {
$b['app_menu'] .= '<div class="app-title"><a href="calc">Calculator</a></div>'; $b['app_menu'][] = Array('url'=>'calc', 'name'=>'Calculator');
} }

View File

@ -15,7 +15,7 @@ function convert_uninstall() {
} }
function convert_app_menu($a,&$b) { function convert_app_menu($a,&$b) {
$b['app_menu'] .= '<div class="app-title"><a href="convert">Units Conversion</a></div>'; $b['app_menu'][] = Array('url'=>'convert', 'name'=>'Units Conversion');
} }

View File

@ -22,7 +22,7 @@ function sniper_uninstall() {
} }
function sniper_app_menu($a,&$b) { function sniper_app_menu($a,&$b) {
$b['app_menu'] .= '<div class="app-title"><a href="sniper">Hot Shot Sniper</a></div>'; $b['app_menu'][] = Array('url'=>'sniper', 'name'=>'Hot Shot Sniper');
} }

View File

@ -17,7 +17,7 @@ function tictac_uninstall() {
} }
function tictac_app_menu($a,&$b) { function tictac_app_menu($a,&$b) {
$b['app_menu'] .= '<div class="app-title"><a href="tictac">' . t('Three Dimensional Tic-Tac-Toe') . '</a></div>'; $b['app_menu'][] = Array('url'=>'tictac', 'name'=>'Three Dimensional Tic-Tac-Toe');
} }

View File

@ -246,7 +246,7 @@ class App {
public $timezone; public $timezone;
public $interactive = true; public $interactive = true;
public $plugins; public $plugins;
public $apps; public $apps = Array();
public $identities; public $identities;
private $scheme; private $scheme;

View File

@ -1,15 +1,18 @@
<?php <?php
function apps_content(&$a) { function apps_content(&$a) {
$title = t('Applications');
$o .= '<h3>' . t('Applications') . '</h3>'; if(count($a->apps)==0)
if($a->apps)
$o .= $a->apps;
else
notice( t('No installed applications.') . EOL); notice( t('No installed applications.') . EOL);
return $o;
} $tpl = get_markup_template("apps.tpl");
return replace_macros($tpl, array(
'$title' => $title,
'$apps' => $a->apps,
));
}

7
view/apps.tpl Normal file
View File

@ -0,0 +1,7 @@
<h3>$title</h3>
<ul>
{{ for $apps as $ap }}
<li><a href="$ap.url">$ap.name</a></li>
{{ endfor }}
</ul>