Exemplo n.º 1
0
 /**
  * Load the form
  */
 protected function loadForm()
 {
     $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
     $rbtHiddenValues[] = array('label' => BL::lbl('Hidden'), 'value' => 'Y');
     $this->frm = new BackendForm('add');
     $this->frm->addText('company');
     $this->frm->addText('name');
     $this->frm->addText('firstname');
     $this->frm->addText('email');
     $this->frm->addText('address');
     $this->frm->addText('zipcode');
     $this->frm->addText('city');
     $this->frm->addDropdown('country', Intl::getRegionBundle()->getCountryNames(BL::getInterfaceLanguage()), 'BE');
     $this->frm->addText('phone');
     $this->frm->addText('fax');
     $this->frm->addText('website');
     $this->frm->addEditor('text');
     $this->frm->addImage('image');
     $this->frm->addText('vat');
     $this->frm->addTextArea('zipcodes');
     $this->frm->addText('remark');
     //$this->frm->addText('assort');
     //$this->frm->addText('open');
     //$this->frm->addText('closed');
     //$this->frm->addText('visit');
     //$this->frm->addText('size');
     $this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
     foreach ((array) BackendModel::get('fork.settings')->get('Core', 'languages') as $key => $language) {
         $fieldText = $this->frm->addEditor("text_" . strtolower($language));
         $fieldOpeningHours = $this->frm->addEditor("opening_hours_" . strtolower($language));
         $this->fieldLanguages[$key]["key"] = $key;
         $this->fieldLanguages[$key]["language"] = $language;
         $this->fieldLanguages[$key]["text"] = $fieldText->parse();
         $this->fieldLanguages[$key]["opening_hours"] = $fieldOpeningHours->parse();
     }
     //--Get all the users
     $groups = BackendAddressesModel::getAllGroups();
     if (!empty($groups)) {
         //--Loop all the group
         foreach ($groups as &$group) {
             $groupCheckboxes[] = array("label" => $group["title"], "value" => $group["id"]);
         }
         //--Add multicheckboxes to form
         $this->frm->addMultiCheckbox("groups", $groupCheckboxes);
     }
     $groups2 = BackendAddressesModel::getAllGroupsTreeArray();
     $this->tpl->assign('groups2', $groups2);
     $this->meta = new BackendMeta($this->frm, null, 'company', true);
 }
Exemplo n.º 2
0
 /**
  * Load the form
  */
 protected function loadForm()
 {
     $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
     $rbtHiddenValues[] = array('label' => BL::lbl('Hidden'), 'value' => 'Y');
     $this->frm = new BackendForm('edit');
     $this->frm->addText('company', $this->record['company']);
     $this->frm->addText('name', $this->record['name']);
     $this->frm->addText('firstname', $this->record['firstname']);
     $this->frm->addText('email', $this->record['email']);
     $this->frm->addText('address', $this->record['address']);
     $this->frm->addText('zipcode', $this->record['zipcode']);
     $this->frm->addText('city', $this->record['city']);
     //        $this->frm->addText('country', $this->record['country']);
     $this->frm->addDropdown('country', Intl::getRegionBundle()->getCountryNames(BL::getInterfaceLanguage()), $this->record['country']);
     $this->frm->addText('phone', $this->record['phone']);
     $this->frm->addText('fax', $this->record['fax']);
     $this->frm->addText('website', $this->record['website']);
     $this->frm->addText('vat', $this->record['vat']);
     $this->frm->addTextArea('zipcodes', $this->record['zipcodes']);
     $this->frm->addText('remark', $this->record['remark']);
     //$this->frm->addText('assort', $this->record['assort']);
     //$this->frm->addText('open', $this->record['open']);
     //$this->frm->addText('closed', $this->record['closed']);
     //$this->frm->addText('visit', $this->record['visit']);
     //$this->frm->addText('size', $this->record['size']);
     //$this->frm->addEditor('text', $this->record['text']);
     $this->frm->addImage('image');
     $this->frm->addCheckbox('delete_image');
     $this->frm->addRadiobutton('hidden', $rbtHiddenValues, $this->record['hidden']);
     foreach ((array) BackendModel::get('fork.settings')->get('Core', 'languages') as $key => $language) {
         $addressesLanguage = BackendAddressesModel::getLanguage($this->id, $language);
         $fieldText = $this->frm->addEditor("text_" . strtolower($language), $addressesLanguage['text']);
         $fieldOpeningHours = $this->frm->addEditor("opening_hours_" . strtolower($language), $addressesLanguage['opening_hours']);
         $this->fieldLanguages[$key]["key"] = $key;
         $this->fieldLanguages[$key]["language"] = $language;
         $this->fieldLanguages[$key]["text"] = $fieldText->parse();
         $this->fieldLanguages[$key]["opening_hours"] = $fieldOpeningHours->parse();
     }
     //--Get all the groups
     $groups = BackendAddressesModel::getAllGroups();
     if (!empty($groups)) {
         //--Loop all the users
         foreach ($groups as &$group) {
             $groupCheckboxes[] = array("label" => $group["title"], "value" => $group["id"]);
         }
         //--Get the users from the group
         $groupsAddress = BackendAddressesModel::getGroupsForAddress($this->id);
         //--Create a selected-array
         $groupCheckboxesSelected = count($groupsAddress) > 0 ? array_keys($groupsAddress) : null;
         //--Add multicheckboxes to form
         $this->frm->addMultiCheckbox("groups", $groupCheckboxes, $groupCheckboxesSelected);
     }
     $groups2 = BackendAddressesModel::getAllGroupsTreeArray();
     $this->tpl->assign('groups2', $groups2);
     $this->tpl->assign('groups2selected', $groupCheckboxesSelected == null ? array() : $groupCheckboxesSelected);
     // meta
     $this->meta = new BackendMeta($this->frm, $this->record['meta_id'], 'company', true);
     $this->meta->setUrlCallback('Backend\\Modules\\Addresses\\Engine\\Model', 'getUrl', array($this->record['id']));
 }