function getEditorStatus($pid) { $sql = sprintf("SELECT user_info.fullname FROM user_info INNER JOIN editor_queue ON user_info.uid=editor_queue.uid WHERE editor_queue.pid='%s'", mysql_real_escape_string($pid)); $eds = get_elements($sql); $need = getNeededEditors($pid); // warning: total needed, not additional $edc = count($eds); if ($eds) { return array($edc . "/{$need}: " . implode(", ", $eds), $need - $edc); } else { return array("<span class='emptylist'>0/{$need}</span>", $need - $edc); } }
function displayEditors($uid, $pid) { ?> <tr> <td class='peopleInfo'> <strong>Discussion Editors:</strong> <?php $est = getEditorStatus($pid); echo $est[0]; ?> <a href="#" class="changeLink">[Change]</a> <!-- There was an if statement around this entire [change] block before, but non-authors should be able to add themselves as discussion editors, and authors should be able to change the number of discussion editors needed, so that's, like, everybody... --> </td> </tr> <tr> <td> <?php if (canChangeEditorsNeeded($uid, $pid)) { ?> <div> <form method="post" action="form-submit.php"> <input type="hidden" name="uid" value="<?php echo $uid; ?> " /> <input type="hidden" name="pid" value="<?php echo $pid; ?> " /> Change # of needed editors: <input type="text" name="needed_editors" value="<?php echo getNeededEditors($pid); ?> " class="shortin" /> <input type="submit" name="changeNeededEditors" value="Go" /> </form> </div> <?php } ?> <table> <form method="post" action="form-submit.php"> <input type="hidden" name="uid" value="<?php echo $uid; ?> " /> <input type="hidden" name="pid" value="<?php echo $pid; ?> " /> <tr> <td> <p><strong>Remove Discussion Editor(s):</strong></p> <?php echo displayRemoveEditor($pid, $uid); ?> </td> <td> <p><strong>Add Discussion Editor(s):</strong></p> <?php echo displayAddEditor($pid, $uid); ?> </td> </tr> <tr> <td colspan="2"> <input type="submit" name="changeEditors" value="Change Editors" /> </td> </tr> </form> </table> </td> </tr> <?php }