Commit 1a0745a2 authored by Oliver Hader's avatar Oliver Hader
Browse files

[TASK] Integrate TYPO3 & PHP version matrix

parent d6030e87
<?php
class Tx_Typo3Roadmap_ViewHelpers_Condition_InArrayViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractConditionViewHelper
{
/**
* @param string $needle
* @param array $array
* @param null $arrayPath
* @return string
*/
public function render($needle, array $array, $arrayPath = null)
{
if ($this->inArray($needle, $array, $arrayPath)) {
return $this->renderThenChild();
} else {
return $this->renderElseChild();
}
}
/**
* @param string $needle
* @param array $array
* @param $arrayPath
* @return bool
*/
protected function inArray($needle, array $array, $arrayPath)
{
foreach ($array as $key => $value) {
if ($arrayPath !== null) {
$arrayValue = Tx_Extbase_Reflection_ObjectAccess::getPropertyPath($value, $arrayPath);
if ($needle === $arrayValue) {
return true;
}
} elseif ($needle === $value) {
return true;
}
}
return false;
}
}
\ No newline at end of file
{namespace roadmap=Tx_Typo3Roadmap_ViewHelpers}
<h3>Charts</h3>
<div id="charts" style="height: 300px;"></div>
......@@ -38,5 +38,38 @@
</div>
<h3>PHP Compatibility Chart</h3>
<f:format.html>{phpTable}</f:format.html>
<table border="1">
<thead>
<tr>
<th>PHP versions</th>
<f:for each="{majorVersions}" as="majorVersion">
<th>
<strong>TYPO3 {majorVersion.title}</strong><br>
{f:format.date(date:majorVersion.developmentstart,format:'Y')}
- {f:format.date(date:majorVersion.regularsupport,format:'Y')}
</th>
</f:for>
</tr>
</thead>
<tbody>
<f:for each="{phpVersions}" as="phpVersion">
<tr>
<td>
PHP {phpVersion.version}
</td>
<f:for each="{majorVersions}" as="majorVersion">
<td>
<roadmap:condition.inArray needle="{phpVersion.uid}" array="{majorVersion.phpVersions}" arrayPath="uid">
<f:then>
yes
</f:then>
<f:else>
no
</f:else>
</roadmap:condition.inArray>
</td>
</f:for>
</tr>
</f:for>
</tbody>
</table>
......@@ -79,15 +79,17 @@ class tx_typo3roadmap_pi1 extends tslib_pibase
$this->pi_loadLL();
$this->initializeView();
$this->db = $GLOBALS['TYPO3_DB'];
$this->pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
$this->pageRenderer = $this->getFrontendController()->getPageRenderer();
$majorVersions = $this->getMajorVersions();
$phpVersions = $this->getAllAvailablePHPVersions();
$this->renderCharts($majorVersions);
$this->view->assign('majors', $majorVersions);
$this->view->assign('ceUid', $this->cObj->data['uid']);
$this->view->assign('phpTable', $this->renderPHPCompatibilityMatrix($this->getAllAvailablePHPVersions(), $majorVersions));
$this->view->assign('phpVersions', $phpVersions);
$this->view->assign('majorVersions', $majorVersions);
$content .= $this->view->render();
......@@ -118,6 +120,11 @@ class tx_typo3roadmap_pi1 extends tslib_pibase
'sorting'
);
foreach ($rows as $index => $singleRow) {
foreach ($singleRow as $fieldName => $fieldValue) {
if (t3lib_div::testInt($fieldValue)) {
$rows[$index][$fieldName] = (int)$fieldValue;
}
}
$rows[$index]['minorversions'] = $this->getMinorVersions($singleRow['uid']);
$rows[$index]['phpVersions'] = $this->getSupportedPHPVersions($singleRow['uid']);
}
......@@ -144,6 +151,10 @@ class tx_typo3roadmap_pi1 extends tslib_pibase
return $rows;
}
/**
* @param int $majorVersion
* @return array
*/
protected function getSupportedPHPVersions($majorVersion)
{
$rows = $this->db->exec_SELECTgetRows(
......@@ -344,6 +355,13 @@ class tx_typo3roadmap_pi1 extends tslib_pibase
return $data;
}
/**
* @param array $allVersions
* @param array $majorVersions
* @return string
*
* @deprecated Not used anymore
*/
protected function renderPHPCompatibilityMatrix(array $allVersions, array $majorVersions)
{
$content = '<table border="1">';
......@@ -356,4 +374,12 @@ class tx_typo3roadmap_pi1 extends tslib_pibase
return $content;
}
/**
* @return tslib_fe
*/
protected function getFrontendController()
{
return $GLOBALS['TSFE'];
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment