本文整理汇总了PHP中Message::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::reset方法的具体用法?PHP Message::reset怎么用?PHP Message::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeMessage
public function writeMessage(DataContainer $dc)
{
//$banner->addBannerNewWindow($GLOBALS['TL_LANG']['CTE'][$module['type']][0], $GLOBALS['TL_LANG']['CTE'][$module['type']][1]);
$banner = new ReadSpeaker\RS_Messages();
Message::reset();
$banner->addBannerReadSpeakerTop($GLOBALS['TL_LANG']['MOD']['readspeaker_settings'][0], $GLOBALS['TL_LANG']['MOD']['readspeaker_settings'][1]);
$count_settings = ReadSpeaker\RsSettingsModel::countAll();
if (!Contao\Input::get('act')) {
if ($count_settings == 0) {
Message::addRaw($GLOBALS['TL_LANG']['tl_rs_settings']['info']['min_one_config']);
} else {
if ($count_settings > 0) {
Message::addRaw($GLOBALS['TL_LANG']['tl_rs_settings']['info']['more_configs']);
}
}
}
}
示例2: writeMessage
public function writeMessage(DataContainer $dc)
{
Message::reset();
if (TL_MODE == 'BE' && Input::get('act') && Input::get('act') == 'edit') {
$banner = new ReadSpeaker\RS_Messages();
$db = \Contao\Database::getInstance();
$module = $db->prepare("SELECT * FROM tl_content WHERE id = ?")->execute($dc->id)->row();
if ($module) {
$rs_banner = false;
$rs_doc_banner = false;
$rs_ce_end_banner = false;
switch ($module['type']) {
case 'rs_content_ce':
$rs_banner = true;
$rs_ce_end_banner = true;
break;
case 'rs_content_end':
$rs_banner = true;
break;
case 'rs_content_doc':
$rs_banner = true;
$rs_doc_banner = true;
break;
case 'rs_content_skip':
$rs_banner = true;
break;
case 'rs_content_read':
$rs_banner = true;
break;
default:
break;
}
if ($rs_banner) {
$banner->addBannerReadSpeakerTop($GLOBALS['TL_LANG']['CTE'][$module['type']][0], $GLOBALS['TL_LANG']['CTE'][$module['type']][1]);
if ($rs_ce_end_banner) {
$banner->addBannerNotForgetEndContentElement();
}
if ($rs_doc_banner) {
$banner->addBannerPossibleDocReaderFileTypes();
}
}
}
}
}
示例3: writeMessage
public function writeMessage($dc)
{
$banner = new ReadSpeaker\RS_Messages();
Message::reset();
$db = \Contao\Database::getInstance();
$module = $db->prepare("SELECT * FROM tl_module WHERE id = ?")->execute($dc->id)->row();
$rs_banner = false;
switch ($module['type']) {
case 'mod_rs':
$rs_banner = true;
break;
case 'mod_rs_skip_from_here':
$rs_banner = true;
break;
case 'mod_rs_read_from_here':
$rs_banner = true;
break;
default:
break;
}
if ($rs_banner) {
$banner->addBannerReadSpeakerTop($GLOBALS['TL_LANG']['FMD'][$module['type']][0], $GLOBALS['TL_LANG']['FMD'][$module['type']][1]);
}
}
示例4: resetMessages
/**
* Reset the message system
*
* @deprecated Use Message::reset() instead
*/
protected function resetMessages()
{
\Message::reset();
}
示例5: edit
//.........这里部分代码省略.........
$version = $objVersions->renderDropdown();
} else {
$version = '';
}
// Submit buttons
$arrButtons = array();
$arrButtons['save'] = '<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['save']) . '">';
$arrButtons['saveNclose'] = '<input type="submit" name="saveNclose" id="saveNclose" class="tl_submit" accesskey="c" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNclose']) . '">';
// Call the buttons_callback (see #4691)
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['edit']['buttons_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['edit']['buttons_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$arrButtons = $this->{$callback[0]}->{$callback[1]}($arrButtons, $this);
} elseif (is_callable($callback)) {
$arrButtons = $callback($arrButtons, $this);
}
}
}
// Add the buttons and end the form
$return .= '
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
' . implode(' ', $arrButtons) . '
</div>
</div>
</form>';
// Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
$return = $version . '
<div id="tl_buttons">
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">' . ($this->noReload ? '
<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this);
} elseif (is_callable($callback)) {
$callback($this);
}
}
}
// Save the current version
if ($this->blnCreateNewVersion && $objModel !== null) {
$objVersions->create();
// Call the onversion_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'])) {
@trigger_error('Using the onversion_callback has been deprecated and will no longer work in Contao 5.0. Use the oncreate_version_callback instead.', E_USER_DEPRECATED);
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this->strTable, $objModel->id, $this);
} elseif (is_callable($callback)) {
$callback($this->strTable, $objModel->id, $this);
}
}
}
}
// Set the current timestamp (-> DO NOT CHANGE THE ORDER version - timestamp)
if ($this->blnIsDbAssisted && $objModel !== null) {
$this->Database->prepare("UPDATE " . $this->strTable . " SET tstamp=? WHERE id=?")->execute(time(), $objModel->id);
}
// Redirect
if (\Input::post('saveNclose')) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$this->redirect($this->getReferer());
}
// Reload
if ($this->blnIsDbAssisted && $this->objActiveRecord !== null) {
$this->redirect($this->addToUrl('id=' . $this->urlEncode($this->objActiveRecord->path)));
} else {
$this->redirect($this->addToUrl('id=' . $this->urlEncode($this->strPath . '/' . $this->varValue) . $this->strExtension));
}
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '
<script>
window.addEvent(\'domready\', function() {
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}
return $return;
}
示例6: edit
//.........这里部分代码省略.........
if (is_array($callback)) {
$this->import($callback[0]);
$this->varValue = $this->{$callback[0]}->{$callback[1]}($this->varValue, $this);
} elseif (is_callable($callback)) {
$this->varValue = $callback($this->varValue, $this);
}
}
}
// Build row
$blnAjax ? $strAjax .= $this->row() : ($return .= $this->row());
}
$class = 'tl_box';
$return .= "\n" . '</fieldset>';
}
}
$this->import('Files');
// Check whether the target file is writeable
if (!$this->Files->is_writeable('system/config/localconfig.php')) {
\Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['notWriteable'], 'system/config/localconfig.php'));
}
// Submit buttons
$arrButtons = array();
$arrButtons['save'] = '<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['save']) . '">';
$arrButtons['saveNclose'] = '<input type="submit" name="saveNclose" id="saveNclose" class="tl_submit" accesskey="c" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNclose']) . '">';
// Call the buttons_callback (see #4691)
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['edit']['buttons_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['edit']['buttons_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$arrButtons = $this->{$callback[0]}->{$callback[1]}($arrButtons, $this);
} elseif (is_callable($callback)) {
$arrButtons = $callback($arrButtons, $this);
}
}
}
// Add the buttons and end the form
$return .= '
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
' . implode(' ', $arrButtons) . '
</div>
</div>
</form>
<script>
window.addEvent(\'domready\', function() {
Theme.focusInput("' . $this->strTable . '");
});
</script>';
// Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
$return = '
<div id="tl_buttons">
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">' . ($this->noReload ? '
<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
// Call onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this);
} elseif (is_callable($callback)) {
$callback($this);
}
}
}
// Reload
if (\Input::post('saveNclose')) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$this->redirect($this->getReferer());
}
$this->reload();
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '
<script>
window.addEvent(\'domready\', function() {
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}
return $return;
}
示例7: edit
//.........这里部分代码省略.........
if ($objVersion->numRows > 1) {
$versions = '';
while ($objVersion->next()) {
$versions .= '
<option value="' . $objVersion->version . '"' . ($objVersion->active ? ' selected="selected"' : '') . '>' . $GLOBALS['TL_LANG']['MSC']['version'] . ' ' . $objVersion->version . ' (' . $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $objVersion->tstamp) . ') ' . $objVersion->username . '</option>';
}
$version = '
<div class="tl_version_panel">
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_version" class="tl_form" method="post">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_version">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<select name="version" class="tl_select">' . $versions . '
</select>
<input type="submit" name="showVersion" id="showVersion" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['restore']) . '">
<a href="contao/diff.php?table=' . $this->strTable . '&pid=' . $objFile->id . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['showDifferences']) . '" onclick="Backend.openModalIframe({\'width\':860,\'title\':\'' . specialchars($GLOBALS['TL_LANG']['MSC']['showDifferences']) . '\',\'url\':this.href});return false">' . $this->generateImage('diff.gif') . '</a>
</div>
</form>
</div>
';
}
}
// Add some buttons and end the form
$return .= '
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['save']) . '">
<input type="submit" name="saveNclose" id="saveNclose" class="tl_submit" accesskey="c" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNclose']) . '">
</div>
</div>
</form>';
// Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
$return = $version . '
<div id="tl_buttons">
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
<h2 class="sub_headline">' . $GLOBALS['TL_LANG']['tl_files']['editFF'] . '</h2>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">' . ($this->noReload ? '
<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this);
}
}
// Save the current version
if ($this->blnCreateNewVersion && \Input::post('SUBMIT_TYPE') != 'auto') {
$this->createNewVersion($this->strTable, $objFile->id);
// Call the onversion_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this->strTable, $objFile->id, $this);
}
}
$this->log('A new version of record "' . $this->strTable . '.id=' . $objFile->id . '" has been created', 'DC_Table edit()', TL_GENERAL);
}
// Set the current timestamp (-> DO NOT CHANGE THE ORDER version - timestamp)
if ($this->blnIsDbAssisted) {
$this->Database->prepare("UPDATE " . $this->strTable . " SET tstamp=? WHERE id=?")->execute(time(), $objFile->id);
}
// Redirect
if (\Input::post('saveNclose')) {
\Message::reset();
setcookie('BE_PAGE_OFFSET', 0, 0, '/');
$this->redirect($this->getReferer());
}
// Reload
if ($this->blnIsDbAssisted) {
$this->redirect($this->addToUrl('id=' . $this->urlEncode($this->objActiveRecord->path)));
} else {
$this->redirect($this->addToUrl('id=' . $this->urlEncode($this->strPath . '/' . $this->varValue) . $this->strExtension));
}
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '
<script>
window.addEvent(\'domready\', function() {
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}
return $return;
}
示例8: edit
//.........这里部分代码省略.........
}
}
// Unset a box if it does not contain any fields
if (count($boxes[$k]) < $eCount) {
unset($boxes[$k]);
}
}
$class = 'tl_tbox';
$fs = $this->Session->get('fieldset_states');
$blnIsFirst = true;
// Render boxes
foreach ($boxes as $k => $v) {
$strAjax = '';
$blnAjax = false;
$key = '';
$cls = '';
$legend = '';
if (isset($legends[$k])) {
list($key, $cls) = explode(':', $legends[$k]);
$legend = "\n" . '<legend onclick="AjaxRequest.toggleFieldset(this,\'' . $key . '\',\'' . $this->strTable . '\')">' . (isset($GLOBALS['TL_LANG'][$this->strTable][$key]) ? $GLOBALS['TL_LANG'][$this->strTable][$key] : $key) . '</legend>';
}
if (isset($fs[$this->strTable][$key])) {
$class .= $fs[$this->strTable][$key] ? '' : ' collapsed';
} else {
$class .= $cls && $legend ? ' ' . $cls : '';
}
$return .= "\n\n" . '<fieldset' . ($key ? ' id="pal_' . $key . '"' : '') . ' class="' . $class . ($legend ? '' : ' nolegend') . '">' . $legend;
// Build rows of the current box
foreach ($v as $vv) {
if ($vv == '[EOF]') {
if ($blnAjax && \Environment::get('isAjaxRequest')) {
return $strAjax . '<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">';
}
$blnAjax = false;
$return .= "\n" . '</div>';
continue;
}
if (preg_match('/^\\[.*\\]$/', $vv)) {
$thisId = 'sub_' . substr($vv, 1, -1);
$blnAjax = $ajaxId == $thisId && \Environment::get('isAjaxRequest') ? true : false;
$return .= "\n" . '<div id="' . $thisId . '">';
continue;
}
$this->strField = $vv;
$this->strInputName = $vv;
$this->varValue = '';
// Autofocus the first field
if ($blnIsFirst && $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['inputType'] == 'text') {
$GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['autofocus'] = 'autofocus';
$blnIsFirst = false;
}
// Convert CSV fields (see #2890)
if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['multiple'] && isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['csv'])) {
$this->varValue = trimsplit($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['csv'], $this->varValue);
}
// Call load_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['load_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['load_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->varValue = $this->{$callback[0]}->{$callback[1]}($this->varValue, $this);
}
}
}
// Re-set the current value
$this->objActiveRecord->{$this->strField} = $this->varValue;
// Build the row and pass the current palette string (thanks to Tristan Lins)
$blnAjax ? $strAjax .= $this->row($this->strPalette) : ($return .= $this->row($this->strPalette));
}
$class = 'tl_box';
$return .= "\n" . '</fieldset>';
}
}
// Add some buttons and end the form
$return .= '</div>' . '<div class="tl_formbody_submit">' . '<div class="tl_submit_container">' . '<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['save']) . '">' . '<input type="submit" name="saveNclose" id="saveNclose" class="tl_submit" accesskey="c" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNclose']) . '">' . '</div>' . '</div>' . '</form>' . '<script>' . ' window.addEvent(\'domready\', function() {' . ' (inp = $(\'' . $this->strTable . '\').getElement(\'input[class^="tl_text"]\')) && inp.focus();' . ' });' . '</script>';
// Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
$return = $version . '<div id="tl_buttons">' . '<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>' . '</div>' . '<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['MSC']['editRecord'], $this->intId ? $this->intId : '') . '</h2>' . \Message::generate() . '<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>' . '<div class="tl_formbody_edit">' . '<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">' . '<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">' . '<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">' . ($this->noReload ? '<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this);
}
}
// Redirect
if (isset($_POST['saveNclose'])) {
\Message::reset();
setcookie('BE_PAGE_OFFSET', 0, 0, '/');
$this->redirect($this->getReferer());
}
$this->reload();
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '<script>' . 'window.addEvent(\'domready\', function() {' . ' Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));' . '});' . '</script>';
}
return $return;
}
开发者ID:madeyourday,项目名称:contao-rocksolid-theme-assistant,代码行数:101,代码来源:ThemeAssistantDataContainer.php
示例9: edit
//.........这里部分代码省略.........
$this->import($callback[0]);
$arrButtons = $this->{$callback}[0]->{$callback}[1]($arrButtons, $this);
} elseif (is_callable($callback)) {
$arrButtons = $callback($arrButtons, $this);
}
}
}
// Add some buttons and end the form
$return .= '
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
' . implode(' ', $arrButtons) . '
</div>
</div>
</form>
<script>
window.addEvent(\'domready\', function() {
Theme.focusInput("' . $this->strTable . '");
});
</script>';
// TODO: find a better solution to handle toggleSubpalette ...
$return .= $this->getSubpaletteJavascript();
$return .= $this->getFilepickerJavascript('reloadEfgFiletree');
// Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
$return = $version . '
<div id="tl_buttons">' . (\Input::get('nb') ? ' ' : '
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>') . '
</div>
<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['MSC']['editRecord'], $this->intId ? 'ID ' . $this->intId : '') . '</h2>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">' . ($this->noReload ? '
<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
$arrValues = $this->values;
array_unshift($arrValues, time());
// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this);
} elseif (is_callable($callback)) {
$callback($this);
}
}
}
// Set the current timestamp
\Database::getInstance()->prepare("UPDATE " . $this->strTable . " SET tstamp=? WHERE " . implode(' AND ', $this->procedure))->execute($arrValues);
// Redirect
if (isset($_POST['saveNclose'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
\Controller::redirect($this->getReferer());
} elseif (isset($_POST['saveNedit'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$strUrl = \Backend::addToUrl($GLOBALS['TL_DCA'][$this->strTable]['list']['operations']['edit']['href']);
$strUrl = preg_replace('/(&)?s2e=[^&]*/i', '', $strUrl);
$strUrl = preg_replace('/(&)?act=[^&]*/i', '', $strUrl);
\Controller::redirect($strUrl);
} elseif (isset($_POST['saveNback'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
\Controller::redirect(\Environment::get('script') . '?do=' . \Input::get('do'));
} elseif (isset($_POST['saveNcreate'])) {
\Message::reset();
setcookie('BE_PAGE_OFFSET', 0, 0, '/');
$strUrl = \Environment::get('script') . '?do=' . \Input::get('do');
if (isset($_GET['table'])) {
$strUrl .= '&table=' . \Input::get('table');
}
$strUrl .= strlen($GLOBALS['TL_DCA'][$this->strTable]['config']['ptable']) ? '&act=create&mode=2&pid=' . CURRENT_ID : '&act=create';
\Controller::redirect($strUrl . '&rt=' . REQUEST_TOKEN);
}
\Controller::reload();
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '
<script>
window.addEvent(\'domready\', function() {
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}
return $return;
}
示例10: edit
//.........这里部分代码省略.........
<div id="tl_buttons">' . (\Input::get('nb') ? ' ' : '
<a href="' . \System::getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>') . $copyFallback . '
</div>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">' . ($this->noReload ? '
<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
$arrValues = $this->values;
array_unshift($arrValues, time());
// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this);
} elseif (is_callable($callback)) {
call_user_func($callback, $this);
}
}
}
// Save the current version
if ($this->blnCreateNewVersion) {
$objVersions->create();
// Call the onversion_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this->strTable, $this->objActiveRecord->id, $this);
} elseif (is_callable($callback)) {
call_user_func($callback, $this->strTable, $this->objActiveRecord->id, $this);
}
}
}
\System::log('A new version of record "' . $this->strTable . '.id=' . $this->intId . '" has been created' . $this->getParentEntries($this->strTable, $this->intId), __METHOD__, TL_GENERAL);
}
// Set the current timestamp (-> DO NOT CHANGE THE ORDER version - timestamp)
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dynamicPtable']) {
$this->Database->prepare("UPDATE " . $this->strTable . " SET ptable=?, tstamp=? WHERE id=?")->execute($this->ptable, time(), $this->intId);
} else {
$this->Database->prepare("UPDATE " . $this->strTable . " SET tstamp=? WHERE id=?")->execute(time(), $this->intId);
}
// Redirect
if (isset($_POST['saveNclose'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
\Controller::redirect(\System::getReferer());
} elseif (isset($_POST['saveNedit'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$strUrl = \Backend::addToUrl($GLOBALS['TL_DCA'][$this->strTable]['list']['operations']['edit']['href'], false);
$strUrl = preg_replace('/(&)?(s2e|act)=[^&]*/i', '', $strUrl);
\Controller::redirect($strUrl);
} elseif (isset($_POST['saveNback'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
if ($this->ptable == '') {
\Controller::redirect(TL_SCRIPT . '?do=' . \Input::get('do'));
} elseif ($this->ptable == 'tl_theme' && $this->strTable == 'tl_style_sheet' || $this->ptable == 'tl_page' && $this->strTable == 'tl_article') {
\Controller::redirect(\System::getReferer(false, $this->strTable));
} else {
\Controller::redirect(\System::getReferer(false, $this->ptable));
}
} elseif (isset($_POST['saveNcreate'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$strUrl = TL_SCRIPT . '?do=' . \Input::get('do');
if (isset($_GET['table'])) {
$strUrl .= '&table=' . \Input::get('table');
}
// Tree view
if ($this->treeView) {
$strUrl .= '&act=create&mode=1&pid=' . $this->intId;
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4 || $this->activeRecord->pid > 0) {
$strUrl .= $this->Database->fieldExists('sorting', $this->strTable) ? '&act=create&mode=1&pid=' . $this->intId . '&id=' . $this->activeRecord->pid : '&act=create&mode=2&pid=' . $this->activeRecord->pid;
} else {
$strUrl .= $this->ptable != '' ? '&act=create&mode=2&pid=' . CURRENT_ID : '&act=create';
}
\Controller::redirect($strUrl . '&rt=' . REQUEST_TOKEN);
}
\Controller::reload();
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '
<script>
window.addEvent(\'domready\', function() {
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}
return $return;
}
示例11: validateUpload
/**
* Validate the upload
* @return string
*/
public function validateUpload()
{
\Message::reset();
$strTempName = $this->strName . '_fineuploader';
$objUploader = new \FileUpload();
$objUploader->setName($this->strName);
$blnIsChunk = isset($_POST['qqpartindex']);
// Convert the $_FILES array to Contao format
if (!empty($_FILES[$strTempName])) {
$arrFile = array('name' => array($_FILES[$strTempName]['name']), 'type' => array($_FILES[$strTempName]['type']), 'tmp_name' => array($_FILES[$strTempName]['tmp_name']), 'error' => array($_FILES[$strTempName]['error']), 'size' => array($_FILES[$strTempName]['size']));
// Set the UUID as the filename
if ($blnIsChunk) {
$arrFile['name'][0] = \Input::post('qquuid') . '.chunk';
}
// Check if the file exists
if (file_exists(TL_ROOT . '/' . $this->strTemporaryPath . '/' . $arrFile['name'][0])) {
$arrFile['name'][0] = $this->getFileName($arrFile['name'][0], $this->strTemporaryPath);
}
$_FILES[$this->strName] = $arrFile;
unset($_FILES[$strTempName]);
// Unset the temporary file
}
$varInput = '';
$extensions = null;
$maxlength = null;
// Add the "chunk" extension to upload types
if ($blnIsChunk) {
$extensions = $GLOBALS['TL_CONFIG']['uploadTypes'];
$GLOBALS['TL_CONFIG']['uploadTypes'] .= ',chunk';
}
// Override the default maxlength value
if (isset($this->arrConfiguration['maxlength'])) {
$maxlength = $GLOBALS['TL_CONFIG']['maxFileSize'];
$GLOBALS['TL_CONFIG']['maxFileSize'] = $this->arrConfiguration['maxlength'];
}
try {
$varInput = $objUploader->uploadTo($this->strTemporaryPath);
if ($objUploader->hasError()) {
foreach ($_SESSION['TL_ERROR'] as $strError) {
$this->addError($strError);
}
}
\Message::reset();
} catch (\Exception $e) {
$this->addError($e->getMessage());
}
// Restore the default maxlength value
if ($maxlength !== null) {
$GLOBALS['TL_CONFIG']['maxFileSize'] = $maxlength;
}
// Restore the default extensions value
if ($extensions !== null) {
$GLOBALS['TL_CONFIG']['uploadTypes'] = $extensions;
}
if (!is_array($varInput) || empty($varInput)) {
$this->addError($GLOBALS['TL_LANG']['MSC']['fineuploader_error']);
}
$varInput = $varInput[0];
// Store the chunk in the session for further merge
if ($blnIsChunk) {
$_SESSION[$this->strName . '_FINEUPLOADER_CHUNKS'][\Input::post('qqfilename')][] = $varInput;
// This is the last chunking request, merge the chunks and create the final file
if (\Input::post('qqpartindex') == \Input::post('qqtotalparts') - 1) {
$strFileName = \Input::post('qqfilename');
// Get the new file name
if (file_exists(TL_ROOT . '/' . $this->strTemporaryPath . '/' . $strFileName)) {
$strFileName = $this->getFileName($strFileName, $this->strTemporaryPath);
}
$objFile = new \File($this->strTemporaryPath . '/' . $strFileName);
// Merge the chunks
foreach ($_SESSION[$this->strName . '_FINEUPLOADER_CHUNKS'][\Input::post('qqfilename')] as $strChunk) {
$objFile->append(file_get_contents(TL_ROOT . '/' . $strChunk), '');
// Delete the file
\Files::getInstance()->delete($strChunk);
}
$objFile->close();
$varInput = $objFile->path;
}
}
return $varInput;
}
示例12: printDocument
/**
* Pass an order to the document
* @param DataContainer
*/
public function printDocument(\DataContainer $dc)
{
$strRedirectUrl = str_replace('&key=print_document', '', \Environment::get('request'));
if (\Input::post('FORM_SUBMIT') == 'tl_iso_print_document') {
if (($objOrder = Order::findByPk($dc->id)) === null) {
\Message::addError('Could not find order id.');
\Controller::redirect($strRedirectUrl);
}
if (($objConfig = $objOrder->getRelated('config_id')) === null) {
\Message::addError('Could not find config id.');
\Controller::redirect($strRedirectUrl);
}
// Set current config
Isotope::setConfig($objConfig);
/** @var \Isotope\Interfaces\IsotopeDocument $objDocument */
if (($objDocument = Document::findByPk(\Input::post('document'))) === null) {
\Message::addError('Could not find document id.');
\Controller::redirect($strRedirectUrl);
}
$objDocument->outputToBrowser($objOrder);
}
$arrSelect = array('name' => 'document', 'label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['document_choice'], 'inputType' => 'select', 'foreignKey' => 'tl_iso_document.name', 'eval' => array('mandatory' => true));
$objSelect = new \SelectMenu(\SelectMenu::getAttributesFromDca($arrSelect, $arrSelect['name']));
$strMessages = \Message::generate();
\Message::reset();
// Return form
return '
<div id="tl_buttons">
<a href="' . ampersand($strRedirectUrl) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBT']) . '">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['print_document'][1], $dc->id) . '</h2>' . $strMessages . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_iso_product_import" class="tl_form" method="post">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="tl_iso_print_document">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<div class="tl_tbox block">
' . $objSelect->parse() . '
<p class="tl_help">' . $objSelect->description . '</p>
</div>
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
<input type="submit" name="print" id="print" class="tl_submit" alt="" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_iso_product_collection']['print']) . '">
</div>
</div>
</form>';
}
示例13: validateUpload
/**
* Validate the upload
* @return string
*/
public function validateUpload()
{
\Message::reset();
$strTempName = $this->strName . '_upload';
$objUploader = new \FileUpload();
$objUploader->setName($this->strName);
// Convert the $_FILES array to Contao format
if (!empty($_FILES[$strTempName])) {
$arrFile = array('name' => array($_FILES[$strTempName]['name']), 'type' => array($_FILES[$strTempName]['type']), 'tmp_name' => array($_FILES[$strTempName]['tmp_name']), 'error' => array($_FILES[$strTempName]['error']), 'size' => array($_FILES[$strTempName]['size']));
// Check if the file exists
if (file_exists(TL_ROOT . '/' . $this->strTemporaryPath . '/' . $arrFile['name'][0])) {
$arrFile['name'][0] = $this->getFileName($arrFile['name'][0], $this->strTemporaryPath);
}
$_FILES[$this->strName] = $arrFile;
unset($_FILES[$strTempName]);
// Unset the temporary file
}
$varInput = '';
$maxlength = null;
// Override the default maxlength value
if (isset($this->arrConfiguration['maxlength'])) {
$maxlength = $GLOBALS['TL_CONFIG']['maxFileSize'];
$GLOBALS['TL_CONFIG']['maxFileSize'] = $this->getMaximumFileSize();
}
try {
$varInput = $objUploader->uploadTo($this->strTemporaryPath);
if ($objUploader->hasError()) {
foreach ($_SESSION['TL_ERROR'] as $strError) {
$this->addError($strError);
}
}
\Message::reset();
} catch (\Exception $e) {
$this->addError($e->getMessage());
}
// Restore the default maxlength value
if ($maxlength !== null) {
$GLOBALS['TL_CONFIG']['maxFileSize'] = $maxlength;
}
if (!is_array($varInput) || empty($varInput)) {
$this->addError($GLOBALS['TL_LANG']['MSC']['avatar_error']);
}
$varInput = $varInput[0];
$strExtension = pathinfo($varInput, PATHINFO_EXTENSION);
$arrAllowedTypes = trimsplit(',', strtolower($this->getAllowedExtensions()));
// File type not allowed
if (!in_array(strtolower($strExtension), $arrAllowedTypes)) {
$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['filetype'], $strExtension));
}
// Check image size
if (($arrImageSize = @getimagesize(TL_ROOT . '/' . $varInput)) !== false) {
// Image exceeds maximum image width
if ($arrImageSize[0] > $GLOBALS['TL_CONFIG']['imageWidth']) {
$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['filewidth'], '', $GLOBALS['TL_CONFIG']['imageWidth']));
}
// Image exceeds maximum image height
if ($arrImageSize[1] > $GLOBALS['TL_CONFIG']['imageHeight']) {
$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['fileheight'], '', $GLOBALS['TL_CONFIG']['imageHeight']));
}
// Image exceeds minimum image width
if ($arrImageSize[0] < $this->arrAvatarSize[0]) {
$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['avatar_width'], $this->arrAvatarSize[0]));
}
// Image exceeds minimum image height
if ($arrImageSize[1] < $this->arrAvatarSize[1]) {
$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['avatar_height'], $this->arrAvatarSize[1]));
}
}
return $varInput;
}
示例14: edit
//.........这里部分代码省略.........
<input type="submit" name="saveNcreate" id="saveNcreate" class="tl_submit" accesskey="n" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNcreate']) . '"> ' : '') . (\Input::get('s2e') ? '
<input type="submit" name="saveNedit" id="saveNedit" class="tl_submit" accesskey="e" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNedit']) . '"> ' : ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4 || strlen($this->ptable) || $GLOBALS['TL_DCA'][$this->strTable]['config']['switchToEdit'] ? '
<input type="submit" name="saveNback" id="saveNback" class="tl_submit" accesskey="g" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNback']) . '"> ' : '')) . '
</div>
</div>
</form>';
// Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
$return = $version . '
<div id="tl_buttons">
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['MSC']['editRecord'], $this->intId ? 'ID ' . $this->intId : '') . '</h2>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">' . ($this->noReload ? '
<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
$arrValues = $this->values;
array_unshift($arrValues, time());
// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this);
}
}
// Save the current version
if ($this->blnCreateNewVersion && \Input::post('SUBMIT_TYPE') != 'auto') {
$this->createNewVersion($this->strTable, $this->intId);
// Call the onversion_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this->strTable, $this->intId, $this);
}
}
$this->log('A new version of record "' . $this->strTable . '.id=' . $this->intId . '" has been created' . $this->getParentEntries($this->strTable, $this->intId), 'DC_Table edit()', TL_GENERAL);
}
// Set the current timestamp (-> DO NOT CHANGE THE ORDER version - timestamp)
$this->Database->prepare("UPDATE " . $this->strTable . " SET tstamp=? WHERE id=?")->execute(time(), $this->intId);
// Redirect
if (isset($_POST['saveNclose'])) {
\Message::reset();
setcookie('BE_PAGE_OFFSET', 0, 0, '/');
$this->redirect($this->getReferer());
} elseif (isset($_POST['saveNedit'])) {
\Message::reset();
setcookie('BE_PAGE_OFFSET', 0, 0, '/');
$strUrl = $this->addToUrl($GLOBALS['TL_DCA'][$this->strTable]['list']['operations']['edit']['href']);
$strUrl = preg_replace('/(&)?s2e=[^&]*/i', '', $strUrl);
$strUrl = preg_replace('/(&)?act=[^&]*/i', '', $strUrl);
$this->redirect($strUrl);
} elseif (isset($_POST['saveNback'])) {
\Message::reset();
setcookie('BE_PAGE_OFFSET', 0, 0, '/');
if ($this->ptable == '') {
$this->redirect(\Environment::get('script') . '?do=' . \Input::get('do'));
} elseif ($this->ptable == 'tl_theme' && $this->strTable == 'tl_style_sheet' || $this->ptable == 'tl_page' && $this->strTable == 'tl_article') {
$this->redirect($this->getReferer(false, $this->strTable));
} else {
$this->redirect($this->getReferer(false, $this->ptable));
}
} elseif (isset($_POST['saveNcreate'])) {
\Message::reset();
setcookie('BE_PAGE_OFFSET', 0, 0, '/');
$strUrl = \Environment::get('script') . '?do=' . \Input::get('do');
if (isset($_GET['table'])) {
$strUrl .= '&table=' . \Input::get('table');
}
// Tree view
if ($this->treeView) {
$strUrl .= '&act=create&mode=1&pid=' . $this->intId;
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4) {
$strUrl .= $this->Database->fieldExists('sorting', $this->strTable) ? '&act=create&mode=1&pid=' . $this->intId . '&id=' . $this->activeRecord->pid : '&act=create&mode=2&pid=' . $this->activeRecord->pid;
} else {
$strUrl .= $this->ptable != '' ? '&act=create&mode=2&pid=' . CURRENT_ID : '&act=create';
}
$this->redirect($strUrl);
}
$this->reload();
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '
<script>
window.addEvent(\'domready\', function() {
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}
return $return;
}
示例15: edit
//.........这里部分代码省略.........
<div id="tl_buttons">' . (\Input::get('nb') ? ' ' : '
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>') . '
</div>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"' . (!empty($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">' . ($this->noReload ? '
<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
// Reload the page to prevent _POST variables from being sent twice
if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
$arrValues = $this->values;
array_unshift($arrValues, time());
// Trigger the onsubmit_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this);
} elseif (is_callable($callback)) {
$callback($this);
}
}
}
// Save the current version
if ($this->blnCreateNewVersion) {
$objVersions->create();
// Call the onversion_callback
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'])) {
@trigger_error('Using the onversion_callback has been deprecated and will no longer work in Contao 5.0. Use the oncreate_version_callback instead.', E_USER_DEPRECATED);
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this->strTable, $this->intId, $this);
} elseif (is_callable($callback)) {
$callback($this->strTable, $this->intId, $this);
}
}
}
}
// Set the current timestamp (-> DO NOT CHANGE THE ORDER version - timestamp)
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dynamicPtable']) {
$this->Database->prepare("UPDATE " . $this->strTable . " SET ptable=?, tstamp=? WHERE id=?")->execute($this->ptable, time(), $this->intId);
} else {
$this->Database->prepare("UPDATE " . $this->strTable . " SET tstamp=? WHERE id=?")->execute(time(), $this->intId);
}
// Redirect
if (isset($_POST['saveNclose'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$this->redirect($this->getReferer());
} elseif (isset($_POST['saveNedit'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$strUrl = $this->addToUrl($GLOBALS['TL_DCA'][$this->strTable]['list']['operations']['edit']['href'], false);
$strUrl = preg_replace('/(&)?(s2e|act)=[^&]*/i', '', $strUrl);
$this->redirect($strUrl);
} elseif (isset($_POST['saveNback'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
if ($this->ptable == '') {
$this->redirect(TL_SCRIPT . '?do=' . \Input::get('do'));
} elseif ($this->ptable == 'tl_theme' && $this->strTable == 'tl_style_sheet' || $this->ptable == 'tl_page' && $this->strTable == 'tl_article') {
$this->redirect($this->getReferer(false, $this->strTable));
} else {
$this->redirect($this->getReferer(false, $this->ptable));
}
} elseif (isset($_POST['saveNcreate'])) {
\Message::reset();
\System::setCookie('BE_PAGE_OFFSET', 0, 0);
$strUrl = TL_SCRIPT . '?do=' . \Input::get('do');
if (isset($_GET['table'])) {
$strUrl .= '&table=' . \Input::get('table');
}
// Tree view
if ($this->treeView) {
$strUrl .= '&act=create&mode=1&pid=' . $this->intId;
} elseif ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4) {
$strUrl .= $this->Database->fieldExists('sorting', $this->strTable) ? '&act=create&mode=1&pid=' . $this->intId . '&id=' . $this->activeRecord->pid : '&act=create&mode=2&pid=' . $this->activeRecord->pid;
} else {
$strUrl .= $this->ptable != '' ? '&act=create&mode=2&pid=' . CURRENT_ID : '&act=create';
}
$this->redirect($strUrl . '&rt=' . REQUEST_TOKEN);
}
$this->reload();
}
// Set the focus if there is an error
if ($this->noReload) {
$return .= '
<script>
window.addEvent(\'domready\', function() {
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}
return $return;
}