Beispiel #1
0
 public function calcDistButtonClicked($sender, $param)
 {
     //lets add the coordinates
     $myGTranslator = new GoogleAdressTranslator();
     $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->partner_street->Text, $this->partner_town->Text)));
     $myLatandLong = explode(",", $mapparams);
     $arraydistance = array(array($myLatandLong['1'], $myLatandLong['0']), array($this->adresse_lat->Text, $this->adresse_long->Text));
     $distance = PFH::getDistance($arraydistance);
     $baseweight = (double) $this->waren_gewicht->Text;
     $baseprice = (double) $this->waren_preis->Text;
     $this->est_waren_preis->Text = $distance * 1.4 / 1000 * 2.5 / 2 * $baseweight / 10000 + $baseprice;
 }
Beispiel #2
0
 /**
  * Creates a new user account if all inputs are valid.
  * This method responds to the OnClick event of the "create" button.
  * @param mixed event sender
  * @param mixed event parameter
  */
 public function createButtonClicked($sender, $param)
 {
     if ($this->IsValid) {
         // populates a UserRecord object with user inputs
         $userRecord = new UserRecord();
         $userRecord->user_username = $this->Username->Text;
         $userRecord->user_password = $this->Password->Text;
         $userRecord->user_mail = $this->Email->Text;
         $userRecord->idtm_user_role = (int) $this->Role->SelectedValue;
         $userRecord->user_vorname = $this->FirstName->Text;
         $userRecord->user_name = $this->LastName->Text;
         // saves to the database via Active Record mechanism
         $userRecord->save();
         $parteiRecord = new ParteiRecord();
         $parteiRecord->idtm_user = $userRecord->idtm_user;
         $parteiRecord->partei_name = $this->FirstName->Text . " " . $this->LastName->Text;
         //save the partei
         $parteiRecord->save();
         $adressRecord = new AdresseRecord();
         $adressRecord->adresse_street = $this->adresse_street->Text;
         $adressRecord->adresse_zip = $this->adresse_zip->Text;
         $adressRecord->adresse_town = $this->adresse_town->Text;
         $adressRecord->idtm_country = 1;
         //lets add the coordinates
         $myGTranslator = new GoogleAdressTranslator();
         $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->adresse_street->Text, $this->adresse_town->Text)));
         $myLatandLong = explode(",", $mapparams);
         //here we check, if the coordinates have been found
         if ($myLatandLong[1] != 0) {
             $adressRecord->adresse_lat = $myLatandLong[1];
             $adressRecord->adresse_long = $myLatandLong[0];
         } else {
             $adressRecord->adresse_lat = "48.189950";
             $adressRecord->adresse_long = "16.377319";
         }
         $adressRecord->save();
         $parteiadresseRecord = new ParteiAdresseRecord();
         $parteiadresseRecord->idta_partei = $parteiRecord->idta_partei;
         $parteiadresseRecord->idta_adresse = $adressRecord->idta_adresse;
         //save adress to partei
         $parteiadresseRecord->save();
         // redirects the browser to the homepage
         $this->Response->redirect($this->Service->DefaultPageUrl);
     }
 }
Beispiel #3
0
 public function editButtonClicked($sender, $param)
 {
     $ar = AdresseRecord::finder()->findByPK($this->edidta_adresse->Data);
     $ar->adresse_street = $this->edStreet->Text;
     $ar->adresse_town = $this->edTown->Text;
     $ar->adresse_zip = $this->edZip->Text;
     $ar->idtm_country = $this->edCountry->Text;
     $ar->idta_adresse = $this->edidta_adresse->Data;
     //lets add the coordinates
     $myGTranslator = new GoogleAdressTranslator();
     $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->edStreet->Text, $this->edTown->Text)));
     $myLatandLong = explode(",", $mapparams);
     //here we check, if the coordinates have been found
     if ($myLatandLong[1] != 0) {
         $ar->adresse_lat = $myLatandLong[1];
         $ar->adresse_long = $myLatandLong[0];
     } else {
         $ar->adresse_lat = "48.189950";
         $ar->adresse_long = "16.377319";
     }
     $ar->save();
     $this->Response->redirect($this->getRequest()->constructUrl('page', "logik.partei"));
 }
Beispiel #4
0
 public function lstAdressSave($sender, $param)
 {
     $item = $param->Item;
     $Record = AdresseRecord::finder()->findByPK($this->lstAdress->DataKeys[$item->ItemIndex]);
     $Record->adresse_street = $item->lst_adresse_street->TextBox->Text;
     $Record->adresse_zip = $item->lst_adresse_zip->TextBox->Text;
     $Record->adresse_town = $item->lst_adresse_town->TextBox->Text;
     //lets add the coordinates
     $myGTranslator = new GoogleAdressTranslator();
     $mapparams = $myGTranslator->getLatAndLong(implode(",", array($item->lst_adresse_street->TextBox->Text, $item->lst_adresse_town->TextBox->Text)));
     $myLatandLong = explode(",", $mapparams);
     //here we check, if the coordinates have been found
     if ($myLatandLong[1] != 0) {
         $Record->adresse_lat = $myLatandLong[1];
         $Record->adresse_long = $myLatandLong[0];
     } else {
         $Record->adresse_lat = $item->lst_adresse_lat->TextBox->Text;
         $Record->adresse_long = $item->lst_adresse_long->TextBox->Text;
     }
     $Record->adresse_ismain = $item->lst_adresse_ismain->ATB_lst_adresse_ismain->Checked ? 1 : 0;
     $Record->save();
     $this->lstAdress->EditItemIndex = -1;
     $this->bindListAdress();
 }