Skip to content

Commit

Permalink
Merge branch 'release/7.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianstein committed Dec 20, 2020
2 parents b30c51a + 6e338f4 commit e0621e7
Show file tree
Hide file tree
Showing 149 changed files with 12,909 additions and 12,744 deletions.
92 changes: 92 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# CSS-Files
[*.css]
indent_style = tab
indent_size = 4

# HTML-Files
[*.html]
indent_style = tab
indent_size = 2

# TMPL-Files
[*.tmpl]
indent_style = tab
indent_size = 4

# SCSS-Files
[*.scss]
indent_style = space
indent_size = 4

# TS/JS-Files
[*.ts]
indent_style = space
indent_size = 2
[*.js]
indent_style = space
indent_size = 2

# JSON-Files
[*.json]
indent_style = tab
indent_size = 4

# PHP-Files
[*.php]
indent_style = space
indent_size = 4

# ReST-Files
[*.rst]
indent_style = space
indent_size = 3

# MD-Files
[*.md]
indent_style = space
indent_size = 4

# YAML-Files
[{*.yaml,*.yml}]
indent_style = space
indent_size = 2

# package.json
# .travis.yml
# bower.json
[{package.json,.travis.yml,bower.json}]
indent_style = space
indent_size = 2

# TypoScript
[*.typoscript]
indent_style = space
indent_size = 2
[*.tsconfig]
indent_style = space
indent_size = 2

# XLF-Files
[*.xlf]
indent_style = tab
indent_size = 4

# SQL-Files
[*.sql]
indent_style = tab
indent_size = 2

# .htaccess
[{_.htaccess,.htaccess}]
indent_style = tab
indent_size = 4
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/Tests export-ignore

/Resources/Private/JavaScript/ export-ignore
/Resources/Private/Sass/ export-ignore
/Resources/Private/gulpfile.js export-ignore
/Resources/Private/package.json export-ignore
/Resources/Private/package-lock.json export-ignore
25 changes: 0 additions & 25 deletions Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,6 @@

namespace In2code\In2studyfinder\Controller;

/***************************************************************
*
* Copyright notice
*
* (c) 2017 Sebastian Stein <sebastian.stein@in2code.de>, In2code GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

use In2code\In2studyfinder\Domain\Repository\StudyCourseRepository;
use In2code\In2studyfinder\Utility\ExtensionUtility;
use TYPO3\CMS\Core\Log\Logger;
Expand Down
126 changes: 17 additions & 109 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,9 @@

namespace In2code\In2studyfinder\Controller;

/***************************************************************
*
* Copyright notice
*
* (c) 2016 Sebastian Stein <sebastian.stein@in2code.de>, In2code GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

use In2code\In2studyfinder\Domain\Model\StudyCourse;
use In2code\In2studyfinder\Service\ExportService;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Log\LogLevel;
use In2code\In2studyfinder\Utility\VersionUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
Expand Down Expand Up @@ -219,86 +192,14 @@ public function exportAction($exporter, $recordLanguage, $selectedProperties, $c
$this->forward('list');
}

/**
* WORKAROUND
*
* see @getCoursesForExport
*/
$courses = $this->getCoursesForExport($courseList, $recordLanguage);
$courses = $this->studyCourseRepository->findByUidsAndLanguage($courseList, (int)$recordLanguage);

$exportService = $this->objectManager->get(ExportService::class, $exporter, $selectedProperties, $courses);
$exportService =
$this->objectManager->get(ExportService::class, $exporter, $selectedProperties, $courses->toArray());

$exportService->export();
}

/**
* WORKAROUND
*
* we make an frontend request because returns the attached records of the course always in the default language.
* This function will be removed if i found a other solution.
*
* @param array $courseList
* @param int $recordLanguage
*
* @return array
* @throws Exception
*/
protected function getCoursesForExport(array $courseList, $recordLanguage)
{
$content['tx_in2studyfinder_pi1']['courseList'] = $courseList;

$opts = [
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => http_build_query($content)
],
];

$context = stream_context_create($opts);

$result = $this->executeFrontendRequest($this->request->getBaseUri(), $recordLanguage, $context);

return unserialize(json_decode($result));
}

/**
* @param $url
* @param $recordLanguage
* @param $context
* @return bool|string
* @throws Exception
*/
protected function executeFrontendRequest($url, $recordLanguage, $context)
{
$urlParts = parse_url($url);
$result = false;

if ($urlParts['scheme'] === 'https') {
$result = file_get_contents(
$urlParts['scheme'] . '://' . $urlParts['host'] . '/?type=2308171056&L=' . $recordLanguage,
false,
$context
);
}


// if the scheme is http or the request returning an error with https
if ($result === false || $urlParts['scheme'] === 'http') {
$result = file_get_contents(
'http://' . $urlParts['host'] . '/?type=2308171056&L=' . $recordLanguage,
false,
$context
);
}

if ($result === false) {
throw new Exception('Error at frontend request of selected programs', 1547629143);
}

return $result;
}

/**
* @param $propertyArray
* @param $objectProperties
Expand All @@ -307,22 +208,29 @@ protected function getFullPropertyList(
&$propertyArray,
$objectProperties
) {

foreach ($objectProperties as $propertyName => $propertyInformation) {
if (!in_array($propertyName, $this->settings['backend']['export']['excludedPropertiesForExport'])) {
if ($propertyInformation['type'] === ObjectStorage::class) {
if (class_exists($propertyInformation['elementType'])) {
if (VersionUtility::isTypo3MajorVersionBelow(10)) {
$elementType = $propertyInformation['elementType'];
$type = $propertyInformation['type'];
} else {
$elementType = $propertyInformation->getElementType();
$type = $propertyInformation->getType();
}

if ($type === ObjectStorage::class) {
if (class_exists($elementType)) {
$this->getFullPropertyList(
$propertyArray[$propertyName],
$this->reflectionService->getClassSchema($propertyInformation['elementType'])
$this->reflectionService->getClassSchema($elementType)
->getProperties()
);
}
} else {
if (class_exists($propertyInformation['type'])) {
if (class_exists($type)) {
$this->getFullPropertyList(
$propertyArray[$propertyName],
$this->reflectionService->getClassSchema($propertyInformation['type'])->getProperties()
$this->reflectionService->getClassSchema($type)->getProperties()
);
} else {
$propertyArray[$propertyName] = $propertyName;
Expand Down

0 comments on commit e0621e7

Please sign in to comment.