@@ -33,144 +33,144 @@ |
||
| 33 | 33 | class GolfCourse extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity |
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * name |
|
| 38 | - * |
|
| 39 | - * @var string |
|
| 40 | - */ |
|
| 41 | - protected $name = ''; |
|
| 36 | + /** |
|
| 37 | + * name |
|
| 38 | + * |
|
| 39 | + * @var string |
|
| 40 | + */ |
|
| 41 | + protected $name = ''; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * website |
|
| 45 | - * |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 48 | - protected $website = ''; |
|
| 43 | + /** |
|
| 44 | + * website |
|
| 45 | + * |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | + protected $website = ''; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * comment |
|
| 52 | - * |
|
| 53 | - * @var string |
|
| 54 | - */ |
|
| 55 | - protected $comment = ''; |
|
| 50 | + /** |
|
| 51 | + * comment |
|
| 52 | + * |
|
| 53 | + * @var string |
|
| 54 | + */ |
|
| 55 | + protected $comment = ''; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * country |
|
| 59 | - * |
|
| 60 | - * @var int |
|
| 61 | - */ |
|
| 62 | - protected $country = 0; |
|
| 57 | + /** |
|
| 58 | + * country |
|
| 59 | + * |
|
| 60 | + * @var int |
|
| 61 | + */ |
|
| 62 | + protected $country = 0; |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * logo |
|
| 66 | - * |
|
| 67 | - * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference |
|
| 68 | - */ |
|
| 69 | - protected $logo = null; |
|
| 64 | + /** |
|
| 65 | + * logo |
|
| 66 | + * |
|
| 67 | + * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference |
|
| 68 | + */ |
|
| 69 | + protected $logo = null; |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Returns the name |
|
| 73 | - * |
|
| 74 | - * @return string $name |
|
| 75 | - */ |
|
| 76 | - public function getName() |
|
| 77 | - { |
|
| 78 | - return $this->name; |
|
| 79 | - } |
|
| 71 | + /** |
|
| 72 | + * Returns the name |
|
| 73 | + * |
|
| 74 | + * @return string $name |
|
| 75 | + */ |
|
| 76 | + public function getName() |
|
| 77 | + { |
|
| 78 | + return $this->name; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Sets the name |
|
| 83 | - * |
|
| 84 | - * @param string $name |
|
| 85 | - * @return void |
|
| 86 | - */ |
|
| 87 | - public function setName($name) |
|
| 88 | - { |
|
| 89 | - $this->name = $name; |
|
| 90 | - } |
|
| 81 | + /** |
|
| 82 | + * Sets the name |
|
| 83 | + * |
|
| 84 | + * @param string $name |
|
| 85 | + * @return void |
|
| 86 | + */ |
|
| 87 | + public function setName($name) |
|
| 88 | + { |
|
| 89 | + $this->name = $name; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Returns the website |
|
| 94 | - * |
|
| 95 | - * @return string $website |
|
| 96 | - */ |
|
| 97 | - public function getWebsite() |
|
| 98 | - { |
|
| 99 | - return $this->website; |
|
| 100 | - } |
|
| 92 | + /** |
|
| 93 | + * Returns the website |
|
| 94 | + * |
|
| 95 | + * @return string $website |
|
| 96 | + */ |
|
| 97 | + public function getWebsite() |
|
| 98 | + { |
|
| 99 | + return $this->website; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Sets the website |
|
| 104 | - * |
|
| 105 | - * @param string $website |
|
| 106 | - * @return void |
|
| 107 | - */ |
|
| 108 | - public function setWebsite($website) |
|
| 109 | - { |
|
| 110 | - $this->website = $website; |
|
| 111 | - } |
|
| 102 | + /** |
|
| 103 | + * Sets the website |
|
| 104 | + * |
|
| 105 | + * @param string $website |
|
| 106 | + * @return void |
|
| 107 | + */ |
|
| 108 | + public function setWebsite($website) |
|
| 109 | + { |
|
| 110 | + $this->website = $website; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Returns the comment |
|
| 115 | - * |
|
| 116 | - * @return string $comment |
|
| 117 | - */ |
|
| 118 | - public function getComment() |
|
| 119 | - { |
|
| 120 | - return $this->comment; |
|
| 121 | - } |
|
| 113 | + /** |
|
| 114 | + * Returns the comment |
|
| 115 | + * |
|
| 116 | + * @return string $comment |
|
| 117 | + */ |
|
| 118 | + public function getComment() |
|
| 119 | + { |
|
| 120 | + return $this->comment; |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * Sets the comment |
|
| 125 | - * |
|
| 126 | - * @param string $comment |
|
| 127 | - * @return void |
|
| 128 | - */ |
|
| 129 | - public function setComment($comment) |
|
| 130 | - { |
|
| 131 | - $this->comment = $comment; |
|
| 132 | - } |
|
| 123 | + /** |
|
| 124 | + * Sets the comment |
|
| 125 | + * |
|
| 126 | + * @param string $comment |
|
| 127 | + * @return void |
|
| 128 | + */ |
|
| 129 | + public function setComment($comment) |
|
| 130 | + { |
|
| 131 | + $this->comment = $comment; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Returns the country |
|
| 136 | - * |
|
| 137 | - * @return int $country |
|
| 138 | - */ |
|
| 139 | - public function getCountry() |
|
| 140 | - { |
|
| 141 | - return $this->country; |
|
| 142 | - } |
|
| 134 | + /** |
|
| 135 | + * Returns the country |
|
| 136 | + * |
|
| 137 | + * @return int $country |
|
| 138 | + */ |
|
| 139 | + public function getCountry() |
|
| 140 | + { |
|
| 141 | + return $this->country; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Sets the country |
|
| 146 | - * |
|
| 147 | - * @param int $country |
|
| 148 | - * @return void |
|
| 149 | - */ |
|
| 150 | - public function setCountry($country) |
|
| 151 | - { |
|
| 152 | - $this->country = $country; |
|
| 153 | - } |
|
| 144 | + /** |
|
| 145 | + * Sets the country |
|
| 146 | + * |
|
| 147 | + * @param int $country |
|
| 148 | + * @return void |
|
| 149 | + */ |
|
| 150 | + public function setCountry($country) |
|
| 151 | + { |
|
| 152 | + $this->country = $country; |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Returns the logo |
|
| 157 | - * |
|
| 158 | - * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $logo |
|
| 159 | - */ |
|
| 160 | - public function getLogo() |
|
| 161 | - { |
|
| 162 | - return $this->logo; |
|
| 163 | - } |
|
| 155 | + /** |
|
| 156 | + * Returns the logo |
|
| 157 | + * |
|
| 158 | + * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $logo |
|
| 159 | + */ |
|
| 160 | + public function getLogo() |
|
| 161 | + { |
|
| 162 | + return $this->logo; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * Sets the logo |
|
| 167 | - * |
|
| 168 | - * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $logo |
|
| 169 | - * @return void |
|
| 170 | - */ |
|
| 171 | - public function setLogo(\TYPO3\CMS\Extbase\Domain\Model\FileReference $logo) |
|
| 172 | - { |
|
| 173 | - $this->logo = $logo; |
|
| 174 | - } |
|
| 165 | + /** |
|
| 166 | + * Sets the logo |
|
| 167 | + * |
|
| 168 | + * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $logo |
|
| 169 | + * @return void |
|
| 170 | + */ |
|
| 171 | + public function setLogo(\TYPO3\CMS\Extbase\Domain\Model\FileReference $logo) |
|
| 172 | + { |
|
| 173 | + $this->logo = $logo; |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | \ No newline at end of file |
@@ -18,19 +18,19 @@ discard block |
||
| 18 | 18 | 'disabled' => 'hidden', |
| 19 | 19 | 'starttime' => 'starttime', |
| 20 | 20 | 'endtime' => 'endtime', |
| 21 | - ], |
|
| 21 | + ], |
|
| 22 | 22 | 'searchFields' => 'name,website,comment,country,logo,', |
| 23 | 23 | 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('golf_courses') . 'Resources/Public/Icons/tx_golfcourses_domain_model_golfcourse.png' |
| 24 | - ], |
|
| 24 | + ], |
|
| 25 | 25 | 'interface' => [ |
| 26 | 26 | 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, website, comment, country, logo', |
| 27 | - ], |
|
| 27 | + ], |
|
| 28 | 28 | 'types' => [ |
| 29 | 29 | '1' => ['showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, name, website, comment, country, logo, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'], |
| 30 | - ], |
|
| 30 | + ], |
|
| 31 | 31 | 'palettes' => [ |
| 32 | 32 | '1' => ['showitem' => ''], |
| 33 | - ], |
|
| 33 | + ], |
|
| 34 | 34 | 'columns' => [ |
| 35 | 35 | |
| 36 | 36 | 'sys_language_uid' => [ |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | 'items' => [ |
| 45 | 45 | ['LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1], |
| 46 | 46 | ['LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0] |
| 47 | - ], |
|
| 48 | - ], |
|
| 49 | - ], |
|
| 47 | + ], |
|
| 48 | + ], |
|
| 49 | + ], |
|
| 50 | 50 | 'l10n_parent' => [ |
| 51 | 51 | 'displayCond' => 'FIELD:sys_language_uid:>:0', |
| 52 | 52 | 'exclude' => 1, |
@@ -56,31 +56,31 @@ discard block |
||
| 56 | 56 | 'renderType' => 'selectSingle', |
| 57 | 57 | 'items' => [ |
| 58 | 58 | ['', 0], |
| 59 | - ], |
|
| 59 | + ], |
|
| 60 | 60 | 'foreign_table' => 'tx_golfcourses_domain_model_golfcourse', |
| 61 | 61 | 'foreign_table_where' => 'AND tx_golfcourses_domain_model_golfcourse.pid=###CURRENT_PID### AND tx_golfcourses_domain_model_golfcourse.sys_language_uid IN (-1,0)', |
| 62 | - ], |
|
| 63 | - ], |
|
| 62 | + ], |
|
| 63 | + ], |
|
| 64 | 64 | 'l10n_diffsource' => [ |
| 65 | 65 | 'config' => [ |
| 66 | 66 | 'type' => 'passthrough', |
| 67 | - ], |
|
| 68 | - ], |
|
| 67 | + ], |
|
| 68 | + ], |
|
| 69 | 69 | 't3ver_label' => [ |
| 70 | 70 | 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel', |
| 71 | 71 | 'config' => [ |
| 72 | 72 | 'type' => 'input', |
| 73 | 73 | 'size' => 30, |
| 74 | 74 | 'max' => 255, |
| 75 | - ] |
|
| 76 | - ], |
|
| 75 | + ] |
|
| 76 | + ], |
|
| 77 | 77 | 'hidden' => [ |
| 78 | 78 | 'exclude' => 1, |
| 79 | 79 | 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', |
| 80 | 80 | 'config' => [ |
| 81 | 81 | 'type' => 'check', |
| 82 | - ], |
|
| 83 | - ], |
|
| 82 | + ], |
|
| 83 | + ], |
|
| 84 | 84 | 'starttime' => [ |
| 85 | 85 | 'exclude' => 1, |
| 86 | 86 | 'l10n_mode' => 'mergeIfNotBlank', |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | 'default' => 0, |
| 95 | 95 | 'range' => [ |
| 96 | 96 | 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) |
| 97 | - ], |
|
| 98 | - ], |
|
| 99 | - ], |
|
| 97 | + ], |
|
| 98 | + ], |
|
| 99 | + ], |
|
| 100 | 100 | 'endtime' => [ |
| 101 | 101 | 'exclude' => 1, |
| 102 | 102 | 'l10n_mode' => 'mergeIfNotBlank', |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | 'default' => 0, |
| 111 | 111 | 'range' => [ |
| 112 | 112 | 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) |
| 113 | - ], |
|
| 114 | - ], |
|
| 115 | - ], |
|
| 113 | + ], |
|
| 114 | + ], |
|
| 115 | + ], |
|
| 116 | 116 | 'name' => [ |
| 117 | 117 | 'exclude' => 1, |
| 118 | 118 | 'label' => 'LLL:EXT:golf_courses/Resources/Private/Language/locallang_db.xlf:tx_golfcourses_domain_model_golfcourse.name', |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | 'type' => 'input', |
| 121 | 121 | 'size' => 30, |
| 122 | 122 | 'eval' => 'trim' |
| 123 | - ], |
|
| 124 | - ], |
|
| 123 | + ], |
|
| 124 | + ], |
|
| 125 | 125 | 'website' => [ |
| 126 | 126 | 'exclude' => 1, |
| 127 | 127 | 'label' => 'LLL:EXT:golf_courses/Resources/Private/Language/locallang_db.xlf:tx_golfcourses_domain_model_golfcourse.website', |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | 'type' => 'input', |
| 130 | 130 | 'size' => 30, |
| 131 | 131 | 'eval' => 'trim' |
| 132 | - ], |
|
| 133 | - ], |
|
| 132 | + ], |
|
| 133 | + ], |
|
| 134 | 134 | 'comment' => [ |
| 135 | 135 | 'exclude' => 1, |
| 136 | 136 | 'label' => 'LLL:EXT:golf_courses/Resources/Private/Language/locallang_db.xlf:tx_golfcourses_domain_model_golfcourse.comment', |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | 'type' => 'input', |
| 139 | 139 | 'size' => 30, |
| 140 | 140 | 'eval' => 'trim' |
| 141 | - ], |
|
| 142 | - ], |
|
| 141 | + ], |
|
| 142 | + ], |
|
| 143 | 143 | 'country' => [ |
| 144 | 144 | 'exclude' => 1, |
| 145 | 145 | 'label' => 'LLL:EXT:golf_courses/Resources/Private/Language/locallang_db.xlf:tx_golfcourses_domain_model_golfcourse.country', |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | 'renderType' => 'selectSingle', |
| 149 | 149 | 'items' => [ |
| 150 | 150 | ['Select Country', -1], |
| 151 | - ], |
|
| 151 | + ], |
|
| 152 | 152 | 'foreign_table' => 'static_countries', |
| 153 | 153 | 'foreign_table_where' => 'ORDER BY cn_official_name_en ASC', |
| 154 | 154 | 'size' => 1, |
| 155 | 155 | 'maxitems' => 1, |
| 156 | 156 | 'eval' => '' |
| 157 | - ], |
|
| 158 | - ], |
|
| 157 | + ], |
|
| 158 | + ], |
|
| 159 | 159 | 'logo' => [ |
| 160 | 160 | 'exclude' => 1, |
| 161 | 161 | 'label' => 'LLL:EXT:golf_courses/Resources/Private/Language/locallang_db.xlf:tx_golfcourses_domain_model_golfcourse.logo', |
@@ -164,44 +164,44 @@ discard block |
||
| 164 | 164 | [ |
| 165 | 165 | 'appearance' => [ |
| 166 | 166 | 'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference' |
| 167 | - ], |
|
| 167 | + ], |
|
| 168 | 168 | 'foreign_types' => [ |
| 169 | 169 | '0' => [ |
| 170 | 170 | 'showitem' => ' |
| 171 | 171 | --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, |
| 172 | 172 | --palette--;;filePalette' |
| 173 | - ], |
|
| 173 | + ], |
|
| 174 | 174 | \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ |
| 175 | 175 | 'showitem' => ' |
| 176 | 176 | --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, |
| 177 | 177 | --palette--;;filePalette' |
| 178 | - ], |
|
| 178 | + ], |
|
| 179 | 179 | \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ |
| 180 | 180 | 'showitem' => ' |
| 181 | 181 | --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, |
| 182 | 182 | --palette--;;filePalette' |
| 183 | - ], |
|
| 183 | + ], |
|
| 184 | 184 | \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ |
| 185 | 185 | 'showitem' => ' |
| 186 | 186 | --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, |
| 187 | 187 | --palette--;;filePalette' |
| 188 | - ], |
|
| 188 | + ], |
|
| 189 | 189 | \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ |
| 190 | 190 | 'showitem' => ' |
| 191 | 191 | --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, |
| 192 | 192 | --palette--;;filePalette' |
| 193 | - ], |
|
| 193 | + ], |
|
| 194 | 194 | \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ |
| 195 | 195 | 'showitem' => ' |
| 196 | 196 | --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, |
| 197 | 197 | --palette--;;filePalette' |
| 198 | - ] |
|
| 199 | - ], |
|
| 198 | + ] |
|
| 199 | + ], |
|
| 200 | 200 | 'maxitems' => 1 |
| 201 | - ], |
|
| 201 | + ], |
|
| 202 | 202 | $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] |
| 203 | 203 | ), |
| 204 | - ], |
|
| 204 | + ], |
|
| 205 | 205 | |
| 206 | - ], |
|
| 206 | + ], |
|
| 207 | 207 | ]; |
| 208 | 208 | \ No newline at end of file |
@@ -35,49 +35,49 @@ |
||
| 35 | 35 | class ListController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController |
| 36 | 36 | { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * golfCourseRepository |
|
| 40 | - * |
|
| 41 | - * @var \TNM\GolfCourses\Domain\Repository\GolfCourseRepository |
|
| 42 | - * @inject |
|
| 43 | - */ |
|
| 44 | - protected $golfCourseRepository = null; |
|
| 38 | + /** |
|
| 39 | + * golfCourseRepository |
|
| 40 | + * |
|
| 41 | + * @var \TNM\GolfCourses\Domain\Repository\GolfCourseRepository |
|
| 42 | + * @inject |
|
| 43 | + */ |
|
| 44 | + protected $golfCourseRepository = null; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var \SJBR\StaticInfoTables\Domain\Repository\CountryRepository |
|
| 48 | - * @inject |
|
| 49 | - */ |
|
| 50 | - protected $countryRepository = null; |
|
| 46 | + /** |
|
| 47 | + * @var \SJBR\StaticInfoTables\Domain\Repository\CountryRepository |
|
| 48 | + * @inject |
|
| 49 | + */ |
|
| 50 | + protected $countryRepository = null; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * action list |
|
| 54 | - * |
|
| 55 | - * @return void |
|
| 56 | - */ |
|
| 57 | - public function listAction() |
|
| 58 | - { |
|
| 59 | - $countryAndCourses = []; |
|
| 60 | - $coursesTotal = 0; |
|
| 61 | - $countriesUidsInUse = $this->golfCourseRepository->findCountriesUidsInUse(); |
|
| 52 | + /** |
|
| 53 | + * action list |
|
| 54 | + * |
|
| 55 | + * @return void |
|
| 56 | + */ |
|
| 57 | + public function listAction() |
|
| 58 | + { |
|
| 59 | + $countryAndCourses = []; |
|
| 60 | + $coursesTotal = 0; |
|
| 61 | + $countriesUidsInUse = $this->golfCourseRepository->findCountriesUidsInUse(); |
|
| 62 | 62 | |
| 63 | - foreach ($countriesUidsInUse as $countryUid) { |
|
| 64 | - /** @var Country $country */ |
|
| 65 | - $country = $this->countryRepository->findByUid($countryUid); |
|
| 66 | - $countryName = $country->getShortNameEn(); |
|
| 67 | - $coursesInCountry = $this->golfCourseRepository->findAllInCountry($countryUid); |
|
| 68 | - if(!count($coursesInCountry)) { |
|
| 69 | - continue; |
|
| 70 | - } |
|
| 71 | - $countryAndCourses[$countryName]['name'] = $countryName; |
|
| 72 | - /** @var GolfCourse $course */ |
|
| 73 | - foreach ($coursesInCountry as $course) { |
|
| 74 | - $countryAndCourses[$countryName]['courses'][$course->getUid()] = $course; |
|
| 75 | - $coursesTotal++; |
|
| 76 | - } |
|
| 77 | - } |
|
| 63 | + foreach ($countriesUidsInUse as $countryUid) { |
|
| 64 | + /** @var Country $country */ |
|
| 65 | + $country = $this->countryRepository->findByUid($countryUid); |
|
| 66 | + $countryName = $country->getShortNameEn(); |
|
| 67 | + $coursesInCountry = $this->golfCourseRepository->findAllInCountry($countryUid); |
|
| 68 | + if(!count($coursesInCountry)) { |
|
| 69 | + continue; |
|
| 70 | + } |
|
| 71 | + $countryAndCourses[$countryName]['name'] = $countryName; |
|
| 72 | + /** @var GolfCourse $course */ |
|
| 73 | + foreach ($coursesInCountry as $course) { |
|
| 74 | + $countryAndCourses[$countryName]['courses'][$course->getUid()] = $course; |
|
| 75 | + $coursesTotal++; |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $this->view->assign('countryAndCourses', $countryAndCourses); |
|
| 80 | - $this->view->assign('coursesCount', $coursesTotal); |
|
| 81 | - $this->view->assign('countriesCount', count($countryAndCourses)); |
|
| 82 | - } |
|
| 79 | + $this->view->assign('countryAndCourses', $countryAndCourses); |
|
| 80 | + $this->view->assign('coursesCount', $coursesTotal); |
|
| 81 | + $this->view->assign('countriesCount', count($countryAndCourses)); |
|
| 82 | + } |
|
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | $country = $this->countryRepository->findByUid($countryUid); |
| 66 | 66 | $countryName = $country->getShortNameEn(); |
| 67 | 67 | $coursesInCountry = $this->golfCourseRepository->findAllInCountry($countryUid); |
| 68 | - if(!count($coursesInCountry)) { |
|
| 68 | + if (!count($coursesInCountry)) { |
|
| 69 | 69 | continue; |
| 70 | 70 | } |
| 71 | 71 | $countryAndCourses[$countryName]['name'] = $countryName; |
@@ -36,42 +36,42 @@ |
||
| 36 | 36 | class GolfCourseRepository extends \TYPO3\CMS\Extbase\Persistence\Repository |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param $countryUid |
|
| 41 | - * |
|
| 42 | - * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
|
| 43 | - */ |
|
| 44 | - public function findAllInCountry($countryUid) |
|
| 45 | - { |
|
| 46 | - /** @var QueryInterface $query */ |
|
| 47 | - $query = $this->createQuery(); |
|
| 39 | + /** |
|
| 40 | + * @param $countryUid |
|
| 41 | + * |
|
| 42 | + * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
|
| 43 | + */ |
|
| 44 | + public function findAllInCountry($countryUid) |
|
| 45 | + { |
|
| 46 | + /** @var QueryInterface $query */ |
|
| 47 | + $query = $this->createQuery(); |
|
| 48 | 48 | |
| 49 | - $querySettings = $query->getQuerySettings(); |
|
| 50 | - $querySettings->setRespectStoragePage(false); |
|
| 51 | - $querySettings->setIgnoreEnableFields(false); |
|
| 49 | + $querySettings = $query->getQuerySettings(); |
|
| 50 | + $querySettings->setRespectStoragePage(false); |
|
| 51 | + $querySettings->setIgnoreEnableFields(false); |
|
| 52 | 52 | |
| 53 | - $query->matching($query->equals('country', $countryUid)); |
|
| 54 | - $query->setOrderings(['name' => 'ASC']); |
|
| 55 | - $query->setQuerySettings($querySettings); |
|
| 53 | + $query->matching($query->equals('country', $countryUid)); |
|
| 54 | + $query->setOrderings(['name' => 'ASC']); |
|
| 55 | + $query->setQuerySettings($querySettings); |
|
| 56 | 56 | |
| 57 | - return $query->execute(); |
|
| 58 | - } |
|
| 57 | + return $query->execute(); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return array |
|
| 62 | - */ |
|
| 63 | - public function findCountriesUidsInUse() |
|
| 64 | - { |
|
| 65 | - $uids = []; |
|
| 66 | - $courses = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 67 | - 'DISTINCT country', |
|
| 68 | - 'tx_golfcourses_domain_model_golfcourse' |
|
| 69 | - ); |
|
| 60 | + /** |
|
| 61 | + * @return array |
|
| 62 | + */ |
|
| 63 | + public function findCountriesUidsInUse() |
|
| 64 | + { |
|
| 65 | + $uids = []; |
|
| 66 | + $courses = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 67 | + 'DISTINCT country', |
|
| 68 | + 'tx_golfcourses_domain_model_golfcourse' |
|
| 69 | + ); |
|
| 70 | 70 | |
| 71 | - foreach ($courses as $course) { |
|
| 72 | - $uids[] = $course['country']; |
|
| 73 | - } |
|
| 71 | + foreach ($courses as $course) { |
|
| 72 | + $uids[] = $course['country']; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $uids; |
|
| 76 | - } |
|
| 75 | + return $uids; |
|
| 76 | + } |
|
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |