public static function get_content($component, $method, $args = array()) {
        global $OUTPUT, $PAGE, $USER;

        $params = self::validate_parameters(self::get_content_parameters(),
            array(
                'component' => $component,
                'method' => $method,
                'args' => $args
            )
        );

        // Reformat arguments into something less unwieldy.
        $arguments = array();
        foreach ($params['args'] as $paramargument) {
            $arguments[$paramargument['name']] = $paramargument['value'];
        }

        // The component was validated via the PARAM_COMPONENT parameter type.
        $classname = '\\' . $params['component'] .'\output\mobile';
        if (!method_exists($classname, $params['method'])) {
            throw new coding_exception("Missing method in $classname");
        }
        $result = call_user_func_array(array($classname, $params['method']), array($arguments));

        // Populate otherdata.
        $otherdata = array();
        if (!empty($result['otherdata'])) {
            $result['otherdata'] = (array) $result['otherdata'];
            foreach ($result['otherdata'] as $name => $value) {
                $otherdata[] = array(
                    'name' => $name,
                    'value' => $value
                );
            }
        }

        return array(
            'templates'  => !empty($result['templates']) ? $result['templates'] : array(),
            'javascript' => !empty($result['javascript']) ? $result['javascript'] : '',
            'otherdata'  => $otherdata,
            'files'      => !empty($result['files']) ? $result['files'] : array(),
            'restrict'   => !empty($result['restrict']) ? $result['restrict'] : array(),
        );
    }
public static function get_content($component, $method, $args = array()) {
        global $OUTPUT, $PAGE, $USER;

        $params = self::validate_parameters(self::get_content_parameters(),
            array(
                'component' => $component,
                'method' => $method,
                'args' => $args
            )
        );

        // Reformat arguments into something less unwieldy.
        $arguments = array();
        foreach ($params['args'] as $paramargument) {
            $arguments[$paramargument['name']] = $paramargument['value'];
        }

        // The component was validated via the PARAM_COMPONENT parameter type.
        $classname = '\\' . $params['component'] .'\output\mobile';
        if (!method_exists($classname, $params['method'])) {
            throw new coding_exception("Missing method in $classname");
        }
        $result = call_user_func_array(array($classname, $params['method']), array($arguments));

        // Populate otherdata.
        $otherdata = array();
        if (!empty($result['otherdata'])) {
            $result['otherdata'] = (array) $result['otherdata'];
            foreach ($result['otherdata'] as $name => $value) {
                $otherdata[] = array(
                    'name' => $name,
                    'value' => $value
                );
            }
        }

        return array(
            'templates'  => !empty($result['templates']) ? $result['templates'] : array(),
            'javascript' => !empty($result['javascript']) ? $result['javascript'] : '',
            'otherdata'  => $otherdata,
            'files'      => !empty($result['files']) ? $result['files'] : array(),
            'restrict'   => !empty($result['restrict']) ? $result['restrict'] : array(),
        );
    }
public static function get_content ( $ component , $ method , $ args = array ( ) ) { global $ OUTPUT , $ PAGE , $ USER ; $ params = self :: validate_parameters ( self :: get_content_parameters ( ) , array ( 'component' => $ component , 'method' => $ method , 'args' => $ args ) ) ; // Reformat arguments into something less unwieldy. $ arguments = array ( ) ; foreach ( $ params [ 'args' ] as $ paramargument ) { $ arguments [ $ paramargument [ 'name' ] ] = $ paramargument [ 'value' ] ; } // The component was validated via the PARAM_COMPONENT parameter type. $ classname = '\\' . $ params [ 'component' ] . '\output\mobile' ; if ( ! method_exists ( $ classname , $ params [ 'method' ] ) ) { throw new coding_exception ( "Missing method in $classname" ) ; } $ result = call_user_func_array ( array ( $ classname , $ params [ 'method' ] ) , array ( $ arguments ) ) ; // Populate otherdata. $ otherdata = array ( ) ; if ( ! empty ( $ result [ 'otherdata' ] ) ) { $ result [ 'otherdata' ] = ( array ) $ result [ 'otherdata' ] ; foreach ( $ result [ 'otherdata' ] as $ name => $ value ) { $ otherdata [ ] = array ( 'name' => $ name , 'value' => $ value ) ; } } return array ( 'templates' => ! empty ( $ result [ 'templates' ] ) ? $ result [ 'templates' ] : array ( ) , 'javascript' => ! empty ( $ result [ 'javascript' ] ) ? $ result [ 'javascript' ] : '' , 'otherdata' => $ otherdata , 'files' => ! empty ( $ result [ 'files' ] ) ? $ result [ 'files' ] : array ( ) , 'restrict' => ! empty ( $ result [ 'restrict' ] ) ? $ result [ 'restrict' ] : array ( ) , ) ; }
Returns a piece of content to be displayed in the Mobile app, it usually returns a template, javascript and
other structured data that will be used to render a view in the Mobile app..

Callbacks (placed in \$component\output\mobile) that are called by this web service are responsible for doing the
appropriate security checks to access the information to be returned.

@param string $component fame of the component.
@param string $method function method name in class \$component\output\mobile.
@param array $args optional arguments for the method.
@return array HTML, JavaScript and other required data and information to create a view in the app.
@since Moodle 3.5
@throws coding_exception
Returns a piece of content to be displayed in the Mobile app it usually returns a template javascript and other structured data that will be used to render a view in the Mobile app ..