public function getResults(Request $request) { $list = Category::getList(); $items = array(); foreach ($list as $t) { $item = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\AttributeKeyCategory(); $item->setItemId($t->getAttributeKeyCategoryID()); $items[] = $item; } return $items; }
public function save_attribute_type_associations() { $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->associateAttributeKeyType($type); } } } $this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated'); }
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'); }
<?php defined('C5_EXECUTE') or die("Access Denied."); use Concrete\Core\Attribute\Type as AttributeType; use Concrete\Core\Attribute\Key\Category as AttributeKeyCategory; use Concrete\Core\Attribute\PendingType as PendingAttributeType; $types = AttributeType::getList(); $categories = AttributeKeyCategory::getList(); $txt = Loader::helper('text'); $form = Loader::helper('form'); $interface = Loader::helper('concrete/ui'); echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Attribute Type Associations'), false, 'span10 offset1'); ?> <form method="post" class="" id="attribute_type_associations_form" action="<?php echo $view->action('save_attribute_type_associations'); ?> "> <table border="0" cellspacing="1" cellpadding="0" border="0" class="table"> <tr> <th><?php echo t('Name'); ?> </th> <?php foreach ($categories as $cat) { ?> <th><?php echo $txt->unhandle($cat->getAttributeKeyCategoryHandle()); ?> </th> <?php
public static function exportList($xml) { $categories = AttributeKeyCategory::getList(); $axml = $xml->addChild('attributekeys'); foreach ($categories as $cat) { $attributes = static::getList($cat->getAttributeKeyCategoryHandle()); foreach ($attributes as $at) { $at->export($axml); } } }
<?php defined('C5_EXECUTE') or die('Access Denied.'); use Concrete\Core\Attribute\Key\Category as AttributeCategory; $valt = Loader::helper('validation/token'); $ci = Loader::helper('concrete/urls'); $ch = Loader::helper('concrete/ui'); $tp = new TaskPermission(); if ($tp->canInstallPackages()) { $mi = Marketplace::getInstance(); } $pkgArray = Package::getInstalledList(); $ci = \Core::make('helper/concrete/urls'); $txt = \Core::make('helper/text'); $nav = \Core::make('helper/navigation'); $catList = AttributeCategory::getList(); if (is_object($pkg)) { $pkgID = $pkg->getPackageID(); } if ($this->controller->getTask() == 'install_package' && $showInstallOptionsScreen && $tp->canInstallPackages()) { ?> <form method="post" action="<?php echo $this->action('install_package', $pkg->getPackageHandle()); ?> "> <?php echo Loader::helper('validation/token')->output('install_options_selected'); ?> <?php echo Loader::packageElement('dashboard/install', $pkg->getPackageHandle()); ?>
/** * Removes a file, including all of its versions. */ public function delete($removeNode = true) { // first, we remove all files from the drive $db = Loader::db(); $em = $db->getEntityManager(); // fire an on_page_delete event $fve = new \Concrete\Core\File\Event\DeleteFile($this); $fve = Events::dispatch('on_file_delete', $fve); if (!$fve->proceed()) { return false; } // Delete the tree node for the file. if ($removeNode) { $nodeID = $db->fetchColumn('select treeNodeID from TreeFileNodes where fID = ?', [$this->getFileID()]); if ($nodeID) { $node = Node::getByID($nodeID); $node->delete(); } } $versions = $this->getVersionList(); foreach ($versions as $fv) { $fv->delete(true); } $db->Execute("delete from FileSetFiles where fID = ?", [$this->fID]); $db->Execute("delete from FileSearchIndexAttributes where fID = ?", [$this->fID]); $db->Execute("delete from DownloadStatistics where fID = ?", [$this->fID]); $db->Execute("delete from FilePermissionAssignments where fID = ?", [$this->fID]); $query = $em->createQuery('select fav from Concrete\\Core\\Entity\\Attribute\\Value\\Value\\ImageFileValue fav inner join fav.file f where f.fID = :fID'); $query->setParameter('fID', $this->getFileID()); $values = $query->getResult(); foreach ($values as $genericValue) { foreach (Category::getList() as $category) { $category = $category->getController(); /** * @var $category AbstractCategory */ $values = $category->getAttributeValueRepository()->findBy(['generic_value' => $genericValue]); foreach ($values as $attributeValue) { $category->deleteValue($attributeValue); } } } $db->Execute("delete from Files where fID = ?", [$this->fID]); }
public function view() { $this->set('categories', AttributeKeyCategory::getList()); }
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $form = Core::make('helper/form'); $categories = array(); $list = \Concrete\Core\Attribute\Key\Category::getList(); foreach ($list as $category) { $categories[$category->getAttributeKeyCategoryID()] = $category->getAttributeKeyCategoryHandle(); } ?> <div class="form-group"> <?php echo $form->label('category', t('Attribute Category')); ?> <?php echo $form->select('akCategoryID', $categories); ?> </div>
public function view() { parent::view(); $this->set('text', \Core::make('helper/text')); $this->set('categories', Category::getList()); }