function SLAM_makeAssetListHTML(&$config, $db, $user, $request, $result) { /* register the necessary header files */ $config->html['css'][] = 'css/list.css'; $config->html['js'][] = 'js/list.js'; /* register the javascript plugin stub */ $config->html['onload'][] = 'doListJS()'; $s = "<div id='assetListContainer'>\n"; $categories = array_keys($result->assets); foreach ($result->assets as $category => $assets) { /* append the category name */ if (count($result->assets) > 1) { $s .= "<div class='assetListName' onClick=\"toggleHideBodyId('assetListTable_{$category}')\">{$category}</div>\n"; } /* generate the category list html */ $s .= "<form name='assetListForm_{$category}' action='" . $request->makeRequestURL($config, array('location' => 'list', 'category' => array($category)), false) . "' method='POST'>\n"; if (count($assets) > 0) { $s .= SLAM_makeAssetTableActions($category); $s .= SLAM_makeAssetTableNavigation($config, $request, $result, $category); $s .= SLAM_makeAssetTableFunctions($category); } $s .= SLAM_makeAssetTableHTML($config, $db, $user, $request, $category, $assets); if ($category != $categories[count($result->assets) - 1]) { $s .= "</form>\n"; } } $s .= SLAM_makeAssetTableActions($category); $s .= SLAM_makeAssetTableNavigation($config, $request, $result, $category); $s .= SLAM_makeAssetTableFunctions($category); $s .= "</form>\n"; $s .= "</div>\n"; return $s; }
function SLAM_makeDashboardListHTML(&$config, $db, $user, $request, $result) { if (empty($result->assets)) { return "<div id='dashboardNoEntries'><span>No assets to show</span></div>\n"; } $s .= "<form name='dashboardListForm' action='" . $request->makeRequestURL($config, array('location' => 'dash', 'order' => $request->order), false) . "' method='POST'>\n"; $s .= "<div id='assetListContainer'>\n"; /* are we to automatically tag entries from these categories? */ $tag = empty($request->search) ? '&tag=true' : ''; /* display the different tables */ foreach ($result->assets as $category => $assets) { /* append the category name */ $s .= "<div class='assetListName'><a href='#' onClick=\"toggleHideBodyId('assetListTable_{$category}'); return false;\" >{$category}</a> <input type='button' value='New' onClick=\"location.href='index.php?a=new&cat={$category}&loc=dash{$tag}'\"/></div>\n"; $s .= SLAM_makeAssetTableHTML($config, $db, $user, $request, $category, $assets); if ($assets != $result->assets[count($result->assets) - 1]) { $s .= "</form>\n"; } } $s .= SLAM_makeDashTableActions($category, !empty($request->search)); $s .= "</div>\n"; $s .= "</form>\n"; return $s; }