Advertisement
Guest User

Untitled

a guest
Aug 27th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.00 KB | None | 0 0
  1. Model for form-filter
  2. --------------------------------------------------------------------------------
  3.  
  4. class Filterdemand extends \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject {
  5.    
  6.     /**
  7.      * Sys-testings set within filter-form
  8.      * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Vendor\Medialibrary\Domain\Model\Test>
  9.      */
  10.     protected $testings;
  11.    
  12.     /**
  13.     * __construct
  14.     *
  15.     * @return AbstractObject
  16.     */
  17.     public function __construct() {
  18.         $this->testings = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
  19.     }
  20.    
  21.    
  22.     /**
  23.      * Returns the testings
  24.      *
  25.      * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Vendor\Medialibrary\Domain\Model\Test> $testings
  26.      */
  27.     public function getTestings() {
  28.         return $this->testings;
  29.     }
  30.  
  31.     /**
  32.      * Sets the testings
  33.      *
  34.      * @param $testings testings
  35.      * @return void
  36.      */
  37.     public function setTestings($testings) {
  38.         $this->testings = $testings;
  39.     }
  40.    
  41. }
  42.  
  43.  
  44.  
  45. Model of records parsed through ForViewHelper
  46. --------------------------------------------------------------------------------
  47. class Test extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
  48.    
  49.     /**
  50.      * Title of entry
  51.      *
  52.      * @var string
  53.      */
  54.     protected $title;
  55.    
  56.     /**
  57.      * Returns the title
  58.      *
  59.      * @return string $title
  60.      */
  61.     public function getTitle() {
  62.         return $this->title;
  63.     }
  64.  
  65.     /**
  66.      * Sets the title
  67.      *
  68.      * @param string $title
  69.      * @return void
  70.      */
  71.     public function setTitle($title) {
  72.         $this->title = $title;
  73.     }
  74.    
  75. }
  76.  
  77. Controller (for different records than the ones parsed through ForViewHelper)
  78. --------------------------------------------------------------------------------
  79. class AsdfController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
  80.    
  81.     /**
  82.      * testRepository
  83.      *
  84.      * @var \Vendor\Medialibrary\Domain\Repository\TestRepository
  85.      * @inject
  86.      */
  87.     protected $testRepository;
  88.    
  89.     /**
  90.      * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
  91.      * @inject
  92.      */
  93.     protected $objectManager;
  94.    
  95.    
  96.    
  97.     /**
  98.      * action list
  99.      *
  100.      * @param Vendor\Medialibrary\Domain\Model\Filter $filter Filter set within form
  101.      * @return void
  102.      */
  103.     public function listAction(\Vendor\Medialibrary\Domain\Model\Filterdemand $filterdemand = NULL) {
  104.        
  105.         $testings = $this->testRepository->findAll();
  106.        
  107.         $filterdemand = $this->objectManager->get('Vendor\\Medialibrary\\Domain\\Model\\Filterdemand');
  108.         $filterdemand->setTestings($testings);
  109.        
  110.        
  111.         $this->view->assignMultiple(array(
  112.             'testings' => $testings,
  113.             'filterdemand' => $filterdemand,
  114.         ));
  115.  
  116.     }
  117.  
  118. }
  119.  
  120.  
  121. View
  122. --------------------------------------------------------------------------------
  123.         <f:form action="list" name="filter" object="{filterdemand}">
  124.             <fieldset>
  125.                 <f:for each="{testings}" as="test">
  126.                     <f:form.checkbox value="{test.uid}" property="testings" id="testings{test.uid}" /><label for="testings{test.uid}">{test.title}</label><br />
  127.                 </f:for>
  128.             </fieldset>
  129.             <fieldset>
  130.                 <f:form.submit value="Filtern" />
  131.             </fieldset>
  132.         </f:form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement