Beispiel #1
0
 public function renderWithTemplate($name, $value, $label, $curent_value)
 {
     $attr = ['type' => 'radio', 'name' => $name, 'value' => $value, 'id' => null];
     $radio = new Radio($name, $attr);
     $radio->setDefault($curent_value);
     return $this->getPartialFromView($this->_radiotemplate, ['form' => $this->getForm(), 'element' => $radio, 'name' => $name, 'value' => $value, 'label' => $label]);
 }
Beispiel #2
0
 public function getGender()
 {
     $genders = array('male' => '男士', 'female' => '女士', 'other' => '其他');
     $radios = array();
     $user = $this->getModel();
     foreach ($genders as $value => $label) {
         $radio = new Radio('gender', array('value' => $value));
         $radio->setLabel($label);
         $radio->setDefault($user->gender);
         $radios[$value] = $radio;
     }
     return $this->gender = $radios;
 }
Beispiel #3
0
 public function getIcons()
 {
     $icons = array('reminder' => 'Reminder', 'rumor' => 'Rumor', 'warning' => 'Warning');
     $radios = array();
     $news = $this->getModel();
     foreach ($icons as $icon => $label) {
         $radio = new Radio('icon', array('value' => $icon));
         $radio->setLabel($label);
         $radio->setDefault($news->icon);
         $radios[$icon] = $radio;
     }
     return $this->radio = $radios;
 }