Пример #1
0
 /**
  * Load the form
  */
 protected function loadForm()
 {
     // create form
     $this->frm = new BackendForm('edit');
     // set array of recurring types
     $selectTypes = array('0' => ucfirst(BL::lbl('Daily')), '1' => ucfirst(BL::lbl('Weekly')), '2' => ucfirst(BL::lbl('Monthly')), '3' => ucfirst(BL::lbl('Yearly')));
     // set array of recurring interval
     $selectInterval = array();
     $i = 1;
     while ($i < $this->maxInterval) {
         $selectInterval[$i] = $i;
         $i++;
     }
     // set array of reservation values
     $radiobuttonSubscriptionsValues[] = array('label' => BL::lbl('Yes'), 'value' => 'Y');
     $radiobuttonSubscriptionsValues[] = array('label' => BL::lbl('No'), 'value' => 'N');
     // set array of possibilities which an item can end on
     $radiobuttonEndsOn[] = array('label' => ucfirst(BL::lbl('Never')), 'value' => '0');
     $radiobuttonEndsOn[] = array('label' => ucfirst(BL::lbl('After')), 'value' => '1');
     $radiobuttonEndsOn[] = array('label' => ucfirst(BL::lbl('On')), 'value' => '2');
     // set array of recurring days of item
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Monday')), 'value' => '0');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Tuesday')), 'value' => '1');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Wednesday')), 'value' => '2');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Thursday')), 'value' => '3');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Friday')), 'value' => '4');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Saturday')), 'value' => '5');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Sunday')), 'value' => '6');
     // recurring item options
     $this->frm->addCheckbox('recurring', $this->record['recurring'] === 'Y' ? true : false);
     $this->frm->addDropdown('type', $selectTypes, $this->recurringOptions['type']);
     $this->frm->addDropdown('interval', $selectInterval, $this->recurringOptions['interval']);
     $this->frm->addMultiCheckbox('days', $multiCheckboxDays, $this->recurringOptionsDays);
     $this->frm->addRadioButton('ends_on', $radiobuttonEndsOn, $this->recurringOptions['ends_on']);
     $this->frm->addText('frequency', $this->recurringOptions['frequency']);
     $this->frm->addDate('recurr_end_date_date', $this->recurringOptions['end_date']);
     $this->frm->addTime('recurr_end_date_time', date('H:i', $this->recurringOptions['end_date']));
     $this->frm->addCheckbox('whole_day', $this->record['whole_day'] === 'Y' ? true : false);
     // location options
     $this->frm->addText('name', $this->record['location_name']);
     $this->frm->addText('street', $this->record['street']);
     $this->frm->addText('number', $this->record['number']);
     $this->frm->addText('zip', $this->record['zip']);
     $this->frm->addText('city', $this->record['city']);
     $this->frm->addDropdown('country', \SpoonLocale::getCountries(BL::getInterfaceLanguage()), $this->record['country']);
     $this->frm->addCheckbox('google_maps', $this->record['google_maps'] === 'Y' ? true : false);
     // standard options
     $this->frm->addText('title', $this->record['title'], null, 'inputText title', 'inputTextError title');
     $this->frm->addEditor('text', $this->record['text']);
     $this->frm->addEditor('introduction', $this->record['introduction']);
     $this->frm->addDate('begin_date_date', $this->record['begin_date']);
     $this->frm->addTime('begin_date_time', date('H:i', $this->record['begin_date']));
     $this->frm->addDate('end_date_date', $this->record['end_date']);
     $this->frm->addTime('end_date_time', date('H:i', $this->record['end_date']));
     $this->frm->addImage('image');
     $this->frm->addText('price', $this->record['price']);
     $this->frm->addCheckbox('delete_image');
     $this->frm->addRadioButton('subscriptions', $radiobuttonSubscriptionsValues, $this->record['allow_subscriptions']);
     // get categories
     $categories = BackendAgendaModel::getCategories();
     $this->frm->addDropdown('category_id', $categories, $this->record['category_id']);
     // meta
     $this->meta = new BackendMeta($this->frm, $this->record['meta_id'], 'title', true);
     $this->meta->setUrlCallBack('Backend\\Modules\\Agenda\\Engine\\Model', 'getUrl', array($this->record['id']));
     $this->media = new BackendMediaHelper($this->frm, (string) $this->getModule(), (int) $this->id, (string) $this->getAction(), 'Agenda');
 }
Пример #2
0
 /**
  * Load the form
  */
 protected function loadForm()
 {
     $this->frm = new BackendForm('add');
     // set array of recurring types
     $selectTypes = array('0' => ucfirst(BL::lbl('Daily')), '1' => ucfirst(BL::lbl('Weekly')), '2' => ucfirst(BL::lbl('Monthly')), '3' => ucfirst(BL::lbl('Yearly')));
     // set array of recurring interval
     $selectInterval = array();
     $i = 1;
     while ($i < $this->maxInterval) {
         $selectInterval[$i] = $i;
         $i++;
     }
     // set array of reservation values
     $radiobuttonSubscriptionsValues[] = array('label' => BL::lbl('Yes'), 'value' => 'Y');
     $radiobuttonSubscriptionsValues[] = array('label' => BL::lbl('No'), 'value' => 'N');
     // set array of possibilities which an item can end on
     $radiobuttonEndsOn[] = array('label' => ucfirst(BL::lbl('Never')), 'value' => '0');
     $radiobuttonEndsOn[] = array('label' => ucfirst(BL::lbl('After')), 'value' => '1');
     $radiobuttonEndsOn[] = array('label' => ucfirst(BL::lbl('On')), 'value' => '2');
     // set array of recurring days of item
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Monday')), 'value' => '0');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Tuesday')), 'value' => '1');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Wednesday')), 'value' => '2');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Thursday')), 'value' => '3');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Friday')), 'value' => '4');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Saturday')), 'value' => '5');
     $multiCheckboxDays[] = array('label' => ucfirst(BL::lbl('Sunday')), 'value' => '6');
     // recurring item options
     $this->frm->addCheckbox('recurring');
     $this->frm->addDropdown('type', $selectTypes, null);
     $this->frm->addDropdown('interval', $selectInterval, null);
     $this->frm->addMultiCheckbox('days', $multiCheckboxDays, 3);
     $this->frm->addRadioButton('ends_on', $radiobuttonEndsOn, null);
     $this->frm->addText('frequency');
     $this->frm->addDate('recurr_end_date_date');
     $this->frm->addTime('recurr_end_date_time');
     $this->frm->addCheckbox('whole_day');
     $this->frm->addRadioButton('subscriptions', $radiobuttonSubscriptionsValues, 'N');
     // location options
     $this->frm->addText('name');
     $this->frm->addText('street');
     $this->frm->addText('number');
     $this->frm->addText('zip');
     $this->frm->addText('city');
     $this->frm->addDropdown('country', \SpoonLocale::getCountries(BL::getInterfaceLanguage()), 'BE');
     $this->frm->addCheckbox('google_maps');
     // standard options
     $this->frm->addText('title', null, null, 'inputText title', 'inputTextError title');
     $this->frm->addEditor('text');
     $this->frm->addEditor('introduction');
     $this->frm->addDate('begin_date_date');
     $this->frm->addTime('begin_date_time');
     $this->frm->addDate('end_date_date');
     $this->frm->addTime('end_date_time');
     $this->frm->addImage('image');
     $this->frm->addText('price');
     // get categories
     $categories = BackendAgendaModel::getCategories();
     $this->frm->addDropdown('category_id', $categories);
     // meta
     $this->meta = new BackendMeta($this->frm, null, 'title', true);
 }