コード例 #1
0
ファイル: HttpRequest.php プロジェクト: JeCat/framework
 public function exportToArray(array &$arrToArray)
 {
     // get 参数
     $aDataSrc = DataSrc::flyweight(array('request', '_GET'), false);
     $aDataSrc->exportToArray($arrToArray);
     foreach ($this->nameIterator() as $sDataName) {
         $arrToArray[$sDataName] = $this->get($sDataName);
     }
 }
コード例 #2
0
ファイル: Request.php プロジェクト: JeCat/framework
 public function has($sName)
 {
     if (!parent::has($sName)) {
         // 尝试转换 xxx.ooo 为 xxx_ooo
         if (strpos($sName, '.') === false or !parent::has(str_replace('.', '_', $sName))) {
             return false;
         }
     }
     return true;
 }
コード例 #3
0
ファイル: Item.php プロジェクト: JeCat/framework
 /**
  * @wiki /MVC模式/视图窗体(控件)/菜单控件
  * ==Item==
  * =Bean配置数组=
  * {|
  * !属性
  * !类型
  * !默认值
  * !可选
  * !说明
  * |-- --
  * |menu
  * |array
  * |无
  * |可选
  * |子菜单项目列表,每个元素都是一个菜单项的配置
  * |-- --
  * |link
  * |string
  * |无
  * |可选
  * |url地址
  * |-- --
  * |onclick
  * |string
  * |无
  * |可选
  * |点击后触发的javascript的代码
  * |-- --
  * |html
  * |string
  * |无
  * |可选
  * |用来代替菜单项内容的html代码
  * |-- --
  * |query
  * |-- -- 
  * |active
  * |boolean
  * |true
  * |可选
  * |设置菜单是否可用
  * |}
  */
 public function buildBean(array &$arrConfig, $sNamespace = '*', \org\jecat\framework\bean\BeanFactory $aBeanFactory = null)
 {
     parent::buildBean($arrConfig, $sNamespace);
     /*
     	判断是否有下级菜单,看是否有item:xxx项
     */
     $bIsMenu = false;
     foreach ($arrConfig as $key => $value) {
         $sPrefix = substr($key, 0, 5);
         if ($sPrefix === 'item:') {
             $bIsMenu = true;
             break;
         }
     }
     if ($bIsMenu) {
         $this->buildSubMenu($arrConfig);
     }
     if (!empty($arrConfig['link'])) {
         $this->setLink($arrConfig['link']);
     }
     if (!empty($arrConfig['onclick'])) {
         $this->setEventOnClick($arrConfig['onclick']);
     }
     if (!empty($arrConfig['html'])) {
         $this->setHtml($arrConfig['html']);
     }
     if (!empty($arrConfig['query'])) {
         if ($aView = $this->view()) {
             if ($aController = $aView->controller()) {
                 $aParams = $aController->params();
                 foreach ((array) $arrConfig['query'] as $sQuote) {
                     if (DataSrc::compare($aParams, $sQuote)) {
                         $this->setActive(true);
                         break;
                     }
                 }
             }
         }
     } else {
         if (!empty($arrConfig['link'])) {
             if ($aView = $this->view()) {
                 if ($aController = $aView->controller()) {
                     $aParams = $aController->params();
                     if (substr($arrConfig['link'], 0, 1) === '?' and DataSrc::compare($aParams, substr($arrConfig['link'], 1))) {
                         $this->setActive(true);
                     }
                 }
             }
         }
     }
     if (array_key_exists('active', $arrConfig)) {
         $this->setActive($arrConfig['active']);
     }
     if ($aSubMenu = $this->subMenu() and ($aSubMenu->isActive() or $aSubMenu->isBubblingActive())) {
         $this->setBubblingActive(true);
     }
 }