<?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("description", array("required"));
		$this->addElement("options", array("required"));
		$this->addElement("more_options", array("required"));
	}

	public function startData($currentData) {
		$data = array();
		
		$data["config"] = array(
			"image" => "",
			"image_name" => "",
			"description" => "",
			"more_options" => "1"
			);
		$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();
		$description = $this->getElement("description")->getValue();
		$options = $this->getElement("options")->getValue();
		$more_options = (int)$this->getElement("more_options")->getValue();

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

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