Public Member Functions | |
__construct () | |
addItem ($itemId, array $item) | |
getItem ($itemId) | |
getItems () | |
getItemsJson () | |
getCount () | |
isAvailable () | |
getFormFieldName () | |
getFormFieldNameInternal () | |
getJsObjectName () | |
getGridJsObjectName () | |
getSelectedJson () | |
getSelected () | |
getApplyButtonHtml () | |
getJavaScript () | |
getGridIdsJson () | |
getHtmlId () | |
Protected Attributes | |
$_items = array() |
Definition at line 34 of file Abstract.php.
__construct | ( | ) |
Constructor
By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes
Reimplemented from Varien_Object.
Definition at line 43 of file Abstract.php.
00044 { 00045 parent::__construct(); 00046 $this->setTemplate('widget/grid/massaction.phtml'); 00047 $this->setErrorText(Mage::helper('catalog')->jsQuoteEscape(Mage::helper('catalog')->__('Please select items'))); 00048 }
addItem | ( | $ | itemId, | |
array $ | item | |||
) |
Add new massaction item
$item = array( 'label' => string, 'complete' => string, // Only for ajax enabled grid (optional) 'url' => string, 'confirm' => string, // text of confirmation of this action (optional) 'additional' => string|array|Mage_Core_Block_Abstract // (optional) );
string | $itemId | |
array | $item |
Definition at line 65 of file Abstract.php.
00066 { 00067 $this->_items[$itemId] = $this->getLayout()->createBlock('adminhtml/widget_grid_massaction_item') 00068 ->setData($item) 00069 ->setMassaction($this) 00070 ->setId($itemId); 00071 00072 if($this->_items[$itemId]->getAdditional()) { 00073 $this->_items[$itemId]->setAdditionalActionBlock($this->_items[$itemId]->getAdditional()); 00074 $this->_items[$itemId]->unsAdditional(); 00075 } 00076 00077 return $this; 00078 }
getApplyButtonHtml | ( | ) |
Retrive apply button html
Definition at line 217 of file Abstract.php.
00218 { 00219 return $this->getButtonHtml($this->__('Submit'), $this->getJsObjectName() . ".apply()"); 00220 }
getCount | ( | ) |
getFormFieldName | ( | ) |
Retrive global form field name for all massaction items
Definition at line 145 of file Abstract.php.
00146 { 00147 return ($this->getData('form_field_name') ? $this->getData('form_field_name') : 'massaction'); 00148 }
getFormFieldNameInternal | ( | ) |
Retrive form field name for internal use. Based on $this->getFormFieldName()
Definition at line 155 of file Abstract.php.
00156 { 00157 return 'internal_' . $this->getFormFieldName(); 00158 }
getGridIdsJson | ( | ) |
Definition at line 232 of file Abstract.php.
00233 { 00234 $gridIds = $this->getParentBlock()->getCollection()->getAllIds(); 00235 00236 if(!empty($gridIds)) { 00237 return join(",", $gridIds); 00238 //return Zend_Json::encode($gridIds); 00239 } 00240 return ''; 00241 //return '[]'; 00242 }
getGridJsObjectName | ( | ) |
Retrive grid block js object name
Definition at line 175 of file Abstract.php.
00176 { 00177 return $this->getParentBlock()->getJsObjectName(); 00178 }
getHtmlId | ( | ) |
Reimplemented from Mage_Adminhtml_Block_Widget.
Definition at line 244 of file Abstract.php.
00245 { 00246 return $this->getParentBlock()->getHtmlId() . '_massaction'; 00247 }
getItem | ( | $ | itemId | ) |
Retrive massaction item with id $itemId
string | $itemId |
Definition at line 86 of file Abstract.php.
00087 { 00088 if(isset($this->_items[$itemId])) { 00089 return $this->_items[$itemId]; 00090 } 00091 00092 return null; 00093 }
getItems | ( | ) |
getItemsJson | ( | ) |
getJavaScript | ( | ) |
Definition at line 222 of file Abstract.php.
00223 { 00224 return " 00225 var {$this->getJsObjectName()} = new varienGridMassaction('{$this->getHtmlId()}', {$this->getGridJsObjectName()}, '{$this->getSelectedJson()}', '{$this->getFormFieldNameInternal()}', '{$this->getFormFieldName()}'); 00226 {$this->getJsObjectName()}.setItems({$this->getItemsJson()}); 00227 {$this->getJsObjectName()}.setGridIds('{$this->getGridIdsJson()}'); 00228 ". ($this->getUseAjax() ? "{$this->getJsObjectName()}.setUseAjax(true);" : '') . 00229 "{$this->getJsObjectName()}.errorText = '{$this->getErrorText()}';"; 00230 }
getJsObjectName | ( | ) |
Retrive massaction block js object name
Definition at line 165 of file Abstract.php.
00166 { 00167 return $this->getHtmlId() . 'JsObject'; 00168 }
getSelected | ( | ) |
Retrive array of selected checkboxes
Definition at line 202 of file Abstract.php.
00203 { 00204 if($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) { 00205 $selected = explode(',', $selected); 00206 return $selected; 00207 } else { 00208 return array(); 00209 } 00210 }
getSelectedJson | ( | ) |
Retrive JSON string of selected checkboxes
Definition at line 185 of file Abstract.php.
00186 { 00187 if($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) { 00188 $selected = explode(',', $selected); 00189 return join(',', $selected); 00190 // return Zend_Json::encode($selected); 00191 } else { 00192 return ''; 00193 // return '[]'; 00194 } 00195 }
isAvailable | ( | ) |
Checks are massactions available
Definition at line 135 of file Abstract.php.
00136 { 00137 return $this->getCount() > 0 && $this->getParentBlock()->getMassactionIdField(); 00138 }
$_items = array() [protected] |
Definition at line 41 of file Abstract.php.