<?php

/**
 * News form.
 *
 * @package    mongol
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class TailanForm extends BaseLegalForm
{
 public function configure()
    {
    
     unset($this['published_at'],$this['sub_type']);

	
	$years = range(date('Y'), date('Y') -50);
	
	$years_list = array_combine($years, $years);
	
	
	$categories = Doctrine::getTable('Category')->getCategoryTailan(0,10);
	
	$this->widgetSchema['is_active'] = new sfWidgetFormInputCheckbox(array(), array('value'=>1)); 
	 
	$this->widgetSchema['name'] = new sfWidgetFormInput(array(),array('class'=>'news_form')); 
	
	$this->widgetSchema['number'] = new sfWidgetFormInput(array(),array('class'=>'news_form')); 
	
	$this->widgetSchema['file_name'] = new sfWidgetFormInputFile(array(),array('class'=>'news_form')); 
	
	$this->widgetSchema['category_id'] = new sfWidgetFormChoice(array('choices' => $categories));
	
	$type = array('41'=>'Жилийн тайлан','42'=>'Улиралын тайлан','43'=>'Сарын тайлан');
	
	$this->widgetSchema['requirement'] = new sfWidgetFormChoice(array('choices' => $type));
	
	
	
	$this->widgetSchema['adopt_date'] = new sfWidgetFormDateTime(array(
																'date' =>array(
																'format'=>' %year% - %month% - %day%',
																'can_be_empty' =>false,
																'years' =>$years_list
																)
																)); 

    $this->widgetSchema->setLabels(array('body'       => 'Агуулга'));
	
	$this->widgetSchema->setLabels(array('requirement'       => 'Шаардлага'));

    $this->widgetSchema->setLabels(array('name'       => 'Нэр'));
	
	$this->widgetSchema->setLabels(array('number'       => 'Дугаар'));
	
	$this->widgetSchema->setLabels(array('file_name'       => 'Файл сонгох'));

    $this->widgetSchema->setLabels(array('category_id'        => 'Ангилал'));

    $this->widgetSchema->setLabels(array('adopt_date'      => 'Батлагдсан огноо'));
	
	
	  $this->widgetSchema->setLabels(array('about'       => 'Байгууллагын тухай'));


   
		
	$this->validatorSchema['file_name'] = new sfValidatorFile(array(
						'required'   => false,
						'path'       => sfConfig::get('sf_upload_dir').'/file/',
						'mime_types' => array('application/pdf'),
						), array('mime_types' => 'The file only accept pdf format.'));
				
	
	$this->widgetSchema->setLabels(array('is_active'      => 'Нийтлэх'));

	 
	   $this->validatorSchema['is_active'] = new sfValidatorPass();
        
    }
  
  
  
}