当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::active_set方法代码示例

本文整理汇总了PHP中GCore\Helpers\Html::active_set方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::active_set方法的具体用法?PHP Html::active_set怎么用?PHP Html::active_set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GCore\Helpers\Html的用法示例。


在下文中一共展示了Html::active_set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeSave

	function beforeSave(&$data, &$params, $mode){
		foreach($data['extras']['actions_config'] as $f_k => $f_info){
			if(strpos($f_k, '{N}') !== false){
				unset($data['extras']['actions_config'][$f_k]);
			}
		}
		if(!empty($data['extras']['fields']) AND $data['form_type'] == '1'){
			foreach($data['extras']['fields'] as $f_k => $f_info){
				if(strpos($f_k, '{N}') !== false){
					unset($data['extras']['fields'][$f_k]);
				}
			}
			//$data['wizardcode'] = serialize($data['fields_config']);
			if(!empty($data['extras']['fields'])){
				ob_start();
				\GCore\Helpers\Html::active_set('div');//!empty($data['params']['html_helper_set']) ? $data['params']['html_helper_set'] : 'div');
				/*if(!empty($data['params']['theme']) AND $data['params']['theme'] != 'bootstrap3'){
					$doc = \GCore\Libs\Document::getInstance();
					$doc->theme = $data['params']['theme'];
				}*/
				$theme = !empty($data['params']['theme']) ? $data['params']['theme'] : '';
				$doc = \GCore\Libs\Document::getInstance();
				$doc->theme = $theme;
				//echo \GCore\Helpers\Html::formSecStart();

				$containers_ids = array();
				$containers_configs = array();
				foreach($data['extras']['fields'] as $k => $field){
					if($field['type'] == 'multi' AND isset($field['inputs'])){
						foreach($field['inputs'] as $sub_id => $input){
							$field['inputs'][$sub_id] = $this->fix_field_data($field['inputs'][$sub_id]);
						}
					}else{
						$field = $this->fix_field_data($field);
					}
					if($field['type'] == 'container'){
						//if this container is also a root container then close existing ones
						if($field['container_id'] == 0){
							//close all open containers
							foreach($containers_ids as $containers_id){
								$container_id = array_pop($containers_ids);
								echo $this->build_container_code($containers_configs[$container_id], 'end', $k);
							}
						}else{
							check_parent_container:
							if(!empty($containers_ids)){
								$last_container_id = array_pop($containers_ids);
								if($field['container_id'] == $last_container_id){
									//do nothing, we should add the field as regular
									array_push($containers_ids, $last_container_id);
								}else{
									//one container has just ended, because the element belongs to a differnt one, close it
									echo $this->build_container_code($containers_configs[$last_container_id], 'end', $k);
									goto check_parent_container;
								}
							}
						}
						echo $this->build_container_code($field, 'start', $k);
						array_push($containers_ids, $k);
						$containers_configs[$k] = $field;
					}else{
						if(isset($field['container_id'])){
							if($field['container_id'] == 0){
								//close all open containers
								foreach(array_keys($containers_ids) as $c_k){
									$container_id = array_pop($containers_ids);
									echo $this->build_container_code($containers_configs[$container_id], 'end', $k);
								}
							}else{
								check_container:
								if(!empty($containers_ids)){
									$last_container_id = array_pop($containers_ids);
									if($field['container_id'] == $last_container_id){
										//do nothing, we should add the field as regular
										array_push($containers_ids, $last_container_id);
									}else{
										//one container has just ended, because the element belongs to a differnt one, close it
										echo $this->build_container_code($containers_configs[$last_container_id], 'end', $k);
										goto check_container;
									}
								}
							}
						}

						if($field['type'] == 'hidden' OR !empty($field['pure_code'])){
							echo \GCore\Helpers\Html::input($field['name'], $field);
						}else{
							if(!empty($field['dynamic_data']['enabled']) AND !empty($field['dynamic_data']['data_path']) AND !empty($field['dynamic_data']['value_key']) AND !empty($field['dynamic_data']['text_key'])){
								echo $this->build_dynamic_element($field);
							}else{
								/*if(isset($field['label'])){
									$position = isset($field['label_pos']) ? $field['label_pos'] : 'left';
									$field['label'] = array('text' => $field['label'], 'position' => $position);
								}*/
								if($field['type'] == 'multi' AND isset($field['inputs'])){
									foreach($field['inputs'] as $sub_id => $input){
										if(!empty($input['dynamic_data']['enabled']) AND !empty($input['dynamic_data']['data_path']) AND !empty($input['dynamic_data']['value_key']) AND !empty($input['dynamic_data']['text_key'])){
											$field['inputs'][$sub_id]['code'] = $this->build_dynamic_element($input, true);
											$field['inputs'][$sub_id]['type'] = 'custom';
											//$field['inputs'][$sub_id]['label'] = '';
//.........这里部分代码省略.........
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:101,代码来源:form.php


注:本文中的GCore\Helpers\Html::active_set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。