예제 #1
0
 public function insertButtonClicked($sender, $param)
 {
     $adresseRecord = new AdresseRecord();
     $adresseRecord->adresse_street = $this->Street->Text;
     $adresseRecord->adresse_town = $this->Town->Text;
     $adresseRecord->adresse_zip = $this->Zip->Text;
     //lets add the coordinates
     $myGTranslator = new GoogleAdressTranslator();
     $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->Street->Text, $this->Town->Text)));
     $myLatandLong = explode(",", $mapparams);
     //here we check, if the coordinates have been found
     if ($myLatandLong[1] != 0) {
         $adresseRecord->adresse_lat = $myLatandLong[1];
         $adresseRecord->adresse_long = $myLatandLong[0];
     } else {
         $adresseRecord->adresse_lat = "48.189950";
         $adresseRecord->adresse_long = "16.377319";
     }
     $adresseRecord->idtm_country = $this->Country->Text;
     $adresseRecord->save();
     //einbinden der zusaetzlichen infos
     $parteiadresseRecord = new ParteiAdresseRecord();
     $parteiadresseRecord->idta_partei = $this->idta_partei->Data;
     $parteiadresseRecord->idta_adresse = $adresseRecord->idta_adresse;
     $parteiadresseRecord->save();
     $this->Response->redirect($this->getRequest()->constructUrl('page', "logik.partei"));
 }
예제 #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);
     }
 }
예제 #3
0
 public function bind_lstAdress()
 {
     $criteria_p = new TActiveRecordCriteria();
     $criteria_p->Condition = 'idta_partei = :idta_partei';
     $criteria_p->Parameters[':idta_partei'] = $this->idta_partei->Text;
     $templisteadresse = ParteiAdresseRecord::finder()->findAll($criteria_p);
     $listeadresse = (array) $templisteadresse;
     $mydata = array();
     foreach ($listeadresse as $walker) {
         $conditionx = new TActiveRecordCriteria();
         $conditionx->Condition = 'idta_adresse = :idta_adresse';
         $conditionx->Parameters[':idta_adresse'] = $walker->idta_adresse;
         array_push($mydata, AdresseRecord::finder()->find($conditionx));
     }
     //print_r($mydata);
     $this->lstAdress->DataSource = $mydata;
     $this->lstAdress->dataBind();
 }
예제 #4
0
 public function onInit($param)
 {
     //first i like to get all records...
     $mydata = array();
     // populates post data into the repeater
     $companies = $this->buildData();
     foreach ($companies as $companie) {
         $criteria_p = new TActiveRecordCriteria();
         $criteria_p->Condition = 'idta_partei = :idta_partei';
         $criteria_p->Parameters[':idta_partei'] = $companie->idta_partei;
         $templisteadresse = ParteiAdresseRecord::finder()->findAll($criteria_p);
         $listeadresse = (array) $templisteadresse;
         //print_r($listeadresse);
         foreach ($listeadresse as $walker) {
             $conditionx = new TActiveRecordCriteria();
             $conditionx->Condition = 'idta_adresse = :idta_adresse';
             $conditionx->Parameters[':idta_adresse'] = $walker->idta_adresse;
             array_push($mydata, AdresseRecord::finder()->find($conditionx));
         }
     }
     //print_r($mydata);
     $ii = 0;
     foreach ($mydata as $mylocaladress) {
         $marker = prado::createComponent('BActiveGoogleMapMarker');
         $marker->setID("p" . $ii);
         //$marker->setTitle('Adress:'.$mylocaladress->adresse_town."-".$mylocaladress->adresse_street);
         $marker->setTitle('Standort');
         $marker->setPoint(array($mylocaladress->adresse_lat, $mylocaladress->adresse_long));
         $marker->setVisible(true);
         $infobulle = prado::createComponent('TLabel');
         $infobulle->setID('greentradeinfo' . $mylocaladress->idta_adresse);
         $infobulle->setText("Klappt");
         $marker->addedControl($infobulle);
         $this->GoogleMap->addMarker($marker);
         if ($ii == 0) {
             $this->GoogleMap->setCenter("(" . implode(",", array($mylocaladress->adresse_lat, $mylocaladress->adresse_long)) . ")");
         }
         $ii++;
     }
 }
예제 #5
0
 public function dataBindRepeater2($sender, $param)
 {
     $item = $param->Item;
     if ($item->ItemType === 'Item' || $item->ItemType === 'AlternatingItem') {
         $criteria_p = new TActiveRecordCriteria();
         $criteria_p->Condition = 'idta_partei = :idta_partei';
         $criteria_p->Parameters[':idta_partei'] = $item->data->idta_partei;
         $templisteadresse = ParteiAdresseRecord::finder()->findAll($criteria_p);
         $listeadresse = (array) $templisteadresse;
         //print_r($listeadresse);
         $mydata = array();
         foreach ($listeadresse as $walker) {
             $conditionx = new TActiveRecordCriteria();
             $conditionx->Condition = 'idta_adresse = :idta_adresse';
             $conditionx->Parameters[':idta_adresse'] = $walker->idta_adresse;
             array_push($mydata, AdresseRecord::finder()->find($conditionx));
         }
         //print_r($mydata);
         $item->Repeater2->DataSource = $mydata;
         $item->Repeater2->dataBind();
     }
 }