コード例 #1
0
ファイル: Radioset.php プロジェクト: logikostech/forms
 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]);
 }
コード例 #2
0
ファイル: UserForm.php プロジェクト: skybird/phalcon
 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;
 }
コード例 #3
0
ファイル: NewsForm.php プロジェクト: skybird/phalcon
 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;
 }