Commit c3560dbb authored by NITSAN's avatar NITSAN

[Code Improvement] Removed T3 prefix from all appropriate places

parent 5702cc49
Pipeline #6895 passed with stages
in 2 minutes and 43 seconds
<?php
namespace T3o\T3oJobs\Controller;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/***
*
* This file is part of the "Typo3 Jobs" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019
*
***/
/**
* T3jobsController
*/
class T3jobsController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* t3jobsRepository
*
* @var \T3o\T3oJobs\Domain\Repository\T3jobsRepository
* @inject
*/
protected $t3jobsRepository = null;
/**
* t3jobsskillsRepository
*
* @var \T3o\T3oJobs\Domain\Repository\T3jobsskillsRepository
* @inject
*/
protected $t3jobsskillsRepository = null;
/**
* t3teamsRepository
*
* @var \T3o\T3oJobs\Domain\Repository\T3teamsRepository
* @inject
*/
protected $t3teamsRepository = null;
/**
* t3jobsapplicants
*
* @var \T3o\T3oJobs\Domain\Repository\T3jobsapplicants
* @inject
*/
protected $t3jobsapplicants = null;
/**
* User Repository
*
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
* @inject
*/
protected $userRepository;
/**
* action initialize
*/
public function initializeAction()
{
parent::initializeAction();
$data = $this->configurationManager->getContentObject();
$this->contentElementData = $data->data;
}
/**
* action list
*/
public function listAction()
{
if ($_REQUEST['tx_t3ojobs_jobs']['filterJob']) {
$filterJobdata = $this->request->getArgument('filterJob');
$this->view->assign('filterJob', $filterJobdata);
}
if ($filterJobdata['t3teams'] != 0 || $filterJobdata['t3jobskills'] != '' || $filterJobdata['search'] != '') {
$t3jobs = $this->t3jobsRepository->filterjob($filterJobdata);
} else {
$t3jobs = $this->t3jobsRepository->findAllJobs();
}
$t3jobskills = $this->t3jobsskillsRepository->findAll();
$t3teams = $this->t3teamsRepository->findAll();
$assignArray = [
't3jobs' => $t3jobs,
't3jobskills' => $t3jobskills,
't3teams' => $t3teams,
'data' => $this->contentElementData,
];
$this->view->assignMultiple($assignArray);
}
/**
* action show
*
* @param \T3o\T3oJobs\Domain\Model\T3jobs $t3jobs
*/
public function showAction(\T3o\T3oJobs\Domain\Model\T3jobs $t3jobs)
{
$this->view->assign('t3jobs', $t3jobs);
$feuserData = $this->userRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']);
if ($feuserData) {
if ($feuserData->getName()) {
$name = $feuserData->getName();
} else {
$feusername = $feuserData->getUsername();
}
if ($feuserData->getEmail()) {
$feuseremail = $feuserData->getEmail();
}
$assignArray = [
'feusername' => $feusername,
'feuseremail' => $feuseremail,
];
$this->view->assignMultiple($assignArray);
}
$applynow = $_REQUEST['applynow'];
$this->view->assign('applynow', $applynow);
}
/**
* action createrequest
*/
public function createrequestAction()
{
$newRequest = new \T3o\T3oJobs\Domain\Model\T3jobsapplicants;
if ($_REQUEST['tx_t3ojobs_jobs']['jobapplicants']) {
$data = $_REQUEST['tx_t3ojobs_jobs']['jobapplicants'];
$newRequest->setPid($data['jobpid']);
$newRequest->setJobid($data['jobid']);
$newRequest->setJobteam($data['jobteam']);
$newRequest->setJobtitle($data['jobtitle']);
$newRequest->setJobposition($data['jobposition']);
$newRequest->setName($data['jobname']);
$newRequest->setEmail($data['jobemail']);
$newRequest->setSlackId($data['jobslackId']);
$newRequest->setMessage($data['jobmessage']);
if ($data['jobteam']) {
$t3team = $this->t3teamsRepository->findByUid($data['jobteam']);
$mails = $t3team->getReceiversEmails();
$adminname = LocalizationUtility::translate('emailnameAdmin', 'T3oJobs');
$adminmailsubject = LocalizationUtility::translate('adminmailsubject', 'T3oJobs');
if ($mails != '') {
$emails = explode(',', $mails);
foreach ($emails as $mail) {
$res = $this->sendTemplateEmail([$mail => $adminname], [$data['jobemail'] => $data['jobname']], $adminmailsubject, 'adminMailTemplate', $data);
}
}
}
$this->t3jobsapplicants->add($newRequest);
}
}
/**
* @param array $recipient recipient of the email in the format array('recipient@domain.tld' => 'Recipient Name')
* @param array $sender sender of the email in the format array('sender@domain.tld' => 'Sender Name')
* @param string $subject subject of the email
* @param string $templateName template name (UpperCamelCase)
* @param array $variables variables to be passed to the Fluid view
*/
protected function sendTemplateEmail(array $recipient, array $sender, $subject, $templateName, array $variables = [])
{
/** @var \TYPO3\CMS\Fluid\View\StandaloneView $emailView */
$emailView = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
/*For use of Localize value */
$extensionName = $this->request->getControllerExtensionName();
$emailView->getRequest()->setControllerExtensionName($extensionName);
/*For use of Localize value */
$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPaths']['0']);
$templatePathAndFilename = $templateRootPath . 'Email/' . $templateName . '.html';
$emailView->setTemplatePathAndFilename($templatePathAndFilename);
$emailView->assignMultiple($variables);
$emailBody = $emailView->render();
/** @var $message \TYPO3\CMS\Core\Mail\MailMessage */
$message = $this->objectManager->get('TYPO3\\CMS\\Core\\Mail\\MailMessage');
/*Mail to Admin*/
$message->setTo($recipient)->setFrom($sender)->setSubject($subject);
// HTML Email
$message->setBody($emailBody, 'text/html');
// $status = 0;
$message->send();
$status = $message->isSent();
return $status;
}
}
<?php
namespace T3o\T3oJobs\Domain\Model;
/***
*
* This file is part of the "Typo3 Jobs" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019
*
***/
/**
* T3jobs
*/
class T3jobs extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* position
*
* @var string
* @validate NotEmpty
*/
protected $position = '';
/**
* title
*
* @var string
* @validate NotEmpty
*/
protected $title = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* banner
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @cascade remove
*/
protected $banner = null;
/**
* noOfOpeningJobs
*
* @var int
*/
protected $noOfOpeningJobs = 0;
/**
* publishBy
*
* @var string
*/
protected $publishBy = '';
/**
* publishBySlackid
*
* @var string
*/
protected $publishBySlackid = '';
/**
* experiance
*
* @var string
*/
protected $experiance = '';
/**
* status
*
* @var string
*/
protected $status = '';
/**
* t3jobsskills
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3oJobs\Domain\Model\T3jobsskills>
*/
protected $t3jobsskills = null;
/**
* t3teams
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3oJobs\Domain\Model\T3teams>
*/
protected $t3teams = null;
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*/
protected function initStorageObjects()
{
$this->banner = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->t3jobsskills = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->t3teams = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Returns the position
*
* @return string $position
*/
public function getPosition()
{
return $this->position;
}
/**
* Sets the position
*
* @param string $position
*/
public function setPosition($position)
{
$this->position = $position;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription()
{
return $this->description;
}
/**
* Sets the description
*
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* Adds a FileReference
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $banner
*/
public function addBanner(\TYPO3\CMS\Extbase\Domain\Model\FileReference $banner)
{
$this->banner->attach($banner);
}
/**
* Removes a FileReference
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $bannerToRemove The FileReference to be removed
*/
public function removeBanner(\TYPO3\CMS\Extbase\Domain\Model\FileReference $bannerToRemove)
{
$this->banner->detach($bannerToRemove);
}
/**
* Returns the banner
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $banner
*/
public function getBanner()
{
return $this->banner;
}
/**
* Sets the banner
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $banner
*/
public function setBanner(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $banner)
{
$this->banner = $banner;
}
/**
* Returns the noOfOpeningJobs
*
* @return int $noOfOpeningJobs
*/
public function getNoOfOpeningJobs()
{
return $this->noOfOpeningJobs;
}
/**
* Sets the noOfOpeningJobs
*
* @param int $noOfOpeningJobs
*/
public function setNoOfOpeningJobs($noOfOpeningJobs)
{
$this->noOfOpeningJobs = $noOfOpeningJobs;
}
/**
* Returns the publishBy
*
* @return string $publishBy
*/
public function getPublishBy()
{
return $this->publishBy;
}
/**
* Sets the publishBy
*
* @param string $publishBy
*/
public function setPublishBy($publishBy)
{
$this->publishBy = $publishBy;
}
/**
* Returns the publishBySlackid
*
* @return string $publishBySlackid
*/
public function getPublishBySlackid()
{
return $this->publishBySlackid;
}
/**
* Sets the publishBySlackid
*
* @param string $publishBySlackid
*/
public function setPublishBySlackid($publishBySlackid)
{
$this->publishBySlackid = $publishBySlackid;
}
/**
* Returns the experiance
*
* @return string $experiance
*/
public function getExperiance()
{
return $this->experiance;
}
/**
* Sets the experiance
*
* @param string $experiance
*/
public function setExperiance($experiance)
{
$this->experiance = $experiance;
}
/**
* Returns the status
*
* @return string $status
*/
public function getStatus()
{
return $this->status;
}
/**
* Sets the status
*
* @param string $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* Adds a T3jobsskills
*
* @param \T3o\T3oJobs\Domain\Model\T3jobsskills $t3jobsskill
*/
public function addT3jobsskill(\T3o\T3oJobs\Domain\Model\T3jobsskills $t3jobsskill)
{
$this->t3jobsskills->attach($t3jobsskill);
}
/**
* Removes a T3jobsskills
*
* @param \T3o\T3oJobs\Domain\Model\T3jobsskills $t3jobsskillToRemove The T3jobsskills to be removed
*/
public function removeT3jobsskill(\T3o\T3oJobs\Domain\Model\T3jobsskills $t3jobsskillToRemove)
{
$this->t3jobsskills->detach($t3jobsskillToRemove);
}
/**
* Returns the t3jobsskills
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3oJobs\Domain\Model\T3jobsskills> $t3jobsskills
*/
public function getT3jobsskills()
{
return $this->t3jobsskills;
}
/**
* Sets the t3jobsskills
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3oJobs\Domain\Model\T3jobsskills> $t3jobsskills
*/
public function setT3jobsskills(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $t3jobsskills)
{
$this->t3jobsskills = $t3jobsskills;
}
/**
* Adds a T3teams
*
* @param \T3o\T3oJobs\Domain\Model\T3teams $t3team
*/
public function addT3team(\T3o\T3oJobs\Domain\Model\T3teams $t3team)
{
$this->t3teams->attach($t3team);
}
/**
* Removes a T3teams
*
* @param \T3o\T3oJobs\Domain\Model\T3teams $t3teamToRemove The T3teams to be removed
*/
public function removeT3team(\T3o\T3oJobs\Domain\Model\T3teams $t3teamToRemove)
{
$this->t3teams->detach($t3teamToRemove);
}
/**
* Returns the t3teams
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3oJobs\Domain\Model\T3teams> $t3teams
*/
public function getT3teams()
{
return $this->t3teams;
}
/**
* Sets the t3teams
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3oJobs\Domain\Model\T3teams> $t3teams
*/
public function setT3teams(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $t3teams)
{
$this->t3teams = $t3teams;
}
}
<?php
namespace T3o\T3oJobs\Domain\Model;
/***
*
* This file is part of the "Typo3 Jobs" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019
*
***/
/**
* T3jobsapplicants
*/
class T3jobsapplicants extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* jobid
*
* @var string
*/
protected $jobid = '';
/**
* jobteam
*
* @var string
*/
protected $jobteam = '';
/**
* jobtitle
*
* @var string
*/
protected $jobtitle = '';
/**
* jobposition
*
* @var string
*/
protected $jobposition = '';
/**
* name
*
* @var string
*/
protected $name = '';
/**
* email
*
* @var string
*/
protected $email = '';
/**
* slackId
*
* @var string
*/
protected $slackId = '';
/**
* message
*
* @var string
*/
protected $message = '';
/**
* Returns the jobid
*
* @return string $jobid
*/
public function getJobid()
{
return $this->jobid;
}
/**
* Sets the jobid
*
* @param string $jobid
*/
public function setJobid($jobid)
{
$this->jobid = $jobid;
}
/**
* Returns the jobteam
*
* @return string $jobteam
*/
public function getJobteam()
{
return $this->jobteam;
}
/**
* Sets the jobteam
*
* @param string $jobteam
*/
public function setJobteam($jobteam)
{
$this->jobteam = $jobteam;
}
/**
* Returns the jobtitle
*
* @return string $jobtitle
*/
public function getJobtitle()
{
return $this->jobtitle;
}