Ok, not sure if it is related to your issue, but I can see two problems.
return new moodle_url('http://localhost/moodle/blocks/globals/view.php', array('blockid' => 17, 'courseid' => 1, 'global' => 'site'));//todo: get these dynamic
should be something like
return new moodle_url('/blocks/globals/view.php', array( ... ));
with the actually parameters passed dynamically, as your todo note says.
'objectid' => $PAGE->cm->instance,
As far as I know, the $PAGE->cm is only set when you are viewing a real course module (cm), that is an activity module. Modules usually set it by calling require_login()
with the $cm record provided.
Do you have debugging enabled? I believe it would throw an error about accessing property of a non-object, or something like that.