本文整理汇总了PHP中AttributeKeyCategory::getByHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeKeyCategory::getByHandle方法的具体用法?PHP AttributeKeyCategory::getByHandle怎么用?PHP AttributeKeyCategory::getByHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeKeyCategory
的用法示例。
在下文中一共展示了AttributeKeyCategory::getByHandle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installOrUpgrade
private function installOrUpgrade($pkg, $fromVersion)
{
$at = AttributeType::getByHandle('handle_https');
if (!is_object($at)) {
$at = AttributeType::add('handle_https', tc('AttributeTypeName', 'HTTPS handling'), $pkg);
}
$akc = AttributeKeyCategory::getByHandle('collection');
if (is_object($akc)) {
if (!$akc->hasAttributeKeyTypeAssociated($at)) {
$akc->associateAttributeKeyType($at);
}
}
if (empty($fromVersion)) {
$ak = CollectionAttributeKey::getByHandle('handle_https');
if (!is_object($ak)) {
$hhh = Loader::helper('https_handling', 'handle_https');
/* @var $hhh HttpsHandlingHelper */
$httpDomain = defined('BASE_URL') ? BASE_URL : Config::get('BASE_URL');
if (!$httpDomain) {
$httpDomain = 'http://' . $hhh->getRequestDomain();
}
$httpsDomain = defined('BASE_URL_SSL') ? BASE_URL_SSL : Config::get('BASE_URL_SSL');
if (!$httpsDomain) {
$httpsDomain = 'https://' . $hhh->getRequestDomain();
}
$ak = CollectionAttributeKey::add($at, array('akHandle' => 'handle_https', 'akName' => tc('AttributeKeyName', 'Page HTTP/HTTPS'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => 1, 'akIsInternal' => 0, 'akEnabled' => 0, 'akDefaultRequirement' => HttpsHandlingHelper::SSLHANDLING_DOESNOT_MATTER, 'akCustomDomains' => 0, 'akHTTPDomain' => $httpDomain, 'akHTTPSDomain' => $httpsDomain), $pkg);
}
}
}
示例2: install
public function install()
{
$pkg = parent::install();
$pkgh = Package::getByHandle('page_selector_attribute');
Loader::model('attribute/categories/collection');
$col = AttributeKeyCategory::getByHandle('collection');
$pageselector = AttributeType::add('page_selector', t('Page Selector'), $pkgh);
$col->associateAttributeKeyType(AttributeType::getByHandle('page_selector'));
}
示例3: installPageLinkAttribute
private function installPageLinkAttribute(&$pkg)
{
$at = AttributeType::getByHandle('page_selector');
if ($at && intval($at->getAttributeTypeID())) {
//Associate with "file" category (if not done alrady)
Loader::model('attribute/categories/collection');
$akc = AttributeKeyCategory::getByHandle('file');
$sql = 'SELECT COUNT(*) FROM AttributeTypeCategories WHERE atID = ? AND akCategoryID = ?';
$vals = array($at->getAttributeTypeID(), $akc->akCategoryID);
$existsInCategory = Loader::db()->GetOne($sql, $vals);
if (!$existsInCategory) {
$akc->associateAttributeKeyType($at);
}
//Install the link-to-page attribute (if not done already)
Loader::model('file_attributes');
$akHandle = 'gallery_link_to_cid';
$akGalleryLinkToCID = FileAttributeKey::getByHandle($akHandle);
if (!is_object($akGalleryLinkToCID) || !intval($akGalleryLinkToCID->getAttributeKeyID())) {
$akGalleryLinkToCID = FileAttributeKey::add($at, array('akHandle' => $akHandle, 'akName' => t('Gallery Link To Page')), $pkg);
}
}
}
示例4: t
<h6><?php
echo t("All Attributes");
?>
</h6>
<div class="ccm-block-type-search-wrapper ">
<div class="ccm-block-type-search">
<?php
echo $form->text('ccmSearchAttributeListField', array('tabindex' => 1, 'autocomplete' => 'off', 'style' => 'width: 155px'));
?>
</div>
</div>
<?
$category = AttributeKeyCategory::getByHandle('collection');
$sets = $category->getAttributeSets();
?>
<ul id="ccm-page-attribute-list" class="item-select-list">
<? foreach($sets as $as) { ?>
<li class="item-select-list-header ccm-attribute-available"><span><?php
echo $as->getAttributeSetName();
?>
</span></li>
<?
$setattribs = $as->getAttributeKeys();
foreach($setattribs as $ak) {
if (!in_array($ak->getAttributeKeyID(), $allowedAKIDs)) {
continue;
}
示例5: on_start
public function on_start()
{
$this->set('category', AttributeKeyCategory::getByHandle('user'));
}
示例6: defined
defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('user_attributes');
$form = Loader::helper('form');
$tp = new TaskPermission();
if (!$tp->canAccessUserSearch()) {
die(t("Access Denied."));
}
$selectedAKIDs = array();
$slist = UserAttributeKey::getColumnHeaderList();
foreach ($slist as $sk) {
$selectedAKIDs[] = $sk->getAttributeKeyID();
}
if ($_POST['task'] == 'update_columns') {
Loader::model('attribute/category');
$sc = AttributeKeyCategory::getByHandle('user');
$sc->clearAttributeKeyCategoryColumnHeaders();
if (is_array($_POST['akID'])) {
foreach ($_POST['akID'] as $akID) {
$ak = UserAttributeKey::getByID($akID);
$ak->setAttributeKeyColumnHeader(1);
}
}
exit;
}
$list = UserAttributeKey::getList();
?>
<form method="post" id="ccm-user-customize-search-columns-form" action="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
示例7: import
public static function import(SimpleXMLElement $ak)
{
$type = AttributeType::getByHandle($ak['type']);
$akCategoryHandle = $ak['category'];
$pkg = false;
if ($ak['package']) {
$pkg = Package::getByHandle($ak['package']);
}
$akIsInternal = 0;
if ($ak['internal']) {
$akIsInternal = 1;
}
$db = Loader::db();
$akc = AttributeKeyCategory::getByHandle($akCategoryHandle);
$akID = $db->GetOne('select akID from AttributeKeys where akHandle = ? and akCategoryID = ?', array($ak['handle'], $akc->getAttributeKeyCategoryID()));
if (!$akID) {
$akn = self::add($akCategoryHandle, $type, array('akHandle' => $ak['handle'], 'akName' => $ak['name'], 'akIsInternal' => $akIsInternal, 'akIsSearchableIndexed' => $ak['indexed'], 'akIsSearchable' => $ak['searchable']), $pkg);
$akn->getController()->importKey($ak);
}
}
示例8: installUserAttributes
private function installUserAttributes($pkg)
{
$uakc = AttributeKeyCategory::getByHandle('user');
// Multiple means an attribute can be in more than one set, but you
// can't choose what set they show up in for the gui
// $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_MULTIPLE);
// $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_NONE);
$uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
$bua = $uakc->addSet('c5_boilerplate_user_attributes', t('Boilerplate User Attributes'), $pkg);
//add boolean attributes
$bp_boolean = UserAttributeKey::getByHandle('bp_boolean');
if (!$bp_boolean instanceof UserAttributeKey) {
$bp_boolean = UserAttributeKey::add('boolean', array('akHandle' => 'bp_boolean', 'akName' => t('Boolean Name'), 'akIsSearchable' => true, 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($bua);
}
//add text attributes
$bp_text = UserAttributeKey::getByHandle('bp_text');
if (!$bp_text instanceof UserAttributeKey) {
$bp_text = UserAttributeKey::add('text', array('akHandle' => 'bp_text', 'akName' => t('Text Name'), 'akIsSearchable' => true, 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($bua);
}
}
示例9: installCoreAttributeItems
protected function installCoreAttributeItems() {
$cakc = AttributeKeyCategory::getByHandle('collection');
if (is_object($cakc)) {
return false;
}
$cakc = AttributeKeyCategory::add('collection');
$uakc = AttributeKeyCategory::add('user');
$fakc = AttributeKeyCategory::add('file');
$tt = AttributeType::add('text', t('Text'));
$textareat = AttributeType::add('textarea', t('Text Area'));
$boolt = AttributeType::add('boolean', t('Checkbox'));
$dtt = AttributeType::add('date_time', t('Date/Time'));
$ift = AttributeType::add('image_file', t('Image/File'));
$nt = AttributeType::add('number', t('Number'));
$rt = AttributeType::add('rating', t('Rating'));
$st = AttributeType::add('select', t('Select'));
$addresst = AttributeType::add('address', t('Address'));
// assign collection attributes
$cakc->associateAttributeKeyType($tt);
$cakc->associateAttributeKeyType($textareat);
$cakc->associateAttributeKeyType($boolt);
$cakc->associateAttributeKeyType($dtt);
$cakc->associateAttributeKeyType($ift);
$cakc->associateAttributeKeyType($nt);
$cakc->associateAttributeKeyType($rt);
$cakc->associateAttributeKeyType($st);
// assign user attributes
$uakc->associateAttributeKeyType($tt);
$uakc->associateAttributeKeyType($textareat);
$uakc->associateAttributeKeyType($boolt);
$uakc->associateAttributeKeyType($dtt);
$uakc->associateAttributeKeyType($nt);
$uakc->associateAttributeKeyType($st);
$uakc->associateAttributeKeyType($addresst);
// assign file attributes
$fakc->associateAttributeKeyType($tt);
$fakc->associateAttributeKeyType($textareat);
$fakc->associateAttributeKeyType($boolt);
$fakc->associateAttributeKeyType($dtt);
$fakc->associateAttributeKeyType($nt);
$fakc->associateAttributeKeyType($rt);
$fakc->associateAttributeKeyType($st);
}
示例10: importAttributeSets
protected function importAttributeSets(SimpleXMLElement $sx) {
if (isset($sx->attributesets)) {
foreach($sx->attributesets->attributeset as $as) {
$akc = AttributeKeyCategory::getByHandle($as['category']);
$pkg = ContentImporter::getPackageObject($as['package']);
$set = $akc->addSet((string) $as['handle'], (string) $as['name'], $pkg, $as['locked']);
foreach($as->children() as $ask) {
$ak = $akc->getAttributeKeyByHandle((string) $ask['handle']);
if (is_object($ak)) {
$set->addKey($ak);
}
}
}
}
}