Esempio n. 1
0
 function process_section($section, $template)
 {
     global $db;
     if (!is_object($template)) {
         $template = $db->selectObject('section_template', 'id=' . $template);
         $section->subtheme = $template->subtheme;
         $db->updateObject($section, 'section');
     }
     $prefix = '@st' . $template->id;
     $refs = $db->selectObjects('locationref', "source LIKE '{$prefix}%'");
     // Copy all modules and content for this section
     foreach ($refs as $ref) {
         $src = substr($ref->source, strlen($prefix)) . $section->id;
         if (call_user_func(array($ref->module, 'hasContent'))) {
             $oloc = pathos_core_makeLocation($ref->module, $ref->source);
             $nloc = pathos_core_makeLocation($ref->module, $src);
             call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc);
         }
     }
     // Grab sub pages
     foreach ($db->selectObjects('section_template', 'parent=' . $template->id) as $t) {
         navigationmodule::process_subsections($section, $t);
     }
 }