/** * Print required YUI libraries, must be called before html head printed * @return boolean */ public static function js() { global $PAGE, $CFG; // setup variables for non-js interface self::$nonjs = optional_param('nonjscomment', '', PARAM_ALPHA); self::$comment_itemid = optional_param('comment_itemid', '', PARAM_INT); self::$comment_context = optional_param('comment_context', '', PARAM_INT); self::$comment_area = optional_param('comment_area', '', PARAM_ALPHAEXT); $PAGE->requires->yui_lib('yahoo')->in_head(); $PAGE->requires->yui_lib('dom')->in_head(); $PAGE->requires->yui_lib('event')->in_head(); $PAGE->requires->yui_lib('animation')->in_head(); $PAGE->requires->yui_lib('json')->in_head(); $PAGE->requires->yui_lib('connection')->in_head(); $PAGE->requires->js('comment/comment.js')->in_head(); $PAGE->requires->string_for_js('addcomment', 'moodle'); $PAGE->requires->string_for_js('deletecomment', 'moodle'); }
/** * Receive nonjs comment parameters * * @param moodle_page $page The page object to initialise comments within * If not provided the global $PAGE is used */ public static function init(moodle_page $page = null) { global $PAGE; if (empty($page)) { $page = $PAGE; } // setup variables for non-js interface self::$nonjs = optional_param('nonjscomment', '', PARAM_ALPHANUM); self::$comment_itemid = optional_param('comment_itemid', '', PARAM_INT); self::$comment_context = optional_param('comment_context', '', PARAM_INT); self::$comment_page = optional_param('comment_page', '', PARAM_INT); self::$comment_area = optional_param('comment_area', '', PARAM_AREA); $page->requires->string_for_js('addcomment', 'moodle'); $page->requires->string_for_js('deletecomment', 'moodle'); $page->requires->string_for_js('comments', 'moodle'); $page->requires->string_for_js('commentsrequirelogin', 'moodle'); }
/** * Receive nonjs comment parameters */ public static function init() { global $PAGE, $CFG; // setup variables for non-js interface self::$nonjs = optional_param('nonjscomment', '', PARAM_ALPHA); self::$comment_itemid = optional_param('comment_itemid', '', PARAM_INT); self::$comment_context = optional_param('comment_context', '', PARAM_INT); self::$comment_page = optional_param('comment_page', '', PARAM_INT); self::$comment_area = optional_param('comment_area', '', PARAM_ALPHAEXT); $PAGE->requires->string_for_js('addcomment', 'moodle'); $PAGE->requires->string_for_js('deletecomment', 'moodle'); $PAGE->requires->string_for_js('comments', 'moodle'); $PAGE->requires->string_for_js('commentsrequirelogin', 'moodle'); }