Esempio n. 1
0
 private function updateCompetenceTools()
 {
     $this->log('Creating admin referential competence tools...');
     $existingTool = $this->om->getRepository('ClarolineCoreBundle:Tool\\AdminTool')->findByName('competence_referencial');
     if (count($existingTool) === 0) {
         $competenceReferencial = new AdminTool();
         $competenceReferencial->setName('competence_referencial');
         $competenceReferencial->setClass('graduation-cap');
         $this->om->persist($competenceReferencial);
     }
     $existingTool = $this->om->getRepository('ClarolineCoreBundle:Tool\\AdminTool')->findByName('competence_subscription');
     if (count($existingTool) === 0) {
         $competenceSubscription = new AdminTool();
         $competenceSubscription->setName('competence_subscription');
         $competenceSubscription->setClass('code-fork');
         $this->om->persist($competenceSubscription);
     }
     $existingTool = $this->om->getRepository('ClarolineCoreBundle:Tool\\Tool')->findOneBy(array('name' => 'learning_profil'));
     if (!$existingTool) {
         $wsTool = new Tool();
         $wsTool->setName('learning_profil');
         $wsTool->setClass('graduation-cap');
         $wsTool->setIsWorkspaceRequired(true);
         $wsTool->setIsDesktopRequired(false);
         $wsTool->setDisplayableInWorkspace(true);
         $wsTool->setDisplayableInDesktop(false);
         $wsTool->setExportable(false);
         $wsTool->setIsConfigurableInWorkspace(false);
         $wsTool->setIsConfigurableInDesktop(false);
         $this->om->persist($wsTool);
     }
     $this->om->flush();
     $this->log('competence tools created ...');
 }
Esempio n. 2
0
 public function load(ObjectManager $manager)
 {
     $tools = array(array('home', 'home', false, false, true, true, true, false, false, false, false), array('parameters', 'cogs', false, false, true, true, false, false, false, true, true), array('resource_manager', 'folder-open', false, false, true, true, true, true, false, false, false), array('logs', 'list', false, false, true, false, false, false, false, false, true), array('analytics', 'bar-chart-o', false, false, true, false, false, false, false, false, true), array('users', 'user', true, false, true, false, false, false, false, false, true), array('my_contacts', 'users', false, false, false, true, false, false, false, false, true));
     foreach ($tools as $tool) {
         $entity = new Tool();
         $entity->setName($tool[0]);
         $entity->setClass($tool[1]);
         $entity->setIsWorkspaceRequired($tool[2]);
         $entity->setIsDesktopRequired($tool[3]);
         $entity->setDisplayableInWorkspace($tool[4]);
         $entity->setDisplayableInDesktop($tool[5]);
         $entity->setExportable($tool[6]);
         $entity->setIsConfigurableInWorkspace($tool[7]);
         $entity->setIsConfigurableInDesktop($tool[8]);
         $entity->setIsLockedForAdmin($tool[9]);
         $entity->setIsAnonymousExcluded($tool[10]);
         $manager->persist($entity);
         $this->createToolMaskDecoders($manager, $entity);
         $this->createPersonalWorkspaceToolConfig($manager, $entity);
         if ($tool[0] === 'parameters' || $tool[0] === 'resource_manager' || $tool[0] === 'my_contacts') {
             $this->createAdminOrderedTool($manager, $entity);
         }
     }
     $this->updatePersonalWorkspaceResourceRightsConfig($manager);
     $manager->flush();
 }
Esempio n. 3
0
 private function createWorkspaceLearningOutcomesTool()
 {
     $this->log('Creating workspace learning outcomes tool...');
     $learningOutcomesTool = $this->em->getRepository('ClarolineCoreBundle:Tool\\Tool')->findOneBy(array('name' => 'learning_outcomes'));
     if (!$learningOutcomesTool) {
         $wsTool = new Tool();
         $wsTool->setName('learning_outcomes');
         $wsTool->setClass('graduation-cap');
         $wsTool->setIsWorkspaceRequired(true);
         $wsTool->setIsDesktopRequired(false);
         $wsTool->setDisplayableInWorkspace(true);
         $wsTool->setDisplayableInDesktop(false);
         $wsTool->setExportable(false);
         $wsTool->setIsConfigurableInWorkspace(false);
         $wsTool->setIsConfigurableInDesktop(false);
         $this->em->persist($wsTool);
     }
 }
Esempio n. 4
0
 /**
  * @param array  $toolConfiguration
  * @param Plugin $plugin
  * @param Tool   $tool
  */
 private function persistTool($toolConfiguration, Plugin $plugin, Tool $tool)
 {
     $tool->setName($toolConfiguration['name']);
     $tool->setDisplayableInDesktop($toolConfiguration['is_displayable_in_desktop']);
     $tool->setDisplayableInWorkspace($toolConfiguration['is_displayable_in_workspace']);
     $tool->setIsDesktopRequired(false);
     $tool->setIsWorkspaceRequired(false);
     $tool->setPlugin($plugin);
     $tool->setExportable($toolConfiguration['is_exportable']);
     $tool->setIsConfigurableInWorkspace($toolConfiguration['is_configurable_in_workspace']);
     $tool->setIsConfigurableInDesktop($toolConfiguration['is_configurable_in_desktop']);
     $tool->setIsLockedForAdmin($toolConfiguration['is_locked_for_admin']);
     $tool->setIsAnonymousExcluded($toolConfiguration['is_anonymous_excluded']);
     if (isset($toolConfiguration['class'])) {
         $tool->setClass("{$toolConfiguration['class']}");
     } else {
         $tool->setClass("wrench");
     }
     $this->toolManager->create($tool);
     $this->persistCustomToolRights($toolConfiguration['tool_rights'], $tool);
 }
Esempio n. 5
0
 private function addMyContactsTool()
 {
     $this->log('Installing my_contacts tool...');
     $om = $this->container->get('claroline.persistence.object_manager');
     $toolManager = $this->container->get('claroline.manager.tool_manager');
     $myContactsTool = $toolManager->getOneToolByName('my_contacts');
     if (is_null($myContactsTool)) {
         $myContactsTool = new Tool();
         $myContactsTool->setName('my_contacts');
         $myContactsTool->setClass('users');
         $myContactsTool->setIsWorkspaceRequired(false);
         $myContactsTool->setIsDesktopRequired(false);
         $myContactsTool->setDisplayableInWorkspace(false);
         $myContactsTool->setDisplayableInDesktop(true);
         $myContactsTool->setExportable(false);
         $myContactsTool->setIsConfigurableInWorkspace(false);
         $myContactsTool->setIsConfigurableInDesktop(false);
         $myContactsTool->setIsLockedForAdmin(false);
         $myContactsTool->setIsAnonymousExcluded(true);
         $toolManager->create($myContactsTool);
         $myContactsOt = new OrderedTool();
         $myContactsOt->setTool($myContactsTool);
         $myContactsOt->setType(0);
         $myContactsOt->setOrder(10);
         $myContactsOt->setLocked(false);
         $myContactsOt->setName($myContactsTool->getName());
         $myContactsOt->setVisibleInDesktop(true);
         $om->persist($myContactsOt);
         $om->flush();
     }
 }
Esempio n. 6
0
 private function addAnalyticsWorkspaceTool()
 {
     $decoder = $this->om->getRepository('ClarolineCoreBundle:Tool\\Tool')->findOneBy(array('name' => 'analytics'));
     if (!$decoder) {
         $wsTool = new Tool();
         $wsTool->setName('analytics');
         $wsTool->setClass('icon-bar-chart');
         $wsTool->setIsWorkspaceRequired(false);
         $wsTool->setIsDesktopRequired(false);
         $wsTool->setDisplayableInWorkspace(true);
         $wsTool->setDisplayableInDesktop(false);
         $wsTool->setExportable(false);
         $wsTool->setIsConfigurableInWorkspace(false);
         $wsTool->setIsConfigurableInDesktop(false);
         $this->om->persist($wsTool);
         $this->log("Adding 'analytics' tool in workspaces");
     } else {
         $this->log("The 'analytics' tool already exists");
     }
     $this->om->flush();
 }