:::
主內容區域
10-1 修改學生看到的所有投稿主題畫面
- 修改
op_submission_index.tpl<!--投稿主題--> <td><a href="<{$smarty.server.PHP_SELF}>?id=<{$data.id}>"><{$data.title}></a><{$data.files}></td>將連結改為
<{$smarty.server.PHP_SELF}>,其值為$_SERVER['PHP_SELF'],也就是目前網址所執行的檔案,這樣的好處是可以在index.php和setup.php共用 - 修改
index.php的流程,使學生也能看投稿主題的內容//預設動作 default: if (empty($id)) { ...略... } else { $where_arr['id'] = $id; Submission::show($where_arr); $op = 'submission_show'; } break; - 修改
class/Submission.php中的get(),加入:$data['start_ts'] = \strtotime($data['start']); $data['end_ts'] = \strtotime($data['end']); $data['now'] = \time(); - 修改
templates/op_submission_show.tpl在下方加入:<div class="text-center my-3"> <{if $now < $start_ts}> <div class="fs-1 text-info">尚未開始</div> <{elseif $data.now > $data.end_ts}> <div class="fs-1 text-muted">已結束</div> <{else}> <a href="index.php?op=submission_data_create&submission_id=<{$id}>" class="btn btn-primary btn-lg"><i class="fa-solid fa-pen-nib"></i> 我要投稿</a> <{/if}> </div> - 標題的「回投稿管理列表」連結也請改成環境變數:
<h1 class="my text-center"> <a href="<{$smarty.server.PHP_SELF}>" class="text-black-50" data-bs-toggle="tooltip" title="回投稿管理列表"> <i class="fa-solid fa-turn-up fa-rotate-270"></i> </a> <{$title}> </h1>
10. 開始修改「線上投稿」畫面