<?PHP
class SettingsAdmin extends Buyers
{
	public function fetch()
	{
 		if($this->request->method('POST'))
		{
			// Настройки сайта
			$this->settings->site_name = $this->request->post('site_name');
			$this->settings->admin_email = $this->request->post('admin_email', 'email');
			$this->settings->site_logo_url = $this->request->post('site_logo_url');

            // Микроразметка
            $this->settings->schema_region = $this->request->post('schema_region','string');
            $this->settings->schema_country = $this->request->post('schema_country','string');
            $this->settings->schema_city = $this->request->post('schema_city','string');
            $this->settings->schema_code = $this->request->post('schema_code','integer');
            $this->settings->schema_price_range = $this->request->post('schema_price_range');
            $this->settings->schema_worktime = $this->request->post('schema_worktime');
            $this->settings->schema_lat = $this->request->post('schema_lat','float');
            $this->settings->schema_lng = $this->request->post('schema_lng','float');

			// Капча
			$this->settings->site_key = $this->request->post('site_key');
			$this->settings->secret_key = $this->request->post('secret_key');

			// Данные компании
			$this->settings->company_email = $this->request->post('company_email', 'email');
			$this->settings->company_phone = $this->request->post('company_phone');
			$this->settings->company_address = $this->request->post('company_address');
            $this->settings->company_worktime = $this->request->post('company_worktime');

			//Настройки отправки имейл
			$this->settings->mail_from = $this->request->post('mail_from');
			$this->settings->mail_pass = $this->request->post('mail_pass');
			$this->settings->mail_host = $this->request->post('mail_host');
			$this->settings->mail_port = $this->request->post('mail_port');
			$this->settings->mail_alias = $this->request->post('mail_alias');

            $url = array('module'=>'SettingsAdmin','message_success'=>'saved');
			$this->request->redirect($url);
		}

 	  	return $this->design->fetch('settings.tpl');
	}
}
