Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
voting.typo3.org
extensions
election
Commits
fbbeab1d
Commit
fbbeab1d
authored
Dec 22, 2015
by
Oliver Eglseder
Browse files
[TASK] Add ElectionCircular list
parent
ad233ddc
Changes
18
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/AbstractBeController.php
View file @
fbbeab1d
...
...
@@ -113,20 +113,18 @@ abstract class AbstractBeController extends ActionController
}
/**
* @param
array
$requiredUserGroup
s Array of
UID
s
of the user group
s
* @param
int
$requiredUserGroup UID of the user group
* @return bool
*/
protected
function
backendUserHasUserGroup
(
array
$requiredUserGroup
s
)
protected
function
backendUserHasUserGroup
(
$requiredUserGroup
)
{
foreach
(
$requiredUserGroups
as
$requiredUserGroup
)
{
if
(
Configuration
::
AUTH_NONE
===
$requiredUserGroup
)
{
if
(
Configuration
::
AUTH_NONE
===
$requiredUserGroup
)
{
return
true
;
}
foreach
(
$this
->
backendUser
->
userGroups
as
$userGroup
)
{
if
((
int
)
$userGroup
[
'uid'
]
===
$requiredUserGroup
)
{
return
true
;
}
foreach
(
$this
->
backendUser
->
userGroups
as
$userGroup
)
{
if
((
int
)
$userGroup
[
'uid'
]
===
$requiredUserGroup
)
{
return
true
;
}
}
}
return
false
;
}
...
...
Classes/Controller/AbstractProtectedBeController.php
View file @
fbbeab1d
...
...
@@ -27,7 +27,7 @@ abstract class AbstractProtectedBeController extends AbstractBeController
*/
protected
function
initializeAction
()
{
if
(
!
$this
->
backendUserHasUserGroup
(
$this
->
getRequiredUserGroup
s
()))
{
if
(
!
$this
->
backendUserHasUserGroup
(
$this
->
getRequiredUserGroup
()))
{
$this
->
addFlashMessage
(
LocalizationUtility
::
translate
(
'controller.be.protected_controller.no_permission'
,
'election'
),
LocalizationUtility
::
translate
(
'controller.be.protected_controller.error'
,
'election'
),
...
...
@@ -38,7 +38,7 @@ abstract class AbstractProtectedBeController extends AbstractBeController
}
/**
* @return int
[]
* @return int
*/
abstract
protected
function
getRequiredUserGroup
s
();
abstract
protected
function
getRequiredUserGroup
();
}
Classes/Controller/BeConfigurationController.php
View file @
fbbeab1d
...
...
@@ -61,13 +61,13 @@ class BeConfigurationController extends AbstractProtectedBeController
}
/**
* @return int
[]
* @return int
*/
protected
function
getRequiredUserGroup
s
()
protected
function
getRequiredUserGroup
()
{
if
(
null
===
$this
->
configuration
)
{
return
[
Configuration
::
AUTH_NONE
]
;
return
Configuration
::
AUTH_NONE
;
}
return
[
$this
->
configuration
->
getAdministrationGroup
()
]
;
return
$this
->
configuration
->
getAdministrationGroup
();
}
}
Classes/Controller/BeDashboardController.php
View file @
fbbeab1d
...
...
@@ -39,7 +39,7 @@ class BeDashboardController extends AbstractBeController
'elections'
=>
$this
->
electionRepository
->
findAll
(),
]
);
if
(
$this
->
backendUserHasUserGroup
(
[
$this
->
configuration
->
getElectionManagerGroup
()
]
))
{
if
(
$this
->
backendUserHasUserGroup
(
$this
->
configuration
->
getElectionManagerGroup
()))
{
$this
->
view
->
assign
(
'electorImports'
,
$this
->
objectManager
->
get
(
ElectorImportRepository
::
class
)
->
findAll
());
}
}
...
...
Classes/Controller/BeCircularController.php
→
Classes/Controller/Be
Election
CircularController.php
View file @
fbbeab1d
...
...
@@ -17,14 +17,23 @@ namespace TYPO3\Election\Controller;
/**
* Class BeConfigurationController
*/
class
BeCircularController
extends
AbstractProtectedBeController
class
Be
Election
CircularController
extends
AbstractProtectedBeController
{
const
CONTROLLER_NAME
=
'BeCircular'
;
const
CONTROLLER_NAME
=
'Be
Election
Circular'
;
const
ACTION_LIST
=
'list'
;
/**
* @var \TYPO3\Election\Domain\Repository\ElectionCircularRepository
* @inject
*/
protected
$electionCircularRepository
=
null
;
/**
*
*/
public
function
listAction
()
{
$this
->
view
->
assign
(
'electionCirculars'
,
$this
->
electionCircularRepository
->
findAll
());
}
/**
...
...
@@ -41,10 +50,10 @@ class BeCircularController extends AbstractProtectedBeController
}
/**
* @return int
[]
* @return int
*/
protected
function
getRequiredUserGroup
s
()
protected
function
getRequiredUserGroup
()
{
return
[
$this
->
configuration
->
getElectionManagerGroup
()
,
$this
->
configuration
->
getPollManagerGroup
()]
;
return
$this
->
configuration
->
getElectionManagerGroup
();
}
}
Classes/Controller/BeElectionController.php
View file @
fbbeab1d
...
...
@@ -136,10 +136,10 @@ class BeElectionController extends AbstractProtectedBeController
}
/**
* @return int
[]
* @return int
*/
protected
function
getRequiredUserGroup
s
()
protected
function
getRequiredUserGroup
()
{
return
[
$this
->
configuration
->
getElectionManagerGroup
()
]
;
return
$this
->
configuration
->
getElectionManagerGroup
();
}
}
Classes/Controller/BeElectorController.php
View file @
fbbeab1d
...
...
@@ -203,10 +203,10 @@ class BeElectorController extends AbstractProtectedBeController
}
/**
* @return int
[]
* @return int
*/
protected
function
getRequiredUserGroup
s
()
protected
function
getRequiredUserGroup
()
{
return
[
$this
->
configuration
->
getElectionManagerGroup
()
]
;
return
$this
->
configuration
->
getElectionManagerGroup
();
}
}
Classes/Controller/BeElectorateController.php
View file @
fbbeab1d
...
...
@@ -114,11 +114,11 @@ class BeElectorateController extends AbstractProtectedBeController
}
/**
* @return int
[]
* @return int
*/
protected
function
getRequiredUserGroup
s
()
protected
function
getRequiredUserGroup
()
{
return
[
$this
->
configuration
->
getElectionManagerGroup
()
]
;
return
$this
->
configuration
->
getElectionManagerGroup
();
}
/**
...
...
Classes/Controller/BeNomineeController.php
View file @
fbbeab1d
...
...
@@ -127,11 +127,11 @@ class BeNomineeController extends AbstractProtectedBeController
}
/**
* @return int
[]
* @return int
*/
protected
function
getRequiredUserGroup
s
()
protected
function
getRequiredUserGroup
()
{
return
[
$this
->
configuration
->
getElectionManagerGroup
()
]
;
return
$this
->
configuration
->
getElectionManagerGroup
();
}
/**
...
...
Classes/Domain/Model/Circular.php
→
Classes/Domain/Model/
Election
Circular.php
View file @
fbbeab1d
...
...
@@ -15,15 +15,57 @@ namespace TYPO3\Election\Domain\Model;
*/
/**
* Class Circular
* Class
Election
Circular
*/
class
Circular
extends
AbstractEntity
class
Election
Circular
extends
AbstractEntity
{
/**
* @var string
*/
protected
$subject
=
''
;
/**
* @var string
*/
protected
$body
=
''
;
/**
* @var \TYPO3\Election\Domain\Model\Election
*/
protected
$election
=
null
;
/**
* @return string
*/
public
function
getSubject
()
{
return
$this
->
subject
;
}
/**
* @param string $subject
*/
public
function
setSubject
(
$subject
)
{
$this
->
subject
=
$subject
;
}
/**
* @return string
*/
public
function
getBody
()
{
return
$this
->
body
;
}
/**
* @param string $body
*/
public
function
setBody
(
$body
)
{
$this
->
body
=
$body
;
}
/**
* @return Election
*/
...
...
Classes/Domain/Repository/ElectionCircularRepository.php
0 → 100644
View file @
fbbeab1d
<?php
namespace
TYPO3\Election\Domain\Repository
;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use
TYPO3\CMS\Extbase\Persistence\Repository
;
/**
* Class ElectionCircularRepository
*/
class
ElectionCircularRepository
extends
Repository
{
}
Resources/Private/Language/locallang.xlf
View file @
fbbeab1d
...
...
@@ -88,8 +88,8 @@
<trans-unit
id=
"view.be.dashboard.nominee.list"
>
<source>
Nominees
</source>
</trans-unit>
<trans-unit
id=
"view.be.dashboard.circular.list"
>
<source>
Circular
</source>
<trans-unit
id=
"view.be.dashboard.
election_
circular.list"
>
<source>
Election
Circular
</source>
</trans-unit>
<!-- BE CONFIGURATION-->
...
...
@@ -278,7 +278,6 @@
<trans-unit
id=
"model.nominee.field.image"
>
<source>
Image
</source>
</trans-unit>
<trans-unit
id=
"model.nominee.field.url"
>
<source>
URL
</source>
</trans-unit>
...
...
@@ -291,6 +290,25 @@
<trans-unit
id=
"model.nominee.field.public"
>
<source>
Public
</source>
</trans-unit>
</trans-unit>
<!-- BE ELECTION CIRCULARS -->
<trans-unit
id=
"view.be.election_circular.list.welcome"
>
<source>
Election Circulars
</source>
</trans-unit>
<!-- MODEL ELECTION CIRCULARS -->
<trans-unit
id=
"model.election_circular.field.subject"
>
<source>
Subject
</source>
</trans-unit>
<trans-unit
id=
"model.election_circular.field.body"
>
<source>
Body
</source>
</trans-unit>
<trans-unit
id=
"model.election_circular.field.election"
>
<source>
Election
</source>
</trans-unit>
</body>
</file>
...
...
Resources/Private/Partials/Model/ElectionCircular/List.html
0 → 100644
View file @
fbbeab1d
{namespace core=TYPO3\CMS\Core\ViewHelpers}
<table
class=
"table"
>
<thead>
<tr>
<th>
<f:translate
key=
"model.election_circular.field.subject"
>
Subject
</f:translate>
</th>
<th>
<f:translate
key=
"model.election_circular.field.body"
>
Body
</f:translate>
</th>
<th>
<f:translate
key=
"model.election_circular.field.election"
>
Election
</f:translate>
</th>
<th>
<f:translate
key=
"view.be.anything.options"
>
Options
</f:translate>
</th>
</tr>
</thead>
<tbody>
<f:for
each=
"{electionCirculars}"
as=
"electionCircular"
>
<tr>
<td>
<f:link.action
action=
"edit"
controller=
"BeElectionCircular"
arguments=
"{electionCircular:electionCircular}"
>
{electionCircular.subject}
</f:link.action>
</td>
<td>
{electionCircular.body}
</td>
<td>
{electionCircular.election.title}
</td>
<td>
<div
class=
"btn-group"
>
<f:link.action
class=
"btn btn-default"
action=
"edit"
controller=
"BeElectionCircular"
arguments=
"{electionCircular:electionCircular}"
>
<core:icon
identifier=
"actions-edit-rename"
/>
</f:link.action>
<f:link.action
class=
"btn btn-default"
action=
"delete"
controller=
"BeElectionCircular"
arguments=
"{electionCircular:electionCircular}"
>
<core:icon
identifier=
"actions-edit-delete"
/>
</f:link.action>
</div>
</td>
</tr>
</f:for>
</tbody>
</table>
Resources/Private/Partials/View/Menu/GlobalOptions.html
View file @
fbbeab1d
...
...
@@ -12,23 +12,10 @@
<f:link.action
class=
"btn btn-default"
action=
"list"
controller=
"BeElector"
>
<f:translate
key=
"view.be.dashboard.electors.list"
>
Electors
</f:translate>
</f:link.action>
<f:link.action
class=
"btn btn-default"
action=
"list"
controller=
"BeElectionCircular"
>
<f:translate
key=
"view.be.dashboard.election_circular.list"
>
Election Circular
</f:translate>
</f:link.action>
</f:be.security.ifHasRole>
<f:be.security.ifHasRole
role=
"{configuration.electionManagerGroup}"
>
<f:then>
<f:link.action
class=
"btn btn-default"
action=
"list"
controller=
"BeCircular"
>
<f:translate
key=
"view.be.dashboard.circular.list"
>
Circular
</f:translate>
</f:link.action>
</f:then>
<f:else>
<f:be.security.ifHasRole
role=
"{configuration.electionManagerGroup}"
>
<f:link.action
class=
"btn btn-default"
action=
"list"
controller=
"BeCircular"
>
<f:translate
key=
"view.be.dashboard.circular.list"
>
Circular
</f:translate>
</f:link.action>
</f:be.security.ifHasRole>
</f:else>
</f:be.security.ifHasRole>
<f:be.security.ifHasRole
role=
"{configuration.administrationGroup}"
>
<f:link.action
class=
"btn btn-default"
action=
"edit"
controller=
"BeConfiguration"
>
<core:icon
identifier=
"actions-system-extension-configure"
/>
...
...
Resources/Private/Templates/BeElectionCircular/List.html
0 → 100644
View file @
fbbeab1d
<f:layout
name=
"Backend"
/>
<f:section
name=
"LeftToolBar"
>
<f:render
partial=
"View/Menu/ActionButtons/New"
/>
</f:section>
<f:section
name=
"RightToolBar"
>
<f:render
partial=
"View/Menu/GlobalOptions"
arguments=
"{configuration:configuration}"
/>
</f:section>
<f:section
name=
"Welcome"
>
<h1>
<f:translate
key=
"view.be.election_circular.list.welcome"
>
election circulars
</f:translate>
</h1>
</f:section>
<f:section
name=
"Main"
>
<f:render
partial=
"Model/ElectionCircular/List"
arguments=
"{electionCirculars:electionCirculars}"
/>
</f:section>
ext_tables.php
View file @
fbbeab1d
...
...
@@ -28,8 +28,8 @@ call_user_func(
\
TYPO3\Election\Controller\BeElectorateController
::
getActionsForModuleConfiguration
(),
\
TYPO3\Election\Controller\BeNomineeController
::
CONTROLLER_NAME
=>
\
TYPO3\Election\Controller\BeNomineeController
::
getActionsForModuleConfiguration
(),
\
TYPO3\Election\Controller\BeCircularController
::
CONTROLLER_NAME
=>
\
TYPO3\Election\Controller\BeCircularController
::
getActionsForModuleConfiguration
(),
\
TYPO3\Election\Controller\Be
Election
CircularController
::
CONTROLLER_NAME
=>
\
TYPO3\Election\Controller\Be
Election
CircularController
::
getActionsForModuleConfiguration
(),
),
array
(
'access'
=>
'user,group'
,
...
...
ext_tables.sql
View file @
fbbeab1d
...
...
@@ -97,21 +97,38 @@ CREATE TABLE tx_election_domain_model_electorate (
#
Table
structure
for
table
'tx_election_domain_model_nominee'
#
CREATE
TABLE
tx_election_domain_model_nominee
(
uid
INT
(
11
)
unsigned
NOT
NULL
auto_increment
,
pid
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
creation_date
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
creation_user
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
uid
INT
(
11
)
unsigned
NOT
NULL
auto_increment
,
pid
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
creation_date
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
creation_user
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
first_name
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
middle_name
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
last_name
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
gender
TINYINT
(
4
)
unsigned
DEFAULT
'0'
NOT
NULL
,
email
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
url
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
image
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
comment
text
NOT
NULL
,
public
TINYINT
(
4
)
unsigned
DEFAULT
'0'
NOT
NULL
,
elections
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
first_name
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
middle_name
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
last_name
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
gender
TINYINT
(
4
)
DEFAULT
'0'
NOT
NULL
,
email
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
url
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
image
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
comment
text
NOT
NULL
,
public
TINYINT
(
4
)
DEFAULT
'0'
NOT
NULL
,
elections
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
PRIMARY
KEY
(
uid
),
KEY
parent
(
pid
)
);
#
#
Table
structure
for
table
'tx_election_domain_model_electioncircular'
#
CREATE
TABLE
tx_election_domain_model_electioncircular
(
uid
INT
(
11
)
unsigned
NOT
NULL
auto_increment
,
pid
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
creation_date
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
creation_user
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
subject
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
body
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
election
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
PRIMARY
KEY
(
uid
),
KEY
parent
(
pid
)
...
...
@@ -121,10 +138,10 @@ CREATE TABLE tx_election_domain_model_nominee (
#
Table
structure
for
table
'tx_election_domain_model_electorate_elector_mm'
#
CREATE
TABLE
tx_election_domain_model_electorate_elector_mm
(
uid_local
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
uid_foreign
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
sorting
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
sorting_foreign
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
uid_local
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
uid_foreign
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
sorting
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
sorting_foreign
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
KEY
uid_local
(
uid_local
),
KEY
uid_foreign
(
uid_foreign
)
);
...
...
@@ -133,10 +150,10 @@ CREATE TABLE tx_election_domain_model_electorate_elector_mm (
#
Table
structure
for
table
'tx_election_domain_model_election_nominee_mm'
#
CREATE
TABLE
tx_election_domain_model_election_nominee_mm
(
uid_local
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
uid_foreign
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
sorting
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
sorting_foreign
INT
(
11
)
DEFAULT
'0'
NOT
NULL
,
uid_local
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
uid_foreign
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
sorting
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
sorting_foreign
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
KEY
uid_local
(
uid_local
),
KEY
uid_foreign
(
uid_foreign
)
);
ext_typoscript_setup.txt
View file @
fbbeab1d
...
...
@@ -128,4 +128,22 @@ config.tx_extbase.persistence.classes {
}
}
}
TYPO3\Election\Domain\Model\ElectionCircular < temp.abstractEntity
TYPO3\Election\Domain\Model\ElectionCircular {
mapping {
tableName = tx_election_domain_model_electioncircular
columns {
subject.mapOnProperty = subject
body.mapOnProperty = body
election {
mapOnProperty = election
config {
type = select
foreign_table = tx_election_domain_model_election
}
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment