示例#1
0
 /**
  * Implements loadContentDependencies
  */
 public function loadContentDependencies($id, $type = null)
 {
     global $DB;
     $query = "SELECT hcl.id AS unidepid\n                       , hl.id\n                       , hl.machine_name\n                       , hl.major_version\n                       , hl.minor_version\n                       , hl.patch_version\n                       , hl.preloaded_css\n                       , hl.preloaded_js\n                       , hcl.drop_css\n                       , hcl.dependency_type\n                   FROM {hvp_contents_libraries} hcl\n                   JOIN {hvp_libraries} hl ON hcl.library_id = hl.id\n                  WHERE hcl.hvp_id = ?";
     $queryArgs = array($id);
     if ($type !== null) {
         $query .= " AND hcl.dependency_type = ?";
         $queryArgs[] = $type;
     }
     $query .= " ORDER BY hcl.weight";
     $data = $DB->get_records_sql($query, $queryArgs);
     $dependencies = array();
     foreach ($data as $dependency) {
         unset($dependency->unidepid);
         $dependencies[] = \H5PCore::snakeToCamel($dependency);
     }
     return $dependencies;
 }