function manage($page = 1) { $this->viewdata["function_title"] = '<a href="' . site_url('/admin/comics/manage/') . '">' . _('manage') . '</a>'; $comics = new Comic(); if ($this->input->post('search')) { $search = $this->input->post('search'); $comics->ilike('name', $search)->limit(20); $this->viewdata["extra_title"][] = _('Searching') . ': ' . htmlspecialchars(($search)); } $comics->order_by('name', 'ASC'); $comics->get_paged_iterated($page, 20); $data["comics"] = $comics; $this->viewdata["main_content_view"] = $this->load->view("admin/comics/manage.php", $data, TRUE); $this->load->view("admin/default.php", $this->viewdata); }
function add_new_chapter() { $this->viewdata["function_title"] = '<a href="#">' . _("Add New") . '</a>'; if ($this->input->post()) { $chapter = new Chapter(); if ($chapter->add($this->input->post())) { $subchapter = is_int($chapter->subchapter) ? $chapter->subchapter : 0; flash_notice('notice', sprintf(_('Chapter %s has been added to %s.'), $chapter->chapter . '.' . $subchapter, $chapter->comic->name)); redirect('/admin/series/series/' . $chapter->comic->stub . '/' . $chapter->id); } } $this->viewdata["extra_title"][] = _("Chapter"); // Obtain All Comics $comics = new Comic(); $comics->order_by('name', 'ASC')->get(); // Generate Dropdown Array $dropdown = array(); foreach ($comics->all as $comic) { $dropdown[$comic->id] = $comic->name; } // Setup Comics Dropdown $chapter = new Chapter(); $chapter->validation['comic_id']['label'] = _('Series'); $chapter->validation['comic_id']['type'] = 'dropdowner'; $chapter->validation['comic_id']['values'] = $dropdown; $chapter->validation['comic_id']['help'] = _('Add chapter to selected series.'); $table = ormer($chapter); $table[] = array(_('Teams'), array('name' => 'team', 'type' => 'input', 'value' => array('value' => get_setting('fs_gen_default_team')), 'help' => _('Insert the names of the teams who worked on this chapter.'))); $table = tabler($table, FALSE, TRUE); $data["form_title"] = _('Add New Chapter'); $data["table"] = $table; $this->viewdata["main_content_view"] = $this->load->view("admin/form.php", $data, TRUE); $this->load->view("admin/default.php", $this->viewdata); return true; }
public function read($comic, $language = 'en', $volume = 0, $chapter = "", $subchapter = 0, $team = 0, $joint = 0, $pagetext = 'page', $page = 1) { $comice = new Comic(); $comice->where('stub', $comic)->get(); if ($comice->result_count() == 0) { set_notice('warn', 'This comic doesn\'t exist.'); } if ($chapter == "") { redirect('/reader/comic/' . $comic); } $chaptere = new Chapter(); $chaptere->where('comic_id', $comice->id)->where('language', $language)->where('volume', $volume)->where('chapter', $chapter)->order_by('subchapter', 'ASC'); if (!is_int($subchapter) && $subchapter == 'page') { $current_page = $team; } else { $chaptere->where('subchapter', $subchapter); if ($team == 'page') $current_page = $joint; else { if ($team != 0) { $teame = new Team(); $teame->where('stub', $team)->get(); $chaptere->where('team_id', $teame->id); } if ($joint == 'page') $current_page = $pagetext; if ($joint != 0) { $chaptere->where('joint_id', $joint); } } } if (!isset($current_page)) { if ($page != 1) $current_page = $page; else $current_page = 1; } $chaptere->get(); if ($chaptere->result_count() == 0) { show_404(); } $pages = $chaptere->get_pages(); foreach($pages as $page) unset($page["object"]); $next_chapter = $chaptere->next(); if ($current_page > count($pages)) redirect($next_chapter); if ($current_page < 1) $current_page = 1; $chapters = new Chapter(); $chapters->where('comic_id', $comice->id)->order_by('volume', 'desc')->order_by('chapter', 'desc')->order_by('subchapter', 'desc')->get_bulk(); $comics = new Comic(); $comics->order_by('name', 'ASC')->limit(100)->get(); $this->template->set('is_reader', TRUE); $this->template->set('comic', $comice); $this->template->set('chapter', $chaptere); $this->template->set('chapters', $chapters); $this->template->set('comics', $comics); $this->template->set('current_page', $current_page); $this->template->set('pages', $pages); $this->template->set('next_chapter', $next_chapter); $this->template->title($comice->name . ' :: ' . _('Chapter') . ' ' . $chaptere->chapter); $this->template->build('read'); }
public function read($comic, $language = 'en', $volume = 0, $chapter = "", $subchapter = 0, $team = 0, $joint = 0, $pagetext = 'page', $page = 1) { $comice = new Comic(); $comice->where('stub', $comic)->get(); if ($comice->result_count() == 0) { set_notice('warn', 'This comic doesn\'t exist.'); } if ($chapter == "") { redirect('series/' . $comic); } if (!$this->_check_adult($comice)) { // or this function won't stop return FALSE; } $chaptere = new Chapter(); $chaptere->where('comic_id', $comice->id)->where('language', $language)->where('volume', $volume)->where('chapter', $chapter)->order_by('subchapter', 'ASC'); if (!is_int($subchapter) && $subchapter == 'page') { $current_page = $team; } else { $chaptere->where('subchapter', $subchapter); if ($team == 'page') { $current_page = $joint; } else { if ($team != 0) { $teame = new Team(); $teame->where('stub', $team)->get(); $chaptere->where('team_id', $teame->id); } if ($joint == 'page') { $current_page = $pagetext; } if ($joint != 0) { $chaptere->where('joint_id', $joint); } } } if (!isset($current_page)) { if ($page != 1) { $current_page = $page; } else { $current_page = 1; } } $chaptere->get(); if ($chaptere->result_count() == 0) { show_404(); } $pages = $chaptere->get_pages(); foreach ($pages as $page) { unset($page["object"]); } $next_chapter = $chaptere->next(); if ($current_page > count($pages)) { redirect($next_chapter); } if ($current_page < 1) { $current_page = 1; } $chapters = new Chapter(); $chapters->where('comic_id', $comice->id)->order_by('volume', 'desc')->order_by('chapter', 'desc')->order_by('subchapter', 'desc')->get_bulk(); $comics = new Comic(); $comics->order_by('name', 'ASC')->limit(100)->get(); $this->template->set('is_reader', TRUE); $this->template->set('comic', $comice); $this->template->set('chapter', $chaptere); $this->template->set('chapters', $chapters); $this->template->set('comics', $comics); $this->template->set('current_page', $current_page); $this->template->set('pages', $pages); $this->template->set('next_chapter', $next_chapter); $this->template->title($comice->name, _('Chapter') . ' ' . $chaptere->chapter, get_setting('fs_gen_site_title')); switch ($comice->format) { case 1: $format = 'readtoon'; break; default: $format = 'read'; } $this->template->build($format); }