getCSVLineEndings() public static method

Get the possible line endings for a CSV-file
public static getCSVLineEndings ( ) : array
return array
Example #1
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new BackendForm('add');
     // get the groups
     $groups = BackendGroupsModel::getAll();
     // if there is only one group we can check it so the user isn't bothered with an error for not selecting one
     $checkedGroups = count($groups) == 1 ? $groups[0]['value'] : null;
     // create elements
     // profile
     $this->frm->addText('email', null, 255);
     $this->frm->addPassword('password', null, 75, 'inputText inputPassword passwordGenerator', 'inputTextError inputPasswordError passwordGenerator')->setAttributes(array('autocomplete' => 'off'));
     $this->frm->addPassword('confirm_password', null, 75)->setAttributes(array('autocomplete' => 'off'));
     $this->frm->addText('name', null, 255);
     $this->frm->addText('surname', null, 255);
     $this->frm->addText('nickname', null, 24);
     $this->frm->addImage('avatar');
     $this->frm->addDropdown('interface_language', BL::getInterfaceLanguages(), $this->get('fork.settings')->get('Core', 'default_interface_language'));
     $this->frm->addDropdown('date_format', BackendUsersModel::getDateFormats(), BackendAuthentication::getUser()->getSetting('date_format'));
     $this->frm->addDropdown('time_format', BackendUsersModel::getTimeFormats(), BackendAuthentication::getUser()->getSetting('time_format'));
     $this->frm->addDropdown('number_format', BackendUsersModel::getNumberFormats(), BackendAuthentication::getUser()->getSetting('number_format', 'dot_nothing'));
     $this->frm->addDropDown('csv_split_character', BackendUsersModel::getCSVSplitCharacters());
     $this->frm->addDropDown('csv_line_ending', BackendUsersModel::getCSVLineEndings());
     // permissions
     $this->frm->addCheckbox('active', true);
     $this->frm->addCheckbox('api_access', false);
     $this->frm->addMultiCheckbox('groups', $groups, $checkedGroups);
 }
Example #2
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create user objects
     $this->user = new BackendUser($this->id);
     $this->allowUserRights = BackendAuthentication::isAllowedAction('Add') || $this->authenticatedUser->getUserId() != $this->id || $this->authenticatedUser->isGod();
     // redirect to error page when not allowed to edit other profiles
     if (!$this->authenticatedUser->isGod() && ($this->authenticatedUser->getUserId() != $this->id && !BackendAuthentication::isAllowedAction('Add'))) {
         $this->redirect(BackendModel::createURLForAction('Error') . '&type=not-allowed');
     }
     // create form
     $this->frm = new BackendForm('edit');
     // get active groups
     $groups = BackendGroupsModel::getGroupsByUser($this->id);
     // loop through groups and set checked
     foreach ($groups as $group) {
         $checkedGroups[] = $group['id'];
     }
     // create elements
     // profile
     $this->frm->addText('email', $this->record['email'], 255);
     if ($this->user->isGod()) {
         $this->frm->getField('email')->setAttributes(array('disabled' => 'disabled'));
     }
     $this->frm->addText('name', $this->record['settings']['name'], 255);
     $this->frm->addText('surname', $this->record['settings']['surname'], 255);
     $this->frm->addText('nickname', $this->record['settings']['nickname'], 24);
     $this->frm->addImage('avatar');
     // password
     // check if we're god or same user
     if ($this->authenticatedUser->getUserId() == $this->id || $this->authenticatedUser->isGod()) {
         // allow to set new password
         $this->frm->addPassword('new_password', null, 75);
         $this->frm->addPassword('confirm_password', null, 75);
         // disable autocomplete
         $this->frm->getField('new_password')->setAttributes(array('autocomplete' => 'off'));
         $this->frm->getField('confirm_password')->setAttributes(array('autocomplete' => 'off'));
     }
     // settings
     $this->frm->addDropdown('interface_language', BL::getInterfaceLanguages(), $this->record['settings']['interface_language']);
     $this->frm->addDropdown('date_format', BackendUsersModel::getDateFormats(), $this->user->getSetting('date_format'));
     $this->frm->addDropdown('time_format', BackendUsersModel::getTimeFormats(), $this->user->getSetting('time_format'));
     $this->frm->addDropdown('number_format', BackendUsersModel::getNumberFormats(), $this->user->getSetting('number_format', 'dot_nothing'));
     $this->frm->addDropDown('csv_split_character', BackendUsersModel::getCSVSplitCharacters(), $this->user->getSetting('csv_split_character'));
     $this->frm->addDropDown('csv_line_ending', BackendUsersModel::getCSVLineEndings(), $this->user->getSetting('csv_line_ending'));
     // permissions
     $this->frm->addCheckbox('active', $this->record['active'] == 'Y');
     // only when GOD or when you can edit other users
     if ($this->allowUserRights) {
         // disable active field for current users
         if ($this->authenticatedUser->getUserId() == $this->record['id']) {
             $this->frm->getField('active')->setAttribute('disabled', 'disabled');
         }
         $this->frm->addCheckbox('api_access', isset($this->record['settings']['api_access']) && $this->record['settings']['api_access'] == 'Y');
         $this->frm->addMultiCheckbox('groups', BackendGroupsModel::getAll(), $checkedGroups);
     }
 }