You are here

function opigno_scorm_access in Opigno 7

Access callback: verify access to the SCORM object.

Invokes hook_opigno_scorm_access() to verify access. If any module GRANTS access, returns true, even if some other module DENIES access.

Parameters

object $scorm:

Return value

bool

2 string references to 'opigno_scorm_access'
opigno_scorm_menu in modules/scorm/opigno_scorm.module
Implements hook_menu().
opigno_scorm_ui_menu in modules/scorm/ui/opigno_scorm_ui.module
Implements hook_menu().

File

modules/scorm/opigno_scorm.module, line 48
Opigno SCORM API.

Code

function opigno_scorm_access($scorm) {
  $access = NULL;
  foreach (module_implements('opigno_scorm_access') as $module) {
    $result = module_invoke($module, 'opigno_scorm_access', $scorm);

    // Does the module have something to say about this SCORM package ?
    // If it is NULL, skip. If it is set, check it.
    if (isset($result)) {

      // Access granted, end here.
      if ($result) {
        return TRUE;
      }
      else {

        // Access denied, but someone might still grant access.
        // Continue.
        $access = $result;
      }
    }
  }

  // If no-one had anything to say about granting access, return 'access content'.
  // Else, return the access result.
  if (isset($access)) {
    return $access;
  }
  else {
    return user_access('access content');
  }
}