Handle the build widget event.

@param BuildWidgetEvent $event The event.

@return void
337415
public function handleEvent(BuildWidgetEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $widget = $event->getWidget();
        if (!$widget instanceof Widget) {
            return;
        }

        $widget->wizard .= self::getWizard($event->getProperty(), $event->getEnvironment());
    }
563173
public function taskStarted(BuildEvent $event)
    {
        $name = $event->getTask()->getTaskName();
        $now = Phing::currentTimeMillis();
        $this->logStart($event, $now, $name);
        $this->profileData[] = $now;
    }
246536
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->addCompilerPass(
            new DependencyInjection\Compiler\EventPropagationPass(),
            PassConfig::TYPE_BEFORE_OPTIMIZATION
        );
    }
805190
public function buildStarted(BuildEvent $event)
    {
        $this->buildTimerStart = Phing::currentTimeMillis();
        $this->buildElement = $this->doc->createElement(XmlLogger::BUILD_TAG);
        $this->elementStack[] = $this->buildElement;
        $this->timesStack[] = $this->buildTimerStart;
    }
20629
public function onDisplay(DisplayWidgetEvent $event)
    {
        if (!$this->request) {
            throw new NoHttpRequestException();
        }

        $workspace = $event->getInstance()->getWorkspace();

        $templatePath = 'ClarolineForumBundle:Forum:forumsWorkspaceWidget.html.twig';
        $widgetType = 'workspace';
        if ($workspace == null) {
            $templatePath = 'ClarolineForumBundle:Forum:forumsDesktopWidget.html.twig';
            $widgetType = 'desktop';
        }

        $event->setContent($this->templatingEngine->render(
            $templatePath,
            array(
                'widgetType' => $widgetType,
                'messages' => $this->forumWidgetManager->getLastMessages($event->getInstance(), $workspace)
            )
        ));
        $event->stopPropagation();
    }
1076970
public function build(ContainerInterface $container, BuildDataDefinitionEvent $event)
    {
        if (!$this->loadDca($container->getName(), $this->getDispatcher())) {
            return;
        }

        $this->parseCallbacks($container, $this->getDispatcher());
        $this->parseBasicDefinition($container);
        $this->parseDataProvider($container);
        $this->parseRootEntries($container);
        $this->parseParentChildConditions($container);
        $this->parseBackendView($container);
        $this->parsePalettes($container);
        $this->parseProperties($container);
        $this->parseOderPropertyInPalette($container);
    }
112328
public function buildFinished(BuildEvent $event)
    {
        $error = $event->getException();
        if ($error === null) {
            $msg = PHP_EOL . $this->getBuildSuccessfulMessage() . PHP_EOL;
        } else {
            $msg = PHP_EOL . $this->getBuildFailedMessage() . PHP_EOL;
            self::throwableMessage($msg, $error, Project::MSG_VERBOSE <= $this->msgOutputLevel);
        }
        $msg .= PHP_EOL . "Total time: " . self::formatTime(Phing::currentTimeMillis() - $this->startTime) . PHP_EOL;

        if ($error === null) {
            $this->printMessage($msg, $this->out, Project::MSG_VERBOSE);
        } else {
            $this->printMessage($msg, $this->err, Project::MSG_ERR);
        }
    }
806351
public function buildFromEvent(Event $event)
    {
        $this->setEvent($event);

        $configs = $this->getConfigFilesByComposer();
        $this->addFindersByConfigs($configs);

        // We have to initialize composer autoload
        require_once 'vendor/autoload.php';

        $this->build();
    }
1329481
public function taskStarted(BuildEvent $event)
    {
        $task = $event->getTask();

        $taskElement = $this->doc->createElement(XmlLogger::TASK_TAG);
        $taskElement->setAttribute(XmlLogger::NAME_ATTR, $task->getTaskName());
        $taskElement->setAttribute(XmlLogger::LOCATION_ATTR, (string) $task->getLocation());

        $this->timesStack[] = Phing::currentTimeMillis();
        $this->elementStack[] = $taskElement;
    }
582472
public function handle(DecodePropertyValueForWidgetEvent $event)
    {
        $isAllowed = $this->isAllowedContext(
            $event->getEnvironment()->getDataDefinition(),
            $event->getProperty(),
            $event->getModel()
        );

        if (!$isAllowed) {
            return;
        }

        $model     = $event->getModel();
        $metaModel = $this->getMetaModel($model);
        $value     = $event->getValue();

        if (!($metaModel && $value)) {
            return;
        }

        $attribute = $metaModel->getAttributeById($value);
        if ($attribute) {
            $event->setValue($metaModel->getTableName().'_'.$attribute->getColName());
        }
    }
264626
private function findModelIdByPropertyName(BuildWidgetEvent $event)
    {
        if (null !== $event->getModel()->getId()) {
            return;
        }

        $environment    = $event->getEnvironment();
        $dataDefinition = $environment->getDataDefinition();
        $inputProvider  = $environment->getInputProvider();
        $sessionStorage = $environment->getSessionStorage();

        $session = $sessionStorage->get($dataDefinition->getName() . '.' . $inputProvider->getParameter('mode'));

        $model = null;
        foreach ($session['models'] as $sessionModel) {
            $model = $sessionModel;

            if (0 !== \strpos($event->getProperty()->getName(), \str_replace('::', '____', $sessionModel))) {
                continue;
            }

            break;
        }

        $modelId = ModelId::fromSerialized($model);

        $event->getModel()->setId($modelId->getId());
    }
235052
public function onAstBuild(GenericEvent $event)
    {
        $context = $event->getArguments();

        if (isset($context['node'])) {
            $context['node'] = sprintf(
                '%s with attributes %s',
                $context['node']->getType(),
                json_encode($context['node']->getAttributes())
            );
        }
        $this->logger->debug('Building AST, process {method} {node}', $context);
    }
1098586
public function onPostInstallCmd(Event $event)
    {
        $this->bridgeFactory->createBridge($event->getIO())
            ->install($event->getComposer(), $event->isDevMode());
    }
307565
public function targetFinished(BuildEvent $event)
    {
        $start = array_pop($this->profileData);

        $name = "Target " . $event->getTarget()->getName();
        $this->logFinish($event, $start, $name);
    }
1249273
public function messageLogged(BuildEvent $event)
    {
        $priority = $event->getPriority();
        if ($priority <= $this->msgOutputLevel) {
            $msg = "";
            if ($event->getTask() !== null && !$this->emacsMode) {
                $name = $event->getTask();
                $name = $name->getTaskName();
                $msg = str_pad("[$name] ", self::LEFT_COLUMN_SIZE, " ", STR_PAD_LEFT);
            }

            $msg .= $event->getMessage();

            if ($priority != Project::MSG_ERR) {
                $this->printMessage($msg, $this->out, $priority);
            } else {
                $this->printMessage($msg, $this->err, $priority);
            }
        }
    }
961667
public function buildStarted(BuildEvent $event)
    {
        $this->startTime = Phing::currentTimeMillis();
        if ($this->msgOutputLevel >= Project::MSG_INFO) {
            $this->printMessage(
                "Buildfile: " . $event->getProject()->getProperty("phing.file"),
                $this->out,
                Project::MSG_INFO
            );
        }
    }
1247974
public function handleEvent()
    {
        while ($this->socket !== null)
        {
            $events = $this->socket->getSockOpt(ZMQ::SOCKOPT_EVENTS);

            $hasEvents = ($events & ZMQ::POLL_IN) || ($events & ZMQ::POLL_OUT && $this->buffer->listening);
            if (!$hasEvents)
            {
                break;
            }

            if ($events & ZMQ::POLL_IN)
            {
                $this->handleReadEvent();
            }

            if ($events & ZMQ::POLL_OUT && $this->buffer->listening)
            {
                $this->buffer->handleWriteEvent();
            }
        }
    }