/** * This method is used to get the person information by ID as an object. * * @param integer $personId as person ID. * @return object of receiver. */ public function GetPersonById($personId) { $Person_Query = 'SELECT ' . 'Id , ' . 'Gender , ' . 'Title , ' . 'First_Name , ' . 'Last_Name , ' . 'Street_Name , ' . 'Street_No , ' . 'Zip , ' . 'City , ' . 'Country , ' . 'Email ' . 'FROM ' . 'p24_persons ' . 'WHERE ' . 'Id = ' . $personId . ' ' . 'LIMIT 1'; $Person_Result = $this->dbPreis24->query($Person_Query); $Person_Object = $Person_Result->fetch_object(); if ($Person_Object) { $returned_person = new Person($Person_Object->Id, $Person_Object->Gender, OwnLibrary::Utf8Encode($Person_Object->Title), OwnLibrary::Utf8Encode($Person_Object->First_Name), OwnLibrary::Utf8Encode($Person_Object->Last_Name), OwnLibrary::Utf8Encode($Person_Object->Street_Name), OwnLibrary::Utf8Encode($Person_Object->Street_No), OwnLibrary::Utf8Encode($Person_Object->Zip), OwnLibrary::Utf8Encode($Person_Object->City), $Person_Object->Country, $Person_Object->Email); return $returned_person; } else { return null; } }
<?php /** * This is a controller to save a new person using AJAX. * * @author Arsess Vakilpour * @version 1.0 * @package Peris24-Testprojekt */ $New_Person = new Person(null, $this->post_values['Gender'], OwnLibrary::Utf8Encode($this->post_values['Title']), OwnLibrary::Utf8Encode($this->post_values['First_Name']), OwnLibrary::Utf8Encode($this->post_values['Last_Name']), OwnLibrary::Utf8Encode($this->post_values['Street_Name']), OwnLibrary::Utf8Encode($this->post_values['Street_No']), OwnLibrary::Utf8Encode($this->post_values['Zip']), OwnLibrary::Utf8Encode($this->post_values['City']), $this->post_values['Country'], $this->post_values['Email']); if ($this->model->SaveNewPerson($New_Person)) { echo 'Success'; }
break; case 'CY': $country = 'Zypern'; break; } $imgEdit = new ButtonEdit($value->Id); $imgDelete = new ButtonDelete(); $id = new Input(null, null, 'hidden', $value->Id, 'hiddenField'); $tdFunctionContent = $id->Display(); $tdFunctionContent .= $imgDelete->Display() . $imgEdit->Display(); $tdName = new Td((trim($value->Title) == '' ? trim($value->Gender) == '' ? '' : $value->Gender . ' ' : OwnLibrary::Utf8Encode($value->Title) . ' ') . OwnLibrary::Utf8Encode($value->First_Name) . ' ' . OwnLibrary::Utf8Encode($value->Last_Name), 'Name_' . OwnLibrary::Utf8Encode($value->Id)); $tdAddress = new Td(OwnLibrary::Utf8Encode($value->Street_Name) . ' ' . OwnLibrary::Utf8Encode($value->Street_No), 'Street_' . OwnLibrary::Utf8Encode($value->Id)); $tdZip = new Td(OwnLibrary::Utf8Encode($value->Zip), 'Zip_' . OwnLibrary::Utf8Encode($value->Id), null, 'text-align: center;'); $tdCity = new Td(OwnLibrary::Utf8Encode($value->City), 'City_' . OwnLibrary::Utf8Encode($value->Id), null, 'text-align: center;'); $tdCountry = new Td(OwnLibrary::Utf8Encode($country), 'Country_' . OwnLibrary::Utf8Encode($value->Id), null, 'text-align: center;'); $tdEmail = new Td('<a href="mailto:' . OwnLibrary::Utf8Encode($value->Email) . '">' . OwnLibrary::Utf8Encode($value->Email) . '</a>', 'Email_' . OwnLibrary::Utf8Encode($value->Id), null, 'text-align: center;'); $tdFunctions = new Td($tdFunctionContent, null, 'funcs', 'text-align: center; width: 1px;'); $tdArray = array(); $tdArray[] = $tdName; $tdArray[] = $tdAddress; $tdArray[] = $tdZip; $tdArray[] = $tdCity; $tdArray[] = $tdCountry; $tdArray[] = $tdEmail; $tdArray[] = $tdFunctions; $trContent = new Tr($tdArray, null, 'TrMain' . ($key % 2 ? ' tr_even' : '')); $trArray[] = $trContent; } $viewTable = new ViewTable($trHeader, $trArray); $pagination = new Pagination($Persons_List[1]); $contentfooter = new ContentFooter($pagination->Display());