private function updateIcons()
 {
     $this->log('Refreshing mime types icons...');
     $coreIconWebDirRelativePath = "bundles/clarolinecore/images/resources/icons/";
     $resourceImages = $this->container->get('claroline.manager.icon_manager')->getDefaultIconMap();
     $this->om->startFlushSuite();
     foreach ($resourceImages as $resourceImage) {
         $mimeType = $resourceImage[1];
         $rimg = $this->repo->findOneBy(array('mimeType' => $mimeType, 'isShortcut' => false));
         //var_dump(count($results));
         //$rimg = count($results > 0) ? $results[0]: null;
         if ($rimg === null) {
             $this->log('Adding mime type for ' . $mimeType . '.');
             $rimg = new ResourceIcon();
             $rimg->setMimeType($mimeType);
             $rimg->setShortcut(false);
             $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($rimg);
         }
         $rimg->setRelativeUrl($coreIconWebDirRelativePath . $resourceImage[0]);
         $this->om->persist($rimg);
     }
     $this->om->endFlushSuite();
     $baseIcons = $this->repo->findBaseIcons();
     $this->om->startFlushSuite();
     foreach ($baseIcons as $icon) {
         $this->log('Refreshing ' . $icon->getMimeType() . '...');
         $this->iconManager->refresh($icon);
     }
     $this->om->endFlushSuite();
     $this->om->forceFlush();
 }
 public function load(ObjectManager $manager)
 {
     $icon = new ResourceIcon();
     $icon->setMimeType('custom/ujm_exercise');
     $icon->setRelativeUrl('bundles/ujmexo/images/icons/res_exo.png');
     $icon->setShortcut(false);
     $manager->persist($icon);
     $manager->flush();
     $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($icon);
     $this->addReference('icon1', $icon);
 }
Beispiel #3
0
 public function updateIcons()
 {
     $this->log('updating icons...');
     $mimetypes = array('application/illustrator', 'application/ai');
     foreach ($mimetypes as $mimetype) {
         $icon = new ResourceIcon();
         $icon->setRelativeUrl('bundles/clarolinecore/images/resources/icons/res_vector.png');
         $icon->setMimeType($mimetype);
         $icon->setShortcut(false);
         $this->om->persist($icon);
         $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($icon);
     }
 }
 /**
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $coreIconWebDirRelativePath = 'bundles/clarolinecore/images/resources/icons/';
     $resourceImages = $this->container->get('claroline.manager.icon_manager')->getDefaultIconMap();
     foreach ($resourceImages as $resourceImage) {
         $rimg = new ResourceIcon();
         $rimg->setRelativeUrl($coreIconWebDirRelativePath . $resourceImage[0]);
         $rimg->setMimeType($resourceImage[1]);
         $rimg->setShortcut(false);
         $manager->persist($rimg);
         $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($rimg);
     }
 }
Beispiel #5
0
 public function postUpdate()
 {
     $coreIconWebDirRelativePath = "bundles/clarolinecore/images/resources/icons/";
     $images = array(array('res_mspowerpoint.png', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'), array('res_msword.png', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'));
     $this->log('Adding new resource icons...');
     foreach ($images as $image) {
         $rimg = new ResourceIcon();
         $rimg->setRelativeUrl($coreIconWebDirRelativePath . $image[0]);
         $rimg->setMimeType($image[1]);
         $rimg->setShortcut(false);
         $this->objectManager->persist($rimg);
         $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($rimg);
     }
     $this->objectManager->flush();
 }
 public function postUpdate()
 {
     $ds = DIRECTORY_SEPARATOR;
     $coreWebDir = "{$this->container->getParameter('kernel.root_dir')}{$ds}..{$ds}web{$ds}";
     $coreIconWebDirRelativePath = 'bundles/clarolinecore/images/resources/icons/';
     $coreIconWebDir = "{$coreWebDir}bundles{$ds}clarolinecore{$ds}images{$ds}resources{$ds}icons{$ds}";
     $resourceImage = array('res_audio.png', 'audio');
     $em = $this->container->get('doctrine.orm.entity_manager');
     $this->log('Update images...');
     $rimg = new ResourceIcon();
     $rimg->setRelativeUrl($coreIconWebDirRelativePath . $resourceImage[0]);
     $rimg->setMimeType($resourceImage[1]);
     $rimg->setShortcut(false);
     $em->persist($rimg);
     $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($rimg);
 }
Beispiel #7
0
 /**
  * @param array        $resource
  * @param ResourceType $resourceType
  * @param PluginBundle $pluginBundle
  */
 private function updateIcons(array $resource, ResourceType $resourceType, PluginBundle $pluginBundle)
 {
     $resourceIcon = $this->em->getRepository('ClarolineCoreBundle:Resource\\ResourceIcon')->findOneByMimeType('custom/' . $resourceType->getName());
     if (null === $resourceIcon) {
         $resourceIcon = new ResourceIcon();
         $resourceIcon->setMimeType('custom/' . $resourceType->getName());
     }
     if (isset($resource['icon'])) {
         $ds = DIRECTORY_SEPARATOR;
         $webBundleDir = "{$this->kernelRootDir}{$ds}..{$ds}web{$ds}bundles";
         $webPluginDir = "{$webBundleDir}{$ds}{$pluginBundle->getAssetsFolder()}";
         $webPluginImgDir = "{$webPluginDir}{$ds}images";
         $webPluginIcoDir = "{$webPluginImgDir}{$ds}icons";
         $this->fileSystem->mkdir(array($webBundleDir, $webPluginDir, $webPluginImgDir, $webPluginIcoDir));
         $this->fileSystem->copy("{$pluginBundle->getImgFolder()}{$ds}{$resource['icon']}", "{$webPluginIcoDir}{$ds}{$resource['icon']}");
         $resourceIcon->setRelativeUrl("bundles/{$pluginBundle->getAssetsFolder()}/images/icons/{$resource['icon']}");
     } else {
         $defaultIcon = $this->em->getRepository('ClarolineCoreBundle:Resource\\ResourceIcon')->findOneByMimeType('custom/default');
         $resourceIcon->setRelativeUrl($defaultIcon->getRelativeUrl());
     }
     $resourceIcon->setShortcut(false);
     $this->em->persist($resourceIcon);
     $this->im->createShortcutIcon($resourceIcon);
 }
Beispiel #8
0
 /**
  * Creates the shortcut icon for an existing icon.
  *
  * @param \Claroline\CoreBundle\Entity\Resource\ResourceIcon $icon
  *
  * @return \Claroline\CoreBundle\Entity\Resource\ResourceIcon
  *
  * @throws \RuntimeException
  */
 public function createShortcutIcon(ResourceIcon $icon, Workspace $workspace = null)
 {
     $this->om->startFlushSuite();
     $relativeUrl = $this->createShortcutFromRelativeUrl($icon->getRelativeUrl(), $workspace);
     $shortcutIcon = new ResourceIcon();
     $shortcutIcon->setRelativeUrl($relativeUrl);
     $shortcutIcon->setMimeType($icon->getMimeType());
     $shortcutIcon->setShortcut(true);
     $icon->setShortcutIcon($shortcutIcon);
     $shortcutIcon->setShortcutIcon($shortcutIcon);
     $this->om->persist($icon);
     $this->om->persist($shortcutIcon);
     $this->om->endFlushSuite();
     return $shortcutIcon;
 }
 private function addingResourceIcons()
 {
     $coreIconWebDirRelativePath = 'bundles/clarolinecore/images/resources/icons/';
     $om = $this->container->get('doctrine.orm.entity_manager');
     $repo = $om->getRepository('Claroline\\CoreBundle\\Entity\\Resource\\ResourceIcon');
     $resourceImages = $this->container->get('claroline.manager.icon_manager')->getDefaultIconMap();
     foreach ($resourceImages as $resourceImage) {
         $imgs = $repo->findBy(array('mimeType' => $resourceImage[1]));
         if (count($imgs) === 0) {
             $this->log('Adding icon for mime type ' . $resourceImage[1] . '...');
             $rimg = new ResourceIcon();
             $rimg->setRelativeUrl($coreIconWebDirRelativePath . $resourceImage[0]);
             $rimg->setMimeType($resourceImage[1]);
             $rimg->setShortcut(false);
             $om->persist($rimg);
             $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($rimg);
         }
     }
 }
Beispiel #10
0
 public function updateIcons()
 {
     $this->log('updating icons...');
     $coreIconWebDirRelativePath = "bundles/clarolinecore/images/resources/icons/";
     $resourceImages = array(array('res_vector.png', 'application/postscript'), array('res_vector.png', 'image/svg+xml'), array('res_zip.png', 'application/zip'), array('res_zip.png', 'application/x-rar-compressed'), array('res_archive.png', 'application/x-gtar'), array('res_archive.png', 'application/x-7z-compressed'));
     foreach ($resourceImages as $resourceImage) {
         $icon = new ResourceIcon();
         $icon->setRelativeUrl($coreIconWebDirRelativePath . $resourceImage[0]);
         $icon->setMimeType($resourceImage[1]);
         $icon->setShortcut(false);
         $this->om->persist($icon);
         $this->container->get('claroline.manager.icon_manager')->createShortcutIcon($icon);
     }
 }
Beispiel #11
0
 /**
  * @param array        $resource
  * @param ResourceType $resourceType
  * @param PluginBundle $pluginBundle
  */
 private function updateIcons(array $resource, ResourceType $resourceType, PluginBundle $pluginBundle)
 {
     $resourceIcon = $this->em->getRepository('ClarolineCoreBundle:Resource\\ResourceIcon')->findOneByMimeType('custom/' . $resourceType->getName());
     if (null === $resourceIcon) {
         $resourceIcon = new ResourceIcon();
         $resourceIcon->setMimeType('custom/' . $resourceType->getName());
     }
     if (isset($resource['icon'])) {
         $resourceIcon->setRelativeUrl("bundles/{$pluginBundle->getAssetsFolder()}/images/icons/{$resource['icon']}");
     } else {
         $defaultIcon = $this->em->getRepository('ClarolineCoreBundle:Resource\\ResourceIcon')->findOneByMimeType('custom/default');
         $resourceIcon->setRelativeUrl($defaultIcon->getRelativeUrl());
     }
     $resourceIcon->setShortcut(false);
     $this->em->persist($resourceIcon);
     $this->im->createShortcutIcon($resourceIcon);
 }