/** * @param BooleanAttributeKey $source * @param CoreAttributeKey $destination */ public function publish(AttributeKey $source, CoreAttributeKey $destination) { $controller = $destination->getController(); $data = array(); $data['akCheckedByDefault'] = $source->getIsChecked(); $controller->saveKey($data); }
/** * @param DateTimeAttributeKey $source * @param CoreAttributeKey $destination */ public function publish(AttributeKey $source, CoreAttributeKey $destination) { $controller = $destination->getController(); $data = array(); $data['akDateDisplayMode'] = $source->getMode(); $controller->saveKey($data); }
/** * @param TopicsAttributeKey $source * @param CoreAttributeKey $destination */ public function publish(AttributeKey $source, CoreAttributeKey $destination) { $controller = $destination->getController(); $name = (string) $source->getTreeName(); $tree = \Concrete\Core\Tree\Type\Topic::getByName($name); $node = $tree->getNodeByDisplayPath($source->getNodePath()); $controller->setNodes($node->getTreeNodeID(), $tree->getTreeID()); }
/** * @param AddressAttributeKey $source * @param CoreAttributeKey $destination */ public function publish(AttributeKey $source, CoreAttributeKey $destination) { $controller = $destination->getController(); $data = array(); $data['akHasCustomCountries'] = $source->getHasCustomCountries(); $data['akDefaultCountry'] = $source->getDefaultCountry(); foreach ($source->getCustomCountries() as $country) { $data['akCustomCountries'][] = $country; } $controller->saveKey($data); }
/** * @param SelectAttributeKey $source * @param CoreAttributeKey $destination */ public function publish(AttributeKey $source, CoreAttributeKey $destination) { /** * @var \Concrete\Attribute\Select\Controller */ $controller = $destination->getController(); $controller->setAllowedMultipleValues($source->getAllowMultipleValues()); $controller->setAllowOtherValues($source->getAllowOtherValues()); $controller->setOptionDisplayOrder($source->getDisplayOrder()); $options = array(); foreach ($source->getOptions() as $option) { $options[] = $option['value']; } $controller->setOptions($options); }
protected function load($avID) { $db = Loader::db(); // $row = $db->GetRow('select avID, akID, uID, avDateAdded, atID from AttributeValues where avID = ?', array($avID)); $row = $db->GetRow('select avID, akID from AttributeValues where avID = ?', array($avID)); if (is_array($row) && $row['avID'] == $avID) { $this->setPropertiesFromArray($row); $this->attributeKey = Key::getByID($row['akID']); $this->attributeType = $this->getAttributeTypeObject(); } }
public function getPageTypeComposerControlObjects() { $objects = array(); $keys = AttributeKey::getAttributeKeyList('collection'); foreach ($keys as $ak) { $ac = new CollectionAttributeControl(); $ac->setAttributeKeyID($ak->getAttributeKeyID()); $ac->setPageTypeComposerControlIconFormatter($ak->getController()->getIconFormatter()); $ac->setPageTypeComposerControlName($ak->getAttributeKeyDisplayName()); $objects[] = $ac; } return $objects; }
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; }
public function dispatch($action) { $arguments = explode('/', trim($action, '/')); if (count($arguments) > 2) { // there must at last be three arguments here if (isset($arguments[0])) { switch ($arguments[0]) { case 'key': if (isset($arguments[1])) { $key = Key::getByID($arguments[1]); if (is_object($key)) { $controller = $key->getController(); } } break; case 'type': if (isset($arguments[1])) { $type = Type::getByID($arguments[1]); if (is_object($type)) { $controller = $type->getController(); } } break; } } if (isset($controller)) { $action = $arguments[2]; $arguments = array_slice($arguments, 3); if (method_exists($controller, 'action_' . $action)) { //make sure the controller has the right method $response = call_user_func_array(array($controller, 'action_' . $action), $arguments); if ($response instanceof Response) { return $response; } else { print $response; $this->app->shutdown(); } } } } $response = new Response(t('Access Denied')); return $response; }
/** * 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; }
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this); $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this); $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this); $items['attribute_keys'] = AttributeKey::getListByPackage($this); $items['attribute_sets'] = AttributeSet::getListByPackage($this); $items['group_sets'] = GroupSet::getListByPackage($this); $items['page_types'] = PageType::getListByPackage($this); $items['page_templates'] = PageTemplate::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['gathering_item_template_types'] = GatheringItemTemplateType::getListByPackage($this); $items['gathering_item_templates'] = GatheringItemTemplate::getListByPackage($this); $items['gathering_data_sources'] = GatheringDataSource::getListByPackage($this); $items['features'] = Feature::getListByPackage($this); $items['feature_categories'] = FeatureCategory::getListByPackage($this); $btl = new BlockTypeList(); $btl->filterByPackage($this); $blocktypes = $btl->get(); $items['block_types'] = $blocktypes; $items['block_type_sets'] = BlockTypeSet::getListByPackage($this); $items['page_themes'] = PageTheme::getListByPackage($this); $items['permissions'] = PermissionKey::getListByPackage($this); $items['single_pages'] = SinglePage::getListByPackage($this); $items['attribute_types'] = AttributeType::getListByPackage($this); $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this); $items['content_editor_snippets'] = SystemContentEditorSnippet::getListByPackage($this); $items['conversation_editors'] = ConversationEditor::getListByPackage($this); $items['conversation_rating_types'] = ConversationRatingType::getListByPackage($this); $items['page_type_publish_target_types'] = PageTypePublishTargetType::getListByPackage($this); $items['page_type_composer_control_types'] = PageTypeComposerControlType::getListByPackage($this); $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this); $items['community_point_actions'] = UserPointAction::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); $items['workflow_types'] = WorkflowType::getListByPackage($this); ksort($items); return $items; }
public function __wakeup() { $this->attributeKey = \Concrete\Core\Attribute\Key\Key::getByID($this->akID); }
public function run() { $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>"); $this->x->addAttribute('version', '1.0'); // First, attribute categories AttributeKeyCategory::exportList($this->x); // Features Feature::exportList($this->x); FeatureCategory::exportList($this->x); ConversationEditor::exportList($this->x); ConversationRatingType::exportList($this->x); // composer PageTypePublishTargetType::exportList($this->x); PageTypeComposerControlType::exportList($this->x); PageType::exportList($this->x); // attribute types AttributeType::exportList($this->x); // then block types BlockTypeList::exportList($this->x); // now block type sets (including user) BlockTypeSet::exportList($this->x); // gathering GatheringDataSource::exportList($this->x); GatheringItemTemplate::exportList($this->x); // now attribute keys (including user) AttributeKey::exportList($this->x); // now attribute keys (including user) AttributeSet::exportList($this->x); PageTemplate::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 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 stacks/global areas StackList::export($this->x); // now content pages $pages = $this->x->addChild("pages"); $db = Loader::db(); $r = $db->Execute('select Pages.cID from Pages where cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); if ($pc->getPageTypeHandle() == STACKS_PAGE_TYPE) { continue; } $pc->export($pages); } SystemCaptchaLibrary::exportList($this->x); \Concrete\Core\Sharing\SocialNetwork\Link::exportList($this->x); \Concrete\Core\Page\Feed::exportList($this->x); \Concrete\Core\File\Image\Thumbnail\Type\Type::exportList($this->x); Config::exportList($this->x); Tree::exportList($this->x); }
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()); $list = AttributeKey::getList($cat->getAttributeKeyCategoryHandle()); $unassigned = $cat->getUnassignedAttributeKeys(); if (count($list) > 0) { ?> <div class="form-group"> <?php foreach ($list as $ak) { $disabled = ''; if (!in_array($ak, $unassigned) && !$ak->inAttributeSet($set)) { $disabled = array('disabled' => 'disabled'); } ?> <div class="checkbox"> <label> <?php
public function delete() { parent::delete(); $db = Loader::db(); $r = $db->Execute('select avID from CollectionAttributeValues where akID = ?', array($this->getAttributeKeyID())); while ($row = $r->FetchRow()) { $db->Execute('delete from AttributeValues where avID = ?', array($row['avID'])); } $db->Execute('delete from CollectionAttributeValues where akID = ?', array($this->getAttributeKeyID())); }
public function reindex() { $attribs = AttributeFormKey::getAttributes($this->getID(), 'getSearchIndexValue'); $db = Database::connection(); $db->Execute('delete from AttributeFormsIndexAttributes where afID = ?', array($this->getID())); $searchableAttributes = array('afID' => $this->getID()); $rs = $db->Execute('select * from AttributeFormsIndexAttributes where afID = -1'); AttributeKey::reindex('AttributeFormsIndexAttributes', $searchableAttributes, $attribs, $rs); }
public function searchKeywords($keywords, $queryBuilder) { return $queryBuilder->expr()->like('ak_' . $this->attributeKey->getAttributeKeyHandle(), ':keywords'); }
public function delete() { parent::delete(); $db = Database::get(); $r = $db->Execute('select avID from VividStoreProductAttributeValues where akID = ?', array($this->getAttributeKeyID())); while ($row = $r->FetchRow()) { $db->Execute('delete from AttributeValues where avID = ?', array($row['avID'])); } $db->Execute('delete from VividStoreProductAttributeValues where akID = ?', array($this->getAttributeKeyID())); }
<?php defined('C5_EXECUTE') or die("Access Denied."); use Concrete\Core\Attribute\Key\Key as AttributeKey; use Concrete\Core\Attribute\Type as AttributeType; if (isset($_REQUEST['akID'])) { $at = AttributeKey::getInstanceByID($_REQUEST['akID']); } else { $at = AttributeType::getByID($_REQUEST['atID']); } if (is_object($at)) { $cnt = $at->getController(); if (isset($_REQUEST['args']) && is_array($_REQUEST['args'])) { $args = $_REQUEST['args']; } else { $args = array(); } if (method_exists($cnt, 'action_' . $_REQUEST['action'])) { //make sure the controller has the right method call_user_func_array(array($cnt, 'action_' . $_REQUEST['action']), $args); } }
public function delete() { parent::delete(); $db = Database::connection(); $r = $db->executeQuery('select avID from CollectionAttributeValues where akID = ?', array($this->getAttributeKeyID())); while ($row = $r->FetchRow()) { $db->executeQuery('delete from AttributeValues where avID = ?', array($row['avID'])); } $db->executeQuery('delete from CollectionAttributeValues where akID = ?', array($this->getAttributeKeyID())); }
public function reindex($index = false, $actuallyDoReindex = true) { if ($this->isAlias() && !$this->isExternalLink()) { return false; } if ($actuallyDoReindex || Config::get('concrete.page.search.always_reindex') == true) { $db = Loader::db(); $attribs = CollectionAttributeKey::getAttributes($this->getCollectionID(), $this->getVersionID(), 'getSearchIndexValue'); $db->Execute('delete from CollectionSearchIndexAttributes where cID = ?', array($this->getCollectionID())); $searchableAttributes = array('cID' => $this->getCollectionID()); $key = new Key(); $key->reindex('CollectionSearchIndexAttributes', $searchableAttributes, $attribs); if ($index == false) { $index = new IndexedSearch(); } $index->reindexPage($this); $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 0), array('cID'), false); $cache = PageCache::getLibrary(); $cache->purge($this); // we check to see if this page is referenced in any gatherings $c = Page::getByID($this->getCollectionID(), $this->getVersionID()); $items = PageGatheringItem::getListByItem($c); foreach ($items as $it) { $it->deleteFeatureAssignments(); $it->assignFeatureAssignments($c); } } else { $db = Loader::db(); Config::save('concrete.misc.do_page_reindex_check', true); $db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 1), array('cID'), false); } }
public static function getUserAddedList() { return parent::getList('user', array('akIsAutoCreated' => 0)); }