Пример #1
0
 public function saveButtonClicked($sender, $param)
 {
     $parteiRecord = new ParteiRecord();
     $parteiRecord->partei_name = $this->Name1->Text;
     $parteiRecord->partei_name2 = $this->Name2->Text;
     $parteiRecord->partei_name3 = $this->Name3->Text;
     $parteiRecord->partei_vorname = $this->Vorname->Text;
     $parteiRecord->idtm_user = $this->User->getUserId($this->User->Name);
     $parteiRecord->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
 private function buildData()
 {
     // Construts a query criteria
     $criteria_t = new TActiveRecordCriteria();
     $criteria_t->Condition = 'idtm_user = :idtm_user';
     $criteria_t->Parameters[':idtm_user'] = $this->User->getUserId($this->User->Name);
     $criteria_t->OrdersBy['partei_name'] = 'asc';
     // query for the posts with the above criteria and with author information
     return ParteiRecord::finder()->findAll($criteria_t);
 }
Пример #4
0
 /**
  * Initializes the inputs with existing user data.
  * This method is invoked by the framework when the page is being initialized.
  * @param mixed event parameter
  */
 public function onInit($param)
 {
     parent::onInit($param);
     if (!$this->IsPostBack && !$this->isCallback) {
         $sql = "SELECT idtm_user_role, user_role_name FROM tm_user_role";
         $this->User->isInRole('Administrator') ? '' : ($sql .= " WHERE user_role_name = 'Benutzer'");
         $data = PFH::convertdbObjectArray(UserRoleRecord::finder()->findAllBySql($sql), array("idtm_user_role", "user_role_name"));
         $this->Role->DataSource = $data;
         $this->Role->dataBind();
         // Retrieves the existing user data. This is equivalent to:
         $userRecord = $this->getUserRecord();
         //$userRecord=$this->UserRecord;
         // Populates the input controls with the existing user data
         $this->Username->Text = $userRecord->user_username;
         $this->Email->Text = $userRecord->user_mail;
         $this->Role->SelectedValue = $userRecord->idtm_user_role;
         $this->FirstName->Text = $userRecord->user_vorname;
         $this->LastName->Text = $userRecord->user_name;
         $parteiRecord = ParteiRecord::finder()->findBy_idtm_user($userRecord->idtm_user);
         $this->idta_partei->Text = $parteiRecord->idta_partei;
         $this->bind_lstAdress();
     }
 }
Пример #5
0
 /**
  * Fetches posts from database with offset and limit.
  */
 protected function getPartei($offset, $limit)
 {
     // Construts a query criteria
     $criteria_t = new TActiveRecordCriteria();
     $criteria_t->Condition = 'idtm_user = :idtm_user';
     $criteria_t->Parameters[':idtm_user'] = $this->User->getUserId($this->User->Name);
     $criteria_t->OrdersBy['partei_name'] = 'asc';
     $criteria_t->Limit = $limit;
     $criteria_t->Offset = $offset;
     // query for the posts with the above criteria and with author information
     return ParteiRecord::finder()->findAll($criteria_t);
 }
Пример #6
0
 protected function getSelectedPartei($key)
 {
     $SQL = "SELECT partei_name, partei_name2, ta_partei.idta_partei FROM ta_partei INNER JOIN ta_partei_has_ta_adresse ON ta_partei.idta_partei=ta_partei_has_ta_adresse.idta_partei INNER JOIN ta_adresse ON ta_adresse.idta_adresse = ta_partei_has_ta_adresse.idta_adresse INNER JOIN ta_waren ON ta_waren.idta_adresse = ta_adresse.idta_adresse WHERE ta_waren.idta_waren = " . $key;
     $item = ParteiRecord::finder()->findBySQL($SQL);
     return $item;
 }