当前位置: 首页>>代码示例>>PHP>>正文


PHP Attribute\Type类代码示例

本文整理汇总了PHP中Concrete\Core\Attribute\Type的典型用法代码示例。如果您正苦于以下问题:PHP Type类的具体用法?PHP Type怎么用?PHP Type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getByHandle

 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;
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:32,代码来源:FileKey.php

示例2: installAttributeType

 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));
 }
开发者ID:YumpDigital,项目名称:concrete5-package-related-pages,代码行数:7,代码来源:controller.php

示例3: add

 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));
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:8,代码来源:attributes.php

示例4: install

 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);
 }
开发者ID:Bloodb0ne,项目名称:Concrete5_DevRepo,代码行数:8,代码来源:controller.php

示例5: setUp

 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();
 }
开发者ID:masteramuk,项目名称:concrete5,代码行数:11,代码来源:ImporterTest.php

示例6: getResults

 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;
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:11,代码来源:AttributeType.php

示例7: addAttributes

 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);
 }
开发者ID:Bloodb0ne,项目名称:Concrete5_DevRepo,代码行数:11,代码来源:controller.php

示例8: setUp

 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();
 }
开发者ID:JeRoNZ,项目名称:concrete5-1,代码行数:11,代码来源:ContentFileTranslateTest.php

示例9: add

 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;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:53,代码来源:AbstractCategory.php

示例10: setUp

 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));
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:13,代码来源:AttributeTestCase.php

示例11: save_attribute_type_associations

 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');
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:14,代码来源:types.php

示例12: add

 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');
     }
 }
开发者ID:vividweb,项目名称:vivid_store,代码行数:14,代码来源:attributes.php

示例13: import

 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);
             }
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:15,代码来源:ImportAttributesRoutine.php

示例14: installAttributeKeys

 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);
 }
开发者ID:herent,项目名称:c5_tutorials_database_attribute,代码行数:16,代码来源:controller.php

示例15: install

 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')));
     }
 }
开发者ID:JohntheFish,项目名称:c5-open-graph-tags-lite,代码行数:19,代码来源:controller.php


注:本文中的Concrete\Core\Attribute\Type类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。