-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
583 additions
and
442 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,55 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* Copyright (c) 2005-2022 Jonny Spitzner | ||
/* | ||
* Copyright (c) 2005-2024 Jonny Spitzner | ||
* | ||
* @license LGPL-3.0+ | ||
*/ | ||
*/ | ||
|
||
/** | ||
* Back end modules | ||
*/ | ||
array_insert($GLOBALS['BE_MOD']['vegas'], 100, array | ||
use Vegas\Model\VegasModel; | ||
use Vegas\Model\VegasSlidesModel; | ||
use Contao\ArrayUtil; | ||
use Contao\System; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
$GLOBALS['TL_MODELS']['tl_vegas'] = VegasModel::class; | ||
$GLOBALS['TL_MODELS']['tl_vegas_slides'] = VegasSlidesModel::class; | ||
|
||
ArrayUtil::arrayInsert($GLOBALS['BE_MOD']['vegas'], 100, array | ||
( | ||
'vegas' => array | ||
( | ||
'tables' => array('tl_vegas','tl_vegas_slides') | ||
) | ||
'vegas' => array('tables' => array('tl_vegas','tl_vegas_slides')) | ||
)); | ||
|
||
|
||
/** | ||
* Style sheet | ||
*/ | ||
if (TL_MODE == 'BE') | ||
if (System::getContainer()->get('contao.routing.scope_matcher') | ||
->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create('')) | ||
) | ||
{ | ||
$GLOBALS['TL_CSS'][] = 'bundles/jonnyspvegas/vegas/vegasbe.css|static'; | ||
} | ||
}; | ||
|
||
|
||
/** | ||
* Front end modules | ||
*/ | ||
array_insert($GLOBALS['TL_CTE'], 1, array | ||
( | ||
'includes' => array | ||
///** | ||
// * Front end modules | ||
// */ | ||
ArrayUtil::arrayInsert($GLOBALS['TL_CTE'], 1, array | ||
( | ||
'includes' => array | ||
( | ||
'vegas' => 'VegasViewer' | ||
) | ||
) | ||
)); | ||
); | ||
|
||
array_insert($GLOBALS['FE_MOD'], 2, array | ||
( | ||
'miscellaneous' => array | ||
|
||
ArrayUtil::arrayInsert($GLOBALS['FE_MOD'], 2, array | ||
( | ||
'vegas' => 'ModuleVegas' | ||
'miscellaneous' => array | ||
( | ||
'vegas' => 'ModuleVegas' | ||
) | ||
) | ||
)); | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,55 @@ | ||
<?php | ||
|
||
$GLOBALS['TL_DCA']['tl_content']['palettes']['vegas'] = '{type_legend},type;{vegas_legend},vegas;{protected_legend:hide},protected;{expert_legend:hide},cssID,space;{invisible_legend:hide},invisible,start,stop'; | ||
/* | ||
* Copyright (c) 2005-2024 Jonny Spitzner | ||
* | ||
* @license LGPL-3.0+ | ||
*/ | ||
|
||
use Contao\System; | ||
use Contao\Backend; | ||
use Vegas\Model\VegasModel; | ||
use Contao\DataContainer; | ||
use Contao\StringUtil; | ||
use Contao\Image; | ||
|
||
$GLOBALS['TL_DCA']['tl_content']['palettes']['vegas'] = '{type_legend},type;{vegas_legend},vegas;{protected_legend:hide},protected;{expert_legend:hide},cssID,space;{invisible_legend:hide},invisible,start,stop'; | ||
$GLOBALS['TL_DCA']['tl_content']['fields']['vegas'] = array | ||
( | ||
'label' => &$GLOBALS['TL_LANG']['tl_content']['vegas'], | ||
'inputType' => 'select', | ||
'options_callback' => array('tl_content_vegas', 'getVegas'), | ||
'eval' => array('mandatory'=>true, 'chosen'=>true, 'submitOnChange'=>true), | ||
'eval' => array('includeBlankOption' => true,'mandatory'=>true, 'chosen'=>true, 'submitOnChange'=>true), | ||
'wizard' => array(array('tl_content_vegas', 'editVegas')), | ||
'sql' => "int(10) unsigned NOT NULL default '0'" | ||
); | ||
|
||
|
||
class tl_content_vegas extends Backend | ||
{ | ||
|
||
public function getVegas() | ||
public function getVegas(): array | ||
{ | ||
$objVegas = \VegasModel::findAll(); | ||
$arrVegas = array(); | ||
if( isset($objVegas)){ | ||
|
||
if ($objVegas = VegasModel::findAll()) | ||
{ | ||
foreach ($objVegas as $itemVegas) | ||
{ | ||
$arrVegas[$itemVegas->id] = $itemVegas->title . ' (ID ' . $itemVegas->id . ')'; | ||
$arrVegas[$itemVegas->id] =' [ID ' . $itemVegas->id . '] - '. $itemVegas->title ; | ||
} | ||
} | ||
|
||
return $arrVegas; | ||
} | ||
|
||
public function editVegas(DataContainer $dc) | ||
public function editVegas(DataContainer $dc): string | ||
{ | ||
$this->loadLanguageFile('tl_vegas'); | ||
return ($dc->value < 1) ? '' : ' <a href="contao/main.php?do=vegas&act=edit&id=' . $dc->value . '&popup=1&nb=1&rt=' . REQUEST_TOKEN . '" title="' . sprintf(StringUtil::specialchars($GLOBALS['TL_LANG']['tl_vegas']['edit'][1]), $dc->value) . '" onclick="Backend.openModalIframe({\'title\':\'' . StringUtil::specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG']['tl_vegas']['edit'][1], $dc->value))) . '\',\'url\':this.href});return false">' . Image::getHtml('alias.svg', $GLOBALS['TL_LANG']['tl_vegas']['edit'][0]) . '</a>'; | ||
$title = sprintf($GLOBALS['TL_LANG']['tl_vegas']['editheader'][1], $dc->value); | ||
$href = System::getContainer()->get('router')->generate('contao_backend', array('do'=>'vegas', 'table'=>'tl_vegas','act'=>'edit', 'id'=>$dc->value , 'popup'=>'1', 'nb'=>'1')); | ||
|
||
return ' <a href="' . StringUtil::specialcharsUrl($href) . '" title="' . StringUtil::specialchars($title) . '" onclick="Backend.openModalIframe({\'title\':\'' . StringUtil::specialchars(str_replace("'", "\\'", $title)) . '\',\'url\':this.href});return false">' . Image::getHtml('alias.svg', $title) . '</a>'; | ||
|
||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,56 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2005-2024 Jonny Spitzner | ||
* | ||
* @license LGPL-3.0+ | ||
*/ | ||
|
||
use Contao\System; | ||
use Contao\Backend; | ||
use Vegas\Model\VegasModel; | ||
use Contao\DataContainer; | ||
use Contao\StringUtil; | ||
use Contao\Image; | ||
|
||
$GLOBALS['TL_DCA']['tl_module']['palettes']['vegas'] = '{title_legend},name,vegas,type;'; | ||
|
||
$GLOBALS['TL_DCA']['tl_module']['fields']['vegas'] = array | ||
( | ||
'label' => &$GLOBALS['TL_LANG']['tl_module']['vegas'], | ||
'inputType' => 'select', | ||
'options_callback' => array('tl_module_vegas', 'getVegas'), | ||
'eval' => array('mandatory'=>true, 'chosen'=>true, 'submitOnChange'=>true,'tl_class'=>'w50'), | ||
'eval' => array('includeBlankOption' => true,'mandatory'=>true, 'chosen'=>true, 'submitOnChange'=>true,'tl_class'=>'w50'), | ||
'wizard' => array(array('tl_module_vegas', 'editVegas')), | ||
'sql' => "int(10) unsigned NOT NULL default '0'" | ||
); | ||
|
||
class tl_module_vegas extends Backend | ||
{ | ||
|
||
public function getVegas() | ||
public function getVegas(): array | ||
{ | ||
$objVegas = \VegasModel::findAll(); | ||
$arrVegas = array(); | ||
if(isset($objVegas)){ | ||
|
||
if ($objVegas = VegasModel::findAll()) | ||
{ | ||
foreach ($objVegas as $itemVegas) | ||
{ | ||
$arrVegas[$itemVegas->id] = '[ID ' . $itemVegas->id . '] - '. $itemVegas->title; | ||
$arrVegas[$itemVegas->id] =' [ID ' . $itemVegas->id . '] - '. $itemVegas->title ; | ||
} | ||
} | ||
|
||
return $arrVegas; | ||
} | ||
|
||
public function editVegas(DataContainer $dc) | ||
public function editVegas(DataContainer $dc): string | ||
{ | ||
$this->loadLanguageFile('tl_vegas'); | ||
return ($dc->value < 1) ? '' : ' <a href="contao/main.php?do=vegas&act=edit&id=' . $dc->value . '&popup=1&nb=1&rt=' . REQUEST_TOKEN . '" title="' . sprintf(StringUtil::specialchars($GLOBALS['TL_LANG']['tl_vegas']['edit'][1]), $dc->value) . '" onclick="Backend.openModalIframe({\'title\':\'' . StringUtil::specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG']['tl_vegas']['edit'][1], $dc->value))) . '\',\'url\':this.href});return false">' . Image::getHtml('alias.svg', $GLOBALS['TL_LANG']['tl_vegas']['edit'][0]) . '</a>'; | ||
$title = sprintf($GLOBALS['TL_LANG']['tl_vegas']['editheader'][1], $dc->value); | ||
$href = System::getContainer()->get('router')->generate('contao_backend', array('do'=>'vegas', 'table'=>'tl_vegas','act'=>'edit', 'id'=>$dc->value , 'popup'=>'1', 'nb'=>'1')); | ||
|
||
return ' <a href="' . StringUtil::specialcharsUrl($href) . '" title="' . StringUtil::specialchars($title) . '" onclick="Backend.openModalIframe({\'title\':\'' . StringUtil::specialchars(str_replace("'", "\\'", $title)) . '\',\'url\':this.href});return false">' . Image::getHtml('alias.svg', $title) . '</a>'; | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.