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 class Mage_Customer_Block_Widget_Name extends Mage_Customer_Block_Widget_Abstract
00028 {
00029 public function _construct()
00030 {
00031 parent::_construct();
00032
00033
00034 $this->setTemplate('customer/widget/name.phtml');
00035 }
00036
00037
00038
00039
00040
00041
00042
00043 protected function _showConfig($key)
00044 {
00045 $value = $this->getConfig($key);
00046 if (empty($value)) {
00047 return false;
00048 }
00049 return true;
00050 }
00051
00052
00053
00054
00055
00056
00057 public function showPrefix()
00058 {
00059 return $this->_showConfig('prefix_show');
00060 }
00061
00062 public function isPrefixRequired()
00063 {
00064 return $this->getConfig('prefix_show')=='req';
00065 }
00066
00067 public function getPrefixOptions()
00068 {
00069 $options = trim($this->getConfig('prefix_options'));
00070 if (!$options) {
00071 return false;
00072 }
00073 $options = explode(';', $options);
00074 foreach ($options as &$v) {
00075 $v = $this->htmlEscape(trim($v));
00076 }
00077 return $options;
00078 }
00079
00080 public function showMiddlename()
00081 {
00082 return $this->_showConfig('middlename_show');
00083 }
00084
00085 public function showSuffix()
00086 {
00087 return $this->_showConfig('suffix_show');
00088 }
00089
00090 public function isSuffixRequired()
00091 {
00092 return $this->getConfig('suffix_show') == 'req';
00093 }
00094
00095 public function getSuffixOptions()
00096 {
00097 $options = trim($this->getConfig('suffix_options'));
00098 if (!$options) {
00099 return false;
00100 }
00101 $options = explode(';', $options);
00102 foreach ($options as &$v) {
00103 $v = $this->htmlEscape(trim($v));
00104 }
00105 return $options;
00106 }
00107
00108 public function getClassName()
00109 {
00110 if (!$this->hasData('class_name')) {
00111 $this->setData('class_name', 'customer-name');
00112 }
00113 return $this->getData('class_name');
00114 }
00115
00116 public function getContainerClassName()
00117 {
00118 $class = $this->getClassName();
00119 $class .= $this->showPrefix() ? '-prefix' : '';
00120 $class .= $this->showMiddlename() ? '-middlename' : '';
00121 $class .= $this->showSuffix() ? '-suffix' : '';
00122 return $class;
00123 }
00124 }