synchronise item label
@param ItemRdfUpdatedEvent $event
509533
public static function catchItemRdfUpdatedEvent(ItemRdfUpdatedEvent $event) {
        $rdfItem = new core_kernel_classes_Resource($event->getItemUri());
        $type = $rdfItem->getProperty(taoItems_models_classes_ItemsService::PROPERTY_ITEM_MODEL);
        /*@var $directory \oat\oatbox\filesystem\Directory */
        $directory = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($rdfItem);
        $itemModel = $rdfItem->getPropertyValues($type);
        if($directory->exists() && in_array(taoItems_models_classes_itemModel::CLASS_URI_QTI, $itemModel)  ) {
            /* @var $file File */
            $file = $directory->getFile(Service::QTI_ITEM_FILE);
                
            $qtiParser = new Parser($file->read());
            $qtiItem = $qtiParser->load();
            $label = mb_substr($rdfItem->getLabel(), 0, 256, 'UTF-8');
            $qtiItem->setAttribute('label', $label);
            $file->put($qtiItem->toXML());
        }
        
    }
547402
protected function setTitleEditCollectionItem()
    {
        $vars = array('%name' => $this->data_collection['title']);

        if (empty($this->data_collection_item['collection_item_id'])) {
            $text = $this->text('Add item to %name', $vars);
        } else {
            $text = $this->text('Edit item of %name', $vars);
        }

        $this->setTitle($text);
    }
196689
public function refreshIdentifiers(AbstractItem $item)
    {
        /** @var Color $color */
        foreach ($item->getColors() as $color) {
            $color->refreshUuid();
        }

        /** @var Selection $selection */
        foreach ($item->getSelections() as $selection) {
            $selection->refreshUuid();
        }
    }
590148
public function refreshDocument(RefreshEvent $event)
    {
        $document = $event->getDocument();
        $node = $this->documentRegistry->getNodeForDocument($document);
        $locale = $this->documentRegistry->getLocaleForDocument($document);

        // revert/reload the node to the persisted state
        $node->revert();

        $this->rehydrateDocument($document, $node, $locale);
    }
989024
public function update(ProductUpdateEvent $event)
    {
        if (null !== $product = ProductQuery::create()->findPk($event->getProductId())) {
            $con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
            $con->beginTransaction();

            try {
                $prevRef = $product->getRef();

                $product
                    ->setDispatcher($this->eventDispatcher)
                    ->setRef($event->getRef())
                    ->setLocale($event->getLocale())
                    ->setTitle($event->getTitle())
                    ->setDescription($event->getDescription())
                    ->setChapo($event->getChapo())
                    ->setPostscriptum($event->getPostscriptum())
                    ->setVisible($event->getVisible() ? 1 : 0)
                    ->setVirtual($event->getVirtual() ? 1 : 0)
                    ->setBrandId($event->getBrandId() <= 0 ? null : $event->getBrandId())

                    ->save($con)
                ;

                // Update default PSE (if product has no attributes and the product's ref change)
                $defaultPseRefChange = $prevRef !== $product->getRef()
                    && 0 === $product->getDefaultSaleElements()->countAttributeCombinations();
                if ($defaultPseRefChange) {
                    $defaultPse = $product->getDefaultSaleElements();
                    $defaultPse->setRef($product->getRef())->save();
                }

                // Update default category (if required)
                $product->setDefaultCategory($event->getDefaultCategory());

                $event->setProduct($product);
                $con->commit();
            } catch (PropelException $e) {
                $con->rollBack();
                throw $e;
            }
        }
    }
717165
private function _renderItemSeparated (\stdClass $item) {
		$result = '<script type="text/javascript"';
		if ($item->async) $result .= ' async="async"';
		if ($item->async) $result .= ' defer="defer"';
		if (!$item->external && self::$fileChecking) {
			$fullPath = $this->getAppRoot() . $item->path;
			if (!file_exists($fullPath)) {
				$this->log("File not found in CSS view rendering process ('$fullPath').", 'error');
			}
		}
		$result .= ' src="' . $item->src . '"></script>';
		return $result;
	}
85211
public function setEvent($event)
  {
    if ($event === '?' || $event === '') {
      $this->event = null;
    } else {
      $event = Util::foreignLettersToEnglishLetters($event);
      $event = Util::titleCaseIfCurrentlyAllCaps($event);
      $this->event = $event === '?' ? null : $event;
    }
  }
1321177
public function updateIndexedNode(NodeEvent $event)
    {
        $node = $event->getNode();
        if (true === $node->getStatus()->isPublishedState()
        ) {
            $this->nodeIndexor->index($node);
        } elseif (true === $event->getPreviousStatus()->isPublishedState()) {
            $this->nodeIndexor->delete($node);
        }
    }
195590
public function onSubmit(FormEvent $event)
    {
        $form = $event->getForm()->getParent();
        $data = $form->getData();

        if (!\is_object($data)) {
            return;
        }

        $accessor = PropertyAccess::createPropertyAccessor();
        $newCollection = $accessor->getValue($data, $this->name);
        if (!$newCollection instanceof Collection) {
            return;
        }
        /* @var $newCollection Collection */

        $newCollection->clear();

        /** @var $item FormBuilder */
        foreach ($form->get($this->name) as $key => $item) {
            if ($item->get('_delete')->getData()) {
                // do not re-add a deleted child
                continue;
            }
            if ($item->getName() && !is_numeric($item->getName())) {
                // keep key in collection
                $newCollection[$item->getName()] = $item->getData();
            } else {
                $newCollection[] = $item->getData();
            }
        }
    }
85305
def update_item(event, updated_attributes, calendar_item_update_operation_type):
  

  root = M.UpdateItem(
    M.ItemChanges(
      T.ItemChange(
        T.ItemId(Id=event.id, ChangeKey=event.change_key),
        T.Updates()
      )
    ),
    ConflictResolution=u"AlwaysOverwrite",
    MessageDisposition=u"SendAndSaveCopy",
    SendMeetingInvitationsOrCancellations=calendar_item_update_operation_type
  )

  update_node = root.xpath(u'/m:UpdateItem/m:ItemChanges/t:ItemChange/t:Updates', namespaces=NAMESPACES)[0]

  # if not send_only_to_changed_attendees:
  #   # We want to resend invites, which you do by setting an attribute to the same value it has. Right now, events
  #   # are always scheduled as Busy time, so we just set that again.
  #   update_node.append(
  #     update_property_node(field_uri="calendar:LegacyFreeBusyStatus", node_to_insert=T.LegacyFreeBusyStatus("Busy"))
  #   )

  if u'html_body' in updated_attributes:
    update_node.append(
      update_property_node(field_uri="item:Body", node_to_insert=T.Body(event.html_body, BodyType="HTML"))
    )

  if u'text_body' in updated_attributes:
    update_node.append(
      update_property_node(field_uri="item:Body", node_to_insert=T.Body(event.text_body, BodyType="Text"))
    )

  if u'subject' in updated_attributes:
    update_node.append(
      update_property_node(field_uri="item:Subject", node_to_insert=T.Subject(event.subject))
    )

  if u'start' in updated_attributes:
    start = convert_datetime_to_utc(event.start)

    update_node.append(
      update_property_node(field_uri="calendar:Start", node_to_insert=T.Start(start.strftime(EXCHANGE_DATETIME_FORMAT)))
    )

  if u'end' in updated_attributes:
    end = convert_datetime_to_utc(event.end)

    update_node.append(
      update_property_node(field_uri="calendar:End", node_to_insert=T.End(end.strftime(EXCHANGE_DATETIME_FORMAT)))
    )

  if u'location' in updated_attributes:
    update_node.append(
      update_property_node(field_uri="calendar:Location", node_to_insert=T.Location(event.location))
    )

  if u'attendees' in updated_attributes:

    if event.required_attendees:
      required = resource_node(element=T.RequiredAttendees(), resources=event.required_attendees)

      update_node.append(
        update_property_node(field_uri="calendar:RequiredAttendees", node_to_insert=required)
      )
    else:
      update_node.append(delete_field(field_uri="calendar:RequiredAttendees"))

    if event.optional_attendees:
      optional = resource_node(element=T.OptionalAttendees(), resources=event.optional_attendees)

      update_node.append(
        update_property_node(field_uri="calendar:OptionalAttendees", node_to_insert=optional)
      )
    else:
      update_node.append(delete_field(field_uri="calendar:OptionalAttendees"))

  if u'resources' in updated_attributes:
    if event.resources:
      resources = resource_node(element=T.Resources(), resources=event.resources)

      update_node.append(
        update_property_node(field_uri="calendar:Resources", node_to_insert=resources)
      )
    else:
      update_node.append(delete_field(field_uri="calendar:Resources"))

  if u'reminder_minutes_before_start' in updated_attributes:
    if event.reminder_minutes_before_start:
      update_node.append(
        update_property_node(field_uri="item:ReminderIsSet", node_to_insert=T.ReminderIsSet('true'))
      )
      update_node.append(
        update_property_node(
          field_uri="item:ReminderMinutesBeforeStart",
          node_to_insert=T.ReminderMinutesBeforeStart(str(event.reminder_minutes_before_start))
        )
      )
    else:
      update_node.append(
        update_property_node(field_uri="item:ReminderIsSet", node_to_insert=T.ReminderIsSet('false'))
      )

  if u'is_all_day' in updated_attributes:
    update_node.append(
      update_property_node(field_uri="calendar:IsAllDayEvent", node_to_insert=T.IsAllDayEvent(str(event.is_all_day).lower()))
    )

  for attr in event.RECURRENCE_ATTRIBUTES:
    if attr in updated_attributes:

      recurrence_node = T.Recurrence()

      if event.recurrence == 'daily':
        recurrence_node.append(
          T.DailyRecurrence(
            T.Interval(str(event.recurrence_interval)),
          )
        )
      elif event.recurrence == 'weekly':
        recurrence_node.append(
          T.WeeklyRecurrence(
            T.Interval(str(event.recurrence_interval)),
            T.DaysOfWeek(event.recurrence_days),
          )
        )
      elif event.recurrence == 'monthly':
        recurrence_node.append(
          T.AbsoluteMonthlyRecurrence(
            T.Interval(str(event.recurrence_interval)),
            T.DayOfMonth(str(event.start.day)),
          )
        )
      elif event.recurrence == 'yearly':
        recurrence_node.append(
          T.AbsoluteYearlyRecurrence(
            T.DayOfMonth(str(event.start.day)),
            T.Month(event.start.strftime("%B")),
          )
        )

      recurrence_node.append(
        T.EndDateRecurrence(
          T.StartDate(event.start.strftime(EXCHANGE_DATE_FORMAT)),
          T.EndDate(event.recurrence_end_date.strftime(EXCHANGE_DATE_FORMAT)),
        )
      )

      update_node.append(
        update_property_node(field_uri="calendar:Recurrence", node_to_insert=recurrence_node)
      )

  return root
316936
public function on($event, $jsCode, $stopPropagation = false, $preventDefault = false) {
		foreach ($this->items as $item){
			$item->on($event, $jsCode,$stopPropagation,$preventDefault);
		}
	}
1042119
public function synchronizeChildren(PublishEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $liveNode = $event->getNode();
        $draftNode = $this->documentInspector->getNode($document);

        $liveChildren = $this->getChildren($liveNode);
        $draftChildren = $this->getChildren($draftNode);
        $removedChildrenIds = array_diff(array_keys($liveChildren), array_keys($draftChildren));

        foreach ($removedChildrenIds as $removedChildrenId) {
            $liveChildren[$removedChildrenId]->remove();
        }
    }
1101185
public function refreshDocumentForDeleteDraft(RemoveDraftEvent $event)
    {
        $this->rehydrateDocument($event->getDocument(), $event->getNode(), $event->getLocale());
    }
408060
public function onMenuTree(MenuEvent $event)
    {
        $refresh = [];

        foreach ($event->getDeletedItems() as $item) {
            $refresh[] = $item->getNodeId();
        }
        foreach ($event->getTree()->getChildren() as $item) {
            $refresh[] = $item->getNodeId();
        }

        if ($refresh) {
            $this->service->onAliasChange($refresh);
        }
    }
971735
public function handlePersistStagedProperties(PersistEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supportsBehavior($document)) {
            return;
        }

        $document->getStructure()->commitStagedData($event->getOption('clear_missing_content'));
    }
397333
public function offsetSet($index, $item) : void
    {
        if ($item instanceof Fieldset) {
            foreach ($item as $subitem) {
                $this->setValue($subitem);
            }
        } else {
            $this->setValue($item);
        }
        parent::offsetSet($index, $item);
    }
188701
public function addItem(Item $item)
    {
        $itemUUID = $item->composeUUID();

        $this->elementsToUpdate[$itemUUID] = $item;
        unset($this->elementsToDelete[$itemUUID]);
    }