Beispiel #1
0
 /**
  * @wiki /MVC模式/视图窗体(控件)/表单控件
  * ==复选框==
  * =Bean配置数组=
  * {|
  * !属性
  * !类型
  * !默认值
  * !可选
  * !说明
  * |-- --
  * |type
  * |string
  * |无
  * |必须
  * |此项须以下列字符串为值,用来指定选项是checkbox还是radio,"checkbox" 控件以checkbox形式体现,"radio" 控件以radio形式体现
  * |}
  */
 public function buildBean(array &$arrConfig, $sNamespace = '*', \org\jecat\framework\bean\BeanFactory $aBeanFactory = null)
 {
     parent::buildBean($arrConfig);
     if (array_key_exists('type', $arrConfig)) {
         switch ($arrConfig['type']) {
             case "checkbox":
                 $this->setType(self::checkbox);
                 break;
             case "radio":
                 $this->setType(self::radio);
                 break;
         }
     }
     $this->setChecked(!empty($arrConfig['checked']));
 }
Beispiel #2
0
 /**
  * @wiki /MVC模式/视图窗体(控件)/表单控件
  * ==Text==
  * =Bean配置数组=
  * {|
  * !属性
  * !类型
  * !默认值
  * !可选
  * !说明
  * |-- --
  * |type
  * |string
  * |"single"
  * |必须
  * |此项须以下列字符串为值,"single" 将Text初始化为单行文字输入框,即html中设置input标签的type属性为"text","password" 将Text初始化为密码数据框,即html中设置input标签的type属性为"password","multiple" 将Text初始化为字符编辑区域,即html中的textarea标签,"hidden" 将Text初始化为单行文字输入框,即html中设置input标签的type属性为"hidden"
  * |}
  */
 public function buildBean(array &$arrConfig, $sNamespace = '*', \org\jecat\framework\bean\BeanFactory $aBeanFactory = null)
 {
     parent::buildBean($arrConfig, $sNamespace);
     if (array_key_exists('type', $arrConfig)) {
         switch ($arrConfig['type']) {
             case "single":
                 $this->setType(self::single);
                 break;
             case "password":
                 $this->setType(self::password);
                 break;
             case "multiple":
                 $this->setType(self::multiple);
                 break;
             case "hidden":
                 $this->setType(self::hidden);
                 break;
         }
     }
 }
Beispiel #3
0
 public function verifyData()
 {
     if (!parent::verifyData()) {
         // 删除widget中的文件
         if ($aFile = $this->value()) {
             $aFile->delete();
             $this->setValue(null);
         }
         return false;
     } else {
         return true;
     }
 }
Beispiel #4
0
 public function setValue($data = null)
 {
     parent::setValue($data);
     foreach ($this->arrOptions as $key => $option) {
         $this->arrOptions[$key][2] = false;
         if ((string) $option[0] == $data) {
             $this->arrOptions[$key][2] = true;
             return;
         }
     }
 }
Beispiel #5
0
 public function setAttribute($sName, $value)
 {
     $sName = strtolower($sName);
     if ('count' === $sName) {
         $this->setPerPageCount($value);
     }
     parent::setAttribute($sName, $value);
 }
Beispiel #6
0
 public function setView(IView $aView = null)
 {
     parent::setView($aView);
     foreach ($this->widgetIterator() as $aWidget) {
         $aView->addWidget($aWidget);
     }
 }