plugin/wiki/Entity/Section.php
public function setNewActiveContributionToSection(User $user = null)
    {
        $oldActiveContribution = $this->getActiveContribution();
        $newActiveContribution = new Contribution();
        $newActiveContribution->setSection($this);
        if (null === $oldActiveContribution) {
            if (null === $user) {
                $user = $this->getAuthor();
            }
        } else {
            if (null === $user) {
                $user = $oldActiveContribution->getContributor();
            }
            if (null === $user) {
                $user = $this->getAuthor();
            }
            $newActiveContribution->setTitle($oldActiveContribution->getTitle());
            $newActiveContribution->setText($oldActiveContribution->getText());
        }
        $newActiveContribution->setContributor($user);
        $this->setActiveContribution($newActiveContribution);
    }
public function setNewActiveContributionToSection(User $user = null)
    {
        $oldActiveContribution = $this->getActiveContribution();
        $newActiveContribution = new Contribution();
        $newActiveContribution->setSection($this);
        if (null === $oldActiveContribution) {
            if (null === $user) {
                $user = $this->getAuthor();
            }
        } else {
            if (null === $user) {
                $user = $oldActiveContribution->getContributor();
            }
            if (null === $user) {
                $user = $this->getAuthor();
            }
            $newActiveContribution->setTitle($oldActiveContribution->getTitle());
            $newActiveContribution->setText($oldActiveContribution->getText());
        }
        $newActiveContribution->setContributor($user);
        $this->setActiveContribution($newActiveContribution);
    }
public function setNewActiveContributionToSection ( User $ user = null ) { $ oldActiveContribution = $ this -> getActiveContribution ( ) ; $ newActiveContribution = new Contribution ( ) ; $ newActiveContribution -> setSection ( $ this ) ; if ( null === $ oldActiveContribution ) { if ( null === $ user ) { $ user = $ this -> getAuthor ( ) ; } } else { if ( null === $ user ) { $ user = $ oldActiveContribution -> getContributor ( ) ; } if ( null === $ user ) { $ user = $ this -> getAuthor ( ) ; } $ newActiveContribution -> setTitle ( $ oldActiveContribution -> getTitle ( ) ) ; $ newActiveContribution -> setText ( $ oldActiveContribution -> getText ( ) ) ; } $ newActiveContribution -> setContributor ( $ user ) ; $ this -> setActiveContribution ( $ newActiveContribution ) ; }
Creates a new non persisted contribution and sets it as section's active contribution.

@param \Claroline\CoreBundle\Entity\User $user
Creates a new non persisted contribution and sets it as section s active contribution .