main/core/Manager/ToolManager.php
public function addRequiredToolsToUser(User $user, $type = 0)
    {
        $requiredTools = [];
        $adminOrderedTools = $this->getConfigurableDesktopOrderedToolsByTypeForAdmin($type);

        foreach ($adminOrderedTools as $orderedTool) {
            if ($orderedTool->isVisibleInDesktop()) {
                $requiredTools[] = $orderedTool->getTool();
            }
        }

        $position = 1;
        $this->om->startFlushSuite();

        foreach ($requiredTools as $requiredTool) {
            $this->addDesktopTool(
                $requiredTool,
                $user,
                $position,
                $requiredTool->getName(),
                $type
            );
            ++$position;
        }

        $this->om->persist($user);
        $this->om->endFlushSuite($user);
    }
public function addRequiredToolsToUser(User $user, $type = 0)
    {
        $requiredTools = [];
        $adminOrderedTools = $this->getConfigurableDesktopOrderedToolsByTypeForAdmin($type);

        foreach ($adminOrderedTools as $orderedTool) {
            if ($orderedTool->isVisibleInDesktop()) {
                $requiredTools[] = $orderedTool->getTool();
            }
        }

        $position = 1;
        $this->om->startFlushSuite();

        foreach ($requiredTools as $requiredTool) {
            $this->addDesktopTool(
                $requiredTool,
                $user,
                $position,
                $requiredTool->getName(),
                $type
            );
            ++$position;
        }

        $this->om->persist($user);
        $this->om->endFlushSuite($user);
    }
public function addRequiredToolsToUser ( User $ user , $ type = 0 ) { $ requiredTools = [ ] ; $ adminOrderedTools = $ this -> getConfigurableDesktopOrderedToolsByTypeForAdmin ( $ type ) ; foreach ( $ adminOrderedTools as $ orderedTool ) { if ( $ orderedTool -> isVisibleInDesktop ( ) ) { $ requiredTools [ ] = $ orderedTool -> getTool ( ) ; } } $ position = 1 ; $ this -> om -> startFlushSuite ( ) ; foreach ( $ requiredTools as $ requiredTool ) { $ this -> addDesktopTool ( $ requiredTool , $ user , $ position , $ requiredTool -> getName ( ) , $ type ) ; ++ $ position ; } $ this -> om -> persist ( $ user ) ; $ this -> om -> endFlushSuite ( $ user ) ; }
Adds the mandatory tools at the user creation.

@param \Claroline\CoreBundle\Entity\User $user
Adds the mandatory tools at the user creation .