2010-12-07 20:19:27 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Form_EditAudioMD extends Zend_Form
|
|
|
|
{
|
2012-12-05 19:16:25 +01:00
|
|
|
|
|
|
|
public function init() {}
|
|
|
|
|
|
|
|
public function startForm($p_id)
|
2010-12-07 20:19:27 +01:00
|
|
|
{
|
2012-10-19 20:42:01 +02:00
|
|
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
2010-12-30 23:26:44 +01:00
|
|
|
// Set the method for the display form to POST
|
|
|
|
$this->setMethod('post');
|
|
|
|
|
2015-08-05 01:56:12 +02:00
|
|
|
$file_id = new Zend_Form_Element_Hidden('file_id');
|
|
|
|
$file_id->setValue($p_id);
|
|
|
|
$file_id->addDecorator('HtmlTag', array('tag' => 'div', 'style' => 'display:none'));
|
|
|
|
$file_id->removeDecorator('Label');
|
2015-08-07 22:49:05 +02:00
|
|
|
$file_id->setAttrib('class', 'obj_id');
|
2015-08-05 01:56:12 +02:00
|
|
|
$this->addElement($file_id);
|
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add title field
|
2014-05-26 23:13:45 +02:00
|
|
|
$track_title = new Zend_Form_Element_Text('track_title');
|
|
|
|
$track_title->class = 'input_text';
|
|
|
|
$track_title->setLabel(_('Title:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($track_title);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add artist field
|
2014-05-26 23:13:45 +02:00
|
|
|
$artist_name = new Zend_Form_Element_Text('artist_name');
|
|
|
|
$artist_name->class = 'input_text';
|
|
|
|
$artist_name->setLabel(_('Creator:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($artist_name);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add album field
|
2014-05-26 23:13:45 +02:00
|
|
|
$album_title = new Zend_Form_Element_Text('album_title');
|
|
|
|
$album_title->class = 'input_text';
|
|
|
|
$album_title->setLabel(_('Album:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
2015-08-05 01:56:12 +02:00
|
|
|
));
|
2014-05-26 23:13:45 +02:00
|
|
|
$this->addElement($album_title);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2011-05-26 17:11:12 +02:00
|
|
|
// Add track number field
|
2014-05-26 23:13:45 +02:00
|
|
|
$track_number = new Zend_Form_Element('track_number');
|
|
|
|
$track_number->class = 'input_text';
|
|
|
|
$track_number->setLabel('Track Number:')
|
|
|
|
->setFilters(array('StringTrim'))
|
2015-02-17 17:44:31 +01:00
|
|
|
->setValidators(array(new Zend_Validate_Int()));
|
2014-05-26 23:13:45 +02:00
|
|
|
$this->addElement($track_number);
|
2011-05-05 16:55:14 +02:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add genre field
|
2014-05-26 23:13:45 +02:00
|
|
|
$genre = new Zend_Form_Element('genre');
|
|
|
|
$genre->class = 'input_text';
|
|
|
|
$genre->setLabel(_('Genre:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 64))
|
|
|
|
));
|
|
|
|
$this->addElement($genre);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add year field
|
2013-06-06 23:02:01 +02:00
|
|
|
$year = new Zend_Form_Element_Text('year');
|
|
|
|
$year->class = 'input_text';
|
|
|
|
$year->setLabel(_('Year:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 10)),
|
2012-11-27 23:11:29 +01:00
|
|
|
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD"),
|
|
|
|
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM"),
|
|
|
|
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY")
|
2013-06-06 23:02:01 +02:00
|
|
|
));
|
|
|
|
$this->addElement($year);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add label field
|
2014-05-26 23:13:45 +02:00
|
|
|
$label = new Zend_Form_Element('label');
|
|
|
|
$label->class = 'input_text';
|
|
|
|
$label->setLabel(_('Label:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($label);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add composer field
|
2014-05-26 23:13:45 +02:00
|
|
|
$composer = new Zend_Form_Element('composer');
|
|
|
|
$composer->class = 'input_text';
|
|
|
|
$composer->setLabel(_('Composer:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($composer);
|
2012-07-11 00:55:44 +02:00
|
|
|
|
2012-04-04 00:09:03 +02:00
|
|
|
// Add conductor field
|
2014-05-26 23:13:45 +02:00
|
|
|
$conductor = new Zend_Form_Element('conductor');
|
|
|
|
$conductor->class = 'input_text';
|
|
|
|
$conductor->setLabel(_('Conductor:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($conductor);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add mood field
|
2014-05-26 23:13:45 +02:00
|
|
|
$mood = new Zend_Form_Element('mood');
|
|
|
|
$mood->class = 'input_text';
|
|
|
|
$mood->setLabel(_('Mood:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 64))
|
|
|
|
));
|
|
|
|
$this->addElement($mood);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2011-08-03 18:32:59 +02:00
|
|
|
// Add bmp field
|
2012-04-11 20:09:51 +02:00
|
|
|
$bpm = new Zend_Form_Element_Text('bpm');
|
|
|
|
$bpm->class = 'input_text';
|
2012-11-15 16:59:06 +01:00
|
|
|
$bpm->setLabel(_('BPM:'))
|
2012-04-11 20:09:51 +02:00
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('min'=>0,'max' => 8)),
|
|
|
|
new Zend_Validate_Digits()));
|
|
|
|
$this->addElement($bpm);
|
2011-05-05 16:55:14 +02:00
|
|
|
|
2011-08-03 18:32:59 +02:00
|
|
|
// Add copyright field
|
2014-05-26 23:13:45 +02:00
|
|
|
$copyright = new Zend_Form_Element('copyright');
|
|
|
|
$copyright->class = 'input_text';
|
|
|
|
$copyright->setLabel(_('Copyright:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($copyright);
|
2011-05-05 16:55:14 +02:00
|
|
|
|
2011-08-03 18:32:59 +02:00
|
|
|
// Add isrc number field
|
2014-05-26 23:13:45 +02:00
|
|
|
$isrc_number = new Zend_Form_Element('isrc_number');
|
|
|
|
$isrc_number->class = 'input_text';
|
|
|
|
$isrc_number->setLabel(_('ISRC Number:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($isrc_number);
|
2011-05-05 16:55:14 +02:00
|
|
|
|
2011-08-03 18:32:59 +02:00
|
|
|
// Add website field
|
2014-05-26 23:13:45 +02:00
|
|
|
$info_url = new Zend_Form_Element('info_url');
|
|
|
|
$info_url->class = 'input_text';
|
|
|
|
$info_url->setLabel(_('Website:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($info_url);
|
2011-08-03 18:32:59 +02:00
|
|
|
|
|
|
|
// Add language field
|
2014-05-26 23:13:45 +02:00
|
|
|
$language = new Zend_Form_Element('language');
|
|
|
|
$language->class = 'input_text';
|
|
|
|
$language->setLabel(_('Language:'))
|
|
|
|
->setFilters(array('StringTrim'))
|
|
|
|
->setValidators(array(
|
|
|
|
new Zend_Validate_StringLength(array('max' => 512))
|
|
|
|
));
|
|
|
|
$this->addElement($language);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add the submit button
|
2012-12-05 19:16:25 +01:00
|
|
|
$this->addElement('button', 'editmdsave', array(
|
2015-08-05 01:56:12 +02:00
|
|
|
'ignore' => true,
|
2015-08-18 00:34:39 +02:00
|
|
|
'class' => 'btn md-save right-floated',
|
2015-08-05 01:56:12 +02:00
|
|
|
'label' => _('Save'),
|
2011-05-26 17:11:12 +02:00
|
|
|
'decorators' => array(
|
2011-03-31 04:18:05 +02:00
|
|
|
'ViewHelper'
|
2011-05-26 17:11:12 +02:00
|
|
|
)
|
2010-12-30 23:26:44 +01:00
|
|
|
));
|
2011-03-31 04:18:05 +02:00
|
|
|
|
2012-07-11 00:55:44 +02:00
|
|
|
// Add the submit button
|
2012-12-05 19:21:18 +01:00
|
|
|
$this->addElement('button', 'editmdcancel', array(
|
2011-03-31 04:18:05 +02:00
|
|
|
'ignore' => true,
|
2015-08-18 00:34:39 +02:00
|
|
|
'class' => 'btn md-cancel right-floated',
|
2012-11-15 16:59:06 +01:00
|
|
|
'label' => _('Cancel'),
|
2011-05-26 17:11:12 +02:00
|
|
|
'decorators' => array(
|
2011-03-31 04:18:05 +02:00
|
|
|
'ViewHelper'
|
|
|
|
)
|
|
|
|
));
|
|
|
|
|
2015-08-25 23:09:05 +02:00
|
|
|
$this->addDisplayGroup(array('editmdcancel', 'editmdsave'), 'submitButtons', array(
|
2015-08-18 00:34:39 +02:00
|
|
|
'decorators' => array(
|
|
|
|
'FormElements',
|
|
|
|
'DtDdWrapper'
|
|
|
|
)
|
2011-04-02 19:48:20 +02:00
|
|
|
));
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|