コード例 #1
0
ファイル: Key.php プロジェクト: ppiedaderawnet/concrete5
 public function getAttributeSets()
 {
     return \Concrete\Core\Attribute\Set::getByAttributeKey($this);
 }
コード例 #2
0
 protected function assignToSetFromRequest(AttributeKeyInterface $key)
 {
     $request = $this->request;
     $entity = $this->getCategoryObject();
     $category = $entity->getAttributeKeyCategory();
     if ($category->getSetManager()->allowAttributeSets()) {
         $set = Set::getByID($request->request->get('asID'));
         $setKeys = Set::getByAttributeKey($key);
         if (in_array($set, $setKeys)) {
             return;
         }
         if ($category->getSetManager()->allowAttributeSets() == StandardSetManager::ASET_ALLOW_SINGLE || !is_object($set)) {
             $query = $this->entityManager->createQuery('delete from \\Concrete\\Core\\Entity\\Attribute\\SetKey sk where sk.attribute_key = :attribute_key');
             $query->setParameter('attribute_key', $key);
             $query->execute();
         }
         if (is_object($set)) {
             $this->entityManager->refresh($set);
             // Refresh display order just in case.
             $displayOrder = 0;
             foreach ($set->getAttributeKeyCollection() as $setKey) {
                 $setKey->setDisplayOrder($displayOrder);
                 $this->entityManager->persist($setKey);
                 ++$displayOrder;
             }
             $setKey = new SetKey();
             $setKey->setAttributeKey($key);
             $setKey->setAttributeSet($set);
             $setKey->setDisplayOrder($displayOrder);
             $this->entityManager->persist($setKey);
         }
     }
     $this->entityManager->flush();
 }
コード例 #3
0
ファイル: sets.php プロジェクト: ppiedaderawnet/concrete5
    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');
            }
            ?>
                                <div class="checkbox">
                                    <label>
                                        <?php 
            echo $form->checkbox('akID[]', $key->getAttributeKeyID(), $key->inAttributeSet($set), $disabled);
            ?>
                                        <span><?php 
            echo $key->getAttributeKeyDisplayName();
            ?>
</span>
                                        <span class="help-inline"><?php