Example #1
0
 public function action_detail($id)
 {
     $data["news"] = Model_News::find($id, ["where" => [["deleted_at", 0], ["for_teachers", 1]]]);
     if ($data["news"] == null) {
         Response::redirect("teachers/news");
     }
     $is_read = Model_Readnews::find("first", ["where" => [["user_id" => $this->user->id], ["news_id" => $id]]]);
     if ($is_read == null) {
         $is_read = Model_Readnews::forge();
         $is_read->user_id = $this->user->id;
         $is_read->news_id = $id;
         $is_read->save();
     }
     $data["user"] = $this->user;
     $view = View::forge("teachers/news/detail", $data);
     $this->template->content = $view;
 }
Example #2
0
 public function action_detail($id)
 {
     $data["news"] = Model_News::find($id, ["where" => [["deleted_at", 0], ["for_students", 1]]]);
     $data['pasts'] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", 0)], ["deleted_at", 0]]]);
     $data["donetrial"] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", -1)], ["deleted_at", 0]]]);
     if ($data["news"] == null) {
         Response::redirect("students/news");
     }
     $is_read = Model_Readnews::find("first", ["where" => [["user_id" => $this->user->id], ["news_id" => $id]]]);
     if ($is_read == null) {
         $is_read = Model_Readnews::forge();
         $is_read->user_id = $this->user->id;
         $is_read->news_id = $id;
         $is_read->save();
     }
     $data["user"] = $this->user;
     $view = View::forge("students/news/detail", $data);
     $this->template->content = $view;
 }
Example #3
0
<div id="contents-wrap">
	<div id="main">
		<h3>Information</h3>
		<section class="feedback">
			<ul class="list-base">
				<?php 
foreach ($news as $new) {
    ?>
				<li><a href="/students/news/detail/<?php 
    echo $new->id;
    ?>
">
						<?php 
    $is_read = Model_Readnews::find("first", ["where" => [["user_id" => $user->id], ["news_id" => $new->id]]]);
    if ($is_read == null) {
        ?>
<span class="icon-new">NEW</span>
						<?php 
    }
    ?>
<strong><?php 
    echo $new->title;
    ?>
</strong></a></li>
				<?php 
}
?>
			</ul>
			<?php 
echo $pager;
?>