示例#1
0
 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;
 }
示例#2
0
 public function import_compressed()
 {
     $chapter = new Chapter();
     if (!$chapter->add($this->input->post())) {
         log_message('error', 'import_compressed(): Couldn\'t create chapter');
         return array('error' => "Couldn't create the chapter.");
     }
     if (!is_dir($this->input->post('server_path'))) {
         $extension = pathinfo($this->input->post('server_path'), PATHINFO_EXTENSION);
     } else {
         $extension = '';
     }
     if (!$this->compressed_chapter($this->input->post('server_path'), 'file.' . $extension, $chapter->id)) {
         $chapter->remove();
         log_message('error', 'import_compressed(): Couldn\'t add the pages to the chapter');
         return array('error' => "Couldn't add the pages to the chapter.");
     }
     return array('success' => TRUE);
 }
示例#3
0
	public function import_compressed() {

		$chapter = new Chapter();
		if (!$chapter->add($this->input->post())) {
			log_message('error', 'import_compressed(): Couldn\'t create chapter');
			return array('error' => "Couldn't create the chapter.");
		}
		$data['chapter_id'] = $chapter->id;
		$data['overwrite'] = 1;
		$data['full_path'] = $this->input->post('server_path');
		$data['raw_name'] = 'import_' . $chapter->id;
		if(!is_dir($data["full_path"]))
		$data['file_ext'] = '.'.end(explode('.', $this->input->post('server_path')));
		if (!$this->compressed_chapter($data)) {
			$chapter->remove();
			log_message('error', 'import_compressed(): Couldn\'t add the pages to the chapter');
			return array('error' => "Couldn't add the pages to the chapter.");
		}
		return array('success' => TRUE);
	}
示例#4
0
	function add_new($stub = "") {
		$this->viewdata["function_title"] = _("Add new");

		//$stub stands for $comic, but there's already a $comic here
		if ($stub != "") {
			if ($this->input->post()) {
				$chapter = new Chapter();
				if ($chapter->add($this->input->post())) {
					redirect('/admin/comics/comic/' . $chapter->comic->stub . '/' . $chapter->id);
				}
			}
			$comic = new Comic();
			$comic->where('stub', $stub)->get();
			$this->viewdata["extra_title"][] = _("Chapter in") . ' ' . $comic->name;
			$chapter = new Chapter();
			$chapter->comic_id = $comic->id;

			$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["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;
		}
		else {
			$comic = new Comic();
			if ($this->input->post()) {
				if ($comic->add($this->input->post())) {
					$config['upload_path'] = 'content/cache/';
					$config['allowed_types'] = 'jpg|png|gif';
					$this->load->library('upload', $config);
					$field_name = "thumbnail";
					if (count($_FILES) > 0 && $this->upload->do_upload($field_name)) {
						$up_data = $this->upload->data();
						if (!$this->files_model->comic_thumb($comic, $up_data)) {
							log_message("error", "Controller: comics.php/add_new: image failed being added to folder");
						}
						if (!unlink($up_data["full_path"])) {
							log_message('error', 'comics.php/add_new: couldn\'t remove cache file ' . $data["full_path"]);
							return false;
						}
					}
					redirect('/admin/comics/comic/' . $comic->stub);
				}
			}

			$table = ormer($comic);
			$table[] = array(
				_('Licensed in'),
				array(
					'name' => 'licensed',
					'type' => 'nation',
					'value' => array(),
					'help' => _('Insert the nations where the comic is licensed in order to limit the availability.')
				)
			);

			$table = tabler($table, FALSE, TRUE);
			$data['table'] = $table;

			$this->viewdata["extra_title"][] = _("Comic");
			$this->viewdata["main_content_view"] = $this->load->view("admin/form.php", $data, TRUE);
			$this->load->view("admin/default.php", $this->viewdata);
		}
	}
示例#5
0
            }
        }
        $chapter->numberofhost = $realnumberofhost;
        $chapter->fansubmember += array('translator' => get_userid_massively($_POST["translator"]));
        if (!empty($_POST["proofreader"])) {
            $chapter->fansubmember += array('proofreader' => get_userid_massively($_POST["proofreader"]));
        }
        $chapter->fansubmember += array('editor' => get_userid_massively($_POST["editor"]));
        if (!empty($_POST["qualitychecker"])) {
            $chapter->fansubmember += array('qualitychecker' => get_userid_massively($_POST["qualitychecker"]));
        }
        $chapter->fansubmember += array('uploader' => $vbulletin->userinfo['userid']);
        $error = $chapter->validate();
        if ($error == "") {
            $messagetype = "success";
            $message = $chapter->add();
            $contenttemplatename = 'yrms_message';
        } else {
            $messagetype = "error";
            $message = nl2br(construct_phrase($vbphrase['yrms_msg_error_head'], $vbphrase['yrms_chapteradd']) . "\n" . $error);
        }
    }
    if (!isset($contenttemplatename)) {
        $contenttemplatename = 'yrms_vietsubmanga_chapter_add';
    }
    $messagebox = vB_Template::create('yrms_messagebox');
    $messagebox->register('messagetype', $messagetype);
    $messagebox->register('message', $message);
}
if ($_REQUEST['do'] == 'chapterreward') {
    $pagetitle = $vbphrase['yrms_newchapter_award'];