public function exportAll() { $this->x = $this->getXMLRoot(); // 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 $this->exportPages($this->x); 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); Tree::exportList($this->x); }
public function import(\SimpleXMLElement $sx) { if (isset($sx->conversationratingtypes)) { foreach ($sx->conversationratingtypes->conversationratingtype as $th) { $pkg = static::getPackageObject($th['package']); $ce = Type::add((string) $th['handle'], (string) $th['name'], $th['points'], $pkg); } } }
public function getResults(Request $request) { $list = Type::getList(); $items = array(); foreach ($list as $t) { $item = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\ConversationRatingType(); $item->setItemId($t->getConversationRatingTypeID()); $items[] = $item; } return $items; }
public function save() { $db = Loader::db(); foreach (ConversationRatingType::getList() as $crt) { $rtID = $crt->getConversationRatingTypeID(); $rtPoints = $this->post('rtPoints_' . $rtID); if (is_string($rtPoints) && is_numeric($rtPoints)) { $db->Execute('UPDATE ConversationRatingTypes SET cnvRatingTypeCommunityPoints = ? WHERE cnvRatingTypeID = ? LIMIT 1', array($rtPoints, $rtID)); } } $this->redirect('/dashboard/system/conversations/points', 'success'); }
public function save() { if ($this->token->validate('conversation_points')) { $db = Loader::db(); foreach (ConversationRatingType::getList() as $crt) { $rtID = $crt->getConversationRatingTypeID(); $rtPoints = $this->post('rtPoints_' . $rtID); if (is_string($rtPoints) && is_numeric($rtPoints)) { $db->Execute('UPDATE ConversationRatingTypes SET cnvRatingTypeCommunityPoints = ? WHERE cnvRatingTypeID = ? LIMIT 1', array($rtPoints, $rtID)); } } $this->redirect('/dashboard/system/conversations/points', 'success'); } else { $this->error->add(t('Invalid CSRF token. Please refresh and try again.')); $this->view(); } }
public function execute(Batch $batch) { $editors = $batch->getObjectCollection('conversation_editor'); if ($editors) { foreach ($editors->getEditors() as $editor) { if (!$editor->getPublisherValidator()->skipItem()) { $pkg = null; if ($editor->getPackage()) { $pkg = \Package::getByHandle($editor->getPackage()); } $ce = Editor::add($editor->getHandle(), $editor->getName(), $pkg); if ($editor->getIsActive()) { $ce->activate(); } } } } $types = $batch->getObjectCollection('conversation_flag_type'); if ($types) { foreach ($types->getTypes() as $type) { if (!$type->getPublisherValidator()->skipItem()) { $pkg = null; if ($type->getPackage()) { $pkg = \Package::getByHandle($type->getPackage()); } $ce = \Concrete\Core\Conversation\FlagType\FlagType::add($type->getHandle()); } } } $types = $batch->getObjectCollection('conversation_rating_type'); if ($types) { foreach ($types->getTypes() as $type) { if (!$type->getPublisherValidator()->skipItem()) { $pkg = null; if ($type->getPackage()) { $pkg = \Package::getByHandle($type->getPackage()); } \Concrete\Core\Conversation\Rating\Type::add($type->getHandle(), $type->getName(), $type->getPoints(), $pkg); } } } }
public function getConversationMessageRating(Type $ratingType) { $db = Loader::db(); $cnt = $db->GetOne('SELECT count(*) from ConversationMessageRatings where cnvRatingTypeID = ? AND cnvMessageID = ?', array($ratingType->getConversationRatingTypeID(), $this->cnvMessageID)); return $cnt; }
public function skipItem() { $type = Type::getByHandle($this->object->getHandle()); return is_object($type); }
/** * 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; }
<?php defined('C5_EXECUTE') or die("Access Denied."); use Concrete\Core\Conversation\Rating\Type as ConversationRatingType; if (Loader::helper('validation/numbers')->integer($_POST['cnvMessageID']) && $_POST['cnvMessageID'] > 0) { $ratingType = ConversationRatingType::getByHandle($_POST['cnvRatingTypeHandle']); $cnvMessageID = $_POST['cnvMessageID']; $commentRatingUserID = $_POST['commentRatingUserID']; $commentRatingIP = $_POST['commentRatingIP']; $msg = ConversationMessage::getByID($cnvMessageID); $msp = new Permissions($msg); if ($msp->canRateConversationMessage()) { $msg->rateMessage($ratingType, $commentRatingIP, $commentRatingUserID); } }
public function getPackageItems(Package $package) { return Type::getListByPackage($package); }
public function setPropertiesFromArray($arr) { return parent::setPropertiesFromArray($arr); }