00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery extends Varien_Data_Form_Element_Abstract
00036 {
00037
00038 public function getElementHtml()
00039 {
00040 $html = $this->getContentHtml();
00041
00042 return $html;
00043 }
00044
00045
00046
00047
00048
00049
00050 public function getContentHtml()
00051 {
00052
00053
00054 $content = Mage::getSingleton('core/layout')
00055 ->createBlock('adminhtml/catalog_product_helper_form_gallery_content');
00056
00057 $content->setId($this->getHtmlId() . '_content')
00058 ->setElement($this);
00059 return $content->toHtml();
00060 }
00061
00062 public function getLabel()
00063 {
00064 return '';
00065 }
00066
00067
00068
00069
00070
00071
00072
00073 public function canDisplayUseDefault($attribute)
00074 {
00075 if (!$attribute->isScopeGlobal() && $this->getDataObject()->getStoreId()) {
00076 return true;
00077 }
00078
00079 return false;
00080 }
00081
00082
00083
00084
00085
00086
00087
00088 public function usedDefault($attribute)
00089 {
00090 $devaultValue = $this->getDataObject()->getAttributeDefaultValue($attribute->getAttributeCode());
00091 return is_null($devaultValue);
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 public function getScopeLabel($attribute)
00103 {
00104 $html = '';
00105 if (Mage::app()->isSingleStoreMode()) {
00106 return $html;
00107 }
00108
00109 if ($attribute->isScopeGlobal()) {
00110 $html.= '<br/>[GLOBAL]';
00111 }
00112 elseif ($attribute->isScopeWebsite()) {
00113 $html.= '<br/>[WEBSITE]';
00114 }
00115 elseif ($attribute->isScopeStore()) {
00116 $html.= '<br/>[STORE VIEW]';
00117 }
00118 return $html;
00119 }
00120
00121
00122
00123
00124
00125
00126 public function getDataObject()
00127 {
00128 return $this->getForm()->getDataObject();
00129 }
00130
00131
00132
00133
00134
00135
00136
00137
00138 public function getAttributeFieldName($attribute)
00139 {
00140 $name = $attribute->getAttributeCode();
00141 if ($suffix = $this->getForm()->getFieldNameSuffix()) {
00142 $name = $this->getForm()->addSuffixToName($name, $suffix);
00143 }
00144 return $name;
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 public function getAttributeReadonly($attribute)
00154 {
00155 if (is_object($attribute)) {
00156 $attribute = $attribute->getAttributeCode();
00157 }
00158
00159 if ($this->getDataObject()->isLockedAttribute($attribute)) {
00160 return true;
00161 }
00162
00163 return false;
00164 }
00165
00166 public function toHtml()
00167 {
00168 return '<tr><td class="value" colspan="3">' . $this->getElementHtml() . '</td></tr>';
00169 }
00170
00171 }