<?php
/**
 * class presentation_edit_form
 *
 * Description for class presentation_edit_form
 *
 * @author:
*/
namespace form;

use form\slide_form;

class slide_extend_form extends slide_form {
	public function init() {
		$this->addElement("name", array("required"));
		$this->addElement("image", array("required"));
		$this->addElement("image_name", array("required"));
		$this->addElement("options", array("required"));
		$this->addElement("correct", array("required"));
		$this->addElement("time", array("required"));
	}

	public function startData($currentData) {
		$data = array();
		
		$data["config"] = array(
			"image" => "",
			"image_name" => "",
			"time" => "30"
			);
		$data["options"] = false;

		return $data;
	}

	public function save($board_id) {
		global $__database;

		$name = $this->getElement("name")->getValue();
		$image = $this->getElement("image")->getValue();
		$image_name = $this->getElement("image_name")->getValue();
		$options = $this->getElement("options")->getValue();
		$correct = $this->getElement("correct")->getValue();
		$time = (int)$this->getElement("time")->getValue();

		$config = array(
			"image" => $image,
			"image_name" => $image_name,
			"time" => $time
			);

		return $this->__save($board_id, $name, "", "", $config, array(), $options, $correct);
	}
}