diff --git a/app/Http/Controllers/Publish/EditorController.php b/app/Http/Controllers/Publish/EditorController.php index 64538ce..56756c3 100644 --- a/app/Http/Controllers/Publish/EditorController.php +++ b/app/Http/Controllers/Publish/EditorController.php @@ -51,16 +51,16 @@ class EditorController extends Controller * @param int $id * @return \Illuminate\View\View */ - public function accept($id): View + public function receive($id): View { $dataset = Dataset::with('user:id,login')->findOrFail($id); - return view('workflow.editor.accept', [ + return view('workflow.editor.receive', [ 'dataset' => $dataset, ]); } - public function acceptUpdate(Request $request, $id) + public function receiveUpdate(Request $request, $id) { $dataset = Dataset::findOrFail($id); @@ -191,6 +191,7 @@ class EditorController extends Controller 'reviewers' => $reviewers, ]); } + public function approveUpdate(Request $request, $id) { // $dataset = Dataset::findOrFail($id); diff --git a/app/Http/Controllers/Publish/ReviewController.php b/app/Http/Controllers/Publish/ReviewController.php index 092def1..d47a747 100644 --- a/app/Http/Controllers/Publish/ReviewController.php +++ b/app/Http/Controllers/Publish/ReviewController.php @@ -32,6 +32,111 @@ class ReviewController extends Controller ->where('server_state', 'approved') ->where('reviewer_id', $userId) ->get(); - return view('workflow.review.index', compact('datasets')); + return view('workflow.review.index', [ + 'datasets' => $datasets + ]); + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\View\View + */ + public function review($id): View + { + $dataset = Dataset::with('user:id,login')->findOrFail($id); + $dataset->fetchValues(); + $fieldnames = $dataset->describe(); + $fields = []; + foreach ($fieldnames as $fieldName) { + $field = $dataset->getField($fieldName); + $modelClass = $field->getValueModelClass(); + $fieldValues = $field->getValue($fieldName); + $value = ""; + + if (null === $modelClass) { + $value = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/', "\xEF\xBF\xBD ", $fieldValues); + } else { + // $fieldName = $field->getName(); + + + if (!is_array($fieldValues)) { + $fieldValues = array($fieldValues); + } + + foreach ($fieldValues as $fieldValue) { + // if a field has no value then is nothing more to do + // TODO maybe must be there an other solution + // FIXME remove code duplication (duplicates Opus_Model_Xml_Version*) + if (is_null($fieldValue)) { + continue; + } + + if ($fieldValue instanceof \Illuminate\Database\Eloquent\Model) { + //$this->_mapModelAttributes($value, $dom, $childNode); + $attributes = array_keys($fieldValue->getAttributes()); + foreach ($attributes as $property_name) { + $fieldName = self::convertColumnToFieldname($property_name); + // $field = new Field($fieldName); + $fieldval = $fieldValue->{$property_name}; + $value = $value . $fieldName . ": " . $fieldval . "; "; + } + } elseif ($fieldValue instanceof \Carbon\Carbon) { + $value = $value . " Year " . $fieldValue->year; + $value = $value . " Month " . $fieldValue->month; + $value = $value . " Day " . $fieldValue->day; + $value = $value . " Hour " . $fieldValue->hour; + $value = $value . " Minute " . $fieldValue->minute; + $value = $value . " Second " . $fieldValue->second; + $value = $value . " UnixTimestamp " . $fieldValue->timestamp; + $value = $value . " Timezone " . $fieldValue->tzName; + } elseif (is_array($fieldValue)) { + $attributes = $fieldValue; + $value = "