本文整理汇总了PHP中array_duplicate函数的典型用法代码示例。如果您正苦于以下问题:PHP array_duplicate函数的具体用法?PHP array_duplicate怎么用?PHP array_duplicate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_duplicate函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Generate the widget and return it as string
*
* @return string
*/
public function generate()
{
$arrButtons = array('copy', 'drag', 'up', 'down', 'delete');
$strCommand = 'cmd_' . $this->strField;
// Change the order
if (\Input::get($strCommand) && is_numeric(\Input::get('cid')) && \Input::get('id') == $this->currentRecord) {
$this->import('Database');
switch (\Input::get($strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, \Input::get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, \Input::get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, \Input::get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, \Input::get('cid'));
break;
}
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', \Environment::get('request'))));
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || empty($this->varValue)) {
$this->varValue = array('');
}
// Initialize the tab index
if (!\Cache::has('tabindex')) {
\Cache::set('tabindex', 1);
}
$tabindex = \Cache::get('tabindex');
$return = '<ul id="ctrl_' . $this->strId . '" class="tl_listwizard" data-tabindex="' . $tabindex . '">';
// Add input fields
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$return .= '
<li><input type="text" name="' . $this->strId . '[]" class="tl_text" tabindex="' . $tabindex++ . '" value="' . specialchars($this->varValue[$i]) . '"' . $this->getAttributes() . '> ';
// Add buttons
foreach ($arrButtons as $button) {
$class = $button == 'up' || $button == 'down' ? ' class="button-move"' : '';
if ($button == 'drag') {
$return .= \Image::getHtml('drag.gif', '', 'class="drag-handle" title="' . sprintf($GLOBALS['TL_LANG']['MSC']['move']) . '"');
} else {
$return .= '<a href="' . $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=' . $i . '&id=' . $this->currentRecord) . '"' . $class . ' title="' . specialchars($GLOBALS['TL_LANG']['MSC']['lw_' . $button]) . '" onclick="Backend.listWizard(this,\'' . $button . '\',\'ctrl_' . $this->strId . '\');return false">' . \Image::getHtml($button . '.gif', $GLOBALS['TL_LANG']['MSC']['lw_' . $button], 'class="tl_listwizard_img"') . '</a> ';
}
}
$return .= '</li>';
}
// Store the tab index
\Cache::set('tabindex', $tabindex);
return $return . '
</ul>';
}
示例2: generate
/**
* Generate the widget and return it as string
*
* @return string
*/
public function generate()
{
$this->import('Database');
$arrButtons = array('edit', 'copy', 'delete', 'enable', 'drag', 'up', 'down');
$strCommand = 'cmd_' . $this->strField;
// Change the order
if (\Input::get($strCommand) && is_numeric(\Input::get('cid')) && \Input::get('id') == $this->currentRecord) {
switch (\Input::get($strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, \Input::get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, \Input::get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, \Input::get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, \Input::get('cid'));
break;
}
}
// Get all modules of the current theme
$objModules = $this->Database->prepare("SELECT id, name, type FROM tl_module WHERE pid=(SELECT pid FROM " . $this->strTable . " WHERE id=?) ORDER BY name")->execute($this->currentRecord);
// Add the articles module
$modules[] = array('id' => 0, 'name' => $GLOBALS['TL_LANG']['MOD']['article'][0], 'type' => 'article');
if ($objModules->numRows) {
$modules = array_merge($modules, $objModules->fetchAllAssoc());
}
$GLOBALS['TL_LANG']['FMD']['article'] = $GLOBALS['TL_LANG']['MOD']['article'];
// Add the module type (see #3835)
foreach ($modules as $k => $v) {
$v['type'] = $GLOBALS['TL_LANG']['FMD'][$v['type']][0];
$modules[$k] = $v;
}
$objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->limit(1)->execute($this->currentRecord);
// Show all columns and filter in PageRegular (see #3273)
$cols = array('header', 'left', 'right', 'main', 'footer');
$arrSections = trimsplit(',', $objRow->sections);
// Add custom page sections
if (!empty($arrSections) && is_array($arrSections)) {
$cols = array_merge($cols, $arrSections);
}
// Get the new value
if (\Input::post('FORM_SUBMIT') == $this->strTable) {
$this->varValue = \Input::post($this->strId);
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || !$this->varValue[0]) {
$this->varValue = array('');
} else {
$arrCols = array();
// Initialize the sorting order
foreach ($cols as $col) {
$arrCols[$col] = array();
}
foreach ($this->varValue as $v) {
$arrCols[$v['col']][] = $v;
}
$this->varValue = array();
foreach ($arrCols as $arrCol) {
$this->varValue = array_merge($this->varValue, $arrCol);
}
}
// Save the value
if (\Input::get($strCommand) || \Input::post('FORM_SUBMIT') == $this->strTable) {
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
// Reload the page
if (is_numeric(\Input::get('cid')) && \Input::get('id') == $this->currentRecord) {
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', \Environment::get('request'))));
}
}
// Initialize the tab index
if (!\Cache::has('tabindex')) {
\Cache::set('tabindex', 1);
}
$tabindex = \Cache::get('tabindex');
// Add the label and the return wizard
$return = '<table id="ctrl_' . $this->strId . '" class="tl_modulewizard">
<thead>
<tr>
<th>' . $GLOBALS['TL_LANG']['MSC']['mw_module'] . '</th>
<th>' . $GLOBALS['TL_LANG']['MSC']['mw_column'] . '</th>
<th> </th>
</tr>
</thead>
<tbody class="sortable" data-tabindex="' . $tabindex . '">';
// Add the input fields
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$options = '';
// Add modules
foreach ($modules as $v) {
$options .= '<option value="' . specialchars($v['id']) . '"' . static::optionSelected($v['id'], $this->varValue[$i]['mod']) . '>' . $v['name'] . ' [' . $v['type'] . ']</option>';
}
$return .= '
//.........这里部分代码省略.........
示例3: generate
/**
* Generate the widget and return it as string
*
* @return string
*/
public function generate()
{
$arrColButtons = array('ccopy', 'cmovel', 'cmover', 'cdelete');
$arrRowButtons = array('rcopy', 'rdrag', 'rup', 'rdown', 'rdelete');
$strCommand = 'cmd_' . $this->strField;
// Change the order
if (\Input::get($strCommand) && is_numeric(\Input::get('cid')) && \Input::get('id') == $this->currentRecord) {
$this->import('Database');
switch (\Input::get($strCommand)) {
case 'ccopy':
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$this->varValue[$i] = array_duplicate($this->varValue[$i], \Input::get('cid'));
}
break;
case 'cmovel':
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$this->varValue[$i] = array_move_up($this->varValue[$i], \Input::get('cid'));
}
break;
case 'cmover':
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$this->varValue[$i] = array_move_down($this->varValue[$i], \Input::get('cid'));
}
break;
case 'cdelete':
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$this->varValue[$i] = array_delete($this->varValue[$i], \Input::get('cid'));
}
break;
case 'rcopy':
$this->varValue = array_duplicate($this->varValue, \Input::get('cid'));
break;
case 'rup':
$this->varValue = array_move_up($this->varValue, \Input::get('cid'));
break;
case 'rdown':
$this->varValue = array_move_down($this->varValue, \Input::get('cid'));
break;
case 'rdelete':
$this->varValue = array_delete($this->varValue, \Input::get('cid'));
break;
}
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', \Environment::get('request'))));
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || empty($this->varValue)) {
$this->varValue = array(array(''));
}
// Initialize the tab index
if (!\Cache::has('tabindex')) {
\Cache::set('tabindex', 1);
}
$tabindex = \Cache::get('tabindex');
// Begin the table
$return = '<div id="tl_tablewizard">
<table id="ctrl_' . $this->strId . '" class="tl_tablewizard">
<thead>
<tr>';
// Add column buttons
for ($i = 0, $c = count($this->varValue[0]); $i < $c; $i++) {
$return .= '
<td style="text-align:center; white-space:nowrap">';
// Add column buttons
foreach ($arrColButtons as $button) {
$return .= '<a href="' . $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=' . $i . '&id=' . $this->currentRecord) . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['tw_' . $button]) . '" onclick="Backend.tableWizard(this,\'' . $button . '\',\'ctrl_' . $this->strId . '\');return false">' . \Image::getHtml(substr($button, 1) . '.gif', $GLOBALS['TL_LANG']['MSC']['tw_' . $button], 'class="tl_tablewizard_img"') . '</a> ';
}
$return .= '</td>';
}
$return .= '
<td></td>
</tr>
</thead>
<tbody class="sortable" data-tabindex="' . $tabindex . '">';
// Add rows
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$return .= '
<tr>';
// Add cells
for ($j = 0, $d = count($this->varValue[$i]); $j < $d; $j++) {
$return .= '
<td class="tcontainer"><textarea name="' . $this->strId . '[' . $i . '][' . $j . ']" class="tl_textarea noresize" tabindex="' . $tabindex++ . '" rows="' . $this->intRows . '" cols="' . $this->intCols . '"' . $this->getAttributes() . '>' . specialchars($this->varValue[$i][$j]) . '</textarea></td>';
}
$return .= '
<td style="white-space:nowrap">';
// Add row buttons
foreach ($arrRowButtons as $button) {
$class = $button == 'rup' || $button == 'rdown' ? ' class="button-move"' : '';
if ($button == 'rdrag') {
$return .= \Image::getHtml('drag.gif', '', 'class="drag-handle" title="' . sprintf($GLOBALS['TL_LANG']['MSC']['move']) . '"');
} else {
$return .= '<a href="' . $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=' . $i . '&id=' . $this->currentRecord) . '"' . $class . ' title="' . specialchars($GLOBALS['TL_LANG']['MSC']['tw_' . $button]) . '" onclick="Backend.tableWizard(this,\'' . $button . '\',\'ctrl_' . $this->strId . '\');return false">' . \Image::getHtml(substr($button, 1) . '.gif', $GLOBALS['TL_LANG']['MSC']['tw_' . $button], 'class="tl_tablewizard_img"') . '</a> ';
}
}
$return .= '</td>
//.........这里部分代码省略.........
示例4: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
$arrButtons = array('copy', 'up', 'down', 'delete');
$strCommand = 'cmd_' . $this->strField;
// Change the order
if ($this->Input->get($strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
$this->import('Database');
switch ($this->Input->get($strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || count($this->varValue) < 1) {
$this->varValue = array('');
}
$tabindex = 0;
$return .= '<ul id="ctrl_' . $this->strId . '" class="tl_listwizard">';
// Add input fields
for ($i = 0; $i < count($this->varValue); $i++) {
$return .= '
<li><input type="text" name="' . $this->strId . '[]" class="tl_text" tabindex="' . ++$tabindex . '" value="' . specialchars($this->varValue[$i]) . '"' . $this->getAttributes() . '> ';
// Add buttons
foreach ($arrButtons as $button) {
$return .= '<a href="' . $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=' . $i . '&id=' . $this->currentRecord) . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['lw_' . $button]) . '" onclick="Backend.listWizard(this, \'' . $button . '\', \'ctrl_' . $this->strId . '\'); return false;">' . $this->generateImage($button . '.gif', $GLOBALS['TL_LANG']['MSC']['lw_' . $button], 'class="tl_listwizard_img"') . '</a> ';
}
$return .= '</li>';
}
return $return . '
</ul>';
}
示例5: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
// load the callback data if there's any (do not do this in __set() already because then we don't have access to currentRecord)
if (is_array($this->arrCallback)) {
$this->import($this->arrCallback[0]);
$this->columnFields = $this->{$this->arrCallback[0]}->{$this->arrCallback[1]}($this);
}
// use BE script in FE for now
$GLOBALS['TL_JAVASCRIPT']['mcw'] = $GLOBALS['TL_CONFIG']['debugMode'] ? 'system/modules/multicolumnwizard/html/js/multicolumnwizard_be_src.js' : 'system/modules/multicolumnwizard/html/js/multicolumnwizard_be.js';
$GLOBALS['TL_CSS']['mcw'] = $GLOBALS['TL_CONFIG']['debugMode'] ? 'system/modules/multicolumnwizard/html/css/multicolumnwizard_src.css' : 'system/modules/multicolumnwizard/html/css/multicolumnwizard.css';
$this->strCommand = 'cmd_' . $this->strField;
// Change the order
if ($this->Input->get($this->strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
switch ($this->Input->get($this->strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
// Save in File
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'File') {
$this->Config->update(sprintf("\$GLOBALS['TL_CONFIG']['%s']", $this->strField), serialize($this->varValue));
// Reload the page
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($this->strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
} else {
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'Table') {
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['save_callback'])) {
$dataContainer = 'DC_' . $GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'];
// If less than 3.X, we must load the class by hand.
if (version_compare(VERSION, '3.0', '<')) {
require_once sprintf('%s/system/drivers/%s.php', TL_ROOT, $dataContainer);
}
$dc = new $dataContainer($this->strTable);
$dc->field = $objWidget->id;
$dc->inputName = $objWidget->id;
foreach ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['save_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1](serialize($this->varValue), $dc);
}
} else {
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
}
// Reload the page
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($this->strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
} else {
// What to do here?
}
}
}
$arrUnique = array();
$arrDatepicker = array();
$arrColorpicker = array();
$arrTinyMCE = array();
$arrHeaderItems = array();
foreach ($this->columnFields as $strKey => $arrField) {
// Store unique fields
if ($arrField['eval']['unique']) {
$arrUnique[] = $strKey;
}
// Store date picker fields
if ($arrField['eval']['datepicker']) {
$arrDatepicker[] = $strKey;
}
// Store color picker fields
if ($arrField['eval']['colorpicker']) {
$arrColorpicker[] = $strKey;
}
// Store tiny mce fields
if ($arrField['eval']['rte'] && strncmp($arrField['eval']['rte'], 'tiny', 4) === 0) {
foreach ($this->varValue as $row => $value) {
$tinyId = 'ctrl_' . $this->strField . '_row' . $row . '_' . $strKey;
$GLOBALS['TL_RTE']['tinyMCE'][$tinyId] = array('id' => $tinyId, 'file' => 'tinyMCE', 'type' => null);
}
$arrTinyMCE[] = $strKey;
}
if ($arrField['inputType'] == 'hidden') {
continue;
}
}
$intNumberOfRows = max(count($this->varValue), 1);
// always show the minimum number of rows if set
if ($this->minCount && $intNumberOfRows < $this->minCount) {
$intNumberOfRows = $this->minCount;
}
$arrItems = array();
$arrHiddenHeader = array();
// Add input fields
for ($i = 0; $i < $intNumberOfRows; $i++) {
//.........这里部分代码省略.........
示例6: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
if (is_array($GLOBALS['TL_JAVASCRIPT'])) {
array_insert($GLOBALS['TL_JAVASCRIPT'], 1, 'system/modules/MultiTextWizard/html/js/multitext.js');
} else {
$GLOBALS['TL_JAVASCRIPT'] = array('system/modules/MultiTextWizard/html/js/multitext.js');
}
$arrButtons = array('rnew', 'rcopy', 'rup', 'rdown', 'rdelete');
$strCommand = 'cmd_' . $this->strField;
$emptyarray = array();
for ($i = 0; $i < count($this->arrColumns); $i++) {
array_push($emptyarray, '');
}
// Change the order
if ($this->Input->get($strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
$this->import('Database');
switch ($this->Input->get($strCommand)) {
case 'rnew':
array_insert($this->varValue, $this->Input->get('cid') + 1, array($emptyarray));
break;
case 'rcopy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'rup':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'rdown':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'rdelete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || !$this->varValue[0]) {
$this->varValue = array($emptyarray);
}
$objTemplate = new BackendTemplate($this->strMultitextTemplate);
$objTemplate->strId = $this->strId;
$objTemplate->attributes = $this->getAttributes();
$objTemplate->arrColumns = $this->arrColumns;
$objTemplate->varValue = $this->varValue;
$objTemplate->arrMultiErrors = $this->arrMultiErrors;
$buttons = array();
$hasTitles = array_key_exists('buttonTitles', $this->arrConfiguration) && is_array($this->arrConfiguration['buttonTitles']);
foreach ($arrButtons as $button) {
$buttontitle = $hasTitles && array_key_exists($button, $this->arrConfiguration['buttonTitles']) ? $this->arrConfiguration['buttonTitles'][$button] : $GLOBALS['TL_LANG'][$this->strTable][$button][0];
array_push($buttons, array('href' => $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=%s&id=' . $this->currentRecord), 'title' => specialchars($buttontitle), 'onclick' => 'MultiText.multitextWizard(this, \'' . $button . '\', \'ctrl_' . $this->strId . '\'); return false;', 'img' => $this->generateImage(substr($button, 1) . '.gif', $GLOBALS['TL_LANG'][$this->strTable][$button][0], 'class="tl_multitextwizard_img"')));
}
$objTemplate->arrButtons = $buttons;
return $objTemplate->parse();
}
示例7: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/isotope/html/backend.js';
if (!is_array($this->varValue)) {
$this->varValue = array(array('name' => 'gallery'), array('name' => 'thumbnail'), array('name' => 'medium'), array('name' => 'large'));
}
$arrButtons = array('copy', 'delete');
$strCommand = 'cmd_' . $this->strField;
// Change the order
if ($this->Input->get($strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
switch ($this->Input->get($strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
}
// Begin table
$return .= '<table class="tl_imagewatermarkwizard" id="ctrl_' . $this->strId . '">
<thead>
<tr>
<th>' . $GLOBALS['TL_LANG'][$this->strTable]['iwName'] . '</th>
<th>' . $GLOBALS['TL_LANG'][$this->strTable]['iwWidth'] . '</th>
<th>' . $GLOBALS['TL_LANG'][$this->strTable]['iwHeight'] . '</th>
<th>' . $GLOBALS['TL_LANG'][$this->strTable]['iwMode'] . '</th>
<th>' . $GLOBALS['TL_LANG'][$this->strTable]['iwWatermark'] . '</th>
<th>' . $GLOBALS['TL_LANG'][$this->strTable]['iwPosition'] . '</th>
<th> </th>
</tr>
</thead>
<tbody>';
foreach ($this->varValue as $i => $size) {
$arrModes = array();
$arrPositions = array();
foreach ($this->arrOptions as $arrOption) {
$arrModes[] = sprintf('<option value="%s"%s>%s</option>', specialchars($arrOption['value']), is_array($this->varValue[$i]) && $this->varValue[$i]['mode'] == $arrOption['value'] ? ' selected="selected"' : '', $arrOption['label']);
}
foreach (array('tl', 'tc', 'tr', 'bl', 'bc', 'br', 'cc') as $option) {
$arrPositions[] = sprintf('<option value="%s"%s>%s</option>', specialchars($option), is_array($this->varValue[$i]) && $this->varValue[$i]['position'] == $option ? ' selected="selected"' : '', $GLOBALS['TL_LANG'][$this->strTable][$option]);
}
$filepicker = $this->generateImage('pickfile.gif', $GLOBALS['TL_LANG']['MSC']['filepicker'], 'style="vertical-align:top; cursor:pointer;" onclick="Backend.pickFile(this.getPrevious())"');
$return .= '
<tr>
<td><input type="text" name="' . $this->strName . '[' . $i . '][name]" id="' . $this->strId . '_name_' . $i . '" class="tl_text_4" value="' . specialchars($this->varValue[$i]['name']) . '""></td>
<td><input type="text" name="' . $this->strName . '[' . $i . '][width]" id="' . $this->strId . '_width_' . $i . '" class="tl_text_4" value="' . specialchars($this->varValue[$i]['width']) . '""></td>
<td><input type="text" name="' . $this->strName . '[' . $i . '][height]" id="' . $this->strId . '_height_' . $i . '" class="tl_text_4" value="' . specialchars($this->varValue[$i]['height']) . '""></td>
<td><select name="' . $this->strName . '[' . $i . '][mode]" id="' . $this->strId . '_mode_' . $i . '" class="tl_select_interval" onfocus="Backend.getScrollOffset();">' . implode(' ', $arrModes) . '</select></td>
<td><input type="text" name="' . $this->strName . '[' . $i . '][watermark]" id="' . $this->strId . '_watermark_' . $i . '" class="tl_text_2" value="' . specialchars($this->varValue[$i]['watermark']) . '"">' . $filepicker . '</td>
<td><select name="' . $this->strName . '[' . $i . '][position]" id="' . $this->strId . '_position_' . $i . '" class="tl_select_unit" onfocus="Backend.getScrollOffset();">' . implode(' ', $arrPositions) . '</select></td>';
$return .= '
<td>';
foreach ($arrButtons as $button) {
$return .= '<a href="' . $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=' . $i . '&id=' . $this->currentRecord) . '" title="' . specialchars($GLOBALS['TL_LANG'][$this->strTable]['wz_' . $button]) . '" onclick="Isotope.imageWatermarkWizard(this, \'' . $button . '\', \'ctrl_' . $this->strId . '\'); return false;">' . $this->generateImage($button . '.gif', $GLOBALS['TL_LANG'][$this->strTable]['wz_' . $button], 'class="tl_listwizard_img"') . '</a> ';
}
$return .= '</td>
</tr>';
}
return $return . '
</tbody>
</table>';
}
示例8: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
// load the callback data if there's any (do not do this in __set() already because then we don't have access to currentRecord)
if (is_array($this->arrCallback)) {
$this->import($this->arrCallback[0]);
$this->columnFields = $this->{$this->arrCallback[0]}->{$this->arrCallback[1]}($this);
}
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/multicolumnwizard/html/js/multicolumnwizard_' . strtolower(TL_MODE) . '.js';
$GLOBALS['TL_CSS'][] = 'system/modules/multicolumnwizard/html/css/multicolumnwizard.css';
$this->strCommand = 'cmd_' . $this->strField;
// Change the order
if ($this->Input->get($this->strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
switch ($this->Input->get($this->strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'File') {
$this->Config->update(sprintf("\$GLOBALS['TL_CONFIG']['%s']", $this->strField), serialize($this->varValue));
} else {
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['save_callback'])) {
$dataContainer = 'DC_' . $GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'];
require_once sprintf('%s/system/drivers/%s.php', TL_ROOT, $dataContainer);
$dc = new $dataContainer($this->strTable);
$dc->field = $objWidget->id;
$dc->inputName = $objWidget->id;
foreach ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['save_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1](serialize($this->varValue), $dc);
}
} else {
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
}
}
// Reload the page
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($this->strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
}
$arrUnique = array();
$arrDatepicker = array();
$arrHeaderItems = array();
foreach ($this->columnFields as $strKey => $arrField) {
// Store unique fields
if ($arrField['eval']['unique']) {
$arrUnique[] = $strKey;
}
// Store date picker fields
if ($arrField['eval']['datepicker']) {
$arrDatepicker[] = $strKey;
}
if ($arrField['inputType'] == 'hidden') {
continue;
}
}
$intNumberOfRows = max(count($this->varValue), 1);
// always show the minimum number of rows if set
if ($this->minCount && $intNumberOfRows < $this->minCount) {
$intNumberOfRows = $this->minCount;
}
$arrItems = array();
// Add input fields
for ($i = 0; $i < $intNumberOfRows; $i++) {
$this->activeRow = $i;
$strHidden = '';
// Walk every column
foreach ($this->columnFields as $strKey => $arrField) {
$strWidget = '';
// load row specific data (useful for example for default values in different rows)
if (isset($this->arrRowSpecificData[$i][$strKey])) {
$arrField = array_merge($arrField, $this->arrRowSpecificData[$i][$strKey]);
}
$objWidget = $this->initializeWidget($arrField, $i, $strKey, $this->varValue[$i][$strKey]);
// load errors if there are any
if (!empty($this->arrWidgetErrors[$strKey][$i])) {
foreach ($this->arrWidgetErrors[$strKey][$i] as $strErrorMsg) {
$objWidget->addError($strErrorMsg);
}
}
if ($objWidget === null) {
continue;
} elseif (is_string($objWidget)) {
$strWidget = $objWidget;
} elseif ($arrField['inputType'] == 'hidden') {
$strHidden .= $objWidget->generate();
continue;
} else {
$datepicker = '';
// Datepicker
//.........这里部分代码省略.........
示例9: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/isotope/html/backend.js';
$this->import('Database');
//allows us to set which buttons can be enabled for this widget.
/*foreach($this->enabledFunctions as $v)
{
$arrButtons[] = $v;
}*/
$strCommand = 'cmd_' . $this->strField;
// Change the order
if ($this->Input->get($strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
switch ($this->Input->get($strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
}
$objTaxClasses = $this->Database->execute("SELECT id, name FROM tl_iso_tax_class");
if ($objTaxClasses->numRows) {
$arrTaxClasses = $objTaxClasses->fetchAllAssoc();
}
if (!is_array($arrTaxClasses) || !count($arrTaxClasses)) {
$arrTaxClasses = array('');
}
// Get new value
if ($this->Input->post('FORM_SUBMIT') == $this->strTable) {
$varValue = $this->Input->post($this->strId);
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || !$this->varValue[0]) {
//$this->varValue = array('');
} else {
/*foreach($this->varValue as $v)
{
}*/
}
// Save the value
if ($this->Input->get($strCommand) || $this->Input->post('FORM_SUBMIT') == $this->strTable) {
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
// Reload the page
if (is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
}
}
// Add label and return wizard
$return .= '<table class="tl_optionwizard" id="ctrl_' . $this->strId . '">
<thead>';
if (is_array($this->varValue) && count($this->varValue)) {
$return .= '
<tr>
<th><strong>' . $GLOBALS['TL_LANG'][$this->strTable]['opLabel'] . '</strong></th>
<th><strong>' . $GLOBALS['TL_LANG'][$this->strTable]['opPrice'] . '</strong></th>
<th><strong>' . $GLOBALS['TL_LANG'][$this->strTable]['opTaxClass'] . '</strong></th>
<th> </th>
</tr>
</thead>
<tbody>';
// Add rows
for ($i = 0; $i < count($this->varValue); $i++) {
$arrRow = array();
$arrRow = $this->varValue[$i];
$blnEditable = false;
if (is_array($arrRow)) {
$blnEditable = true;
} else {
continue;
}
$return .= '<tr>';
$return .= ' <td>' . $this->varValue[$i]['label'] . '<input type="hidden" name="' . $this->strId . '[' . $i . '][label]" id="' . $this->strId . '_label_' . $i . '" value="' . $this->varValue[$i]['label'] . '"></td>';
$return .= ' <td>' . ($blnEditable ? '<input type="text" name="' . $this->strId . '[' . $i . '][total_price]" id="' . $this->strId . '_total_price_' . $i . '" class="tl_text_3" value="' . specialchars(round($this->varValue[$i]['total_price'], 2)) . '">' : round($this->varValue[$i]['total_price'], 2)) . '</td>';
$options = '';
$options = '<option value=""' . $this->optionSelected(NULL, $this->varValue[$i]['tax_class']) . '>-</option>';
// Add Tax Classes
foreach ($arrTaxClasses as $v) {
$options .= '<option value="' . specialchars($v['id']) . '"' . $this->optionSelected($v['id'], $this->varValue[$i]['tax_class']) . '>' . $v['name'] . '</option>';
if ($v['id'] == $this->varValue[$i]['tax_class']) {
$strTaxLabel = $v['name'];
}
}
$return .= '
<td>' . ($blnEditable ? '<select name="' . $this->strId . '[' . $i . '][tax_class]" class="tl_select_2" onfocus="Backend.getScrollOffset();">' . $options . '</select>' : $strTaxLabel) . '</td>';
$return .= '<td>';
if (is_array($arrButtons)) {
foreach ($arrButtons as $button) {
//.........这里部分代码省略.........
示例10: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
$arrColButtons = array('ccopy', 'cmovel', 'cmover', 'cdelete');
$arrRowButtons = array('rcopy', 'rup', 'rdown', 'rdelete');
$strCommand = 'cmd_' . $this->strField;
// Change the order
if ($this->Input->get($strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
$this->import('Database');
switch ($this->Input->get($strCommand)) {
case 'ccopy':
for ($i = 0; $i < count($this->varValue); $i++) {
$this->varValue[$i] = array_duplicate($this->varValue[$i], $this->Input->get('cid'));
}
break;
case 'cmovel':
for ($i = 0; $i < count($this->varValue); $i++) {
$this->varValue[$i] = array_move_up($this->varValue[$i], $this->Input->get('cid'));
}
break;
case 'cmover':
for ($i = 0; $i < count($this->varValue); $i++) {
$this->varValue[$i] = array_move_down($this->varValue[$i], $this->Input->get('cid'));
}
break;
case 'cdelete':
for ($i = 0; $i < count($this->varValue); $i++) {
$this->varValue[$i] = array_delete($this->varValue[$i], $this->Input->get('cid'));
}
break;
case 'rcopy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'rup':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'rdown':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'rdelete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || count($this->varValue) < 1) {
$this->varValue = array(array(''));
}
// Begin table
$return .= '<div id="tl_tablewizard">
<table id="ctrl_' . $this->strId . '" class="tl_tablewizard">
<tbody>
<tr>';
// Add column buttons
for ($i = 0; $i < count($this->varValue[0]); $i++) {
$return .= '
<td style="text-align:center; white-space:nowrap;">';
// Add column buttons
foreach ($arrColButtons as $button) {
$return .= '<a href="' . $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=' . $i . '&id=' . $this->currentRecord) . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['tw_' . $button]) . '" onclick="Backend.tableWizard(this, \'' . $button . '\', \'ctrl_' . $this->strId . '\'); return false;">' . $this->generateImage(substr($button, 1) . '.gif', $GLOBALS['TL_LANG']['MSC']['tw_' . $button], 'class="tl_tablewizard_img"') . '</a> ';
}
$return .= '</td>';
}
$return .= '
<td></td>
</tr>';
$tabindex = 0;
// Add rows
for ($i = 0; $i < count($this->varValue); $i++) {
$return .= '
<tr>';
// Add cells
for ($j = 0; $j < count($this->varValue[$i]); $j++) {
$return .= '
<td class="tcontainer"><textarea name="' . $this->strId . '[' . $i . '][' . $j . ']" class="tl_textarea" tabindex="' . ++$tabindex . '" rows="' . $this->intRows . '" cols="' . $this->intCols . '"' . $this->getAttributes() . '>' . specialchars($this->varValue[$i][$j]) . '</textarea></td>';
}
$return .= '
<td style="white-space:nowrap;">';
// Add row buttons
foreach ($arrRowButtons as $button) {
$return .= '<a href="' . $this->addToUrl('&' . $strCommand . '=' . $button . '&cid=' . $i . '&id=' . $this->currentRecord) . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['tw_' . $button]) . '" onclick="Backend.tableWizard(this, \'' . $button . '\', \'ctrl_' . $this->strId . '\'); return false;">' . $this->generateImage(substr($button, 1) . '.gif', $GLOBALS['TL_LANG']['MSC']['tw_' . $button], 'class="tl_tablewizard_img"') . '</a> ';
}
$return .= '</td>
</tr>';
}
$return .= '
</tbody>
</table>
</div>
<script>
Backend.tableWizardResize();
</script>';
return $return;
}
示例11: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
// load the callback data if there's any (do not do this in __set() already because then we don't have access to currentRecord)
if (is_array($this->arrCallback)) {
$this->import($this->arrCallback[0]);
$this->columnFields = $this->{$this->arrCallback[0]}->{$this->arrCallback[1]}($this);
}
$this->strCommand = 'cmd_' . $this->strField;
// TODO: Actions
if ($this->Input->get($this->strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
switch ($this->Input->get($this->strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
// Save in File
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'File') {
$this->Config->update(sprintf("\$GLOBALS['TL_CONFIG']['%s']", $this->strField), serialize($this->varValue));
// Reload the page
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($this->strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
} else {
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'Table') {
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['save_callback'])) {
$dataContainer = 'DC_' . $GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'];
// If less than 3.X, we must load the class by hand.
if (version_compare(VERSION, '3.0', '<')) {
require_once sprintf('%s/system/drivers/%s.php', TL_ROOT, $dataContainer);
}
$dc = new $dataContainer($this->strTable);
$dc->field = $objWidget->id;
$dc->inputName = $objWidget->id;
foreach ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['save_callback'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1](serialize($this->varValue), $dc);
}
} else {
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
}
// Reload the page
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($this->strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
} else {
// What to do here?
}
}
}
$arrUnique = array();
$arrDatepicker = array();
$arrTinyMCE = array();
$arrHeaderItems = array();
foreach ($this->columnFields as $strKey => $arrField) {
// Store unique fields
if ($arrField['eval']['unique']) {
$arrUnique[] = $strKey;
}
// Store date picker fields
if ($arrField['eval']['datepicker']) {
$arrDatepicker[] = $strKey;
}
// Store tiny mce fields
if ($arrField['eval']['rte'] && strncmp($arrField['eval']['rte'], 'tiny', 4) === 0) {
foreach ($this->varValue as $row => $value) {
$tinyId = 'ctrl_' . $this->strField . '_row' . $row . '_' . $strKey;
$GLOBALS['TL_RTE']['tinyMCE'][$tinyId] = array('id' => $tinyId, 'file' => 'tinyMCE', 'type' => null);
}
$arrTinyMCE[] = $strKey;
}
if ($arrField['inputType'] == 'hidden') {
continue;
}
}
$intNumberOfRows = max(count($this->varValue), 1);
// always show the minimum number of rows if set
if ($this->minCount && $intNumberOfRows < $this->minCount) {
$intNumberOfRows = $this->minCount;
}
$arrHidden = array();
$arrItems = array();
$arrHiddenHeader = array();
// Add input fields
for ($i = 0; $i < $intNumberOfRows; $i++) {
$this->activeRow = $i;
$strHidden = '';
// Walk every column
foreach ($this->columnFields as $strKey => $arrField) {
$strWidget = '';
$blnHiddenBody = false;
if ($arrField['eval']['hideHead'] == true) {
//.........这里部分代码省略.........
示例12: generate
/**
* Generate the widget and return it as string
* @return string
*/
public function generate()
{
$this->import('Database');
$arrButtons = array('copy', 'up', 'down', 'delete');
$strCommand = 'cmd_' . $this->strField;
// Change the order
if ($this->Input->get($strCommand) && is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
switch ($this->Input->get($strCommand)) {
case 'copy':
$this->varValue = array_duplicate($this->varValue, $this->Input->get('cid'));
break;
case 'up':
$this->varValue = array_move_up($this->varValue, $this->Input->get('cid'));
break;
case 'down':
$this->varValue = array_move_down($this->varValue, $this->Input->get('cid'));
break;
case 'delete':
$this->varValue = array_delete($this->varValue, $this->Input->get('cid'));
break;
}
}
// Get all modules of the current theme
$objModules = $this->Database->prepare("SELECT id, name, type FROM tl_module WHERE pid=(SELECT pid FROM " . $this->strTable . " WHERE id=?) ORDER BY name")->execute($this->currentRecord);
// Add the articles module
$modules[] = array('id' => 0, 'name' => $GLOBALS['TL_LANG']['MOD']['article'][0], 'type' => 'article');
if ($objModules->numRows) {
$modules = array_merge($modules, $objModules->fetchAllAssoc());
}
$GLOBALS['TL_LANG']['FMD']['article'] = $GLOBALS['TL_LANG']['MOD']['article'];
// Add the module type (see #3835)
foreach ($modules as $k => $v) {
$v['type'] = $GLOBALS['TL_LANG']['FMD'][$v['type']][0];
$modules[$k] = $v;
}
$objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->limit(1)->execute($this->currentRecord);
// Show all columns and filter in PageRegular (see #3273)
$cols = array('header', 'left', 'right', 'main', 'footer');
$arrSections = deserialize($objRow->sections);
// Add custom page sections
if (is_array($arrSections) && !empty($arrSections)) {
$cols = array_merge($cols, $arrSections);
}
// Get the new value
if ($this->Input->post('FORM_SUBMIT') == $this->strTable) {
$this->varValue = $this->Input->post($this->strId);
}
// Make sure there is at least an empty array
if (!is_array($this->varValue) || !$this->varValue[0]) {
$this->varValue = array('');
} else {
// Initialize the sorting order
foreach ($cols as $col) {
$arrCols[$col] = array();
}
foreach ($this->varValue as $v) {
$arrCols[$v['col']][] = $v;
}
$this->varValue = array();
foreach ($arrCols as $arrCol) {
$this->varValue = array_merge($this->varValue, $arrCol);
}
}
// Save the value
if ($this->Input->get($strCommand) || $this->Input->post('FORM_SUBMIT') == $this->strTable) {
$this->Database->prepare("UPDATE " . $this->strTable . " SET " . $this->strField . "=? WHERE id=?")->execute(serialize($this->varValue), $this->currentRecord);
// Reload the page
if (is_numeric($this->Input->get('cid')) && $this->Input->get('id') == $this->currentRecord) {
$this->redirect(preg_replace('/&(amp;)?cid=[^&]*/i', '', preg_replace('/&(amp;)?' . preg_quote($strCommand, '/') . '=[^&]*/i', '', $this->Environment->request)));
}
}
// Add label and return wizard
$return .= '<table id="ctrl_' . $this->strId . '" class="tl_modulewizard">
<thead>
<tr>
<th>' . $GLOBALS['TL_LANG']['MSC']['mw_module'] . '</th>
<th> </th>
<th>' . $GLOBALS['TL_LANG']['MSC']['mw_column'] . '</th>
<th> </th>
</tr>
</thead>
<tbody>';
// Load the tl_article language file
$this->loadLanguageFile('tl_article');
$tabindex = 0;
// Add the input fields
for ($i = 0; $i < count($this->varValue); $i++) {
$options = '';
// Add modules
foreach ($modules as $v) {
$options .= '<option value="' . specialchars($v['id']) . '"' . $this->optionSelected($v['id'], $this->varValue[$i]['mod']) . '>' . $v['name'] . ' // ' . $v['type'] . '</option>';
}
$return .= '
<tr>
<td><select name="' . $this->strId . '[' . $i . '][mod]" class="tl_select tl_chosen" tabindex="' . ++$tabindex . '" onfocus="Backend.getScrollOffset()" onchange="Backend.updateModuleLink(this)">' . $options . '</select></td>
<td><a href="contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->varValue[$i]['mod'] . '" title="' . specialchars($GLOBALS['TL_LANG']['tl_layout']['edit_module']) . '" class="module_link" style="display:' . ($this->varValue[$i]['mod'] > 0 ? 'inline' : 'none') . '">' . $this->generateImage('edit.gif') . '</a>' . $this->generateImage('edit_.gif', '', 'class="module_image" style="display:' . ($this->varValue[$i]['mod'] > 0 ? 'none' : 'inline') . '"') . '</td>';
//.........这里部分代码省略.........