public function formlistAction()
    {
        //first create the baseurl of the form http(s)://projecturl/openrosa/download/form/
        $helper  = new \Zend_View_Helper_ServerUrl();
        $baseUrl = $helper->serverUrl() . \Zend_Controller_Front::getInstance()->getBaseUrl() . '/openrosa/download/form/';

        //As we don't have forms defined yet, we pass in an array, but ofcourse this should be dynamic
        //and come from a helper method
        $model = $this->getModel();
        $rawForms = $model->load(array('gof_form_active'=>1));
        foreach($rawForms as $form) {
            $forms[] = array(
                'formID'      => $form['gof_form_id'],
                'name'        => $form['gof_form_title'],
                'version'     => $form['gof_form_version'],
                'hash'        => md5($form['gof_form_id'].$form['gof_form_version']),
                'downloadUrl' => $baseUrl . $form['gof_form_xml']
            );
        }

        //Now make it a rosaresponse
        $this->makeRosaResponse();

        $xml = $this->getXml('xforms xmlns="http://openrosa.org/xforms/xformsList"');
        foreach ($forms as $form) {
            $xform = $xml->addChild('xform');
            foreach ($form as $key => $value) {
                $xform->addChild($key, $value);
            }
        }

        echo $xml->asXML();
    }
public function formlistAction()
    {
        //first create the baseurl of the form http(s)://projecturl/openrosa/download/form/
        $helper  = new \Zend_View_Helper_ServerUrl();
        $baseUrl = $helper->serverUrl() . \Zend_Controller_Front::getInstance()->getBaseUrl() . '/openrosa/download/form/';

        //As we don't have forms defined yet, we pass in an array, but ofcourse this should be dynamic
        //and come from a helper method
        $model = $this->getModel();
        $rawForms = $model->load(array('gof_form_active'=>1));
        foreach($rawForms as $form) {
            $forms[] = array(
                'formID'      => $form['gof_form_id'],
                'name'        => $form['gof_form_title'],
                'version'     => $form['gof_form_version'],
                'hash'        => md5($form['gof_form_id'].$form['gof_form_version']),
                'downloadUrl' => $baseUrl . $form['gof_form_xml']
            );
        }

        //Now make it a rosaresponse
        $this->makeRosaResponse();

        $xml = $this->getXml('xforms xmlns="http://openrosa.org/xforms/xformsList"');
        foreach ($forms as $form) {
            $xform = $xml->addChild('xform');
            foreach ($form as $key => $value) {
                $xform->addChild($key, $value);
            }
        }

        echo $xml->asXML();
    }
public function formlistAction ( ) { //first create the baseurl of the form http(s)://projecturl/openrosa/download/form/ $ helper = new \ Zend_View_Helper_ServerUrl ( ) ; $ baseUrl = $ helper -> serverUrl ( ) . \ Zend_Controller_Front :: getInstance ( ) -> getBaseUrl ( ) . '/openrosa/download/form/' ; //As we don't have forms defined yet, we pass in an array, but ofcourse this should be dynamic //and come from a helper method $ model = $ this -> getModel ( ) ; $ rawForms = $ model -> load ( array ( 'gof_form_active' => 1 ) ) ; foreach ( $ rawForms as $ form ) { $ forms [ ] = array ( 'formID' => $ form [ 'gof_form_id' ] , 'name' => $ form [ 'gof_form_title' ] , 'version' => $ form [ 'gof_form_version' ] , 'hash' => md5 ( $ form [ 'gof_form_id' ] . $ form [ 'gof_form_version' ] ) , 'downloadUrl' => $ baseUrl . $ form [ 'gof_form_xml' ] ) ; } //Now make it a rosaresponse $ this -> makeRosaResponse ( ) ; $ xml = $ this -> getXml ( 'xforms xmlns="http://openrosa.org/xforms/xformsList"' ) ; foreach ( $ forms as $ form ) { $ xform = $ xml -> addChild ( 'xform' ) ; foreach ( $ form as $ key => $ value ) { $ xform -> addChild ( $ key , $ value ) ; } } echo $ xml -> asXML ( ) ; }
Accessible via formList as defined in the menu and standard for openRosa clients
Accessible via formList as defined in the menu and standard for openRosa clients