Línea 827... |
Línea 827... |
827 |
]);
|
827 |
]);
|
828 |
}
|
828 |
}
|
Línea 829... |
Línea -... |
829 |
|
- |
|
- |
|
829 |
|
830 |
|
830 |
|
- |
|
831 |
|
- |
|
832 |
$request = $this->getRequest();
|
- |
|
833 |
if ($request->isGet()) {
|
- |
|
834 |
|
- |
|
835 |
$isJson = false;
|
- |
|
836 |
|
- |
|
837 |
$headers = $request->getHeaders();
|
- |
|
838 |
if ($headers->has('Accept')) {
|
- |
|
839 |
$accept = $headers->get('Accept');
|
- |
|
840 |
|
- |
|
841 |
$prioritized = $accept->getPrioritized();
|
- |
|
842 |
|
- |
|
843 |
foreach ($prioritized as $key => $value) {
|
- |
|
844 |
$raw = trim($value->getRaw());
|
- |
|
845 |
|
- |
|
846 |
if (!$isJson) {
|
- |
|
847 |
$isJson = strpos($raw, 'json');
|
- |
|
848 |
}
|
831 |
|
849 |
}
|
832 |
|
850 |
}
|
Línea 860... |
Línea 878... |
860 |
|
878 |
|
861 |
$contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
|
879 |
$contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
|
Línea -... |
Línea 880... |
- |
|
880 |
$contentReaction = $contentReactionMapper->fetchOneByKnowledgeAreaIdAndUserId($knowledgeAreaContent->id, $currentUser->id);
|
- |
|
881 |
|
- |
|
882 |
|
- |
|
883 |
if($isJson) {
|
- |
|
884 |
return new JsonModel([
|
- |
|
885 |
'success' => true,
|
- |
|
886 |
'data' => [
|
- |
|
887 |
'category' => $knowledgeAreaCategory->name,
|
- |
|
888 |
'title' => $knowledgeAreaContent->title,
|
- |
|
889 |
'description' => $knowledgeAreaContent->description,
|
- |
|
890 |
'link' => $knowledgeAreaContent->link,
|
- |
|
891 |
'image' => $this->url()->fromRoute('storage', ['type' => 'knowledge-area', 'code' => $knowledgeAreaContent->uuid, 'filename' => $knowledgeAreaContent->image]),
|
- |
|
892 |
'attachment' => $knowledgeAreaContent->attachment ? $this->url()->fromRoute('storage', ['type' => 'knowledge-area', 'code' => $knowledgeAreaContent->uuid, 'filename' => $knowledgeAreaContent->attachment]) : '',
|
- |
|
893 |
'reaction' => $contentReaction ? $contentReaction->reaction : '',
|
- |
|
894 |
'routeComments' => $this->url()->fromRoute('knowledge-area/comments', ['id' => $knowledgeAreaContent->uuid]),
|
- |
|
895 |
'routeCommentAdd' => $this->url()->fromRoute('knowledge-area/comments/add', ['id' => $knowledgeAreaContent->uuid]),
|
- |
|
896 |
'routeSaveReaction' => $this->url()->fromRoute('knowledge-area/save-reaction', ['id' => $knowledgeAreaContent->uuid]),
|
- |
|
897 |
'routeDeleteReaction' => $this->url()->fromRoute('knowledge-area/delete-reaction', ['id' => $knowledgeAreaContent->uuid]),
|
Línea 862... |
Línea 898... |
862 |
$contentReaction = $contentReactionMapper->fetchOneByKnowledgeAreaIdAndUserId($knowledgeAreaContent->id, $currentUser->id);
|
898 |
]
|
863 |
|
899 |
]);
|
864 |
|
900 |
} else {
|
865 |
|
901 |
|
866 |
$this->layout()->setTemplate('layout/layout.phtml');
|
902 |
$this->layout()->setTemplate('layout/layout.phtml');
|
867 |
$viewModel = new ViewModel();
|
903 |
$viewModel = new ViewModel();
|
868 |
$viewModel->setTemplate('leaders-linked/knowledge-area/view.phtml');
|
904 |
$viewModel->setTemplate('leaders-linked/knowledge-area/view.phtml');
|
869 |
$viewModel->setVariables([
|
905 |
$viewModel->setVariables([
|
870 |
'category' => $knowledgeAreaCategory->name,
|
906 |
'category' => $knowledgeAreaCategory->name,
|
871 |
'title' => $knowledgeAreaContent->title,
|
907 |
'title' => $knowledgeAreaContent->title,
|
872 |
'description' => $knowledgeAreaContent->description,
|
908 |
'description' => $knowledgeAreaContent->description,
|
873 |
'link' => $knowledgeAreaContent->link,
|
909 |
'link' => $knowledgeAreaContent->link,
|
874 |
'image' => $this->url()->fromRoute('storage', ['type' => 'knowledge-area', 'code' => $knowledgeAreaContent->uuid, 'filename' => $knowledgeAreaContent->image]),
|
910 |
'image' => $this->url()->fromRoute('storage', ['type' => 'knowledge-area', 'code' => $knowledgeAreaContent->uuid, 'filename' => $knowledgeAreaContent->image]),
|
875 |
'attachment' => $knowledgeAreaContent->attachment ? $this->url()->fromRoute('storage', ['type' => 'knowledge-area', 'code' => $knowledgeAreaContent->uuid, 'filename' => $knowledgeAreaContent->attachment]) : '',
|
911 |
'attachment' => $knowledgeAreaContent->attachment ? $this->url()->fromRoute('storage', ['type' => 'knowledge-area', 'code' => $knowledgeAreaContent->uuid, 'filename' => $knowledgeAreaContent->attachment]) : '',
|
876 |
'reaction' => $contentReaction ? $contentReaction->reaction : '',
|
912 |
'reaction' => $contentReaction ? $contentReaction->reaction : '',
|
877 |
'routeComments' => $this->url()->fromRoute('knowledge-area/comments', ['id' => $knowledgeAreaContent->uuid]),
|
913 |
'routeComments' => $this->url()->fromRoute('knowledge-area/comments', ['id' => $knowledgeAreaContent->uuid]),
|
878 |
'routeCommentAdd' => $this->url()->fromRoute('knowledge-area/comments/add', ['id' => $knowledgeAreaContent->uuid]),
|
914 |
'routeCommentAdd' => $this->url()->fromRoute('knowledge-area/comments/add', ['id' => $knowledgeAreaContent->uuid]),
|
- |
|
915 |
'routeSaveReaction' => $this->url()->fromRoute('knowledge-area/save-reaction', ['id' => $knowledgeAreaContent->uuid]),
|
879 |
'routeSaveReaction' => $this->url()->fromRoute('knowledge-area/save-reaction', ['id' => $knowledgeAreaContent->uuid]),
|
916 |
'routeDeleteReaction' => $this->url()->fromRoute('knowledge-area/delete-reaction', ['id' => $knowledgeAreaContent->uuid]),
|
880 |
'routeDeleteReaction' => $this->url()->fromRoute('knowledge-area/delete-reaction', ['id' => $knowledgeAreaContent->uuid]),
|
917 |
]);
|
881 |
]);
|
918 |
return $viewModel;
|
882 |
return $viewModel;
|
919 |
}
|
883 |
} else {
|
920 |
} else {
|