• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Attribute\Type类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: dispatch

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


示例17: save_attribute_type_associations

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


示例18: setUp

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


示例19: import

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


示例20: execute

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Key\Category类代码示例发布时间:2022-05-23
下一篇:
PHP Util\ProcessExecutor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap