<?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("image", array("required"));
		$this->addElement("image_name", array("required"));
		$this->addElement("position", array("required"), array("1", "2"));
		$this->addElement("text", array("required"));
		$this->addElement("reactions", array("required"), array("1", "2", "3", "4", "5", "6", "7"));
	}

	public function startData($currentData) {
		$data = array();
		
		$data["config"] = array(
			"image" => "",
			"image_name" => "",
			"position" => "1",
			"text" => ""
			);
		$data["options"] = true;

		return $data;
	}

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

		$name = "";
		$image = "";
		$video = "";
		$image = $this->getElement("image")->getValue();
		$image_name = $this->getElement("image_name")->getValue();
		$position = $this->getElement("position")->getValue();
		$text = $this->getElement("text")->getValue();
		$reactions = $this->getElement("reactions")->getValue();

		$config = array(
			"image" => $image,
			"image_name" => $image_name,
			"position" => $position,
			"text" => $text
			);
		
		return $this->__save($board_id, $name, $image, $video, $config, $reactions);
	}
}