private function createAdminOrderedTool(ObjectManager $manager, Tool $tool) { $orderedTool = new OrderedTool(); $orderedTool->setTool($tool); $orderedTool->setType(0); $orderedTool->setOrder(1); $orderedTool->setLocked(false); $orderedTool->setName($tool->getName()); $orderedTool->setVisibleInDesktop(true); $manager->persist($orderedTool); }
private function initializeAdminDesktopMenuConfiguration() { $this->log('Initializing default desktop menu configuration...'); $parametersTool = $this->toolManager->getOneToolByName('parameters'); $resourcesTool = $this->toolManager->getOneToolByName('resource_manager'); $messageTool = $this->toolManager->getOneToolByName('message'); $this->om->startFlushSuite(); if (!is_null($parametersTool)) { $paramOt = $this->toolManager->getOneAdminOrderedToolByToolAndType($parametersTool); if (is_null($paramOt)) { $paramOt = new OrderedTool(); $paramOt->setTool($parametersTool); $paramOt->setType(0); $paramOt->setOrder(1); $paramOt->setLocked(false); $paramOt->setName($parametersTool->getName()); } $paramOt->setVisibleInDesktop(true); $this->om->persist($paramOt); } if (!is_null($resourcesTool)) { $resourceOt = $this->toolManager->getOneAdminOrderedToolByToolAndType($resourcesTool); if (is_null($resourceOt)) { $resourceOt = new OrderedTool(); $resourceOt->setTool($resourcesTool); $resourceOt->setType(0); $resourceOt->setOrder(2); $resourceOt->setLocked(false); $resourceOt->setName($resourcesTool->getName()); } $resourceOt->setVisibleInDesktop(true); $this->om->persist($resourceOt); } if (!is_null($messageTool)) { $messageOt = $this->toolManager->getOneAdminOrderedToolByToolAndType($messageTool); if (is_null($messageOt)) { $messageOt = new OrderedTool(); $messageOt->setTool($messageTool); $messageOt->setType(0); $messageOt->setOrder(3); $messageOt->setLocked(false); $messageOt->setName($messageTool->getName()); } $messageOt->setVisibleInDesktop(true); $this->om->persist($messageOt); } $this->om->endFlushSuite(); }
/** * {@inheritdoc} */ public function load(ObjectManager $om) { $messagePlugin = $this->getPluginFromIdentityMapOrScheduledForInsert($om, 'Claroline', 'MessageBundle'); if (!is_null($messagePlugin)) { $toolRepo = $om->getRepository('ClarolineCoreBundle:Tool\\Tool'); $messageTool = $toolRepo->findOneBy(array('name' => 'message')); if (is_null($messageTool)) { $messageTool = new Tool(); $messageTool->setName('message'); $messageTool->setClass('envelope'); $messageTool->setDisplayableInWorkspace(false); $messageTool->setDisplayableInDesktop(true); $messageTool->setPlugin($messagePlugin); $om->persist($messageTool); $adminMessageOt = new OrderedTool(); $adminMessageOt->setName('message'); $adminMessageOt->setTool($messageTool); $adminMessageOt->setLocked(false); $adminMessageOt->setOrder(1); $adminMessageOt->setType(0); $adminMessageOt->setVisibleInDesktop(true); $om->persist($adminMessageOt); $userRepo = $om->getRepository('ClarolineCoreBundle:User'); $users = $userRepo->findAllEnabledUsers(); foreach ($users as $user) { $messageOt = new OrderedTool(); $messageOt->setName('message'); $messageOt->setTool($messageTool); $messageOt->setUser($user); $messageOt->setLocked(false); $messageOt->setOrder(1); $messageOt->setType(0); $messageOt->setVisibleInDesktop(true); $om->persist($messageOt); } } else { $messageTool->setPlugin($messagePlugin); $om->persist($messageTool); } $om->flush(); } }
/** * @EXT\Route( * "/ordered/tool/{orderedTool}/locke/toggle", * name="claro_admin_ordered_tool_toggle_lock", * options={"expose"=true} * ) * * @EXT\ParamConverter("authenticatedUser", options={"authenticatedUser"=true}) */ public function toggleLock(OrderedTool $orderedTool) { $isLocked = $orderedTool->isLocked(); $orderedTool->setLocked(!$isLocked); $this->toolManager->editOrderedTool($orderedTool); return new Response('success', 200); }
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(); } }