Skip to content

Commit a92bdcb

Browse files
committedApr 15, 2016
[TASK] Add simple-blog code
1 parent fead7de commit a92bdcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2169
-6
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
namespace BeechIt\SimpleBlog\Controller;
3+
4+
5+
/***************************************************************
6+
*
7+
* Copyright notice
8+
*
9+
* (c) 2016 Ruud Silvrants <t3ext@beech.it>, BeechIt
10+
*
11+
* All rights reserved
12+
*
13+
* This script is part of the TYPO3 project. The TYPO3 project is
14+
* free software; you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation; either version 3 of the License, or
17+
* (at your option) any later version.
18+
*
19+
* The GNU General Public License can be found at
20+
* http://www.gnu.org/copyleft/gpl.html.
21+
*
22+
* This script is distributed in the hope that it will be useful,
23+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
* GNU General Public License for more details.
26+
*
27+
* This copyright notice MUST APPEAR in all copies of the script!
28+
***************************************************************/
29+
30+
/**
31+
* BlogController
32+
*/
33+
class BlogController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
34+
{
35+
36+
/**
37+
* blogRepository
38+
*
39+
* @var \BeechIt\SimpleBlog\Domain\Repository\BlogRepository
40+
* @inject
41+
*/
42+
protected $blogRepository = NULL;
43+
44+
/**
45+
* action list
46+
*
47+
* @return void
48+
*/
49+
public function listAction()
50+
{
51+
$blogs = $this->blogRepository->findAll();
52+
$this->view->assign('blogs', $blogs);
53+
}
54+
55+
/**
56+
* action show
57+
*
58+
* @param \BeechIt\SimpleBlog\Domain\Model\Blog $blog
59+
* @return void
60+
*/
61+
public function showAction(\BeechIt\SimpleBlog\Domain\Model\Blog $blog)
62+
{
63+
$this->view->assign('blog', $blog);
64+
}
65+
66+
/**
67+
* action new
68+
*
69+
* @return void
70+
*/
71+
public function newAction()
72+
{
73+
74+
}
75+
76+
/**
77+
* action create
78+
*
79+
* @param \BeechIt\SimpleBlog\Domain\Model\Blog $newBlog
80+
* @return void
81+
*/
82+
public function createAction(\BeechIt\SimpleBlog\Domain\Model\Blog $newBlog)
83+
{
84+
$this->addFlashMessage('The object was created. Please be aware that this action is publicly accessible unless you implement an access check. See http://wiki.typo3.org/T3Doc/Extension_Builder/Using_the_Extension_Builder#1._Model_the_domain', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
85+
$this->blogRepository->add($newBlog);
86+
$this->redirect('list');
87+
}
88+
89+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<?php
2+
namespace BeechIt\SimpleBlog\Domain\Model;
3+
4+
5+
/***************************************************************
6+
*
7+
* Copyright notice
8+
*
9+
* (c) 2016 Ruud Silvrants <t3ext@beech.it>, BeechIt
10+
*
11+
* All rights reserved
12+
*
13+
* This script is part of the TYPO3 project. The TYPO3 project is
14+
* free software; you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation; either version 3 of the License, or
17+
* (at your option) any later version.
18+
*
19+
* The GNU General Public License can be found at
20+
* http://www.gnu.org/copyleft/gpl.html.
21+
*
22+
* This script is distributed in the hope that it will be useful,
23+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
* GNU General Public License for more details.
26+
*
27+
* This copyright notice MUST APPEAR in all copies of the script!
28+
***************************************************************/
29+
30+
/**
31+
* Blog
32+
*/
33+
class Blog extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
34+
{
35+
36+
/**
37+
* title
38+
*
39+
* @var string
40+
*/
41+
protected $title = '';
42+
43+
/**
44+
* blogdate
45+
*
46+
* @var \DateTime
47+
*/
48+
protected $blogdate = null;
49+
50+
/**
51+
* teaser
52+
*
53+
* @var string
54+
*/
55+
protected $teaser = '';
56+
57+
/**
58+
* description
59+
*
60+
* @var string
61+
*/
62+
protected $description = '';
63+
64+
/**
65+
* Constructor of a new Blog which automatically sets the date on today
66+
*/
67+
public function __construct() {
68+
$this->blogdate = new \DateTime();
69+
}
70+
71+
/**
72+
* Returns the title
73+
*
74+
* @return string $title
75+
*/
76+
public function getTitle()
77+
{
78+
return $this->title;
79+
}
80+
81+
/**
82+
* Sets the title
83+
*
84+
* @param string $title
85+
* @return void
86+
*/
87+
public function setTitle($title)
88+
{
89+
$this->title = $title;
90+
}
91+
92+
/**
93+
* Returns the blogdate
94+
*
95+
* @return \DateTime $blogdate
96+
*/
97+
public function getBlogdate()
98+
{
99+
return $this->blogdate;
100+
}
101+
102+
/**
103+
* Sets the blogdate
104+
*
105+
* @param \DateTime $blogdate
106+
* @return void
107+
*/
108+
public function setBlogdate(\DateTime $blogdate)
109+
{
110+
$this->blogdate = $blogdate;
111+
}
112+
113+
/**
114+
* Returns the teaser
115+
*
116+
* @return string $teaser
117+
*/
118+
public function getTeaser()
119+
{
120+
return $this->teaser;
121+
}
122+
123+
/**
124+
* Sets the teaser
125+
*
126+
* @param string $teaser
127+
* @return void
128+
*/
129+
public function setTeaser($teaser)
130+
{
131+
$this->teaser = $teaser;
132+
}
133+
134+
/**
135+
* Returns the description
136+
*
137+
* @return string $description
138+
*/
139+
public function getDescription()
140+
{
141+
return $this->description;
142+
}
143+
144+
/**
145+
* Sets the description
146+
*
147+
* @param string $description
148+
* @return void
149+
*/
150+
public function setDescription($description)
151+
{
152+
$this->description = $description;
153+
}
154+
155+
}

0 commit comments

Comments
 (0)
Please sign in to comment.