30 parent::__construct($factoryElement, $factoryCollection, $escaper,
$data);
41 $gallery = $this->getValue();
43 $html =
'<table id="gallery" class="gallery" border="0" cellspacing="3" cellpadding="0">';
44 $html .=
'<thead id="gallery_thead" class="gallery">' .
45 '<tr class="gallery">' .
46 '<td class="gallery" valign="middle" align="center">Big Image</td>' .
47 '<td class="gallery" valign="middle" align="center">Thumbnail</td>' .
48 '<td class="gallery" valign="middle" align="center">Small Thumb</td>' .
49 '<td class="gallery" valign="middle" align="center">Sort Order</td>' .
50 '<td class="gallery" valign="middle" align="center">Delete</td>' .
53 $widgetButton = $this->
getForm()->getParent()->getLayout();
54 $buttonHtml = $widgetButton->createBlock(
55 \
Magento\Backend\Block\Widget\Button::class
57 [
'label' =>
'Add New Image',
'onclick' =>
'addNewImg()',
'class' =>
'add']
60 $html .=
'<tfoot class="gallery">';
61 $html .=
'<tr class="gallery">';
62 $html .=
'<td class="gallery" valign="middle" align="left" colspan="5">' . $buttonHtml .
'</td>';
66 $html .=
'<tbody class="gallery">';
69 if ($this->getValue() !==
null) {
70 foreach ($this->getValue() as
$image) {
72 $html .=
'<tr class="gallery">';
73 foreach ($this->getValue()->getAttributeBackend()->getImageTypes() as
$type) {
75 $html .=
'<td class="gallery" align="center" style="vertical-align:bottom;">';
76 $html .=
'<a href="' .
78 '" target="_blank" onclick="imagePreview(\'' .
84 '\');
return false;
" ' . 86 'image-' . $image->getValueId() 94 $image->getValueId() . 99 '" height="25
" align="absmiddle
" class="small-image-preview
"></a><br/>'; 100 $html .= '<input type="file
" name="' . 105 $image->getValueId() . 111 $html .= '<td class="gallery
" align="center
" style="vertical-align:bottom;
">' . 112 '<input type="input
" name="' . 115 $image->getValueId() . 117 $image->getPosition() . 121 $image->getValueId() . 124 'position-' . $image->getValueId() 126 $html .= '<td class="gallery
" align="center
" style="vertical-align:bottom;
">' . 130 $image->getValueId() . 132 $image->getValueId() . 136 $image->getValueId() . 139 'delete-button-' . $image->getValueId() 145 $html .= '<script type="text/javascript
">' . 146 'document.getElementById("gallery_thead
").style.visibility="hidden
";' . 150 $html .= '</tbody></table>'; 152 $name = $this->getName(); 153 $parentName = parent::getName(); 155 $html .= <<<EndSCRIPT 157 <script language="javascript
"> 160 function addNewImg(){ 162 document.getElementById("gallery_thead
").style.visibility="visible
"; 165 new_file_input = '<input type="file
" name="{
$name}_%j%[%
id%]
" size="1
" />'; 168 var new_row_input = document.createElement( 'input' ); 169 new_row_input.type = 'text'; 170 new_row_input.name = '{$parentName}[position]['+id+']'; 171 new_row_input.size = '3'; 172 new_row_input.value = '0'; 175 var new_row_button = document.createElement( 'input' ); 176 new_row_button.type = 'checkbox'; 177 new_row_button.value = 'Delete'; 179 table = document.getElementById( "gallery
" ); 181 // no of rows in the table: 182 noOfRows = table.rows.length; 184 // no of columns in the pre-last row: 185 noOfCols = table.rows[noOfRows-2].cells.length; 187 // insert row at pre-last: 188 var x=table.insertRow(noOfRows-1); 190 // insert cells in row. 191 for (var j = 0; j < noOfCols; j++) { 193 newCell = x.insertCell(j); 194 newCell.align = "center
"; 195 newCell.valign = "middle
"; 198 newCell.appendChild( new_row_input ); 201 newCell.appendChild( new_row_button ); 204 newCell.innerHTML = new_file_input.replace(/%j%/g, j).replace(/%id%/g, id); 210 new_row_button.onclick= function(){ 212 this.parentNode.parentNode.parentNode.removeChild( this.parentNode.parentNode ); 215 // without it Safari wants to reload the browser window 216 // which nixes your already queued uploads 224 $html .= $this->getAfterElementHtml(); 231 public function getName() 233 return $this->getData('name'); 239 public function getParentName() 241 return parent::getName();
jquery extjs ext tree checkbox
if(!isset($_GET['name'])) $name