public function import(\SimpleXMLElement $sx) { $em = \Database::connection()->getEntityManager(); $em->getClassMetadata('Concrete\\Core\\Entity\\Express\\Entity')->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator()); if (isset($sx->expressentities)) { foreach ($sx->expressentities->entity as $entityNode) { $entity = $em->find('Concrete\\Core\\Entity\\Express\\Entity', (string) $entityNode['id']); if (!is_object($entity)) { $entity = new Entity(); $entity->setId((string) $entityNode['id']); } $entity->setPluralHandle((string) $entityNode['plural_handle']); $entity->setHandle((string) $entityNode['handle']); $entity->setDescription((string) $entityNode['description']); $entity->setName((string) $entityNode['name']); if ((string) $entityNode['include_in_public_list'] == '') { $entity->setIncludeInPublicList(false); } $entity->setHandle((string) $entityNode['handle']); $tree = ExpressEntryResults::get(); $node = $tree->getNodeByDisplayPath((string) $entityNode['results-folder']); $node = \Concrete\Core\Tree\Node\Type\ExpressEntryResults::add((string) $entityNode['name'], $node); $entity->setEntityResultsNodeId($node->getTreeNodeID()); $indexer = $entity->getAttributeKeyCategory()->getSearchIndexer(); if (is_object($indexer)) { $indexer->createRepository($entity->getAttributeKeyCategory()); } $em->persist($entity); } } $em->flush(); $em->getClassMetadata('Concrete\\Core\\Entity\\Express\\Entity')->setIdGenerator(new UuidGenerator()); }
protected function getResultsTreeNodeObject() { $tree = ExpressEntryResults::get(); return $tree->getRootTreeNodeObject(); }
public function view($treeID = false) { $tree = ExpressEntryResults::get(); $this->set('tree', $tree); $this->requireAsset('core/topics'); }
public function edit() { $this->loadResultsFolderInformation(); $this->requireAsset('core/tree'); $this->clearSessionControls(); $list = Type::getList(); $attribute_fields = array(); foreach ($list as $type) { $attribute_fields[] = ['id' => 'attribute_key|' . $type->getAttributeTypeID(), 'displayName' => $type->getAttributeTypeDisplayName()]; } $select = array(); $select[0] = new \stdClass(); $select[0]->label = t('Input Field Types'); $select[0]->fields = $attribute_fields; $other_fields = array(); $other_fields[] = ['id' => 'entity_property|text', 'displayName' => t('Display Text')]; $select[1] = new \stdClass(); $select[1]->label = t('Other Fields'); $select[1]->fields = $other_fields; $controls = array(); $form = $this->getFormEntity(); if (is_object($form)) { $entity = $form->getEntity(); $controls = $form->getControls(); $this->set('formName', $entity->getName()); $this->set('submitLabel', $this->submitLabel); $node = Node::getByID($entity->getEntityResultsNodeId()); if (is_object($node)) { $folder = $node->getTreeNodeParentObject(); $this->set('resultsFolder', $folder->getTreeNodeID()); } } $this->set('controls', $controls); $this->set('types_select', $select); $tree = ExpressEntryResults::get(); $this->set('tree', $tree); }
public function edit($id = null) { $tree = ExpressEntryResults::get(); $this->set('tree', $tree); $this->requireAsset('core/topics'); $r = $this->entityManager->getRepository('\\Concrete\\Core\\Entity\\Express\\Entity'); $this->entity = $r->findOneById($id); if (is_object($this->entity)) { $node = Node::getByID($this->entity->getEntityResultsNodeId()); if (is_object($node)) { $folder = $node->getTreeNodeParentObject(); $this->set('folder', $folder); } $forms = array('' => t('** Select Form')); $defaultViewFormID = 0; $defaultEditFormID = 0; $ownedByID = 0; $entities = array('' => t('** No Owner')); foreach ($r->findAll() as $ownedByEntity) { $entities[$ownedByEntity->getID()] = $ownedByEntity->getName(); } foreach ($this->entity->getForms() as $form) { $forms[$form->getID()] = $form->getName(); } if (is_object($this->entity->getDefaultViewForm())) { $defaultViewFormID = $this->entity->getDefaultViewForm()->getID(); } if (is_object($this->entity->getDefaultEditForm())) { $defaultEditFormID = $this->entity->getDefaultEditForm()->getID(); } if (is_object($this->entity->getOwnedBy())) { $ownedByID = $this->entity->getOwnedBy()->getID(); } $this->set('defaultEditFormID', $defaultEditFormID); $this->set('defaultViewFormID', $defaultViewFormID); $this->set('ownedByID', $ownedByID); $this->set('forms', $forms); $this->set('entity', $this->entity); $this->set('pageTitle', t('Edit Entity')); $this->render('/dashboard/system/express/entities/edit'); } else { $this->view(); } }