Example #1
0
 public static function getByHandle($akHandle)
 {
     $ak = CacheLocal::getEntry('file_attribute_key_by_handle', $akHandle);
     if (is_object($ak)) {
         return $ak;
     } else {
         if ($ak == -1) {
             return false;
         }
     }
     $ak = -1;
     $db = Loader::db();
     $q = "SELECT ak.akID FROM AttributeKeys ak INNER JOIN AttributeKeyCategories akc ON ak.akCategoryID = akc.akCategoryID  WHERE ak.akHandle = ? AND akc.akCategoryHandle = 'file'";
     $akID = $db->GetOne($q, array($akHandle));
     if ($akID > 0) {
         $ak = self::getByID($akID);
     } else {
         // else we check to see if it's listed in the initial registry
         $ia = FileTypeList::getImporterAttribute($akHandle);
         if (is_object($ia)) {
             // we create this attribute and return it.
             $at = AttributeType::getByHandle($ia->akType);
             $args = array('akHandle' => $akHandle, 'akName' => $ia->akName, 'akIsSearchable' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => $ia->akIsEditable);
             $ak = static::add($at, $args);
         }
     }
     CacheLocal::set('file_attribute_key_by_handle', $akHandle, $ak);
     if ($ak === -1) {
         return false;
     }
     return $ak;
 }
 protected function installAttributeType($pkg)
 {
     $attributeHandle = 'related_pages';
     \Loader::model('attribute/categories/collection');
     AttributeType::add($attributeHandle, t('Related Pages'), \Package::getByHandle($this->pkgHandle));
     AttributeKeyCategory::getByHandle('collection')->associateAttributeKeyType(AttributeType::getByHandle($attributeHandle));
 }
Example #3
0
 public function add($id = null, $type = null)
 {
     $this->select_type($id, $type);
     $type = Type::getByID($type);
     $entity = $this->getEntity($id);
     $this->set('entity', $entity);
     $this->executeAdd($type, \URL::to('/dashboard/system/express/entities/attributes', 'view', $id));
 }
 public function install()
 {
     $pkg = parent::install();
     \Loader::model('attribute/categories/collection');
     $col = AttributeKeyCategory::getByHandle('collection');
     $at = AttributeType::add('icon_selector', t('Icon Selector'), $pkg);
     $col->associateAttributeKeyType($at);
 }
 public function install()
 {
     $pkg = parent::install();
     \Loader::model('attribute/categories/collection');
     $col = AttributeKeyCategory::getByHandle('collection');
     //Install attribute and attach to the Colletion Category
     $gallery = AttributeType::add('mixed_gallery', t('Mixed Gallery'), $pkg);
     $col->associateAttributeKeyType($gallery);
 }
Example #6
0
 protected function setUp()
 {
     $this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'FileImageThumbnailTypes', 'FilePermissionAssignments', 'AttributeKeyCategories', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'AttributeValues', 'atNumber', 'Logs', 'FileVersionLog'));
     parent::setUp();
     Config::set('concrete.upload.extensions', '*.txt;*.jpg;*.jpeg;*.png');
     $category = Category::add('file');
     $number = AttributeType::add('number', 'Number');
     FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
     FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
     CacheLocal::flush();
 }
 public function getResults(Request $request)
 {
     $list = Type::getAttributeTypeList();
     $items = array();
     foreach ($list as $type) {
         $attributeType = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\AttributeType();
         $attributeType->setItemId($type->getAttributeTypeID());
         $items[] = $attributeType;
     }
     return $items;
 }
 private function addAttributes($pkg)
 {
     \Loader::model('attribute/categories/collection');
     $col = AttributeKeyCategory::getByHandle('collection');
     $fileSelector = AttributeType::add('multifile_picker', t('Multiple File Picker'), $pkg);
     $col->associateAttributeKeyType($fileSelector);
     $userSelector = AttributeType::add('multiuser_picker', t('Multiple User Picker'), $pkg);
     $col->associateAttributeKeyType($userSelector);
     $pageSelector = AttributeType::add('multipage_picker', t('Multiple Page Picker'), $pkg);
     $col->associateAttributeKeyType($pageSelector);
 }
 protected function setUp()
 {
     $this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'FileImageThumbnailTypes', 'FilePermissionAssignments', 'AttributeKeyCategories', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'SystemContentEditorSnippets', 'AttributeValues', 'atNumber', 'FileVersionLog'));
     parent::setUp();
     define('UPLOAD_FILE_EXTENSIONS_ALLOWED', '*.txt;*.jpg;*.jpeg;*.png');
     Category::add('file');
     $number = AttributeType::add('number', 'Number');
     FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
     FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
     CacheLocal::flush();
 }
 public function add($type, $key, $settings = null, $pkg = null)
 {
     if (is_string($type)) {
         $type = \Concrete\Core\Attribute\Type::getByHandle($type);
     }
     // Legacy array support for $key
     $asID = false;
     if (is_array($key)) {
         $handle = $key['akHandle'];
         $name = $key['akName'];
         if (isset($key['asID'])) {
             $asID = $key['asID'];
         }
         $key = $this->createAttributeKey();
         $key->setAttributeKeyHandle($handle);
         $key->setAttributeKeyName($name);
     }
     // Legacy support for third parameter which used to be package
     if ($settings instanceof Package || $settings instanceof \Concrete\Core\Package\Package) {
         $pkg = $settings;
         unset($settings);
     }
     if (!$settings) {
         $settings = $type->getController()->getAttributeKeySettings();
     }
     $key->setAttributeType($type);
     $this->entityManager->persist($key);
     $this->entityManager->flush();
     $settings->setAttributeKey($key);
     $key->setAttributeKeySettings($settings);
     $this->entityManager->persist($settings);
     $this->entityManager->flush();
     if (is_object($pkg)) {
         $key->setPackage($pkg);
     }
     // Modify the category's search indexer.
     $indexer = $this->getSearchIndexer();
     if (is_object($indexer)) {
         $indexer->updateRepositoryColumns($this, $key);
     }
     $this->entityManager->persist($key);
     $this->entityManager->flush();
     /* legacy support, attribute set */
     if ($asID) {
         $manager = $this->getSetManager();
         $factory = new SetFactory($this->entityManager);
         $set = $factory->getByID($asID);
         if (is_object($set)) {
             $manager->addKey($set, $key);
         }
     }
     return $key;
 }
Example #11
0
 protected function setUp()
 {
     parent::setUp();
     $this->installAttributeCategoryAndObject();
     AttributeType::add('boolean', 'Boolean');
     AttributeType::add('textarea', 'Textarea');
     AttributeType::add('text', 'text');
     foreach ($this->keys as $akHandle => $args) {
         $args['akHandle'] = $akHandle;
         $type = AttributeType::getByHandle($args['type']);
         $this->keys[] = call_user_func_array(array($this->getAttributeKeyClass(), 'add'), array($type, $args));
     }
 }
Example #12
0
 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');
 }
Example #13
0
 public function add()
 {
     $this->select_type();
     $type = $this->get('type');
     $cnt = $type->getController();
     $e = $cnt->validateKey($this->post());
     if ($e->has()) {
         $this->set('error', $e);
     } else {
         $type = AttributeType::getByID($this->post('atID'));
         StoreProductKey::add($type, $this->post());
         $this->redirect('/dashboard/store/products/attributes/', 'success');
     }
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->attributekeys)) {
         foreach ($sx->attributekeys->attributekey as $ak) {
             $akc = \Concrete\Core\Attribute\Key\Category::getByHandle($ak['category']);
             $controller = $akc->getController();
             $attribute = $controller->getAttributeKeyByHandle((string) $ak['handle']);
             if (!$attribute) {
                 $pkg = static::getPackageObject($ak['package']);
                 $type = Type::getByHandle((string) $ak['type']);
                 $key = $controller->import($type, $ak, $pkg);
             }
         }
     }
 }
 private function installAttributeKeys($pkg)
 {
     $dbTableDemoAT = AttributeType::getByHandle("db_table_demo");
     if (!$dbTableDemoAT) {
         $dbTableDemoAT = AttributeType::add("db_table_demo", "Database Table Demo", $pkg);
         $cakc = AttributeKeyCategory::getByHandle('collection');
         $cakc->associateAttributeKeyType($dbTableDemoAT);
         $uakc = AttributeKeyCategory::getByHandle('user');
         $uakc->associateAttributeKeyType($dbTableDemoAT);
         $fakc = AttributeKeyCategory::getByHandle('file');
         $fakc->associateAttributeKeyType($dbTableDemoAT);
     }
     $this->addPageAttributeKeys($pkg);
     $this->addUserAttributeKeys($pkg);
     $this->addFileAttributeKeys($pkg);
 }
 public function install()
 {
     $pkg = parent::install();
     //Add dashboard page
     $sp = SinglePage::add('/dashboard/open_graph_tags_lite', $pkg);
     if (is_object($sp)) {
         $sp->update(array('cName' => t('Open Graph Tags Lite'), 'cDescription' => t('Auto insert Open Graph Tags (OGP) into HEAD tag')));
     }
     $sp = SinglePage::add('/dashboard/open_graph_tags_lite/settings', $pkg);
     if (is_object($sp)) {
         $sp->update(array('cName' => t('Open Graph Tags Settings'), 'cDescription' => ''));
     }
     //Add og:image attribute
     $cak = CollectionAttributeKey::getByHandle('og_image');
     if (!is_object($cak)) {
         $at = AttributeType::getByHandle('image_file');
         CollectionAttributeKey::add($at, array('akHandle' => 'og_image', 'akName' => t('og:image')));
     }
 }
Example #17
0
 public function dispatch($action)
 {
     $arguments = explode('/', trim($action, '/'));
     if (count($arguments) > 2) {
         // there must at last be three arguments here
         if (isset($arguments[0])) {
             switch ($arguments[0]) {
                 case 'key':
                     if (isset($arguments[1])) {
                         $key = Key::getByID($arguments[1]);
                         if (is_object($key)) {
                             $controller = $key->getController();
                         }
                     }
                     break;
                 case 'type':
                     if (isset($arguments[1])) {
                         $type = Type::getByID($arguments[1]);
                         if (is_object($type)) {
                             $controller = $type->getController();
                         }
                     }
                     break;
             }
         }
         if (isset($controller)) {
             $action = $arguments[2];
             $arguments = array_slice($arguments, 3);
             if (method_exists($controller, 'action_' . $action)) {
                 //make sure the controller has the right method
                 $response = call_user_func_array(array($controller, 'action_' . $action), $arguments);
                 if ($response instanceof Response) {
                     return $response;
                 } else {
                     print $response;
                     $this->app->shutdown();
                 }
             }
         }
     }
     $response = new Response(t('Access Denied'));
     return $response;
 }
Example #18
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');
 }
Example #19
0
 protected function setUp()
 {
     $this->tables = array_merge($this->tables, array('Files', 'FileVersions', 'Users', 'PermissionAccessEntityTypes', 'FileAttributeValues', 'AttributeKeyCategories', 'AttributeSetKeys', 'Packages', 'AttributeSets', 'FileImageThumbnailTypes', 'AttributeTypes', 'ConfigStore', 'AttributeKeys', 'AttributeValues', 'FileSets', 'atNumber', 'FileVersionLog', 'FileSetFiles'));
     parent::setUp();
     \Config::set('concrete.upload.extensions', '*.txt;*.jpg;*.jpeg;*.png');
     Category::add('file');
     \Concrete\Core\Permission\Access\Entity\Type::add('file_uploader', 'File Uploader');
     $number = AttributeType::add('number', 'Number');
     FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
     FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
     mkdir($this->getStorageDirectory());
     $this->getStorageLocation();
     $sample = dirname(__FILE__) . '/StorageLocation/fixtures/sample.txt';
     $image = DIR_BASE . '/concrete/images/logo.png';
     $fi = new Importer();
     $files = array('sample1.txt' => $sample, 'sample2.txt' => $sample, 'sample4.txt' => $sample, 'sample5.txt' => $sample, 'awesome.txt' => $sample, 'testing.txt' => $sample, 'logo1.png' => $image, 'logo2.png' => $image, 'logo3.png' => $image, 'foobley.png' => $image, 'test.png' => $image);
     foreach ($files as $filename => $pointer) {
         $fi->import($pointer, $filename);
     }
     $this->list = new \Concrete\Core\File\FileList();
     $this->list->ignorePermissions();
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->attributetypes)) {
         foreach ($sx->attributetypes->attributetype as $at) {
             $pkg = static::getPackageObject($at['package']);
             $name = (string) $at['name'];
             if (!$name) {
                 $name = \Core::make('helper/text')->unhandle($at['handle']);
             }
             $type = Type::getByHandle($at['handle']);
             if (!is_object($type)) {
                 $type = Type::add((string) $at['handle'], $name, $pkg);
             }
             if (isset($at->categories)) {
                 foreach ($at->categories->children() as $cat) {
                     $catobj = \Concrete\Core\Attribute\Key\Category::getByHandle((string) $cat['handle']);
                     $catobj->getController()->associateAttributeKeyType($type);
                 }
             }
         }
     }
 }
 public function execute(Batch $batch)
 {
     $types = $batch->getObjectCollection('attribute_key_category');
     if (!$types) {
         return;
     }
     foreach ($types->getCategories() as $type) {
         if (!$type->getPublisherValidator()->skipItem()) {
             $pkg = null;
             if ($type->getPackage()) {
                 $pkg = \Package::getByHandle($type->getPackage());
             }
             $type = Type::add($type->getHandle(), $type->getName(), $pkg);
             $categories = $type->getCategories();
             foreach ($categories as $category) {
                 $co = Category::getByHandle($category);
                 if (is_object($co)) {
                     $co->associateAttributeKeyType($type);
                 }
             }
         }
     }
 }
Example #22
0
<?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 
Example #23
0
 /**
  * @param \Concrete\Core\Attribute\Type $attributeType
  */
 public function __construct($attributeType)
 {
     $this->identifier = $attributeType->getAttributeTypeID();
     $this->attributeType = $attributeType;
     $this->set('controller', $this);
 }
<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Attribute\Key\Key as AttributeKey;
use Concrete\Core\Attribute\Type as AttributeType;
if (isset($_REQUEST['akID'])) {
    $at = AttributeKey::getInstanceByID($_REQUEST['akID']);
} else {
    $at = AttributeType::getByID($_REQUEST['atID']);
}
if (is_object($at)) {
    $cnt = $at->getController();
    if (isset($_REQUEST['args']) && is_array($_REQUEST['args'])) {
        $args = $_REQUEST['args'];
    } else {
        $args = array();
    }
    if (method_exists($cnt, 'action_' . $_REQUEST['action'])) {
        //make sure the controller has the right method
        call_user_func_array(array($cnt, 'action_' . $_REQUEST['action']), $args);
    }
}
Example #25
0
 public function upgrade()
 {
     $pkg = Package::getByHandle('vivid_store');
     if (version_compare($pkg->getPackageVersion(), '2.1', '<')) {
         Installer::renameDatabaseTables($pkg);
         Installer::refreshDatabase($pkg);
         /** Version 1.1 ***********************************************/
         /**************************************************************/
         /*
          * 1. Installs new payment method: Invoice
          *
          */
         $invoicePM = PaymentMethod::getByHandle('invoice');
         if (!is_object($invoicePM)) {
             PaymentMethod::add('invoice', 'Invoice', $pkg);
         }
         /** Version 2.0 ***********************************************/
         /**************************************************************/
         /*
          * 1. Installs new PageType: store_product
          * 2. Installs a parent page to publish products under
          * 3. Install Product block
          * 4. Set pagetype defaults
          * 5. Give default for measurement units
          * 6. Install a fileset for digital downloads
          * 7. Install product attributes
          *
          */
         /*
          * 1. Installs new PageType: store_product
          */
         $this->installStoreProductPageType($pkg);
         /*
          * 2. Installs a parent page to publish products under
          */
         //first check and make sure the config isn't set.
         $publishTarget = Config::get('vividstore.productPublishTarget');
         if ($publishTarget < 1 || empty($publishTarget)) {
             //if not, install the proudct detail page if needed.
             $productParentPage = Page::getByPath('/product-detail');
             if ($productParentPage->isError()) {
                 $home = Page::getByID(HOME_CID);
                 $pageType = PageType::getByHandle('page');
                 $pageTemplate = PageTemplate::getByHandle('full');
                 $productParentPage = $home->add($pageType, array('cName' => t('Product Detail'), 'cHandle' => 'product-detail', 'pkgID' => $pkg->pkgID), $pageTemplate);
                 Page::getByPath('/product-detail')->setAttribute('exclude_nav', 1);
             }
             //set the config to publish under the new page.
             Config::save('vividstore.productPublishTarget', $productParentPage->getCollectionID());
         }
         /*
          * 3. Install Product Block
          */
         $productBlock = BlockType::getByHandle("vivid_product");
         if (!is_object($productBlock)) {
             BlockType::installBlockTypeFromPackage('vivid_product', $pkg);
         }
         /*
          * 3. Install Product PageType Defaults
          */
         $pageType = PageType::getByHandle('store_product');
         $template = $pageType->getPageTypeDefaultPageTemplateObject();
         $pageObj = $pageType->getPageTypePageTemplateDefaultPageObject($template);
         $bt = BlockType::getByHandle('vivid_product');
         $blocks = $pageObj->getBlocks('Main');
         if ($blocks[0] && $blocks[0]->getBlockTypeHandle() == "content") {
             $blocks[0]->deleteBlock();
         }
         if (count($blocks) < 1) {
             $data = array('productLocation' => 'page', 'showProductName' => 1, 'showProductDescription' => 1, 'showProductDetails' => 1, 'showProductPrice' => 1, 'showImage' => 1, 'showCartButton' => 1, 'showGroups' => 1);
             $pageObj->addBlock($bt, 'Main', $data);
         }
         /*
          * 5. Measurement Units.
          */
         $sizeUnits = Config::get('vividstore.sizeUnit');
         if (empty($sizeUnits)) {
             Config::save('vividstore.sizeUnit', 'in');
         }
         $weightUnits = Config::get('vividstore.weightUnit');
         if (empty($weightUnits)) {
             Config::save('vividstore.weightUnit', 'lb');
         }
         /*
          * 6. Fileset for digital downloads
          */
         $fs = FileSet::getByName('Digital Downloads');
         if (!is_object($fs)) {
             FileSet::add("Digital Downloads");
         }
         /*
          * 7. Product Attributes page
          */
         $attrPage = Page::getByPath('/dashboard/store/products/attributes');
         if (!is_object($attrPage) || $attrPage->isError()) {
             SinglePage::add('/dashboard/store/products/attributes', $pkg);
         }
         /*
          *  Add email order attribute
          */
         $text = AttributeType::getByHandle('text');
         $oakc = AttributeKeyCategory::getByHandle('store_order');
         $orderCustSet = AttributeSet::getByHandle('order_customer');
         $email = StoreOrderKey::getByHandle('email');
         if (!is_object($email)) {
             StoreOrderKey::add($text, array('akHandle' => 'email', 'akName' => t('Email')), $pkg)->setAttributeSet($orderCustSet);
         }
         // convert legacy config items to current config storage
         // applies for version 2.1.1 and below
         $db = Database::get();
         $configitems = $db->GetAll("SELECT * FROM Config WHERE configGroup='vividstore'");
         if (!empty($configitems)) {
             foreach ($configitems as $config) {
                 Config::save('vividstore.' . $config['configItem'], $config['configValue']);
             }
             $db->Execute("DELETE FROM Config WHERE configGroup='vividstore'");
         }
     }
     Installer::addOrderStatusesToDatabase($pkg);
     $paypalPM = PaymentMethod::getByHandle('paypal_standard');
     if (!is_object($paypalPM)) {
         PaymentMethod::add('paypal_standard', 'PayPal Standard', $pkg);
     }
     $co = Config::get('vividstore.cartOverlay');
     if (empty($co)) {
         Config::save('vividstore.cartOverlay', false);
     }
     parent::upgrade();
 }
 public function skipItem()
 {
     $type = Type::getByHandle($this->object->getHandle());
     return is_object($type);
 }
Example #27
0
 /**
  * Returns an array of package items (e.g. blocks, themes)
  */
 public function getPackageItems()
 {
     $items = array();
     $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this);
     $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this);
     $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this);
     $items['attribute_keys'] = AttributeKey::getListByPackage($this);
     $items['attribute_sets'] = AttributeSet::getListByPackage($this);
     $items['group_sets'] = GroupSet::getListByPackage($this);
     $items['page_types'] = PageType::getListByPackage($this);
     $items['page_templates'] = PageTemplate::getListByPackage($this);
     $items['mail_importers'] = MailImporter::getListByPackage($this);
     $items['gathering_item_template_types'] = GatheringItemTemplateType::getListByPackage($this);
     $items['gathering_item_templates'] = GatheringItemTemplate::getListByPackage($this);
     $items['gathering_data_sources'] = GatheringDataSource::getListByPackage($this);
     $items['features'] = Feature::getListByPackage($this);
     $items['feature_categories'] = FeatureCategory::getListByPackage($this);
     $btl = new BlockTypeList();
     $btl->filterByPackage($this);
     $blocktypes = $btl->get();
     $items['block_types'] = $blocktypes;
     $items['block_type_sets'] = BlockTypeSet::getListByPackage($this);
     $items['page_themes'] = PageTheme::getListByPackage($this);
     $items['permissions'] = PermissionKey::getListByPackage($this);
     $items['single_pages'] = SinglePage::getListByPackage($this);
     $items['attribute_types'] = AttributeType::getListByPackage($this);
     $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this);
     $items['content_editor_snippets'] = SystemContentEditorSnippet::getListByPackage($this);
     $items['conversation_editors'] = ConversationEditor::getListByPackage($this);
     $items['conversation_rating_types'] = ConversationRatingType::getListByPackage($this);
     $items['page_type_publish_target_types'] = PageTypePublishTargetType::getListByPackage($this);
     $items['page_type_composer_control_types'] = PageTypeComposerControlType::getListByPackage($this);
     $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this);
     $items['community_point_actions'] = UserPointAction::getListByPackage($this);
     $items['jobs'] = Job::getListByPackage($this);
     $items['workflow_types'] = WorkflowType::getListByPackage($this);
     ksort($items);
     return $items;
 }
Example #28
0
 public static function installProductAttributes(Package $pkg)
 {
     //create custom attribute category for products
     $pakc = AttributeKeyCategory::getByHandle('store_product');
     if (!is_object($pakc)) {
         $pakc = AttributeKeyCategory::add('store_product', AttributeKeyCategory::ASET_ALLOW_SINGLE, $pkg);
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('text'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('textarea'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('number'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('address'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('boolean'));
         $pakc->associateAttributeKeyType(AttributeType::getByHandle('date_time'));
     }
 }
 public function run()
 {
     $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>");
     $this->x->addAttribute('version', '1.0');
     // First, attribute categories
     AttributeKeyCategory::exportList($this->x);
     // Features
     Feature::exportList($this->x);
     FeatureCategory::exportList($this->x);
     ConversationEditor::exportList($this->x);
     ConversationRatingType::exportList($this->x);
     // composer
     PageTypePublishTargetType::exportList($this->x);
     PageTypeComposerControlType::exportList($this->x);
     PageType::exportList($this->x);
     // attribute types
     AttributeType::exportList($this->x);
     // then block types
     BlockTypeList::exportList($this->x);
     // now block type sets (including user)
     BlockTypeSet::exportList($this->x);
     // gathering
     GatheringDataSource::exportList($this->x);
     GatheringItemTemplate::exportList($this->x);
     // now attribute keys (including user)
     AttributeKey::exportList($this->x);
     // now attribute keys (including user)
     AttributeSet::exportList($this->x);
     PageTemplate::exportList($this->x);
     // now theme
     PageTheme::exportList($this->x);
     // now packages
     PackageList::export($this->x);
     // permission access entity types
     PermissionAccessEntityType::exportList($this->x);
     // now task permissions
     PermissionKey::exportList($this->x);
     // workflow types
     WorkflowType::exportList($this->x);
     // now jobs
     Job::exportList($this->x);
     // now single pages
     $singlepages = $this->x->addChild("singlepages");
     $db = Loader::db();
     $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($singlepages);
     }
     // now stacks/global areas
     StackList::export($this->x);
     // now content pages
     $pages = $this->x->addChild("pages");
     $db = Loader::db();
     $r = $db->Execute('select Pages.cID from Pages where cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         if ($pc->getPageTypeHandle() == STACKS_PAGE_TYPE) {
             continue;
         }
         $pc->export($pages);
     }
     SystemCaptchaLibrary::exportList($this->x);
     \Concrete\Core\Sharing\SocialNetwork\Link::exportList($this->x);
     \Concrete\Core\Page\Feed::exportList($this->x);
     \Concrete\Core\File\Image\Thumbnail\Type\Type::exportList($this->x);
     Config::exportList($this->x);
     Tree::exportList($this->x);
 }
Example #30
0
 /**
  * @param \Concrete\Core\Attribute\Type $at An attribute type object
  * @return bool True if the attribute type is associated with the current attribute category, false if not
  */
 public function hasAttributeKeyTypeAssociated($at)
 {
     $atCount = Database::connection()->fetchColumn('SELECT COUNT(atID)
         FROM AttributeTypeCategories
         WHERE atID = ? AND akCategoryID = ?', array($at->getAttributeTypeID(), $this->akCategoryID));
     return $atCount > 0;
 }