Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
5.3 kB
1
Indexable
Never
public function mattPrepareData($registry_id, $entryId)
    {
        $finalData =[];
        $entityData = $this->mattGetRegistryEntityData($registry_id);
        foreach ($entityData as $row){
            $getRowDetails = $this->getRegistryEntityRow($row->id);
            $entityId = $getRowDetails->id;
            $multiformConfig = array(json_decode($getRowDetails->multiform_data));
            if (strpos($getRowDetails->name, 'text') === 0) {
                $getValue = $this->mattGetRegistryEntityVarcharValue($entityId, $entryId);
                $finalData[] = array(
                'title' =>$getRowDetails->title,
                'type' => 'text',
                'systemName' =>$getRowDetails->system_name,
                'entities_id' =>$getRowDetails->id,
                'value' =>$getValue->value,
                'multiformData' => array(json_decode($getRowDetails->multiform_data)),
                );
            } else if (strpos($getRowDetails->name, 'smart') === 0) {
                echo 'zaczynam obrabianie smarta o id: ' . $getRowDetails->id;
                //$rr = array(json_decode($getRowDetails->multiform_data));
                //var_dump ($rr[0]->registries);
                //var_dump ($rr[0]);
                //diee($rr);
                $getValues3 = $this->mattGetRegistryEntitiesInt($getRowDetails->id, $entryId);
                //diee($getValues3->toArray());
//                if ($getValues3!=null){
                $final=[];
                foreach ($getValues3 as $row2){
                    $valuessData = $this->mattGetRegistryEntityVarcharValueOnlyEntry($row2->value);
                    //$finalSmartRadioSelectedValues[] = $valuessData->toArray();
                    foreach ($valuessData as $key=>$row3 ){
                        $x[$key] = array(
                            'entities_varchar_id' => $row3->id,
                            'value' => $row3->value
                        );
                        //echo $row3->value;
                    }
                    $finalSmartRadioSelectedValues[] = array(
                        'entities_int_id' => $row2->id,
                        'varchar_data' => $x
                    );
                }
//                } else {
//                    $finalSmartRadioSelectedValues ='nd';
//                }
                $finalData[] = array(
                    'title' =>$getRowDetails->title,
                    'type' => 'smartRadioGroup',
                    'systemName' =>$getRowDetails->system_name,
                    'entities_id' =>$getRowDetails->id,
                    'value' => $finalSmartRadioSelectedValues,
                    'multiformData' => array(json_decode($getRowDetails->multiform_data))
                    //inside multiformdata is registry_id data source
                    
                );
                //$aa = json_encode($finalData);
                //echo $aa;
                //print_r($finalData, false);
                echo "<pre>".print_r($finalData,TRUE)."</pre>"; //the best debug view
                                echo 'end final data';
                echo "<br>";
                echo "<br>";
                echo "<br>";
                //diee($finalData);
            } else if (strpos($getRowDetails->name, 'date')=== 0){
                $getValue = $this->mattGetRegistryEntityDateValue($entityId, $entryId);
                $finalData[] = array(
                    'title' =>$getRowDetails->title,
                    'type' => 'date',
                    'systemName' =>$getRowDetails->system_name,
                    'entities_id' =>$getRowDetails->id,
                    'value' => $getValue->value,
                    'multiformData' => array(json_decode($getRowDetails->multiform_data))
                    //inside multiformdata is registry_id data source
                );
            } else if (strpos($getRowDetails->name, 'datetime')=== 0){
                $getValue = $this->mattGetRegistryEntityDateTimeValue($entityId, $entryId);
                $finalData[] = array(
                    'title' =>$getRowDetails->title,
                    'type' => 'date',
                    'systemName' =>$getRowDetails->system_name,
                    'entities_id' =>$getRowDetails->id,
                    'value' => $getValue->value,
                    'multiformData' => array(json_decode($getRowDetails->multiform_data))
                    //inside multiformdata is registry_id data source
                );
            } else if (strpos($getRowDetails->name, 'radio-group')=== 0){
                $getValue = $this->mattGetRegistryEntityVarcharValue($entityId, $entryId);
                $finalData[] = array(
                    'title' =>$getRowDetails->title,
                    'type' => 'date',
                    'systemName' =>$getRowDetails->system_name,
                    'entities_id' =>$getRowDetails->id,
                    'value' => $getValue->value,
                    'multiformData' => array(json_decode($getRowDetails->multiform_data))
                    //inside multiformdata is registry_id data source and RadioGroupAvlValues
                );
            };
        };
        diee($finalData);
    }