function get_article_info($dbc, $id) { $query = "SELECT * FROM article where id = {$id}"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); if ($row = mysqli_fetch_array($result)) { $article_info[title] = $row[title]; $article_info[create_time] = $row[create_time]; $article_info[deleted] = $row[deleted]; $article_info[publish_time] = $row[publish_time] == '' ? '尚未发布' : $row[publish_time]; $article_info[creators] = render_authors($dbc, $id, 'creator'); return $article_info; } }
$result = mysqli_query($dbc, $query) or die('Error querying database.'); //echo '<ul>'; $row_num = 1; $color = true; while ($row = mysqli_fetch_array($result)) { if ($color) { echo '<tr>'; } else { echo '<tr class="info">'; } $color = !$color; echo '<td>' . $row_num++ . '</td>'; echo '<td>' . render_authors($dbc, $row[id], 'creator') . '</td>'; echo '<td>' . render_authors($dbc, $row[id], 'author') . '</td>'; echo '<td>' . render_authors($dbc, $row[id], 'reviewer') . '</td>'; echo '<td>' . render_authors($dbc, $row[id], 'publisher') . '</td>'; echo '<td><a href="article.php?id=' . $row['id'] . '">' . $row['title'] . '</a>'; if ($recycle) { echo ' <a href="' . $_SERVER['PHP_SELF'] . '?recycle=' . $row['id'] . '"><i class="icon-share"></i></a>'; } echo '</td>'; echo '<td>' . get_abstract($dbc, $row['id']) . '</td>'; echo '<td>' . $row['create_time'] . '</td>'; //echo '<a class="btn" href="article.php?id=' . $row['id'] . '"><i class="icon-edit"></i></a>'; if ($role == 'creator') { if ($recycle) { echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?delete=' . $row['id'] . '"><i class="icon-trash"></i></a>'; } else { echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?recycle=' . $row['id'] . '"><i class="icon-trash"></i></a></td></tr>'; } }
echo render_authors($dbc, $id, 'creator', ', '); ?> ; <strong>作者: </strong> <?php echo render_authors($dbc, $id, 'author', ', '); ?> ; <strong>评审: </strong> <?php echo render_authors($dbc, $id, 'reviewer', ', '); ?> ; <strong>发布者: </strong> <?php echo render_authors($dbc, $id, 'publisher', ', '); ?> . <p> <strong>创建时间:</strong><?php echo $article_info[create_time]; ?> ; <strong>发布时间:</strong><?php echo $article_info[publish_time]; ?> </font></p> </font> <p> <?php if ($has_right_to_edit) { echo '<a class="btn btn-primary" href="article_metadata.php?id=' . $id . '"><i class="icon-th-list icon-white"></i> 编辑元信息</a>';