$result = db_query("SELECT\n\t\tt.id,\n\t\tt.title,\n\t\tt.isAdmin,\n\t\tt.threadDate,\n\t\t(SELECT COUNT(*) FROM bulletin_board_followups f WHERE t.id = f.topicID AND f.isActive = 1) replies,\n\t\tISNULL(u.nickname, u.firstname) + ' ' + u.lastname name\n\tFROM bulletin_board_topics t\n\tJOIN intranet_users u ON u.userID = t.createdBy\n\tWHERE t.isActive = 1 \n\tORDER BY t.threadDate DESC", 4); while ($r = db_fetch($result)) { if ($r["isAdmin"]) { $r["replies"] = "-"; } ?> <tr height="20"<?php if ($r["isAdmin"]) { ?> style="background-color:#fffce0;"<?php } ?> > <td width="90%"><a href="<?php echo $module["url"]; ?> topic.php?id=<?php echo $r["id"]; ?> "><?php echo format_text_shorten($r["title"], 41); ?> </a></td> <td width="10%" align="center"><?php echo $r["replies"]; ?> </td> </tr> <?php }
function draw_form_select($name, $sql_options, $value = false, $required = true, $class = false, $action = false, $nullvalue = "", $maxlength = false) { global $_josh; if (!$class) { $class = $_josh["styles"]["select"]; } $return = '<select name="' . $name . '" id="' . $name . '" class="' . $class . '"'; if ($action) { $return .= ' onchange="javascript:' . $action . '"'; } $return .= '>'; if (!$required) { $return .= "<option value=''>" . $nullvalue . "</option>"; } if (is_array($sql_options)) { while (list($key, $val) = each($sql_options)) { $val = format_text_shorten($val); $return .= "<option value='" . $key . "' id='" . $name . $key . "'"; if ($key == $value) { $return .= " selected"; } $return .= ">" . $val . "</option>"; } } else { $result = db_query($sql_options); $key = false; while ($r = db_fetch($result)) { if (!$key) { $key = array_keys($r); } $r[$key[1]] = format_text_shorten($r[$key[1]]); $return .= '<option value="' . $r[$key[0]] . '" id="' . $name . $r[$key[0]] . '"'; if ($r[$key[0]] == $value) { $return .= ' selected'; } $return .= '>' . $r[$key[1]] . '</option>'; } } $return .= '</select>'; return $return; }