Commit dd7d0b04 authored by Dominik Dörr's avatar Dominik Dörr
Browse files

Merge branch '205-create-karma-extension-shell' into 'develop'

Resolve "Create karma extension shell"

Closes #205

See merge request !105
parents fcba249d 63ccb689
Pipeline #5648 passed with stages
in 4 minutes and 55 seconds
<?php
namespace T3o\Karma\Domain\Model;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class Campaign extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* The title of the campaign
*
* @var string
*/
protected $title;
/**
* The percentage with which to change the entry value (no change = 100)
*
* @var int
*/
protected $percent;
/**
* The value to add or subtract from the entry value
*
* @var int
*/
protected $value;
/**
* Returns the title of the campaign
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set the title of the campaign
*
* @param string $title
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* Return the percentage amount to change the entry value
*
* No change = 100
*
* @return int
*/
public function getPercent()
{
return $this->percent;
}
/**
* Set the percentage value with which to change an entry
*
* No change = 100
*
* @param int $percent
*/
public function setPercent(int $percent)
{
$this->percent = $percent;
}
/**
* Returns the value to add or subtract from the entry value
*
* @return int
*/
public function getValue()
{
return $this->value;
}
/**
* Set the value to add or subtract from the entry value
*
* @param int $value
*/
public function setValue(int $value)
{
$this->value = $value;
}
}
<?php
namespace T3o\Karma\Domain\Model;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class KarmaSource extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* The title of the karma source
*
* @var string
*/
protected $title;
/**
* The alphanumeric code of the karma source
*
* Used for API calls etc.
*
* @var string
*/
protected $code;
/**
* Get the title of the karma source
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set the title of the karma source
*
* @param string $title
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* Get the karma source code
*
* Alphanumeric code for use in APIs etc.
*
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* Set the karma code
*
* Set the alphanumeric code for use in APIs etc.
*
* @param string $code
*/
public function setCode(string $code)
{
$this->code = $code;
}
}
<?php
namespace T3o\Karma\Domain\Model;
use In2code\Userprofile\Domain\Model\FrontendUser;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* The date when the entry expired, if set.
*
* Set when the entry expires.
*
* @var int
*/
protected $expired;
/**
* The unchangeable ledgerentry entry value
*
* @var int
*/
protected $immutableValue;
/**
* The changeable ledgerentry entry value.
*
* Can be depreciated over time or set to zero.
*
* @var int
*/
protected $mutableValue;
/**
* The entry karmaSource
*
* @var KarmaSource
*/
protected $karmaSource;
/**
* Set to the related campaign if the entry is generated through a campaign
*
* @var Campaign
*/
protected $campaign;
/**
* The user the entry is valid for
*
* @var FrontendUser
*/
protected $user;
/**
* Return the expired timestamp or zero if not yet expired
*
* @return int
*/
public function getExpired()
{
return $this->expired;
}
/**
* Returns true if the entry has expired
*
* @return bool
*/
public function isExpired()
{
return (bool)$this->getExpired();
}
/**
* Set the timestamp for the entry's expiry, or zero if the entry has not expired
*
* @param int $expired
*/
public function setExpired(int $expired)
{
$this->expired = $expired;
}
/**
* Returns the unchangeable entry value
*
* @return int
*/
public function getImmutableValue()
{
return $this->immutableValue;
}
/**
* Set the unchangeable entry value.
*
* Should only be done once.
*
* @param int $immutableValue
*/
public function setImmutableValue(int $immutableValue)
{
$this->immutableValue = $immutableValue;
}
/**
* Returns the changeable entry value
*
* @return int
*/
public function getMutableValue()
{
return $this->mutableValue;
}
/**
* Set the changeable entry value
*
* @param int $mutableValue
*/
public function setMutableValue(int $mutableValue)
{
$this->mutableValue = $mutableValue;
}
/**
* Get the entry karma source
*
* @return KarmaSource
*/
public function getKarmaSource()
{
return $this->karmaSource;
}
/**
* Set the entry karma source
*
* @param KarmaSource $karmaSource
*/
public function setKarmaSource(KarmaSource $karmaSource)
{
$this->karmaSource = $karmaSource;
}
/**
* Get the entry campaign that generated this entry, or null if no campaign
*
* @return Campaign
*/
public function getCampaign()
{
return $this->campaign;
}
/**
* Set the campaign that generated this entry
*
* @param Campaign $campaign
*/
public function setCampaign(Campaign $campaign)
{
$this->campaign = $campaign;
}
/**
* Get the user this entry is for
*
* @return FrontendUser
*/
public function getUser()
{
return $this->user;
}
/**
* Set the user the entry is for
*
* @param FrontendUser $user
*/
public function setUser(FrontendUser $user)
{
$this->user = $user;
}
}
<?php
namespace T3o\Karma\Domain\Repository;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class CampaignRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}
<?php
namespace T3o\Karma\Domain\Repository;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class KarmaSourceRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}
<?php
namespace T3o\Karma\Domain\Repository;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class LedgerEntryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}
<?php
declare(strict_types = 1);
/*
* Table configuration fe_users
*/
$feUsersColumns = [
'tx_karma_immutable_value_cache' => [
'exclude' => 0,
'config' => [
'type' => 'passthrough',
],
],
'tx_karma_mutable_value_cache' => [
'exclude' => 0,
'config' => [
'type' => 'passthrough',
],
],
'tx_karma_cache_timestamp' => [
'exclude' => 0,
'config' => [
'type' => 'passthrough',
],
],
];
$fields = 'tx_karma_immutable_value_cache,tx_karma_mutable_value_cache,tx_karma_cache_timestamp,';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'fe_users',
'tx_karma_immutable_value_cache,tx_karma_mutable_value_cache,tx_karma_cache_timestamp,',
'',
''
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $feUsersColumns);
<?php
defined('TYPO3_MODE') or die();
$ll = 'LLL:EXT:karma/Resources/Private/Language/locallang_db.xlf:';
$tx_karma_domain_model_campaign = [
'ctrl' => [
'title' => $ll . 'tx_karma_domain_model_campaign',
'label' => 'title',
'hideAtCopy' => true,
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'default_sortby' => 'ORDER BY title',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'iconfile' => 'EXT:karma/Resources/Public/Icons/tx_karma_domain_model_campaign.svg',
],
'interface' => [
'showRecordFieldList' => 'pid,hidden,title,code'
],
'columns' => [
'hidden' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
'default' => 0
],
],
'pid' => [
'label' => 'pid',
'config' => [
'type' => 'passthrough'
]
],
'crdate' => [
'label' => 'crdate',
'config' => [
'type' => 'passthrough',
]
],
'tstamp' => [
'label' => 'tstamp',
'config' => [
'type' => 'passthrough',
]
],
'starttime' => [