sintonia/airtime_mvc/application/forms/EditAudioMD.php

154 lines
4.8 KiB
PHP
Raw Normal View History

<?php
class Application_Form_EditAudioMD extends Zend_Form
{
public function init()
{
global $CC_CONFIG;
2010-12-30 23:26:44 +01:00
// Set the method for the display form to POST
$this->setMethod('post');
// Add title field
2011-02-24 17:06:19 +01:00
$this->addElement('text', 'track_title', array(
2010-12-30 23:26:44 +01:00
'label' => 'Title:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim'),
));
// Add artist field
2011-02-24 17:06:19 +01:00
$this->addElement('text', 'artist_name', array(
'label' => 'Creator:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim'),
));
// Add album field
2011-02-24 17:06:19 +01:00
$this->addElement('text', 'album_title', array(
2010-12-30 23:26:44 +01:00
'label' => 'Album:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim')
));
// Add track number field
$this->addElement('text', 'track_number', array(
'label' => 'Track:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add genre field
2010-12-30 23:26:44 +01:00
$this->addElement('text', 'genre', array(
'label' => 'Genre:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim')
));
// Add year field
2011-02-24 17:06:19 +01:00
$this->addElement('text', 'year', array(
2010-12-30 23:26:44 +01:00
'label' => 'Year:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim'),
'validators' => array(
array('date', false, array('YYYY-MM-DD')),
2011-02-12 20:44:55 +01:00
array('date', false, array('YYYY-MM')),
array('date', false, array('YYYY'))
)
2010-12-30 23:26:44 +01:00
));
// Add label field
2011-02-24 17:06:19 +01:00
$this->addElement('text', 'label', array(
2010-12-30 23:26:44 +01:00
'label' => 'Label:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim')
));
// Add composer field
2011-02-24 17:06:19 +01:00
$this->addElement('text', 'composer', array(
2010-12-30 23:26:44 +01:00
'label' => 'Composer:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim')
));
// Add conductor field
$this->addElement('text', 'conductor', array(
'label' => 'Conductor:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
2010-12-30 23:26:44 +01:00
// Add mood field
2011-02-24 17:06:19 +01:00
$this->addElement('text', 'mood', array(
2010-12-30 23:26:44 +01:00
'label' => 'Mood:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim')
));
// Add bmp field
$bpm = new Zend_Form_Element_Text('bpm');
$bpm->class = 'input_text';
$bpm->setLabel('BPM:')
->setFilters(array('StringTrim'))
->setValidators(array(
new Zend_Validate_StringLength(array('min'=>0,'max' => 8)),
new Zend_Validate_Digits()));
$this->addElement($bpm);
// Add copyright field
$this->addElement('text', 'copyright', array(
'label' => 'Copyright:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add isrc number field
$this->addElement('text', 'isrc_number', array(
'label' => 'ISRC Number:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add website field
$this->addElement('text', 'info_url', array(
'label' => 'Website:',
2011-02-12 20:44:55 +01:00
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add language field
$this->addElement('text', 'language', array(
'label' => 'Language:',
'class' => 'input_text',
2010-12-30 23:26:44 +01:00
'filters' => array('StringTrim')
));
// Add the submit button
2010-12-30 23:26:44 +01:00
$this->addElement('submit', 'submit', array(
'ignore' => true,
'class' => 'btn',
'label' => 'Save',
'decorators' => array(
'ViewHelper'
)
2010-12-30 23:26:44 +01:00
));
// Add the submit button
$this->addElement('button', 'cancel', array(
'ignore' => true,
'class' => 'btn md-cancel',
'label' => 'Cancel',
'onclick' => 'javascript:document.location.href="'.$CC_CONFIG['base_dir'].'/Library"',
'decorators' => array(
'ViewHelper'
)
));
$this->addDisplayGroup(array('submit', 'cancel'), 'submitButtons', array(
'decorators' => array(
'FormElements',
'DtDdWrapper'
)
));
}
}