{ return $this->result; } } class ViewImplJSON extends ViewImpl { protected $result = array(); public function drawLine() { $this->appendResult(array('type' => 'line')); } public function drawText($text) { $this->appendResult(array('type' => 'text', 'text' => $text)); } protected function appendResult($result) { $this->result[] = $result; } public function getResult() { return json_encode($this->result); } } /// $Content = new ViewContent(); $Table = new ViewTable(); $Content->printParagraph('Hello world'); $Content->printResult(); $Table->drawCell('I am cell'); $Table->printResult();
$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()); $viewPersons = new ViewPersons(); $viewPersons->par = $this; $viewPersons->page_title = 'Adressbuch'; $viewPersons->page_title_right = $buttonNewPerson->Display(); if (empty($Persons_List[0])) { $viewPersons->content = '<br />' . $notFoundMassage->Display() . '<br /><br />'; } $viewPersons->content .= $viewTable->Display(); $viewPersons->contentFooter = $contentfooter->Display(); include_once 'view/javascripts/' . $this->get_values['Page'] . '.javascript.php'; $viewPersons->Display();