Skip to content
Snippets Groups Projects
Commit 6f935d23 authored by damjan's avatar damjan
Browse files

[FEATURE] Getting the data (in progress)

parent 96d918ab
No related branches found
No related tags found
No related merge requests found
......@@ -28,14 +28,16 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
/**
* The action which fetches initial data for typoScript reference page, and displays the page.
*
* @return void
* @param string $typeId
*/
public function indexAction() {
$jsonAttributes = $this->tsrefRestService->getAttributesJson(TRUE);
$this->view->assign(
'foos', [
'bar', $jsonAttributes
]
);
public function indexAction($typeId = NULL) {
$attributes = $this->tsrefRestService->getTypes();
if($typeId !== NULL) {
//TODO: fetch all data for attribute with id: $typeId
}
$this->view->assign('types', $attributes);
$this->view->assign('typeId', $typeId);
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ class TsrefRestService {
/**
* URL of REST API resource.
*/
const REST_API_BASE_URL = '127.0.0.1:8000/api/attributes';
const RESOURCE_URL = '127.0.0.1:8000/api/attributes';
/**
* Default typo3 version of typoScript attributes
......@@ -37,7 +37,7 @@ class TsrefRestService {
$curlHandle = curl_init();
// Set URL to download
curl_setopt($curlHandle, CURLOPT_URL, self::REST_API_BASE_URL);
curl_setopt($curlHandle, CURLOPT_URL, self::RESOURCE_URL);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, TRUE);
......@@ -78,6 +78,19 @@ class TsrefRestService {
return $output;
}
/**
* Gets all type attributes by $typo3Version and $typo3Group from RESOURCE_URL
*
* @param string $typo3Version
* @param int $typo3Group
* @return mixed
*/
public function getTypes($typo3Version = self::TYPO3_DEFAULT_VERSION, $typo3Group = Attribute::NORMAL_GROUP) {
$typesJson = $this->getAttributesJson(TRUE, $typo3Version, $typo3Group);
$typesPhp = json_decode($typesJson);
return $typesPhp;
}
/**
* Adds new attribute to REST API resource by use of POST method.
*
......
......@@ -2,13 +2,18 @@
<html>
<head>
<meta charset="utf-8">
<title><f:render section="Title" /></title>
<link rel="stylesheet" href="{f:uri.resource(package: 'SGalinski.TypoScriptReferenceFrontend', path: 'Css/Tsref.css')}" />
<title>
<f:render section="Title" />
</title>
<f:base />
</head>
<body>
<f:flashMessages class="flashmessages" />
<h1><f:render section="Title" /></h1>
<h1>
<f:render section="Title" />
</h1>
<f:render section="Content" />
</body>
</html>
\ No newline at end of file
......@@ -4,12 +4,23 @@
<f:section name="Content">
<h1>A freshly created Fluid template!</h1>
<p>Some data set by the controller:</p>
<ul>
<f:for each="{foos}" as="foo">
<li>{foo}</li>
</f:for>
</ul>
<div class="col-sm-3">
<ul>
<f:for each="{types}" as="type">
<li>
<f:link.action package="SGalinski.TypoScriptReferenceFrontend" controller="tsref" action="index"
arguments="{typeId: type.id}">
{type.id} {type.name}
</f:link.action>
</li>
</f:for>
</ul>
</div>
<div class="col-sm-9">
test {typeId}
</div>
</f:section>
\ No newline at end of file
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px
}
@media (min-width: 768px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left
}
.col-sm-3 {
width: 25%
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment