/**
  * Create a copy of a theme and return the new copy.
  * 
  * @param object Harmoni_Gui2_ThemeInterface $theme
  * @return object Harmoni_Gui2_ThemeInterface
  * @access public
  * @since 5/16/08
  */
 public function createCopy(Harmoni_Gui2_ThemeInterface $theme)
 {
     $newTheme = $this->createTheme();
     $newTheme->updateDisplayName($theme->getDisplayName() . " " . _("copy"));
     $newTheme->updateDescription($theme->getDescription());
     $newTheme->updateThumbnail($theme->getThumbnail());
     if ($theme->supportsOptions()) {
         $optionsSession = $theme->getOptionsSession();
         $newOptionsSession = $newTheme->getOptionsSession();
         $newOptionsSession->updateOptionsDocument($optionsSession->getOptionsDocument());
     }
     $modSess = $newTheme->getModificationSession();
     $modSess->updateGlobalCss($theme->getGlobalCss());
     foreach ($theme->getComponentTypes() as $type) {
         $modSess->updateCssForType($type, $theme->getCssForType($type));
         $modSess->updateTemplateForType($type, $theme->getTemplateForType($type));
     }
     foreach ($theme->getImages() as $image) {
         $path = $image->getPath();
         $dir = dirname($path);
         $prefixPath = '';
         if (preg_match('/^(?:(?:.*\\/)?images\\/)?(.+)$/', $dir, $matches)) {
             $prefixPath = $matches[1];
         }
         $modSess->addImage($image, $image->getBasename(), $prefixPath);
     }
     return $newTheme;
 }