Example #1
0
 public static function handle_resource_content(cc_i_manifest &$manifest, $packageroot, $contextid, $outdir, $allinone = true)
 {
     $result = array();
     cc_helpers::add_files($manifest, $packageroot, $outdir, $allinone);
     $files = cc_helpers::embedded_mapping($packageroot, $contextid);
     //$rdir = $allinone ? new cc_resource_location($outdir) : null;
     $rootnode = null;
     $rootvals = null;
     $depfiles = array();
     $depres = array();
     $flocation = null;
     foreach ($files as $virtual => $values) {
         $clean_filename = $values[2];
         $vals = pkg_static_resources::instance()->get_identifier($virtual);
         $resource = $vals[3];
         $identifier = $resource->identifier;
         $flocation = $vals[1];
         if ($values[1]) {
             $rootnode = $resource;
             $rootvals = $flocation;
             continue;
         }
         $depres[] = $identifier;
         $depfiles[] = $vals[1];
         $result[$virtual] = array($identifier, $flocation, false);
     }
     if (!empty($rootnode)) {
         $rootnode->files = array_merge($rootnode->files, $depfiles);
         $result[$virtual] = array($rootnode->identifier, $rootvals, true);
     }
     return $result;
 }