Last active
December 12, 2015 12:09
-
-
Save JohannesFerner/4770211 to your computer and use it in GitHub Desktop.
DCA-Ausschnitt
Problem
Klick auf 'toggleKarriereAt' toggled auch das 'toggle' / visible field.
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 | |
//... | |
'toggle' => array | |
( | |
'label' => &$GLOBALS['TL_LANG']['tl_job']['toggle'], | |
'icon' => 'visible.gif', | |
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', | |
'button_callback' => array('tl_job', 'toggleIcon') | |
), | |
'toggleKarriereAt' => array | |
( | |
'label' => &$GLOBALS['TL_LANG']['tl_job']['toggleKarriereAt'], | |
'icon' => '/system/modules/jobportal/assets/Letter-K-lg-icon.png', | |
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleKarriereAt(this,%s)"', | |
'button_callback' => array('tl_job', 'toggleKarriereAtIcon') | |
), | |
//... | |
/** | |
* Return the "toggle visibility" button | |
* @param array | |
* @param string | |
* @param string | |
* @param string | |
* @param string | |
* @param string | |
* @return string | |
*/ | |
public function toggleKarriereAtIcon($row, $href, $label, $title, $icon, $attributes) { | |
if (strlen(Input::get('tid'))) { | |
$this->toggleKarriereAt(Input::get('tid'), (Input::get('state') == 1)); | |
$this->redirect($this->getReferer()); | |
} | |
$href .= '&tid=' . $row['id'] . '&state=' . ($row['karriere_export'] ? '' : 1); | |
if (!$row['karriere_export']) { | |
$icon = '/system/modules/jobportal/assets/Letter-K-grey-icon.png'; | |
} | |
return '<a href="' . $this->addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . $this->generateImage($icon, $label) . '</a> '; | |
} | |
/** | |
* Disable/enable a user group | |
* @param integer | |
* @param boolean | |
*/ | |
public function toggleKarriereAt($intId, $blnVisible) { | |
// Check permissions to edit | |
Input::setGet('id', $intId); | |
Input::setGet('act', 'toggle'); | |
$this->createInitialVersion('tl_job', $intId); | |
// Update the database | |
$this->Database->prepare("UPDATE tl_job SET tstamp=" . time() . ", karriere_export='" . ($blnVisible ? 1 : '') . "' WHERE id=?") | |
->execute($intId); | |
$this->createNewVersion('tl_job', $intId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment