本文整理汇总了PHP中Concrete\Core\Attribute\Key\Category::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getByID方法的具体用法?PHP Category::getByID怎么用?PHP Category::getByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Attribute\Key\Category
的用法示例。
在下文中一共展示了Category::getByID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemsFromRequest
public function getItemsFromRequest($array)
{
$items = array();
foreach ($array as $id) {
$t = Category::getByID($id);
if (is_object($t)) {
$category = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\AttributeKeyCategory();
$category->setItemId($t->getAttributeKeyCategoryID());
$items[] = $category;
}
}
return $items;
}
示例2: getResults
public function getResults(Request $request)
{
$category = Category::getByID($request->query->get('akCategoryID'));
$items = array();
if (is_object($category)) {
$keys = Key::getAttributeKeyList($category->getAttributeKeyCategoryHandle());
foreach ($keys as $key) {
$item = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\AttributeKey();
$item->setItemId($key->getAttributeKeyID());
$items[] = $item;
}
}
return $items;
}
示例3: validateKey
/**
* Automatically run when an attribute key is added or updated
* @param bool|array $args
* @return \Concrete\Core\Error\Error
*/
public function validateKey($args = false)
{
if ($args == false) {
$args = $this->post();
}
/** @var \Concrete\Core\Form\Service\Validation $val */
$val = Core::make('helper/validation/form');
/** @var \Concrete\Core\Validation\CSRF\Token $valt */
$valt = Core::make('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());
}
/** @var \Concrete\Core\Utility\Service\Validation\Strings $stringValidator */
$stringValidator = Core::make('helper/validation/strings');
if (!$stringValidator->handle($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.", $args['akHandle']));
}
} else {
$error->add(t("An attribute with the handle %s already exists.", $args['akHandle']));
}
}
} else {
$error->add('Invalid attribute category.');
}
return $error;
}
示例4: getAttributeKeys
public function getAttributeKeys()
{
$db = Loader::db();
$r = $db->Execute('select akID from AttributeSetKeys where asID = ? order by displayOrder asc', array($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;
}
示例5: getItemName
public static function getItemName($item)
{
$txt = Loader::helper('text');
if ($item instanceof BlockType) {
return t($item->getBlockTypeName());
} else {
if ($item instanceof PageTheme) {
return $item->getThemeDisplayName();
} else {
if ($item instanceof Feature) {
return $item->getFeatureName();
} else {
if ($item instanceof FeatureCategory) {
return $item->getFeatureCategoryName();
} else {
if ($item instanceof GatheringDataSource) {
return $item->getGatheringDataSourceName();
} else {
if ($item instanceof GatheringItemTemplateType) {
return $txt->unhandle($item->getGatheringItemTemplateTypeHandle());
} else {
if ($item instanceof GatheringItemTemplate) {
return $item->getGatheringItemTemplateName();
} else {
if ($item instanceof BlockTypeSet) {
return $item->getBlockTypeSetDisplayName();
} else {
if ($item instanceof PageTypeComposerControlType) {
return $item->getPageTypeComposerControlTypeName();
} else {
if ($item instanceof PageTypePublishTargetType) {
return $item->getPageTypePublishTargetTypeDisplayName();
} else {
if ($item instanceof PageType) {
return $item->getPageTypeName();
} else {
if ($item instanceof PageTemplate) {
return $item->getPageTemplateDisplayName();
} else {
if ($item instanceof MailImporter) {
return $item->getMailImporterName();
} else {
if ($item instanceof Page) {
return $item->getCollectionPath();
} else {
if ($item instanceof AttributeType) {
return $item->getAttributeTypeDisplayName();
} else {
if ($item instanceof PermissionAccessEntityType) {
return $item->getAccessEntityTypeDisplayName();
} else {
if ($item instanceof PermissionKeyCategory) {
return $txt->unhandle($item->getPermissionKeyCategoryHandle());
} 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->getAttributeSetDisplayName(), $txt->unhandle($at->getAttributeKeyCategoryHandle()));
} else {
if ($item instanceof GroupSet) {
return $item->getGroupSetDisplayName();
} else {
if ($item instanceof AttributeKey) {
$akc = AttributeKeyCategory::getByID($item->getAttributeKeyCategoryID());
return t(' %s (%s)', $txt->unhandle($item->getAttributeKeyHandle()), $txt->unhandle($akc->getAttributeKeyCategoryHandle()));
} else {
if ($item instanceof UserPointAction) {
return $item->getUserPointActionName();
} else {
if ($item instanceof SystemCaptchaLibrary) {
return $item->getSystemCaptchaLibraryName();
} else {
if ($item instanceof SystemAntispamLibrary) {
return $item->getSystemAntispamLibraryName();
} else {
if ($item instanceof ConversationRatingType) {
return $item->getConversationRatingTypeDisplayName();
} else {
if ($item instanceof SystemContentEditorSnippet) {
return $item->getSystemContentEditorSnippetName();
} else {
if (is_a($item, 'PermissionKey')) {
return $item->getPermissionKeyDisplayName();
} else {
if (is_a($item, 'Job')) {
return $item->getJobName();
} else {
if (is_a($item, 'WorkflowType')) {
return $item->getWorkflowTypeName();
}
}
}
}
}
}
}
}
}
//.........这里部分代码省略.........
示例6: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$canRead = false;
use Concrete\Core\Attribute\Key\Category as AttributeKeyCategory;
$ch = Page::getByPath('/dashboard/settings/attributes/sets');
$cp = new Permissions($ch);
if ($cp->canViewPage()) {
$canRead = true;
}
if (!$canRead) {
die(t("Access Denied."));
}
$db = Loader::db();
$akc = AttributeKeyCategory::getByID($_POST['categoryID']);
$uats = $_REQUEST['asID'];
if (is_array($uats)) {
$manager = $akc->getController()->getSetManager();
$manager->updateAttributeSetDisplayOrder($uats);
}
示例7: update
/**
* Updates an attribute key.
*/
public function update($args)
{
$prevHandle = $this->getAttributeKeyHandle();
extract($args);
if (!isset($akHandle)) {
throw new ErrorException('No attribute key handle set.');
}
if (!isset($akName)) {
throw new ErrorException('No Attribute Key name set.');
}
$akIsSearchable = intval($akIsSearchable);
$akIsSearchableIndexed = intval($akIsSearchableIndexed);
$db = Loader::db();
$akCategoryHandle = $db->GetOne("select akCategoryHandle from AttributeKeyCategories inner join AttributeKeys on AttributeKeys.akCategoryID = AttributeKeyCategories.akCategoryID where akID = ?", $this->getAttributeKeyID());
$a = array($akHandle, $akName, $akIsSearchable, $akIsSearchableIndexed, $this->getAttributeKeyID());
$r = $db->query("update AttributeKeys set akHandle = ?, akName = ?, akIsSearchable = ?, akIsSearchableIndexed = ? where akID = ?", $a);
$category = AttributeKeyCategory::getByID($this->akCategoryID);
switch ($category->allowAttributeSets()) {
case AttributeKeyCategory::ASET_ALLOW_SINGLE:
if (isset($asID) && $asID > 0) {
$as = AttributeSet::getByID($asID);
if (!$this->inAttributeSet($as) && is_object($as)) {
$this->clearAttributeSets();
$this->setAttributeSet($as);
}
} else {
// clear set
$this->clearAttributeSets();
}
break;
}
if ($r) {
$txt = Loader::helper('text');
$pkgID = $category->getPackageID();
$prefix = $pkgID > 0 ? $category->getPackageHandle() : false;
$className = core_class('Core\\Attribute\\Key\\' . $txt->camelcase($akCategoryHandle) . 'Key', $prefix);
$ak = Core::make($className);
$ak->load($this->getAttributeKeyID());
$at = $ak->getAttributeType();
$cnt = $at->getController();
$cnt->setAttributeKey($ak);
$cnt->saveKey($args);
$ak->updateSearchIndex($prevHandle);
return $ak;
}
}
示例8: t
<input type="hidden" name="asID" value="<?php
echo $set->getAttributeSetID();
?>
" />
<?php
echo Loader::helper('validation/token')->output('update_set_attributes');
?>
<fieldset>
<legend><?php
echo t('Add Attributes to Set');
?>
</legend>
<?php
$cat = AttributeKeyCategory::getByID($set->getAttributeSetKeyCategoryID());
$cat = $cat->getAttributeKeyCategory();
$list = $cat->getList();
$unassigned = $cat->getSetManager()->getUnassignedAttributeKeys();
if (count($list) > 0) {
?>
<div class="form-group">
<?php
foreach ($list as $key) {
$keySets = \Concrete\Core\Attribute\Set::getByAttributeKey($key);
$disabled = '';
if (!$key->inAttributeSet($set) && count($keySets)) {
$disabled = array('disabled' => 'disabled');
}
?>
示例9: update_set_attributes
public function update_set_attributes()
{
if ($this->token->validate('update_set_attributes')) {
$as = AttributeSet::getByID($this->post('asID'));
if (!is_object($as)) {
$this->error->add(t('Invalid attribute set.'));
}
if (!$this->error->has()) {
// go through and add all the attributes that aren't in another set
$as->clearAttributeKeys();
$cat = AttributeKeyCategory::getByID($as->getAttributeSetKeyCategoryID());
$unassigned = $cat->getUnassignedAttributeKeys();
if (is_array($this->post('akID'))) {
foreach ($unassigned as $ak) {
if (in_array($ak->getAttributeKeyID(), $this->post('akID'))) {
$as->addKey($ak);
}
}
}
$this->redirect('dashboard/system/attributes/sets', 'category', $cat->getAttributeKeyCategoryID(), 'set_updated');
}
} else {
$this->error->add($this->token->getErrorMessage());
}
$this->edit($this->post('asID'));
}