Exemple #1
0
 public function view($in)
 {
     $wo = $this->wo;
     $tableName = $this->tableName;
     if (!WOOOF::hasContent($tableName)) {
         $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, "1000 No value for tableName");
         return false;
     }
     $showDetails = $wo->getFromArray($in, '_showDetails', true);
     $tplContentTop = '';
     $tplContent = '';
     $tplErrorMessage = '';
     $tplMessage = '';
     $wo->debug("Generic.show for '{$tableName}'.");
     $table = new WOOOF_dataBaseTable($wo->db, $tableName);
     if (!$table->constructedOk) {
         $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, "1010 Failed to init '{$tableName}'!");
         return false;
     }
     // form html
     // $htmlFragment = '';
     $id = $wo->getFromArray($in, '_id');
     $tplContentTop .= "<h1>'{$tableName}' View for [{$id}]</h1>";
     // Show the data
     //
     $formBody = $table->presentRowReadOnly($id);
     if ($formBody === FALSE) {
         $tplContent .= "Failed to perform 'view'!";
         $tplErrorMessage .= $wo->getLastErrorAsStringAndClear() . '<br>';
     } else {
         $tplContent .= $formBody;
     }
     return array('contentTop' => $tplContentTop, 'content' => $tplContent, 'errorMessage' => $tplErrorMessage, 'message' => $tplMessage);
 }