/** * Load the form */ private function loadForm() { // gender dropdown values $genderValues = array('male' => SpoonFilter::ucfirst(BL::getLabel('Male')), 'female' => SpoonFilter::ucfirst(BL::getLabel('Female'))); // birthdate dropdown values $days = range(1, 31); $months = SpoonLocale::getMonths(BL::getInterfaceLanguage()); $years = range(date('Y'), 1900); // create form $this->frm = new BackendForm('add'); // create elements $this->frm->addText('email'); $this->frm->addPassword('password'); $this->frm->addText('display_name'); $this->frm->addText('first_name'); $this->frm->addText('last_name'); $this->frm->addText('city'); $this->frm->addDropdown('gender', $genderValues); $this->frm->addDropdown('day', array_combine($days, $days)); $this->frm->addDropdown('month', $months); $this->frm->addDropdown('year', array_combine($years, $years)); $this->frm->addDropdown('country', SpoonLocale::getCountries(BL::getInterfaceLanguage())); // set default elements dropdowns $this->frm->getField('gender')->setDefaultElement(''); $this->frm->getField('day')->setDefaultElement(''); $this->frm->getField('month')->setDefaultElement(''); $this->frm->getField('year')->setDefaultElement(''); $this->frm->getField('country')->setDefaultElement(''); }
/** * Load the form */ private function loadForm() { $this->frm = new BackendForm('add'); $this->frm->addText('title', null, null, 'inputText title', 'inputTextError title'); $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'); }
/** * Load the form */ private function loadForm() { $this->frm = new BackendForm('edit'); $this->frm->addText('title', $this->record['title'], null, 'inputText title', 'inputTextError title'); $this->frm->addEditor('text', $this->record['text']); $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']); }
/** * Load the form * * @return void */ private function loadForm() { // gender dropdown values $genderValues = array('male' => ucfirst(BL::getLabel('Male')), 'female' => ucfirst(BL::getLabel('Female'))); // birthdate dropdown values $days = range(1, 31); $months = SpoonLocale::getMonths(BL::getInterfaceLanguage()); $years = range(date('Y'), 1900); // get settings $birthDate = BackendProfilesModel::getSetting($this->id, 'birth_date'); // get day, month and year if ($birthDate) { list($birthYear, $birthMonth, $birthDay) = explode('-', $birthDate); } else { $birthDay = ''; $birthMonth = ''; $birthYear = ''; } // create form $this->frm = new BackendForm('edit'); // create elements $this->frm->addText('email', $this->profile['email']); $this->frm->addPassword('password'); $this->frm->addText('display_name', $this->profile['display_name']); $this->frm->addText('first_name', BackendProfilesModel::getSetting($this->id, 'first_name')); $this->frm->addText('last_name', BackendProfilesModel::getSetting($this->id, 'last_name')); $this->frm->addText('city', BackendProfilesModel::getSetting($this->id, 'city')); $this->frm->addDropdown('gender', $genderValues, BackendProfilesModel::getSetting($this->id, 'gender')); $this->frm->addDropdown('day', array_combine($days, $days), $birthDay); $this->frm->addDropdown('month', $months, $birthMonth); $this->frm->addDropdown('year', array_combine($years, $years), (int) $birthYear); $this->frm->addDropdown('country', SpoonLocale::getCountries(BL::getInterfaceLanguage()), BackendProfilesModel::getSetting($this->id, 'country')); // set default elements dropdowns $this->frm->getField('gender')->setDefaultElement(''); $this->frm->getField('day')->setDefaultElement(''); $this->frm->getField('month')->setDefaultElement(''); $this->frm->getField('year')->setDefaultElement(''); $this->frm->getField('country')->setDefaultElement(''); }
/** * Get time ago as a string for use in a datagrid * * @param int $timestamp The UNIX-timestamp to convert in a time-ago-string. * @return string */ public static function getTimeAgo($timestamp) { $timestamp = (int) $timestamp; // get user setting for long dates $format = BackendAuthentication::getUser()->getSetting('datetime_format'); // get the time ago as a string $timeAgo = SpoonDate::getTimeAgo($timestamp, BL::getInterfaceLanguage(), $format); return '<abbr title="' . SpoonDate::getDate($format, $timestamp, BL::getInterfaceLanguage()) . '">' . $timeAgo . '</abbr>'; }