DuoFernDevice/module.php
/**
     * Sets dynamic configuration form for device list
     *
     * @return string configuration json string
     */
Sets dynamic configuration form for device list
@return string configuration json string
Sets dynamic configuration form for device list @return string configuration json string
public function GetConfigurationForm()
    {
        $data = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . "form.json"), true);
        switch ($this->DeviceGroupBuffer) {
            case 22:
                array_splice($data['elements'], 0, 1);
                break;
            default: 
                array_splice($data['elements'], 1, count($data['elements']) - 5);
                unset($data['actions']);
                break;
        }
        $duoFernCode = $this->ReadPropertyString("duoFernCode");
        $productName = DuoFernDeviceType::getDeviceType($duoFernCode);
        if ($productName !== null) {
            $data['elements'][count($data['elements']) - 3]['label'] = sprintf($this->Translate("Product name: %s"), $productName);
        } else {
            array_splice($data['elements'], count($data['elements']) - 3, 1);
        }
        if ($this->VersionBuffer !== null && $this->GetStatus()) {
            $data['elements'][count($data['elements']) - 1]['label'] = sprintf($this->Translate("Version: %s"), $this->VersionBuffer);
        } else {
            array_splice($data['elements'], count($data['elements']) - 1, 1);
        }
        return json_encode($data);
    }
public function GetConfigurationForm ( ) { $ data = json_decode ( file_get_contents ( __DIR__ . DIRECTORY_SEPARATOR . " form.json " ) , true ) ; switch ( $ this -> DeviceGroupBuffer ) { case 22 : array_splice ( $ data [ 'elements' ] , 0 , 1 ) ; break ; default : array_splice ( $ data [ 'elements' ] , 1 , count ( $ data [ 'elements' ] ) - 5 ) ; unset ( $ data [ 'actions' ] ) ; break ; } $ duoFernCode = $ this -> ReadPropertyString ( " duoFernCode " ) ; $ productName = DuoFernDeviceType :: getDeviceType ( $ duoFernCode ) ; if ( $ productName !== null ) { $ data [ 'elements' ] [ count ( $ data [ 'elements' ] ) - 3 ] [ 'label' ] = sprintf ( $ this -> Translate ( " Product name: %s " ) , $ productName ) ; } else { array_splice ( $ data [ 'elements' ] , count ( $ data [ 'elements' ] ) - 3 , 1 ) ; } if ( $ this -> VersionBuffer !== null && $ this -> GetStatus ( ) ) { $ data [ 'elements' ] [ count ( $ data [ 'elements' ] ) - 1 ] [ 'label' ] = sprintf ( $ this -> Translate ( " Version: %s " ) , $ this -> VersionBuffer ) ; } else { array_splice ( $ data [ 'elements' ] , count ( $ data [ 'elements' ] ) - 1 , 1 ) ; } return json_encode ( $ data ) ; }
Sets dynamic configuration form for device list
 @return string configuration json string
Sets dynamic configuration form for device list @return string configuration json string
// slice not needed elements // not supported device // set product name // set version