本文整理汇总了PHP中AttributeKeyCategory类的典型用法代码示例。如果您正苦于以下问题:PHP AttributeKeyCategory类的具体用法?PHP AttributeKeyCategory怎么用?PHP AttributeKeyCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AttributeKeyCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: parseManual
/**
* {@inheritdoc}
*
* @see \C5TL\Parser\DynamicItem::parseManual()
*/
public function parseManual(\Gettext\Translations $translations, $concrete5version)
{
if (class_exists('\\AttributeKeyCategory', true) && class_exists('\\AttributeSet', true)) {
foreach (\AttributeKeyCategory::getList() as $akc) {
foreach ($akc->getAttributeSets() as $as) {
$this->addTranslation($translations, $as->getAttributeSetName(), 'AttributeSetName');
}
}
}
}
示例4: run
public function run()
{
$this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>");
$this->x->addAttribute('version', '1.0');
// First, attribute categories
AttributeKeyCategory::exportList($this->x);
// attribute types
AttributeType::exportList($this->x);
// then block types
BlockTypeList::exportList($this->x);
// now attribute keys (including user)
AttributeKey::exportList($this->x);
// now attribute keys (including user)
AttributeSet::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
Loader::model('job');
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 page types
CollectionType::exportList($this->x);
// now stacks/global areas
Loader::model('stack/list');
StackList::export($this->x);
// now content pages
$pages = $this->x->addChild("pages");
$db = Loader::db();
$r = $db->Execute('select Pages.cID from Pages left join ComposerDrafts on Pages.cID = ComposerDrafts.cID where ComposerDrafts.cID is null and cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc');
while ($row = $r->FetchRow()) {
$pc = Page::getByID($row['cID'], 'RECENT');
$pc->export($pages);
}
Loader::model("system/captcha/library");
SystemCaptchaLibrary::exportList($this->x);
Config::exportList($this->x);
}
示例5: getAttributeKeys
public function getAttributeKeys() {
$db = Loader::db();
$r = $db->Execute('select akID from AttributeSetKeys where asID = ? order by displayOrder asc', $this->getAttributeSetID());
$keys = array();
$cat = AttributeKeyCategory::getByID($this->akCategoryID);
while ($row = $r->FetchRow()) {
$ak = $cat->getAttributeKeyByID($row['akID']);
if (is_object($ak)) {
$keys[] = $ak;
}
}
return $keys;
}
示例6: save_attribute_type_associations
public function save_attribute_type_associations()
{
$list = AttributeKeyCategory::getList();
foreach ($list as $cat) {
$cat->clearAttributeKeyCategoryTypes();
if (is_array($this->post($cat->getAttributeKeyCategoryHandle()))) {
foreach ($this->post($cat->getAttributeKeyCategoryHandle()) as $id) {
$type = AttributeType::getByID($id);
$cat->associateAttributeKeyType($type);
}
}
}
$this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated');
}
示例7: parseManual
/**
* @see \C5TL\Parser\DynamicItem::parseManual()
*/
public function parseManual(\Gettext\Translations $translations, $concrete5version)
{
if (class_exists('\\AttributeKeyCategory', true) && class_exists('\\AttributeKey', true) && class_exists('\\AttributeType', true)) {
foreach (\AttributeKeyCategory::getList() as $akc) {
$akcHandle = $akc->getAttributeKeyCategoryHandle();
foreach (\AttributeKey::getList($akcHandle) as $ak) {
if ($ak->getAttributeType()->getAttributeTypeHandle() === 'select') {
foreach ($ak->getController()->getOptions() as $option) {
$this->addTranslation($translations, $option->getSelectAttributeOptionValue(false), 'SelectAttributeValue');
}
}
}
}
}
}
示例8: exportAll
public function exportAll()
{
$this->x = $this->getXMLRoot();
// First, attribute categories
AttributeKeyCategory::exportList($this->x);
// attribute types
AttributeType::exportList($this->x);
// then block types
BlockTypeList::exportList($this->x);
// now attribute keys (including user)
AttributeKey::exportList($this->x);
// now attribute keys (including user)
AttributeSet::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
Loader::model('job');
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 page types
CollectionType::exportList($this->x);
// now stacks/global areas
Loader::model('stack/list');
StackList::export($this->x);
$this->exportPages($this->x);
Loader::model("system/captcha/library");
SystemCaptchaLibrary::exportList($this->x);
Config::exportList($this->x);
}
示例9: 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);
}
}
}
示例10: on_start
public function on_start()
{
$this->set('disableThirdLevelNav', true);
$this->set('category', AttributeKeyCategory::getByHandle('collection'));
}
示例11: validateKey
public function validateKey($args = false) {
if ($args == false) {
$args = $this->post();
}
$val = Loader::helper('validation/form');
$valt = Loader::helper('validation/token');
$val->setData($args);
$val->addRequired("akHandle", t("Handle required."));
$val->addRequired("akName", t('Name required.'));
$val->addRequired("atID", t('Type required.'));
$val->test();
$error = $val->getError();
if (!$valt->validate('add_or_update_attribute')) {
$error->add($valt->getErrorMessage());
}
if(preg_match("/[^A-Za-z0-9\_]/", $args['akHandle'])) {
$error->add(t('Attribute handles may only contain letters, numbers and underscore "_" characters'));
}
$akc = AttributeKeyCategory::getByID($args['akCategoryID']);
if (is_object($akc)) {
if ($akc->handleExists($args['akHandle'])) {
if (is_object($this->attributeKey)) {
$ak2 = $akc->getAttributeKeyByHandle($args['akHandle']);
if ($ak2->getAttributeKeyID() != $this->attributeKey->getAttributeKeyID()) {
$error->add(t("An attribute with the handle %s already exists.", $akHandle));
}
} else {
$error->add(t("An attribute with the handle %s already exists.", $akHandle));
}
}
} else {
$error->add('Invalid attribute category.');
}
return $error;
}
示例12: 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);
}
}
}
}
}
示例13: getItemName
public static function getItemName($item) {
$txt = Loader::helper('text');
Loader::model('single_page');
Loader::model('dashboard/homepage');
if ($item instanceof BlockType) {
return $item->getBlockTypeName();
} else if ($item instanceof PageTheme) {
return $item->getThemeName();
} else if ($item instanceof CollectionType) {
return $item->getCollectionTypeName();
} else if ($item instanceof MailImporter) {
return $item->getMailImporterName();
} else if ($item instanceof SinglePage) {
return $item->getCollectionPath();
} else if ($item instanceof AttributeType) {
return $item->getAttributeTypeName();
} else if ($item instanceof AttributeKeyCategory) {
return $txt->unhandle($item->getAttributeKeyCategoryHandle());
} else if ($item instanceof AttributeSet) {
$at = AttributeKeyCategory::getByID($item->getAttributeSetKeyCategoryID());
return t('%s (%s)', $item->getAttributeSetName(), $txt->unhandle($at->getAttributeKeyCategoryHandle()));
} else if (is_a($item, 'AttributeKey')) {
$akc = AttributeKeyCategory::getByID($item->getAttributeKeyCategoryID());
return t(' %s (%s)', $txt->unhandle($item->getAttributeKeyHandle()), $txt->unhandle($akc->getAttributeKeyCategoryHandle()));
} else if ($item instanceof ConfigValue) {
return ucwords(strtolower($txt->unhandle($item->key)));
} else if ($item instanceof DashboardHomepage) {
return t('%s (%s)', $item->dbhDisplayName, $txt->unhandle($item->dbhModule));
} else if (is_a($item, 'TaskPermission')) {
return $item->getTaskPermissionName();
} else if (is_a($item, 'Job')) {
return $item->getJobName();
}
}
示例14: 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);
}
示例15: foreach
</h3>
<form class="" method="post" action="<?php
echo $this->action('update_set_attributes');
?>
">
<input type="hidden" name="asID" value="<?php
echo $set->getAttributeSetID();
?>
" />
<?php
echo Loader::helper('validation/token')->output('update_set_attributes');
?>
<?php
$cat = AttributeKeyCategory::getByID($set->getAttributeSetKeyCategoryID());
$list = AttributeKey::getList($cat->getAttributeKeyCategoryHandle());
$unassigned = $cat->getUnassignedAttributeKeys();
if (count($list) > 0) {
?>
<div class="clearfix">
<ul class="inputs-list">
<?php
foreach ($list as $ak) {
$disabled = '';
if (!in_array($ak, $unassigned) && !$ak->inAttributeSet($set)) {
$disabled = array('disabled' => 'disabled');
}
?>