public function execute(ActionInterface $action)
 {
     // Grab the target item for the page's page type.
     $subject = $action->getSubject();
     $target = $action->getTarget();
     $areaMapper = new Area();
     $targetItemList = new TargetItemList($target->getBatch(), $areaMapper);
     foreach ($subject->getAreas() as $area) {
         $item = new Item($area->getName());
         $targetItem = $targetItemList->getSelectedTargetItem($item);
         if ($targetItem instanceof UnmappedTargetItem) {
             $template = $subject->getTemplate();
             // Now, if the page template exists in the batch, there's a chance that the reason the area
             // doesn't exist in the site is because it's part of the new template. In that case, we should show
             // an info message so we don't get as many scary red errors.
             if ($template) {
                 $em = \ORM::entityManager('migration_tool');
                 $r = $em->getRepository('\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\PageTemplate');
                 $batchTemplate = $r->findOneByHandle($template);
             }
             if (isset($batchTemplate) && is_object($batchTemplate)) {
                 $action->getTarget()->addMessage(new Message(t('Area <strong>%s</strong> does not exist in site. If the area is page of the new page template this message can be disregarded.', $item->getIdentifier()), Message::E_INFO));
             } else {
                 $action->getTarget()->addMessage(new Message(t('Area <strong>%s</strong> does not exist.', $item->getIdentifier())));
             }
         }
     }
 }
Пример #2
0
 /**
  * Installs a BlockType that is passed via a btHandle string. The core or override directories are parsed.
  */
 public static function installBlockType($btHandle, $pkg = false)
 {
     $env = Environment::get();
     $pkgHandle = false;
     if (is_object($pkg)) {
         $pkgHandle = $pkg->getPackageHandle();
     }
     $class = static::getBlockTypeMappedClass($btHandle, $pkgHandle);
     $app = Facade::getFacadeApplication();
     $bta = $app->build($class);
     $path = dirname($env->getPath(DIRNAME_BLOCKS . '/' . $btHandle . '/' . FILENAME_BLOCK_DB, $pkgHandle));
     //Attempt to run the subclass methods (install schema from db.xml, etc.)
     $r = $bta->install($path);
     // Prevent the database records being stored in wrong language
     $loc = Localization::getInstance();
     $loc->pushActiveContext('system');
     //Install the block
     $bt = new \Concrete\Core\Entity\Block\BlockType\BlockType();
     $bt->loadFromController($bta);
     if (is_object($pkg)) {
         $bt->setPackageID($pkg->getPackageID());
     }
     $bt->setBlockTypeHandle($btHandle);
     $loc->popActiveContext();
     $em = \ORM::entityManager();
     $em->persist($bt);
     $em->flush();
     if ($bta->getBlockTypeDefaultSet()) {
         $set = Set::getByHandle($bta->getBlockTypeDefaultSet());
         if (is_object($set)) {
             $set->addBlockType($bt);
         }
     }
     return $bt;
 }
Пример #3
0
 public function transform($entity, ItemInterface $item, TargetItem $targetItem, Batch $batch)
 {
     $mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\Attribute();
     $ak = $mapper->getTargetItemContentObject($targetItem);
     if (is_object($ak)) {
         $type = $ak->getAttributeKeyType()->getAttributeTypeHandle();
     } else {
         $collection = $batch->getObjectCollection('attribute_key');
         foreach ($collection->getKeys() as $key) {
             if ($key->getHandle() == $item->getIdentifier()) {
                 $type = $key->getType();
                 break;
             }
         }
     }
     if (isset($type)) {
         $manager = \Core::make('migration/manager/import/attribute/value');
         try {
             $driver = $manager->driver($type);
         } catch (\Exception $e) {
         }
         if (isset($driver)) {
             $xml = simplexml_load_string($entity->getValue());
             $value = $driver->parse($xml);
             $attribute = $entity->getAttribute();
             $attribute->setAttributeValue($value);
             $manager = \ORM::entityManager('migration_tools');
             $manager->persist($attribute);
             $manager->remove($entity);
             $manager->flush();
         }
     }
 }
 public function displayObjectCollection()
 {
     $em = \ORM::entityManager('migration_tool');
     $r = $em->getRepository("\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\Batch");
     $batch = $r->findFromCollection($this->collection);
     print \View::element('batch_content_types/' . $this->getElement(), array('batch' => $batch, 'type' => $this->collection->getType(), 'collection' => $this->collection), 'migration_tool');
 }
 public function __construct(ObjectCollection $collection)
 {
     $em = \ORM::entityManager('migration_tool');
     $r = $em->getRepository('\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\Batch');
     $this->collection = $collection;
     $this->batch = $r->findFromCollection($collection);
     $this->validator = $collection->getRecordValidator($this->batch);
 }
Пример #6
0
 public function view()
 {
     $r = \ORM::entityManager()->getRepository('\\Concrete\\Core\\Entity\\Express\\Entity');
     $entities = $r->findAll(array(), array('name' => 'asc'));
     $this->set('types', $entities);
     $this->set('currentType', $this->currentEntity);
     $this->set('entityAction', $this->entityAction);
 }
Пример #7
0
 public static function add($filename, $prefix, $data = array(), $fsl = false, $folder = false)
 {
     $db = Loader::db();
     $dh = Loader::helper('date');
     $date = $dh->getOverridableNow();
     if (!is_object($fsl)) {
         $fsl = StorageLocation::getDefault();
     }
     $uID = 0;
     $u = new User();
     if (isset($data['uID'])) {
         $uID = $data['uID'];
     } else {
         if ($u->isRegistered()) {
             $uID = $u->getUserID();
         }
     }
     if (!$folder instanceof FileFolder) {
         $filesystem = new Filesystem();
         $folder = $filesystem->getRootFolder();
     }
     $f = new \Concrete\Core\Entity\File\File();
     $f->storageLocation = $fsl;
     $f->fDateAdded = new Carbon($date);
     $f->folderTreeNodeID = $folder->getTreeNodeID();
     $em = \ORM::entityManager();
     $em->persist($f);
     $em->flush();
     if ($uID > 0) {
         $ui = UserInfo::getByID($uID);
         if (is_object($ui)) {
             $ue = $ui->getEntityObject();
             if (is_object($ue)) {
                 $f->setUser($ue);
             }
         }
     }
     $node = \Concrete\Core\Tree\Node\Type\File::add($f, $folder);
     $fv = Version::add($f, $filename, $prefix, $data);
     $f->versions->add($fv);
     $fve = new \Concrete\Core\File\Event\FileVersion($fv);
     Events::dispatch('on_file_add', $fve);
     $entities = $u->getUserAccessEntityObjects();
     $hasUploader = false;
     foreach ($entities as $obj) {
         if ($obj instanceof FileUploaderPermissionAccessEntity) {
             $hasUploader = true;
         }
     }
     if (!$hasUploader) {
         $u->refreshUserGroups();
     }
     return $fv;
 }
 public function finish(ActionInterface $action)
 {
     $entityManager = \ORM::entityManager();
     $target = $action->getTarget();
     $pl = 0;
     $n = count($this->paths);
     $l = strlen($this->paths[0]);
     while ($pl < $l) {
         $c = $this->paths[0][$pl];
         for ($i = 1; $i < $n; ++$i) {
             if ($this->paths[$i][$pl] !== $c) {
                 break 2;
             }
         }
         ++$pl;
     }
     $common = substr($this->paths[0], 0, $pl);
     $pages = $target->getBatch()->getPages();
     // $entityManager->getConnection()->getConfiguration()->setSQLLogger(new EchoSQLLogger());
     if ($common && count($pages) > 1) {
         $common = '/' . trim($common, '/');
         $contentSearchURL = "/\\{ccm:export:page:" . preg_quote($common, '/') . "(.*?)\\}/i";
         $contentReplaceURL = "{ccm:export:page:\$1}";
         foreach ($pages as $page) {
             $originalPath = $page->getOriginalPath();
             $newPath = substr($originalPath, strlen($common));
             if ($page->canNormalizePath()) {
                 $page->setBatchPath($newPath);
             }
             $areas = $page->getAreas();
             foreach ($areas as $area) {
                 $blocks = $area->getBlocks();
                 foreach ($blocks as $block) {
                     $value = $block->getBlockValue();
                     if ($value instanceof ImportedBlockValue) {
                         $content = preg_replace($contentSearchURL, $contentReplaceURL, $value->getValue());
                         $query = $entityManager->createQuery("update \\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\BlockValue\\ImportedBlockValue v\n                            set v.value = :value where v.id = :primary");
                         $query->setParameter('primary', $value->getID());
                         $query->setParameter('value', $content);
                         $query->execute();
                     }
                 }
             }
         }
     } else {
         foreach ($pages as $page) {
             if ($page->canNormalizePath()) {
                 $page->setBatchPath($page->getOriginalPath());
             }
         }
     }
 }
 public function execute(ActionInterface $action)
 {
     $blocks = $action->getSubject();
     $target = $action->getTarget();
     $mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\BlockType();
     $targetItemList = new TargetItemList($target->getBatch(), $mapper);
     foreach ($blocks as $block) {
         if ($block->getType()) {
             $item = new BlockItem($block);
             $targetItem = $targetItemList->getSelectedTargetItem($item);
             if ($targetItem instanceof UnmappedTargetItem) {
                 $action->getTarget()->addMessage(new Message(t('Block type <strong>%s</strong> does not exist.', $item->getIdentifier())));
             }
         } elseif ($block->getDefaultsOutputIdentifier()) {
             // This is a block on a page that is pulling its content from page defaults. We need to find
             // a block with the corresponding string in page defaults. Otherwise we're going to have a problem.
             $area = $block->getArea();
             $found = false;
             if (is_object($area)) {
                 $page = $area->getPage();
                 if (is_object($page)) {
                     $type = $page->getType();
                     $template = $page->getTemplate();
                     if ($type && $template) {
                         // Retrieve the page  type by handle.
                         $em = \ORM::entityManager('migration_tool');
                         $r1 = $em->getRepository('\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\PageType\\PageType');
                         $pageType = $r1->findOneByHandle($type);
                         if (is_object($pageType)) {
                             $defaults = $pageType->getDefaultPageCollection();
                             foreach ($defaults->getPages() as $default) {
                                 if ($default->getTemplate() == $template) {
                                     // whew. We've located the proper place.
                                     foreach ($default->getAreas() as $area) {
                                         foreach ($area->getBlocks() as $defaultBlock) {
                                             if ($defaultBlock->getDefaultsOutputIdentifier() == $block->getDefaultsOutputIdentifier()) {
                                                 $found = true;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             if (!$found) {
                 $action->getTarget()->addMessage(new Message(t('Page Type Defaults Output Reference <strong>%s</strong> not found within corresponding defaults.', $block->getDefaultsOutputIdentifier())));
             }
         }
     }
 }
Пример #10
0
 /**
  * @param $ftTypeHandle
  *
  * @return \Concrete\Core\Entity\File\Image\Thumbnail\Type\Type
  */
 public static function getByHandle($ftTypeHandle)
 {
     // ugh doctrine doesn't cache when searching by ftTypeHandle
     $cache = \Core::make('cache/request');
     $item = $cache->getItem('file/image/thumbnail/' . $ftTypeHandle);
     if (!$item->isMiss()) {
         return $item->get();
     }
     $em = \ORM::entityManager();
     $r = $em->getRepository('\\Concrete\\Core\\Entity\\File\\Image\\Thumbnail\\Type\\Type')->findOneBy(array('ftTypeHandle' => $ftTypeHandle));
     $cache->save($item->set($r));
     return $r;
 }
 public function topicTreeExists($name, $batch)
 {
     $tree = Topic::getByName($name);
     if (is_object($tree)) {
         return true;
     }
     $r = \ORM::entityManager()->getRepository('\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\Tree');
     $tree = $r->findOneByName($name);
     if (is_object($tree)) {
         return true;
     }
     return false;
 }
 protected function createData()
 {
     $page1 = self::createPage('Page 1');
     $page2 = self::createPage('Page 2');
     $page3 = self::createPage('Page 3');
     $page4 = self::createPage('Page 4');
     $subpageA = self::createPage('Subpage A', $page2);
     self::createPage('Subpage B', $page2);
     self::createPage('Subpage C', $page2);
     $feed = new \Concrete\Core\Page\Feed();
     $feed->setHandle('blog');
     $feed->setParentID(1);
     \ORM::entityManager('core')->persist($feed);
     \ORM::entityManager('core')->flush();
 }
Пример #13
0
 public function setupDoctrineCommands()
 {
     if (!Core::make('app')->isInstalled()) {
         return;
     }
     $helperSet = ConsoleRunner::createHelperSet(\ORM::entityManager('core'));
     $this->setHelperSet($helperSet);
     $migrationsConfiguration = new MigrationsConfiguration();
     /** @var \Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand[] $commands */
     $commands = array(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand());
     foreach ($commands as $migrationsCommand) {
         $migrationsCommand->setMigrationConfiguration($migrationsConfiguration);
         $this->add($migrationsCommand);
     }
     ConsoleRunner::addCommands($this);
 }
Пример #14
0
 public static function add($pTemplateHandle, $pTemplateName, $pTemplateIcon = FILENAME_PAGE_TEMPLATE_DEFAULT_ICON, $pkg = null, $pTemplateIsInternal = false)
 {
     $pkgID = !is_object($pkg) ? 0 : $pkg->getPackageID();
     $template = new \Concrete\Core\Entity\Page\Template();
     $template->pTemplateHandle = $pTemplateHandle;
     $template->pTemplateName = $pTemplateName;
     $template->pTemplateIcon = $pTemplateIcon;
     $template->pkgID = $pkgID;
     $template->pTemplateIsInternal = (bool) $pTemplateIsInternal;
     $em = \ORM::entityManager();
     $em->persist($template);
     $em->flush();
     // now that we have added a template, we need to find any page types that can use this template (any page types that allow ALL page templates or all + a template not of this kind)
     // and we need to update them to have a reference to this template defaults
     $ptlist = PageType::getList();
     foreach ($ptlist as $pt) {
         $pt->rescanPageTypeComposerOutputControlObjects();
     }
     return $template;
 }
Пример #15
0
 public function save_attribute_type_associations()
 {
     if (!$this->token->validate('save_attribute_type_associations')) {
         $this->error->add(t('Invalid CSRF token. Please refresh and try again.'));
         return;
     }
     $manager = \ORM::entityManager();
     $list = Category::getList();
     foreach ($list as $cat) {
         $cat->clearAttributeKeyCategoryTypes();
         if (is_array($this->post($cat->getAttributeKeyCategoryHandle()))) {
             foreach ($this->post($cat->getAttributeKeyCategoryHandle()) as $id) {
                 $type = Type::getByID($id);
                 $cat->getAttributeTypes()->add($type);
             }
         }
         $this->entityManager->persist($cat);
     }
     $this->entityManager->flush();
     $this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated');
 }
Пример #16
0
 /**
  * Set a canonical page path.
  */
 public function testSettingCanonicalPagePaths()
 {
     $home = Page::getByID(HOME_CID);
     $pt = PageType::getByID(1);
     $template = PageTemplate::getByID(1);
     $page = $home->add($pt, array('uID' => 1, 'cName' => 'My fair page.', 'pTemplateID' => $template->getPageTemplateID()));
     $page->setCanonicalPagePath('/a-completely-new-canonical-page-path');
     $testPath = \ORM::entityManager('core')->getRepository('\\Concrete\\Core\\Page\\PagePath')->findOneBy(array('cID' => $page->getCollectionID(), 'ppIsCanonical' => true));
     $this->assertInstanceOf('\\Concrete\\Core\\Page\\PagePath', $testPath);
     $this->assertEquals('/a-completely-new-canonical-page-path', $testPath->getPagePath());
     $this->assertEquals(false, $testPath->isPagePathAutoGenerated());
     $path = $page->getCollectionPathObject();
     $this->assertEquals('/a-completely-new-canonical-page-path', $path->getPagePath());
     $this->assertEquals('my-fair-page', $page->getCollectionHandle());
     // now we rescan and make sure everything is cool
     $page->rescanCollectionPath();
     $path = $page->getCollectionPathObject();
     $this->assertInstanceOf('\\Concrete\\Core\\Page\\PagePath', $path);
     $this->assertEquals('/a-completely-new-canonical-page-path', $path->getPagePath());
     $this->assertEquals(false, $path->isPagePathAutoGenerated());
 }
Пример #17
0
 public function transform($entity, ItemInterface $item, TargetItem $targetItem, Batch $batch)
 {
     $mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\BlockType();
     $bt = $mapper->getTargetItemContentObject($targetItem);
     if (is_object($bt)) {
         $type = $bt->getBlockTypeHandle();
     } else {
         $collection = $batch->getObjectCollection('block_type');
         foreach ($collection->getTypes() as $blockType) {
             if ($blockType->getHandle() == $item->getIdentifier()) {
                 $type = $blockType->getType();
                 break;
             }
         }
     }
     if (isset($type)) {
         $manager = \Core::make('migration/manager/import/cif_block');
         try {
             $driver = $manager->driver($type);
         } catch (\Exception $e) {
         }
         if (isset($driver)) {
             $value = null;
             if ($entity->getValue()) {
                 $xml = simplexml_load_string($entity->getValue());
                 $value = $driver->parse($xml);
             }
             $block = $entity->getBlock();
             $block->setBlockValue($value);
             $manager = \ORM::entityManager('migration_tools');
             $manager->persist($block);
             $manager->remove($entity);
             $manager->flush();
         }
     }
 }
Пример #18
0
 public static function getByServiceHandle($ssHandle, Site $site = null)
 {
     $em = \ORM::entityManager();
     $site = is_object($site) ? $site : \Core::make('site')->getSite();
     return $em->getRepository('\\Concrete\\Core\\Entity\\Sharing\\SocialNetwork\\Link')->findOneBy(array('ssHandle' => $ssHandle, 'site' => $site));
 }
Пример #19
0
 /**
  * returns the FileVersion object for the provided fvID
  * if none provided returns the approved version
  * @param int $fvID
  * @return Version
  */
 public function getVersion($fvID = null)
 {
     if (!$fvID) {
         return $this->getApprovedVersion();
     }
     $em = \ORM::entityManager('core');
     $r = $em->getRepository('\\Concrete\\Core\\File\\Version');
     return $r->findOneBy(array('file' => $this, 'fvID' => $fvID));
 }
Пример #20
0
 protected function save($flush = true)
 {
     $em = \ORM::entityManager('core');
     $em->persist($this);
     if ($flush) {
         $em->flush();
     }
 }
 public static function getByID($id)
 {
     $em = \ORM::entityManager('core');
     $r = $em->find('\\Concrete\\Core\\StyleCustomizer\\CustomCssRecord', $id);
     return $r;
 }
Пример #22
0
 public static function getByServiceHandle($ssHandle)
 {
     $em = \ORM::entityManager('core');
     return $em->getRepository('\\Concrete\\Core\\Sharing\\SocialNetwork\\Link')->findOneBy(array('ssHandle' => $ssHandle));
 }
Пример #23
0
 public function delete()
 {
     $em = \ORM::entityManager();
     $em->remove($this);
     $em->flush();
 }
Пример #24
0
 public function __construct(\Concrete\Core\Page\Page $c)
 {
     parent::__construct($c);
     // Source: https://gist.github.com/Kaapiii/fe892b5a95b4a4f61280
     $this->blogService = new BlogService(\ORM::entityManager());
 }
Пример #25
0
 public function update($pTemplateHandle, $pTemplateName, $pTemplateIcon = FILENAME_PAGE_TEMPLATE_DEFAULT_ICON)
 {
     $this->pTemplateHandle = $pTemplateHandle;
     $this->pTemplateName = $pTemplateName;
     $this->pTemplateIcon = $pTemplateIcon;
     $em = \ORM::entityManager('core');
     $em->persist($this);
     $em->flush();
 }
Пример #26
0
 /**
  * Removes the storage type if no configurations exist.
  * @throws \Exception
  * @return bool
  */
 public function delete()
 {
     $list = StorageLocation::getList();
     foreach ($list as $item) {
         if ($item->getTypeObject()->getHandle() == $this->getHandle()) {
             throw new \Exception(t('Please remove all storage locations using this storage type.'));
         }
     }
     $em = \ORM::entityManager('core');
     $em->remove($this);
     $em->flush();
     return true;
 }
Пример #27
0
 public function install_database()
 {
     $db = Database::get();
     $num = $db->GetCol("show tables");
     if (count($num) > 0) {
         throw new \Exception(t('There are already %s tables in this database. concrete5 must be installed in an empty database.', count($num)));
     }
     $installDirectory = DIR_BASE_CORE . '/config';
     try {
         $em = \ORM::entityManager('core');
         $dbm = Core::make('database/structure', $em);
         $dbm->generateProxyClasses();
         Package::installDB($installDirectory . '/db.xml');
         $this->indexAdditionalDatabaseFields();
         $configuration = new Configuration();
         $version = $configuration->getVersion(Config::get('concrete.version_db'));
         $version->markMigrated();
     } catch (\Exception $e) {
         throw new \Exception(t('Unable to install database: %s', $db->ErrorMsg() ? $db->ErrorMsg() : $e->getMessage()));
     }
 }
Пример #28
0
 /**
  * @deprecated
  */
 public function getEntityManager()
 {
     return \ORM::entityManager();
 }
Пример #29
0
 public function submit()
 {
     $r = new PageEditResponse();
     if ($this->validateAction()) {
         $oc = $this->page;
         if ($oc->getCollectionParentID() != $_POST['cParentID']) {
             if ($this->page->getCollectionID() == HOME_CID) {
                 throw new Exception('You cannot move the homepage.');
             }
             $dc = Page::getByID($_POST['cParentID'], 'RECENT');
             if (!is_object($dc) || $dc->isError()) {
                 throw new Exception('Invalid parent page.');
             }
             $dcp = new Permissions($dc);
             $ct = PageType::getByID($this->page->getPageTypeID());
             if (!$dcp->canAddSubpage($ct)) {
                 throw new Exception('You do not have permission to add this subpage here.');
             }
             if (!$oc->canMoveCopyTo($dc)) {
                 throw new Exception('You cannot add a page beneath itself.');
             }
             if ($oc->isPageDraft()) {
                 $oc->setPageDraftTargetParentPageID($dc->getCollectionID());
             } else {
                 $u = new User();
                 $pkr = new MovePagePageWorkflowRequest();
                 $pkr->setRequestedPage($oc);
                 $pkr->setRequestedTargetPage($dc);
                 $pkr->setSaveOldPagePath(false);
                 $pkr->setRequesterUserID($u->getUserID());
                 $u->unloadCollectionEdit($oc);
                 $response = $pkr->trigger();
                 if ($response instanceof WorkflowProgressResponse && !$this->request->request->get('sitemap')) {
                     $nc = Page::getByID($oc->getCollectionID());
                     $r->setRedirectURL(Loader::helper('navigation')->getLinkToCollection($nc));
                 }
             }
         }
         // now we do additional page URLs
         $req = Request::getInstance();
         $oc->clearPagePaths();
         $canonical = $req->request->get('canonical');
         $pathArray = $req->request->get('path');
         if (isset($canonical) && $this->page->getCollectionID() == HOME_CID) {
             throw new Exception('You cannot change the canonical path of the home page.');
         }
         if (is_array($pathArray)) {
             foreach ($pathArray as $i => $path) {
                 $p = new PagePath();
                 $p->setPagePath($path);
                 $p->setPageObject($this->page);
                 if ($canonical == $i) {
                     $p->setPagePathIsCanonical(true);
                 }
                 \ORM::entityManager()->persist($p);
             }
         }
         \ORM::entityManager()->flush();
         $r->setTitle(t('Page Updated'));
         $r->setMessage(t('Page location information saved successfully.'));
         $r->setPage($this->page);
         $nc = Page::getByID($this->page->getCollectionID(), 'ACTIVE');
         $r->outputJSON();
     }
 }
Пример #30
0
 /**
  * Return an array of AuthenticationTypes that are associated with a specific package.
  *
  * @param \Package $pkg
  *
  * @return \Concrete\Core\Entity\File\StorageLocation\Type\Type[]
  */
 public static function getListByPackage($pkg)
 {
     $em = \ORM::entityManager();
     return $em->getRepository('\\Concrete\\Core\\Entity\\File\\StorageLocation\\Type\\Type')->findBy(array('pkgID' => $pkg->getPackageID()), array('fslTypeID' => 'asc'));
 }