Ongoing development.

This commit is contained in:
David Molineus
2015-01-05 12:25:46 +01:00
parent 74a4d79aa0
commit be9060795d
25 changed files with 472 additions and 33 deletions

View File

@@ -14,6 +14,12 @@ namespace Netzmacht\Contao\Leaflet\Dca;
class Layer
{
private $layers;
public function __construct()
{
$this->layers = &$GLOBALS['LEAFLET_LAYERS'];
}
public function getVariants($dataContainer)
{
if ($dataContainer->activeRecord
@@ -25,4 +31,49 @@ class Layer
return array();
}
// Call paste_button_callback (&$dc, $row, $table, $cr, $childs, $previous, $next)
public function getPasteButtons($dataContainer, $row, $table, $whatever, $children)
{
$pasteAfterUrl = \Controller::addToUrl(
'act='.$children['mode'].'&mode=1&pid='.$row['id']
.(!is_array($children['id']) ? '&id='.$children['id'] : '')
);
$buffer = sprintf(
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
$pasteAfterUrl,
specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])),
\Image::getHtml(
'pasteafter.gif',
sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])
)
);
if (!empty($this->layers[$row['type']]['children'])) {
$pasteIntoUrl = \Controller::addToUrl(
sprintf(
'act=%s&amp;mode=2&amp;pid=%s%s',
$children['mode'],
$row['id'],
!is_array($children['id']) ? '&amp;id='.$children['id'] : ''
)
);
$buffer .= sprintf(
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
$pasteIntoUrl,
specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])),
\Image::getHtml(
'pasteinto.gif',
sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])
)
);
} elseif ($row['id'] > 0) {
$buffer .= \Image::getHtml('pasteinto_.gif');
}
return $buffer;
}
}