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();
 }
Пример #3
0
 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);
 }
 protected function addTreeNodeTypes()
 {
     $this->output(t('Adding tree node types...'));
     $this->connection->Execute('update TreeNodeTypes set treeNodeTypeHandle = ? where treeNodeTypeHandle = ?', array('category', 'topic_category'));
     $this->connection->Execute('update PermissionKeys set pkHandle = ? where pkHandle = ?', array('view_category_tree_node', 'view_topic_category_tree_node'));
     $this->connection->Execute('update PermissionKeyCategories set pkCategoryHandle = ? where pkCategoryHandle = ?', array('category_tree_node', 'topic_category_tree_node'));
     $results = NodeType::getByHandle('express_entry_results');
     if (!is_object($results)) {
         NodeType::add('express_entry_results');
     }
     $category = NodeType::getByHandle('express_entry_category');
     if (!is_object($category)) {
         NodeType::add('express_entry_category');
     }
     $results = TreeType::getByHandle('express_entry_results');
     if (!is_object($results)) {
         TreeType::add('express_entry_results');
         $tree = ExpressEntryResults::add();
         $node = $tree->getRootTreeNodeObject();
         // Add forms node beneath it.
         \Concrete\Core\Tree\Node\Type\ExpressEntryCategory::add(ExpressFormBlockController::FORM_RESULTS_CATEGORY_NAME, $node);
     }
 }
Пример #5
0
 public function view($treeID = false)
 {
     $tree = ExpressEntryResults::get();
     $this->set('tree', $tree);
     $this->requireAsset('core/topics');
 }
Пример #6
0
 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();
     }
 }
 public function install_data_objects()
 {
     \Concrete\Core\Tree\Node\NodeType::add('category');
     \Concrete\Core\Tree\Node\NodeType::add('express_entry_category');
     \Concrete\Core\Tree\TreeType::add('express_entry_results');
     \Concrete\Core\Tree\Node\NodeType::add('express_entry_results');
     $tree = ExpressEntryResults::add();
     $node = $tree->getRootTreeNodeObject();
     // Add forms node beneath it.
     $forms = ExpressEntryCategory::add(ExpressFormBlockController::FORM_RESULTS_CATEGORY_NAME, $node);
     // Set the forms node to allow guests to post entries, since we're using it from the front-end.
     $forms->assignPermissions(Group::getByID(GUEST_GROUP_ID), ['add_express_entries']);
     // Set the root node to allow guests to view entries, so that blocks like express
     // entry list and express entry details work.
     $node->assignPermissions(Group::getByID(GUEST_GROUP_ID), ['view_express_entries']);
 }