public function listAction() { $this->_helper->viewRenderer->setNeverRender(true); $fields = new Model_Fields(); $sites = new Model_Sites(); $sitesRows = $sites->get($this->user, $this->_getParam('startIndex'), $this->_getParam('results')); $jsonObj = new StdClass(); $jsonObj->recordsReturned = count($sitesRows); $jsonObj->totalRecords = $sites->getNumSites($this->user); $jsonObj->startIndex = $this->_getParam('startIndex'); $jsonObj->sort = null; $jsonObj->dir = 'asc'; $jsonObj->records = array(); foreach ($sitesRows as $site) { $jsonObjSite = new StdClass(); $jsonObjSite->id = $site->id; $jsonObjSite->site = $site->site; $trusted = unserialize($site->trusted); $jsonObjSite->trusted = is_bool($trusted) && $trusted || is_array($trusted); if (is_array($trusted) && isset($trusted['Zend_OpenId_Extension_Sreg']) && count($trusted['Zend_OpenId_Extension_Sreg']) > 0) { $translatedTrusted = array(); foreach ($trusted['Zend_OpenId_Extension_Sreg'] as $identifier => $value) { $translatedTrusted[$this->view->translate($fields->getFieldName($identifier))] = $value; } $jsonObjSite->infoExchanged = $translatedTrusted; } else { $jsonObjSite->infoExchanged = false; } $jsonObj->records[] = $jsonObjSite; } echo Zend_Json::encode($jsonObj); }