Ejemplo n.º 1
0
 /**
  * 生成表单域对应的html
  * @param  array  $input
  * @param  array  $field 字段信息
  * @return string
  */
 public function genHtml(&$input, $field)
 {
     $width = $input['width'];
     $height = $input['height'];
     $value = $input['value'];
     $type = $input['type'];
     $remark = $input['remark'];
     $class = 'input';
     if ('file' == $type) {
         $fn = "{$field['name']}";
     } else {
         $fn = "{$field['model']}[{$field['name']}]";
     }
     $html = '';
     if ('text' == $type) {
         $html = genText($fn, $width, $value, $class);
     } else {
         if ('password' == $type) {
             $html = genPassword($fn, $width, $value, $class);
         } else {
             if ('select' == $type) {
                 $list = $this->optValueToArray($input['opt_value']);
                 $html = genSelect($fn, $list['opt_value'], $list['selected']);
             } else {
                 if ('radio' == $type) {
                     $list = $this->optValueToArray($input['opt_value']);
                     $html = genRadios($fn, $list['opt_value'], $list['selected']);
                 } else {
                     if ('checkbox' == $type) {
                         $list = $this->optValueToArray($input['opt_value'], true);
                         $html = genCheckboxs($fn, $list['opt_value'], $list['selected']);
                     } else {
                         if ('file' == $type) {
                             $html = genFile($fn);
                         } else {
                             if ('textarea' == $type) {
                                 $html = genTextarea($fn, $value, $width, $height, $remark);
                             } else {
                                 if ('date' == $type) {
                                     $html = genDate($fn, $value, $class);
                                 } else {
                                     if ('relation_select' == $type) {
                                         $relaOpts = $this->getRelationOpts($field);
                                         $input['opt_value'] = $this->optArrayToString($relaOpts);
                                         $html = genSelect($fn, $relaOpts['opt_value']);
                                     } else {
                                         if ('editor' == $type) {
                                             $html = genEditor($fn, empty($value) ? $remark : $value, $width, $height, $input['editor']);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $input['html'] = $html;
 }
Ejemplo n.º 2
0
            //echo "auxNroCampo=$auxNroCampo auxEntidad=$auxEntidad <br>";
			$entidades[$auxEntidad]['CAMPO'.$auxNroCampo ] = $value;
			$i++;
		}
	}
	
	$path_XML = "./modules/$m/$g_pathGenClassXML";

	//--- Generacion de Archivos XML
	//var_dump($entidades);	
	// generacion por cada entidad
	if (count($entidades)>0){
		foreach ($entidades as $key=>$value){
			$sXML = genXMLEntity( $key,$value,$_SESSION[$m]['table']);
			$path = strtolower("$path_XML/cg_ent_$key.xml");
			genFile( $sXML, $path);
			$archivos[ucfirst(strtolower($key))]=$path; 
		}
	}
	$smarty->assign('archivos',$archivos);

//-------------------------------------------------------
//genXMLEntity
//-------------------------------------------------------   
function genXMLEntity( $entidad, $alias, $tablas ){

    $CR="\n";
	$indent="  ";
	$sXML = "<xml>$CR";	
	$sXML .= $indent.addNodo('entidad',ucfirst(strtolower($entidad)));
	$i=0;
Ejemplo n.º 3
0
		if (substr($key,0,6)=='chkEnt')	{
			$codebase = genClaseBase($value,$path,$filebase);
			$code = genClase($value,$path,$file);
			$files .= $path."/".$filebase."\n";
		
			if(!is_dir($path))   {
				if (mkdir($path)) { 
					genFile($codebase,$path."/".$filebase);
					genFile($code,$path."/".$file);
				}else{
					echo "ERROR: No se pudo crear directorio".$path;
				}
             }else{
				genFile($codebase,$path."/".$filebase);
				if(!file_exists($path."/".$file)){
					genFile($code,$path."/".$file);
					$files .= $path."/".$file."\n";
				}
			 }  
			$i++;
		}
	}
	
	$smarty->assign('files',$files);



//-------------------------------------------------------
//GEN CLASE BASE
//-------------------------------------------------------
function genClaseBase($fileName,&$path,&$file) {