-
-
Save anonymous/b45f80ba85ba2cf3d6ce to your computer and use it in GitHub Desktop.
the edit form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Somea\Translation\Domain\Repository; | |
/* * | |
* This script belongs to the FLOW3 package "Somea.Translation". * | |
* * | |
* */ | |
use TYPO3\FLOW3\Annotations as FLOW3; | |
/** | |
* A repository for TranslationTargets | |
* | |
* @FLOW3\Scope("singleton") | |
*/ | |
class TranslationTargetRepository extends \TYPO3\FLOW3\Persistence\Repository { | |
/** | |
* Finds target by the specified unit and language | |
* | |
* @param \Somea\Translation\Domain\Model\TranslationUnit $unitId | |
* @param \Somea\Translation\Domain\Model\TranslationLanguage $language | |
* @return \TYPO3\FLOW3\Persistence\QueryResultInterface The target | |
*/ | |
public function findTargetByUnitAndLanguages(\Somea\Translation\Domain\Model\TranslationUnit $unitId, \Somea\Translation\Domain\Model\TranslationLanguage $language){ | |
$query = $this->createQuery(); | |
$result= $query->matching($query->logicalAnd($query->equals('translationUnit', $unitId), $query->equals('translationLanguage', $language)))->execute(); | |
return $result; | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* edit action | |
* @param \Somea\Translation\Domain\Model\TranslationUnit $unit An Unit to edit | |
* @param \Somea\Translation\Domain\Model\TranslationPackage $package | |
* @param \Somea\Translation\Domain\Model\TranslationLanguage $language | |
* @return void | |
*/ | |
public function editAction(TranslationUnit $unit, TranslationPackage $package, TranslationLanguage $language) { | |
$target= $this->translationTargetRepository->findTargetByUnitAndLanguages($unit, $language); | |
$this->view->assign('title','Edit Translation Unit'); | |
$this->view->assign('packages', $package); | |
$this->view->assign('languages', $language); | |
$this->view->assign('unit', $unit); | |
$this->view->assign('target', $target); | |
} | |
/** | |
* Set property mapper configuration for target creation | |
* @return void | |
*/ | |
public function initializeUpdateAction(){ | |
$this->arguments['target']->getPropertyMappingConfiguration()->allowCreationForSubProperty('translationUnit'); | |
$this->arguments['target']->getPropertyMappingConfiguration()->allowModificationForSubProperty('translationUnit'); | |
} | |
/** | |
* update action | |
* @param \Somea\Translation\Domain\Model\TranslationTarget $target A new unit to add | |
* @param \Somea\Translation\Domain\Model\TranslationPackage $package A new Package to add | |
* @param \Somea\Translation\Domain\Model\TranslationLanguage $language A new Language to add | |
* @return void | |
*/ | |
public function updateAction(TranslationTarget $target, TranslationPackage $package, TranslationLanguage $language) { | |
$this->translationTargetRepository->update($target); | |
$this->redirect('index','TranslationUnit','Somea.Translation',array('language' => $language, 'package' => $package)); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<f:layout name="Default" /> | |
<f:section name="mainbox"> | |
<h2 class="title">{title}</h2> | |
<f:flashMessages class="flashmessages"/> | |
<p id="packageName">Language: {languages.name}</p><br /> | |
<label for="package" id="packageName">Package Name: {packages.name}</label><br /><br /> | |
<f:form method="post" action="update" controller="TranslationUnit" name="target" object="{target}" enctype="multipart/form-data"> | |
<f:form.hidden property="translationUnit.translationPackage" id="translationPackage" name="package" value="{packages}" /> | |
<f:form.hidden id="package" name="package" value="{packages}" /> | |
<f:form.hidden id="translationLanguage" property="translationLanguage" value="{languages}" /> | |
<f:form.hidden id="language" name="language" value="{languages}" /> | |
<label for="key">Translation Unit Key</label><br /> | |
<f:form.textbox property="translationUnit.translationKey" id="translationKey" value="{unit.translationKey}" /><br /><br /> | |
<label for="source">Translation Unit Source</label><br /> | |
<f:form.textbox property="translationUnit.translationSource" id="translationSource" value="{unit.translationSource}" /><br /><br /> | |
<label for="target">Translation Unit Target</label><br /> | |
<f:form.textbox property="translationTarget" id="translationTarget" value="{target.translationTarget}"/><br /><br /> | |
<label for="approval">Translation Unit Approval</label><br /> | |
<f:form.select property="translationApproval" id="translationApproval" options="{no: 'no', yes: 'yes'}" /><br /><br /> | |
<label for="comment">Translation Unit Comments</label><br /> | |
<f:form.textbox property="comment" id="comment" /><br /><br /> | |
<div style="margin-top: 10px;"><f:form.submit value="Submit post"/></div> | |
</f:form> | |
<div class="backbutton" style="margin-top: 30px;"><a href="javascript:history.go(-1)">Back To Previous Page</a></div> | |
</f:section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Somea\Translation\Domain\Model; | |
/* * | |
* This script belongs to the FLOW3 package "Somea.Translation". * | |
* * | |
* */ | |
use TYPO3\FLOW3\Annotations as FLOW3; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* A Translation target | |
* | |
* @FLOW3\Scope("prototype") | |
* @FLOW3\Entity | |
*/ | |
class TranslationTarget { | |
/** | |
* The translation target | |
* @var string | |
*/ | |
protected $translationTarget; | |
/** | |
* The translation approval | |
* @var string | |
*/ | |
protected $translationApproval; | |
/** | |
* The translation comment | |
* @var string | |
*/ | |
protected $comment; | |
/** | |
* The translationlanguage | |
* @var \Somea\Translation\Domain\Model\TranslationLanguage | |
* @ORM\ManyToOne(targetEntity="\Somea\Translation\Domain\Model\TranslationLanguage", inversedBy="translationTarget") | |
*/ | |
protected $translationLanguage; | |
/** | |
* The translationunit | |
* @var \Somea\Translation\Domain\Model\TranslationUnit | |
* @ORM\ManyToOne(targetEntity="\Somea\Translation\Domain\Model\TranslationUnit", inversedBy="translationTarget") | |
*/ | |
protected $translationUnit; | |
/** | |
* Get the Translation target's target | |
* | |
* @return string The Translation target's target | |
*/ | |
public function getTranslationTarget() { | |
return $this->translationTarget; | |
} | |
/** | |
* Sets this Translation target's target | |
* | |
* @param string $translationTarget The Translation target's target | |
* @return void | |
*/ | |
public function setTranslationTarget($translationTarget) { | |
$this->translationTarget = $translationTarget; | |
} | |
/** | |
* Get the Translation target's approval | |
* | |
* @return string The Translation target's approval | |
*/ | |
public function getTranslationApproval() { | |
return $this->translationApproval; | |
} | |
/** | |
* Sets this Translation target's approval | |
* | |
* @param string $translationApproval The Translation target's approval | |
* @return void | |
*/ | |
public function setTranslationApproval($translationApproval) { | |
$this->translationApproval = $translationApproval; | |
} | |
/** | |
* Get the Translation target's comment | |
* | |
* @return string The Translation target's comment | |
*/ | |
public function getComment() { | |
return $this->comment; | |
} | |
/** | |
* Sets this Translation target's comment | |
* | |
* @param string $comment The Translation target's comment | |
* @return void | |
*/ | |
public function setComment($comment) { | |
$this->comment = $comment; | |
} | |
/** | |
* Get the Translation target's translationlanguage | |
* | |
* @return \Somea\Translation\Domain\Model\TranslationLanguage The Translation unit's translationlanguage | |
*/ | |
public function getTranslationLanguage() { | |
return $this->translationLanguage; | |
} | |
/** | |
* Sets this Translation target's translationlanguage | |
* | |
* @param \Somea\Translation\Domain\Model\TranslationLanguage $translationlanguage The Translation unit's translationlanguage | |
* @return void | |
*/ | |
public function setTranslationLanguage(\Somea\Translation\Domain\Model\TranslationLanguage $translationLanguage) { | |
$this->translationLanguage = $translationLanguage; | |
} | |
/** | |
* Get the Translation target's translationunit | |
* | |
* @return \Somea\Translation\Domain\Model\TranslationUnit The Translation unit's translationunit | |
*/ | |
public function getTranslationUnit() { | |
return $this->translationUnit; | |
} | |
/** | |
* Sets this Translation target's translationlanguage | |
* | |
* @param \Somea\Translation\Domain\Model\TranslationUnit $translationUnit The Translation unit's translationunit | |
* @return void | |
*/ | |
public function setTranslationUnit(\Somea\Translation\Domain\Model\TranslationUnit $translationUnit) { | |
$this->translationUnit = $translationUnit; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment