Commit cd886cf3 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

[TASK] Changes to PSR-2

parent 3ee40b8c
......@@ -14,9 +14,11 @@
/**
* Class Tx_T3oMembership_Controller_MemberController
*
* @author Thomas Löffler <thomas.loeffler@typo3.org>
*/
class Tx_T3oMembership_Controller_MemberController extends Tx_Extbase_MVC_Controller_ActionController {
class Tx_T3oMembership_Controller_MemberController extends Tx_Extbase_MVC_Controller_ActionController
{
/**
* memberRepository
......@@ -38,7 +40,8 @@ class Tx_T3oMembership_Controller_MemberController extends Tx_Extbase_MVC_Contro
* @param Tx_T3oMembership_Domain_Repository_MemberRepository $memberRepository
* @return void
*/
public function injectMemberRepository(Tx_T3oMembership_Domain_Repository_MemberRepository $memberRepository) {
public function injectMemberRepository(Tx_T3oMembership_Domain_Repository_MemberRepository $memberRepository)
{
$this->memberRepository = $memberRepository;
}
......@@ -48,7 +51,8 @@ class Tx_T3oMembership_Controller_MemberController extends Tx_Extbase_MVC_Contro
* @param Tx_T3oMembership_Domain_Repository_MembershipRepository $membershipRepository
* @return void
*/
public function injectMembershipRepository(Tx_T3oMembership_Domain_Repository_MembershipRepository $membershipRepository) {
public function injectMembershipRepository(Tx_T3oMembership_Domain_Repository_MembershipRepository $membershipRepository)
{
$this->membershipRepository = $membershipRepository;
}
......@@ -57,7 +61,8 @@ class Tx_T3oMembership_Controller_MemberController extends Tx_Extbase_MVC_Contro
*
* @return void
*/
public function listAction() {
public function listAction()
{
$filterMembership = 0;
$filterString = '';
......@@ -66,7 +71,7 @@ class Tx_T3oMembership_Controller_MemberController extends Tx_Extbase_MVC_Contro
$this->view->assign('filter', $filterString);
}
if ($this->request->hasArgument('membership') && $this->request->getArgument('membership')) {
$filterMembership = (int) $this->request->getArgument('membership');
$filterMembership = (int)$this->request->getArgument('membership');
$this->view->assign('membership', $filterMembership);
}
......
......@@ -14,9 +14,11 @@
/**
* Class Tx_T3oMembership_Domain_Model_Member
*
* @author Thomas Löffler <thomas.loeffler@typo3.org>
*/
class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_AbstractEntity {
class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_AbstractEntity
{
/**
* Member name
......@@ -120,7 +122,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return string $name
*/
public function getName() {
public function getName()
{
return $this->name;
}
......@@ -130,7 +133,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param string $name
* @return void
*/
public function setName($name) {
public function setName($name)
{
$this->name = $name;
}
......@@ -154,14 +158,16 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
/**
* @return string
*/
public function getLastname() {
public function getLastname()
{
return $this->lastname;
}
/**
* @param string $lastname
*/
public function setLastname($lastname) {
public function setLastname($lastname)
{
$this->lastname = $lastname;
}
......@@ -170,7 +176,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return integer $externalId
*/
public function getExternalId() {
public function getExternalId()
{
return $this->externalId;
}
......@@ -180,7 +187,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param integer $externalId
* @return void
*/
public function setExternalId($externalId) {
public function setExternalId($externalId)
{
$this->externalId = $externalId;
}
......@@ -189,7 +197,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return DateTime $endDate
*/
public function getEndDate() {
public function getEndDate()
{
return $this->endDate;
}
......@@ -199,7 +208,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param DateTime $endDate
* @return void
*/
public function setEndDate($endDate) {
public function setEndDate($endDate)
{
$this->endDate = $endDate;
}
......@@ -208,7 +218,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return string $address
*/
public function getAddress() {
public function getAddress()
{
return $this->address;
}
......@@ -218,7 +229,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param string $address
* @return void
*/
public function setAddress($address) {
public function setAddress($address)
{
$this->address = $address;
}
......@@ -227,7 +239,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return string $zip
*/
public function getZip() {
public function getZip()
{
return $this->zip;
}
......@@ -237,7 +250,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param string $zip
* @return void
*/
public function setZip($zip) {
public function setZip($zip)
{
$this->zip = $zip;
}
......@@ -246,7 +260,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return string $city
*/
public function getCity() {
public function getCity()
{
return $this->city;
}
......@@ -256,7 +271,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param string $city
* @return void
*/
public function setCity($city) {
public function setCity($city)
{
$this->city = $city;
}
......@@ -265,7 +281,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return string $country
*/
public function getCountry() {
public function getCountry()
{
return $this->country;
}
......@@ -275,7 +292,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param string $country
* @return void
*/
public function setCountry($country) {
public function setCountry($country)
{
$this->country = $country;
}
......@@ -284,7 +302,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return string $email
*/
public function getEmail() {
public function getEmail()
{
return $this->email;
}
......@@ -294,7 +313,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param string $email
* @return void
*/
public function setEmail($email) {
public function setEmail($email)
{
$this->email = $email;
}
......@@ -303,7 +323,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return string $url
*/
public function getUrl() {
public function getUrl()
{
return $this->url;
}
......@@ -313,21 +334,24 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param string $url
* @return void
*/
public function setUrl($url) {
public function setUrl($url)
{
$this->url = $url;
}
/**
* @return string
*/
public function getInvoiceEmail() {
public function getInvoiceEmail()
{
return $this->invoiceEmail;
}
/**
* @param string $invoiceEmail
*/
public function setInvoiceEmail($invoiceEmail) {
public function setInvoiceEmail($invoiceEmail)
{
$this->invoiceEmail = $invoiceEmail;
}
......@@ -336,7 +360,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
*
* @return Tx_T3oMembership_Domain_Model_Membership $membership
*/
public function getMembership() {
public function getMembership()
{
return $this->membership;
}
......@@ -346,7 +371,8 @@ class Tx_T3oMembership_Domain_Model_Member extends Tx_Extbase_DomainObject_Abstr
* @param Tx_T3oMembership_Domain_Model_Membership $membership
* @return void
*/
public function setMembership(Tx_T3oMembership_Domain_Model_Membership $membership) {
public function setMembership(Tx_T3oMembership_Domain_Model_Membership $membership)
{
$this->membership = $membership;
}
......
......@@ -14,9 +14,11 @@
/**
* Class Tx_T3oMembership_Domain_Model_Membership
*
* @author Thomas Löffler <thomas.loeffler@typo3.org>
*/
class Tx_T3oMembership_Domain_Model_Membership extends Tx_Extbase_DomainObject_AbstractValueObject {
class Tx_T3oMembership_Domain_Model_Membership extends Tx_Extbase_DomainObject_AbstractValueObject
{
/**
* name
......@@ -37,7 +39,8 @@ class Tx_T3oMembership_Domain_Model_Membership extends Tx_Extbase_DomainObject_A
/**
* @return string
*/
public function __toString() {
public function __toString()
{
return $this->name;
}
......@@ -46,7 +49,8 @@ class Tx_T3oMembership_Domain_Model_Membership extends Tx_Extbase_DomainObject_A
*
* @return string $name
*/
public function getName() {
public function getName()
{
return $this->name;
}
......@@ -56,7 +60,8 @@ class Tx_T3oMembership_Domain_Model_Membership extends Tx_Extbase_DomainObject_A
* @param string $name
* @return void
*/
public function setName($name) {
public function setName($name)
{
$this->name = $name;
}
......@@ -65,7 +70,8 @@ class Tx_T3oMembership_Domain_Model_Membership extends Tx_Extbase_DomainObject_A
*
* @return string $logo
*/
public function getLogo() {
public function getLogo()
{
return $this->logo;
}
......@@ -75,7 +81,8 @@ class Tx_T3oMembership_Domain_Model_Membership extends Tx_Extbase_DomainObject_A
* @param string $logo
* @return void
*/
public function setLogo($logo) {
public function setLogo($logo)
{
$this->logo = $logo;
}
......
......@@ -14,9 +14,11 @@
/**
* Class Tx_T3oMembership_Domain_Repository_MemberRepository
*
* @author Thomas Löffler <thomas.loeffler@typo3.org>
*/
class Tx_T3oMembership_Domain_Repository_MemberRepository extends Tx_Extbase_Persistence_Repository {
class Tx_T3oMembership_Domain_Repository_MemberRepository extends Tx_Extbase_Persistence_Repository
{
/**
* @var array
......@@ -31,11 +33,13 @@ class Tx_T3oMembership_Domain_Repository_MemberRepository extends Tx_Extbase_Per
* @param integer $filterMembership
* @return Tx_Extbase_Persistence_QueryResultInterface
*/
public function findByStringAndMembership($filterString, $filterMembership) {
public function findByStringAndMembership($filterString, $filterMembership)
{
$query = $this->createQuery();
$constraints = array();
if ($filterString) {
$filterString = $this->getDatabaseConnection()->escapeStrForLike($filterString, 'tx_t3omembership_domain_model_member');
$filterString = $this->getDatabaseConnection()
->escapeStrForLike($filterString, 'tx_t3omembership_domain_model_member');
$constraints[] = $query->like('name', '%' . $filterString . '%');
}
if ($filterMembership) {
......@@ -48,7 +52,8 @@ class Tx_T3oMembership_Domain_Repository_MemberRepository extends Tx_Extbase_Per
/**
* @return t3lib_DB
*/
protected function getDatabaseConnection() {
protected function getDatabaseConnection()
{
return $GLOBALS['TYPO3_DB'];
}
}
\ No newline at end of file
......@@ -14,9 +14,11 @@
/**
* Class Tx_T3oMembership_Domain_Repository_MembershipRepository
*
* @author Thomas Löffler <thomas.loeffler@typo3.org>
*/
class Tx_T3oMembership_Domain_Repository_MembershipRepository extends Tx_Extbase_Persistence_Repository {
class Tx_T3oMembership_Domain_Repository_MembershipRepository extends Tx_Extbase_Persistence_Repository
{
/**
* @var array
......
......@@ -14,19 +14,23 @@
/**
* Class Tx_T3oMembership_Task_ImportMembersAdditionalFields
*
* @author Thomas Löffler <thomas.loeffler@typo3.org>
*/
class Tx_T3oMembership_Task_ImportMembers_AdditionalFieldProvider implements tx_scheduler_AdditionalFieldProvider {
class Tx_T3oMembership_Task_ImportMembers_AdditionalFieldProvider implements tx_scheduler_AdditionalFieldProvider
{
/**
* Gets additional fields to render in the form to add/edit a task
*
* @param array $taskInfo
* @param tx_scheduler_Task $task
* @param tx_scheduler_Module $schedulerModule
* @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '',
* 'label' => '', 'cshKey' => '', 'cshLabel' => ''))
*/
public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $schedulerModule) {
public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $schedulerModule)
{
$additionalFields = array();
// adds field for setting file path for CSV file to import
$importFile = '';
......@@ -51,23 +55,27 @@ class Tx_T3oMembership_Task_ImportMembers_AdditionalFieldProvider implements tx_
/**
* Validates the additional fields' values
*
* @param array $submittedData
* @param tx_scheduler_Module $schedulerModule
* @return boolean
*/
public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule) {
public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
{
// only validation for importFile would be a file_exists, but it will be validated in the task itself
return TRUE;
return true;
}
/**
* Takes care of saving the additional fields' values in the task's object
*
* @param array $submittedData
* @param tx_scheduler_Task $task
* @param tx_scheduler_Task|Tx_T3oMembership_Task_ImportMembersTask $task
* @return void
*/
public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) {
public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task)
{
$task->setImportFile($submittedData['importFile']);
$task->setMembershipStoragePid($submittedData['storagePid']);
}
......
<?php
/**
* This file is part of the TYPO3 CMS project.
*
......@@ -11,8 +12,8 @@
*
* The TYPO3 project - inspiring people to share!
*/
class Tx_T3oMembership_Task_ImportMembersTask extends tx_scheduler_Task {
class Tx_T3oMembership_Task_ImportMembersTask extends tx_scheduler_Task
{
/**
* @var string
......@@ -32,7 +33,8 @@ class Tx_T3oMembership_Task_ImportMembersTask extends tx_scheduler_Task {
/**
* @return boolean
*/
public function execute() {
public function execute()
{
t3lib_div::devLog('[tx_scheduler_ImportMember]: execute', 't3o_membership', 0);
$membershipRecords = $this->getDatabaseConnection()->exec_SELECTgetRows(
......@@ -49,7 +51,8 @@ class Tx_T3oMembership_Task_ImportMembersTask extends tx_scheduler_Task {
$importFile = t3lib_div::getFileAbsFileName($this->getImportFile());
if (!file_exists($importFile)) {
t3lib_div::devLog('[tx_scheduler_ImportMember]: no importfile - given value: ' . $importFile, 't3o_membership', 0);
return FALSE;
return false;
} else {
$this->getDatabaseConnection()->exec_TRUNCATEquery('tx_t3omembership_domain_model_member');
$fileData = file($importFile);
......@@ -87,14 +90,15 @@ class Tx_T3oMembership_Task_ImportMembersTask extends tx_scheduler_Task {
}
}
return TRUE;
return true;
}
/**
* @param string $membershipName
* @return integer
*/
protected function getMembershipUid($membershipName) {
protected function getMembershipUid($membershipName)
{
$membershipName = trim(str_replace('Membership', '', $membershipName));
return $this->memberships[$membershipName];
......@@ -102,40 +106,49 @@ class Tx_T3oMembership_Task_ImportMembersTask extends tx_scheduler_Task {
/**
* Gets importFile
*
* @return string
*/
public function getImportFile() {
public function getImportFile()
{
return $this->importFile;
}
/**
* Sets importFile
*
* @param string $importFile
*/
public function setImportFile($importFile) {
public function setImportFile($importFile)
{
$this->importFile = $importFile;
}
/**
* Gets membershipStoragePid
*
* @return int
*/
public function getMembershipStoragePid() {
public function getMembershipStoragePid()
{
return $this->membershipStoragePid;
}
/**
* Sets membershipStoragePid
*
* @param int $membershipStoragePid
*/
public function setMembershipStoragePid($membershipStoragePid) {
public function setMembershipStoragePid($membershipStoragePid)
{
$this->membershipStoragePid = $membershipStoragePid;
}
/**
* @return t3lib_DB
*/
protected function getDatabaseConnection() {
protected function getDatabaseConnection()
{
return $GLOBALS['TYPO3_DB'];
}
}
<?php
if (!defined ('TYPO3_MODE')) {
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
......
<?php
if (!defined ('TYPO3_MODE')) {
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
......
......@@ -29,12 +29,9 @@ $EM_CONF[$_EXTKEY] = array(
'lockType' => '',
'version' => '1.1.1',
'constraints' => array(
'depends' => array(
),
'conflicts' => array(
),
'suggests' => array(
),
'depends' => array(),
'conflicts' => array(),
'suggests' => array(),
),
);
......
......@@ -11,7 +11,8 @@ Tx_Extbase_Utility_Extension::registerPlugin(
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'TYPO3 Membership');
t3lib_extMgm::addLLrefForTCAdescr('tx_t3omembership_domain_model_member', 'EXT:t3o_membership/Resources/Private/Language/locallang_csh_tx_t3omembership_domain_model_member.xml');
t3lib_extMgm::addLLrefForTCAdescr('tx_t3omembership_domain_model_member',
'EXT:t3o_membership/Resources/Private/Language/locallang_csh_tx_t3omembership_domain_model_member.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_t3omembership_domain_model_member');
$TCA['tx_t3omembership_domain_model_member'] = array(
'ctrl' => array(
......@@ -20,7 +21,7 @@ $TCA['tx_t3omembership_domain_model_member'] = array(
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'dividers2tabs' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
......@@ -38,7 +39,8 @@ $TCA['tx_t3omembership_domain_model_member'] = array(
),
);
t3lib_extMgm::addLLrefForTCAdescr('tx_t3omembership_domain_model_membership', 'EXT:t3o_membership/Resources/Private/Language/locallang_csh_tx_t3omembership_domain_model_membership.xml');
t3lib_extMgm::addLLrefForTCAdescr('tx_t3omembership_domain_model_membership',
'EXT:t3o_membership/Resources/Private/Language/locallang_csh_tx_t3omembership_domain_model_membership.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_t3omembership_domain_model_membership');
$TCA['tx_t3omembership_domain_model_membership'] = array(
'ctrl' => array(
......@@ -47,7 +49,7 @@ $TCA['tx_t3omembership_domain_model_membership'] = array(
'tstamp' => 'tstamp',
'crdate' => 'crdate',