示例#1
0
 /**
  * Get information for this content
  * @return the xml content
  */
 function getAlternative()
 {
     $resources = parent::getPrimaryResources();
     foreach ($resources as $rid => $prop) {
         $resources_types = parent::getPrimaryResourcesTypes($rid);
         if (empty($resources_types)) {
             //if there are no resource types, then don't use it.
             continue;
         }
         $temp = array();
         $secondary_array = array();
         foreach ($resources_types as $rtid) {
             $sec_resources['secondary_resources'] = parent::getSecondaryResources($rid);
             //determine secondary resource type
             foreach ($sec_resources['secondary_resources'] as $sec_id => $sec_resource) {
                 $current_sec_file = $sec_resource['resource'];
                 $secondary_array['secondary_resources'][] = $current_sec_file;
                 //add to secondary file array if it's not there
                 if (!isset($this->original_files[$current_sec_file]) || empty($this->original_files[$current_sec_file])) {
                     //TODO merge these values i think
                     $this->original_files[$current_sec_file] = $sec_resource;
                     $this->original_files[$current_sec_file]['resource_type'][$prop['resource']][] = parent::getSecondaryResourcesTypes($sec_id);
                 } else {
                     $this->original_files[$current_sec_file]['resource_type'][$prop['resource']][] = parent::getSecondaryResourcesTypes($sec_id);
                 }
                 //add this primary file ref, and the resources type to the secondary file
                 $this->original_files[$current_sec_file]['primary_resources'][$prop['resource']] = $rtid;
                 //					$this->original_files[$current_sec_file]['primary_resources'][$prop['resource']]['language_code'] = $sec_resource['language_code'];
             }
         }
         $res_type['resource_type'] = $rtid;
         //could be 1+
         $temp = array_merge($prop, $res_type, $secondary_array);
         if (isset($this->original_files[$temp['resource']])) {
             //use the existing temp array values, but merge in the secondary_array
             $temp = array_merge($this->original_files[$temp['resource']], $secondary_array);
         }
         if (!empty($temp)) {
             $this->original_files[$temp['resource']] = $temp;
         }
     }
     return $this->original_files;
 }