function freshports_WatchListDDLB($dbh, $UserID, $selected = '', $size = 0, $multiple = 0, $show_active = 1, $element_id = 0) { # return the HTML which forms a dropdown list box. # optionally, select the item identified by $selected. $Debug = 0; $HTML = '<select name="wlid'; if ($multiple) { $HTML .= '[]'; } $HTML .= '" title="Select a watch list"'; if ($size) { $HTML .= ' size="' . $size . '"'; } if ($multiple) { $HTML .= ' multiple'; } $HTML .= ">\n"; $WatchLists = new WatchLists($dbh); $NumRows = $WatchLists->Fetch($UserID, $element_id); if ($Debug) { echo "{$NumRows} rows found!<br>"; echo "selected = '{$selected}'<br>"; } if ($NumRows) { for ($i = 0; $i < $NumRows; $i++) { $WatchList = $WatchLists->FetchNth($i); $HTML .= '<option value="' . htmlspecialchars(pg_escape_string($WatchList->id)) . '"'; if ($selected == '') { if ($element_id && $WatchList->watch_list_count > 0) { $HTML .= ' selected'; } } else { if ($WatchList->id == $selected) { $HTML .= ' selected'; } } $HTML .= '>' . htmlspecialchars(pg_escape_string($WatchList->name)); if ($show_active && $WatchList->in_service == 't') { $HTML .= '*'; } if ($element_id && $WatchList->watch_list_count) { $HTML .= " +"; } $HTML .= "</option>\n"; } } $HTML .= '</select>'; return $HTML; }
function DisplayWatchListNewsFeeds($db, $UserID) { $Debug = 0; echo '<h1>These are your newsfeeds</h1>'; $WatchLists = new WatchLists($db); $NumRows = $WatchLists->Fetch($UserID); if ($Debug) { echo "{$NumRows} rows found!<br>"; echo "selected = '{$selected}'<br>"; } $HTML = ''; if ($NumRows) { for ($i = 0; $i < $NumRows; $i++) { $WatchList = $WatchLists->FetchNth($i); $URL = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?id=' . $WatchList->token; $HTML .= '<a href="' . $URL . '">' . $WatchList->name . '</a><br>'; } } $HTML .= '</select>'; echo $HTML; }