public function getElement($value = "", $group = "", $html = "")
 {
     if ($group) {
         $this->group = $group;
         $this->fieldname = $this->getFieldName($this->fieldname);
     }
     $this->value = $value;
     $class = 'select';
     $default = isset($this->element['default']) ? $this->element['default'] : "";
     $this->value = $this->value == "" || $this->value == null ? $default : $this->value;
     $class .= isset($this->element['class']) ? (string) $this->element['class'] : '';
     $style = isset($this->element['style']) ? (string) $this->element['style'] : '';
     $size = isset($this->element['size']) ? (string) $this->element['size'] : '30';
     $multiple = isset($this->element['multiple']) ? (string) $this->element['multiple'] : false;
     if ($multiple) {
         $multiple = ' multiple="multiple" ';
         $this->name .= "[]";
     } else {
         $multiple = "";
     }
     $html = '<select name="' . $this->name . '" class="' . $class . '"' . $multiple . ' style="' . $style . '">';
     $blocks = Mage::getModel('cms/block')->getCollection()->addFilter("is_active", 1)->getItems();
     $html .= '<option value="0">' . Mage::helper('ves_tempcp')->__("---- Select a Static Block ----") . '</option>';
     if (!empty($blocks)) {
         foreach ($blocks as $block) {
             if ($block->getIdentifier() == $this->value) {
                 $html .= '<option value="' . $block->getIdentifier() . '" selected="selected">' . $block->getTitle() . '</option>';
             } else {
                 $html .= '<option value="' . $block->getIdentifier() . '">' . $block->getTitle() . '</option>';
             }
         }
     }
     $html .= '</select>';
     return parent::getElement($value, $group, $html);
 }
示例#2
0
 public function getElement($value = "", $group = "", $html = "")
 {
     if ($group) {
         $this->group = $group;
         $this->fieldname = $this->getFieldName($this->fieldname);
     }
     $this->value = $value;
     $class = isset($this->element['class']) ? (string) $this->element['class'] : '';
     $style = isset($this->element['style']) ? (string) $this->element['style'] : '';
     $max_length = isset($this->element['max_length']) ? (string) $this->element['max_length'] : '150';
     $size = isset($this->element['size']) ? (string) $this->element['size'] : '30';
     $html = '<input type="text" name="' . $this->name . '" max_length="' . $max_length . '" size="' . $size . '" style="' . $style . '" class="' . $class . '" value="' . $this->value . '"/>';
     return parent::getElement($value, $group, $html);
 }
示例#3
0
 public function getElement($value = "", $group = "", $html = "")
 {
     if ($group) {
         $this->group = $group;
         $this->fieldname = $this->getFieldName($this->fieldname);
     }
     $this->value = $value;
     $class = isset($this->element['class']) ? (string) $this->element['class'] : '';
     $cols = isset($this->element['cols']) ? (string) $this->element['cols'] : '25';
     $rows = isset($this->element['rows']) ? (string) $this->element['rows'] : '10';
     $width = isset($this->element['width']) ? (string) $this->element['width'] : '400px';
     $height = isset($this->element['height']) ? (string) $this->element['height'] : '300px';
     $html = Mage::helper('ves_tempcp/element')->getElementEditor($this->group . '_' . $this->fieldname, $this->name, $value, 'class="' . $class . '" cols="' . $cols . '" rows="' . $rows . '" style="width:' . $width . ';height:' . $height . '"');
     return parent::getElement($value, $group, $html);
 }
示例#4
0
 public function getElement($value = "", $group = "", $html = "")
 {
     if ($group) {
         $this->group = $group;
         $this->fieldname = $this->getFieldName($this->fieldname);
     }
     $this->value = $value;
     $class = isset($this->element['class']) ? (string) $this->element['class'] : '';
     $cols = isset($this->element['cols']) ? (string) $this->element['cols'] : '25';
     $rows = isset($this->element['rows']) ? (string) $this->element['rows'] : '10';
     $width = isset($this->element['width']) ? (string) $this->element['width'] : '400px';
     $height = isset($this->element['height']) ? (string) $this->element['height'] : '300px';
     $html = '<textarea name="' . $this->name . '" id="' . $this->group . '_' . $this->fieldname . '" class="' . $class . '" cols="' . $cols . '" rows="' . $rows . '" style="width:' . $width . ';height:' . $height . '">' . $value . '</textarea>';
     return parent::getElement($value, $group, $html);
 }
示例#5
0
 public function getElement($value = "", $group = "", $html = "")
 {
     if ($group) {
         $this->group = $group;
         $this->fieldname = $this->getFieldName($this->fieldname);
     }
     $this->value = $value;
     $class = 'select';
     $default = isset($this->element['default']) ? $this->element['default'] : "";
     $this->value = empty($this->value) ? $default : $this->value;
     $class .= isset($this->element['class']) ? (string) $this->element['class'] : '';
     $style = isset($this->element['style']) ? (string) $this->element['style'] : '';
     $size = isset($this->element['size']) ? ' size="' . (string) $this->element['size'] . '"' : '';
     $vars = get_object_vars($this->element);
     $options = $vars['option'];
     $options = $this->getOptions($options);
     $multiple = isset($this->element['multiple']) ? (string) $this->element['multiple'] : true;
     if ($multiple) {
         $multiple = ' multiple="multiple" ';
         $class .= ' multiselect';
         $this->name .= "[]";
     } else {
         $multiple = "";
     }
     $html = '<select name="' . $this->name . '" class="' . $class . '"' . $multiple . $size . ' style="' . $style . '">';
     $layouts = array("all" => Mage::helper('ves_tempcp')->__("All Pages"), "home" => Mage::helper('ves_tempcp')->__("Home"));
     if ($options) {
         foreach ($options as $option) {
             $layouts[$option] = Mage::helper('ves_tempcp')->__($option);
         }
     }
     if (!empty($layouts)) {
         foreach ($layouts as $key => $val) {
             if ($key == $this->value || is_array($this->value) && in_array($key, $this->value)) {
                 $html .= '<option value="' . $key . '" selected="selected">' . $val . '</option>';
             } else {
                 $html .= '<option value="' . $key . '">' . $val . '</option>';
             }
         }
     }
     $html .= '</select>';
     return parent::getElement($value, $group, $html);
 }