<?php
class MyWeb_File_Form_LoginIni extends MyWeb_File_Form_AbstractIni
{
	private $_addContent;
	
	
	
	
	private $_nameLogin = "user_userName";
	private $_labelLogin = "Login";
	private $_namePassword = "user_passwd";
	private $_labelPassword = "Password";
	private $_lengthLoginDown = 3;
	private $_lengthLoginUp = 20;
	private $_lengthPasswordUp = 20;
	
	/**
	 * 
	 * Metoda prida retezec do vysledneho souboru
	 * @param $content
	 */
	public function add_contentFile($content)
	{
		$this->_addContent = $content;
	}
	
	private function defaultSettings()
	{
		if (is_null($this->_describeTable)){
			$this->_describeTable = $this->_dbTable->get_describeTable();
		}
	}
	
	public function __construct($dbTable,$path = null)
	{
		$this->_dbTable = $dbTable;
		$this->defaultSettings();
		$this->_path = $path;	//*** pridano zajistuje pouziti nove cesty od uzivatele misto default
		$this->defaultSettingsPath($this->_default_path_form_ini);
		$this->set_typeFile('ini');
		$this->_currentPrefix = 0;
		if (0 === strcmp($this->_filename, 'none')){
			$this->_filename = $this->_dbTable->get_modelName().ucfirst($this->_labelLogin);
		}
	}
	
	
	public function createContent()
	{
		
		$stringFile = "\n".
		
		'elements.'.$this->_nameLogin.'.Type = text'															. "\n" .
		'elements.'.$this->_nameLogin.'.Options.required = true' 												. "\n" .
		'elements.'.$this->_nameLogin.'.Options.label = '.$this->_labelLogin									. "\n" .
		'elements.'.$this->_nameLogin.'.Options.size = '.$this->_lengthLoginUp									. "\n" .
		'elements.'.$this->_nameLogin.'.Options.maxlength = '.$this->_lengthLoginUp								. "\n" .
																												  "\n" .
		'elements.'.$this->_nameLogin.'.Options.validators.length.validator = "StringLength"'					. "\n" .
		'elements.'.$this->_nameLogin.'.Options.validators.length.options.1 = '.$this->_lengthLoginDown			. "\n" .
		'elements.'.$this->_nameLogin.'.Options.validators.length.options.2 = '.$this->_lengthLoginUp			. "\n" .
		'elements.'.$this->_nameLogin.'.Options.validators.alnum.validator = "Alnum"'							. "\n" .
																												  "\n" .
																												  "\n" .
																												  "\n" .
		'elements.'.$this->_namePassword.'.Type = text' 														. "\n" .
		'elements.'.$this->_namePassword.'.Options.required = true' 											. "\n" .
		'elements.'.$this->_namePassword.'.Options.label = '.$this->_labelPassword								. "\n" .
		'elements.'.$this->_namePassword.'.Options.size = '.$this->_lengthPasswordUp							. "\n" .
		'elements.'.$this->_namePassword.'.Options.maxlength = '.$this->_lengthPasswordUp						. "\n" .
																												  "\n" .
		'elements.'.$this->_namePassword.'.Options.validators.length.validator = "StringLength"'				. "\n" .
		'elements.'.$this->_namePassword.'.Options.validators.length.options.1 = '.$this->_lengthLoginDown		. "\n" .
		'elements.'.$this->_namePassword.'.Options.validators.length.options.2 = '.$this->_lengthPasswordUp		. "\n" .
		'elements.'.$this->_namePassword.'.Options.validators.alnum.validator = "Alnum"'						. "\n" .
																												  "\n" .
																												  "\n" .
		$this->_addContent																						. "\n" .
																												  "\n";
		$this->set_contentFile($stringFile);
	}
}