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


PHP Category::getByID方法代码示例

本文整理汇总了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;
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:13,代码来源:AttributeKeyCategory.php

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

示例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;
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:45,代码来源:Controller.php

示例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;
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:14,代码来源:Set.php

示例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();
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
//.........这里部分代码省略.........
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:101,代码来源:Package.php

示例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);
}
开发者ID:seebaermichi,项目名称:concrete5,代码行数:20,代码来源:attribute_set_order_update.php

示例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;
     }
 }
开发者ID:jkoudys,项目名称:concrete5,代码行数:49,代码来源:Key.php

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

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


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