function Draw_tags($pro_id, $contest_id = 0) { if (!isset($_SESSION['user_id'])) { return; } $user_id = $_SESSION['user_id']; echo '<table border=0><tr>'; //是否解决/提交 $query = "select result from user_submit where user_id=" . intval($user_id) . " and pro_id=" . intval($pro_id); $ret = oj_query($query); $row = mysql_fetch_row($ret); if (isset($row[0])) { if ($contest_id != 0) { $query = "select max(result=1) from submit_status where user_id=" . intval($user_id) . " and pro_id=" . intval($pro_id) . " and contest_id=" . intval($contest_id); $ret = oj_query($query); $row = mysql_fetch_row($ret); if (isset($row[0])) { $state = $row[0]; } } else { $state = $row[0]; } } if (isset($state)) { echo '<td>'; if ($state == 0) { Draw_single_tag('Submitted', '#ccccff', '#333377'); } else { Draw_single_tag('Solved', 'red', 'white'); } echo '</td>'; } //其他tag $query = 'select config_mark.* from user_mark ' . 'inner join config_mark on user_mark.mark_id=config_mark.mark_id ' . " where user_id=" . intval($user_id) . " and pro_id=" . intval($pro_id); $ret = oj_query($query); while ($row = mysql_fetch_assoc($ret)) { echo '<td>'; $tag_fore_color = rgb_to_html($row['fore_color']); $tag_entity = "<a href='search.php?field=tag&text={$row['mark_id']}' style='color:{$tag_fore_color}'>{$row['mark_des']}</a>"; Draw_single_tag($tag_entity, rgb_to_html($row['back_color']), ''); echo '</td>'; } //添加tag echo '<td>'; Draw_single_tag("<a title='Edit tag' href='addtag.php?pro_id={$pro_id}'>+</a>", '#ccffcc', ''); echo '</td>'; echo '</tr></table>'; }
echo '<tr>'; } $now_mark_id = $row['mark_id']; $now_tag_count = 0; if (isset($tag_count[$now_mark_id])) { $now_tag_count = $tag_count[$now_mark_id]; } echo '<td align=center width=20% title="'; echo $now_tag_count . ' people marked this problem as ' . $row['mark_des']; echo '">'; echo "<input type=checkbox name='new_tag[]' value='{$now_mark_id}' "; if (isset($tag_marked[$now_mark_id])) { echo 'checked'; } echo '>'; Draw_single_tag($row['mark_des'] . "({$now_tag_count})", rgb_to_html($row['back_color']), rgb_to_html($row['fore_color'])); echo '</td>'; $i++; if ($i == 5) { echo '</tr>'; $i = 0; } } if ($i != 0) { echo '</tr>'; } ?> </table> <center><input type=submit value='Update' name='action'></center> </form> <?php