public function displayStatusProperty(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $records = RecordsRequest::fromRequest($this->app, $request, false, [\ACL::CHGSTATUS]);

        $databoxes = $records->databoxes();
        if (count($databoxes) > 1) {
            return new Response($this->render('prod/actions/Property/index.html.twig', [
                'records'   => $records,
            ]));
        }

        $databox = reset($databoxes);
        $statusStructure = $databox->getStatusStructure();
        $recordsStatuses = [];

        foreach ($records->received() as $record) {
            foreach ($statusStructure as $status) {
                $bit = $status['bit'];

                if (!isset($recordsStatuses[$bit])) {
                    $recordsStatuses[$bit] = $status;
                }

                $statusSet = \databox_status::bitIsSet($record->getStatusBitField(), $bit);

                if (!isset($recordsStatuses[$bit]['flag'])) {
                    $recordsStatuses[$bit]['flag'] = (int) $statusSet;
                }

                // if flag property was already set and the value is different from the previous one
                // it means that records share different value for the same flag
                if ($recordsStatuses[$bit]['flag'] !== (int) $statusSet) {
                    $recordsStatuses[$bit]['flag'] = 2;
                }
            }
        }

        return new Response($this->render('prod/actions/Property/index.html.twig', [
            'records'   => $records,
            'status'    => $recordsStatuses,
        ]));
    }
public function displayStatusProperty(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $records = RecordsRequest::fromRequest($this->app, $request, false, [\ACL::CHGSTATUS]);

        $databoxes = $records->databoxes();
        if (count($databoxes) > 1) {
            return new Response($this->render('prod/actions/Property/index.html.twig', [
                'records'   => $records,
            ]));
        }

        $databox = reset($databoxes);
        $statusStructure = $databox->getStatusStructure();
        $recordsStatuses = [];

        foreach ($records->received() as $record) {
            foreach ($statusStructure as $status) {
                $bit = $status['bit'];

                if (!isset($recordsStatuses[$bit])) {
                    $recordsStatuses[$bit] = $status;
                }

                $statusSet = \databox_status::bitIsSet($record->getStatusBitField(), $bit);

                if (!isset($recordsStatuses[$bit]['flag'])) {
                    $recordsStatuses[$bit]['flag'] = (int) $statusSet;
                }

                // if flag property was already set and the value is different from the previous one
                // it means that records share different value for the same flag
                if ($recordsStatuses[$bit]['flag'] !== (int) $statusSet) {
                    $recordsStatuses[$bit]['flag'] = 2;
                }
            }
        }

        return new Response($this->render('prod/actions/Property/index.html.twig', [
            'records'   => $records,
            'status'    => $recordsStatuses,
        ]));
    }
public function displayStatusProperty ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } $ records = RecordsRequest :: fromRequest ( $ this -> app , $ request , false , [ \ ACL :: CHGSTATUS ] ) ; $ databoxes = $ records -> databoxes ( ) ; if ( count ( $ databoxes ) > 1 ) { return new Response ( $ this -> render ( 'prod/actions/Property/index.html.twig' , [ 'records' => $ records , ] ) ) ; } $ databox = reset ( $ databoxes ) ; $ statusStructure = $ databox -> getStatusStructure ( ) ; $ recordsStatuses = [ ] ; foreach ( $ records -> received ( ) as $ record ) { foreach ( $ statusStructure as $ status ) { $ bit = $ status [ 'bit' ] ; if ( ! isset ( $ recordsStatuses [ $ bit ] ) ) { $ recordsStatuses [ $ bit ] = $ status ; } $ statusSet = \ databox_status :: bitIsSet ( $ record -> getStatusBitField ( ) , $ bit ) ; if ( ! isset ( $ recordsStatuses [ $ bit ] [ 'flag' ] ) ) { $ recordsStatuses [ $ bit ] [ 'flag' ] = ( int ) $ statusSet ; } // if flag property was already set and the value is different from the previous one // it means that records share different value for the same flag if ( $ recordsStatuses [ $ bit ] [ 'flag' ] !== ( int ) $ statusSet ) { $ recordsStatuses [ $ bit ] [ 'flag' ] = 2 ; } } } return new Response ( $ this -> render ( 'prod/actions/Property/index.html.twig' , [ 'records' => $ records , 'status' => $ recordsStatuses , ] ) ) ; }
Display Status property

@param  Request $request
@return Response
Display Status property