public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->workflows)) {
         foreach ($sx->workflows->workflow as $wf) {
             $pkg = static::getPackageObject($wf['package']);
             $workflow = Workflow::getByName((string) $wf['name']);
             if (!is_object($workflow)) {
                 $type = Type::getByHandle((string) $wf['type']);
                 if (is_object($type)) {
                     Workflow::add($type, (string) $wf['name'], $pkg);
                 }
             }
         }
     }
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->workflowtypes)) {
         foreach ($sx->workflowtypes->workflowtype as $wt) {
             $pkg = static::getPackageObject($wt['package']);
             $name = $wt['name'];
             if (!$name) {
                 $name = \Core::make('helper/text')->unhandle($wt['handle']);
             }
             $type = \Concrete\Core\Workflow\Type::getByHandle((string) $wt['handle']);
             if (!is_object($type)) {
                 $type = \Concrete\Core\Workflow\Type::add($wt['handle'], $name, $pkg);
             }
         }
     }
 }
 public function execute(Batch $batch)
 {
     $types = $batch->getObjectCollection('workflow_type');
     if (!$types) {
         return;
     }
     foreach ($types->getTypes() as $type) {
         if (!$type->getPublisherValidator()->skipItem()) {
             $pkg = null;
             if ($type->getPackage()) {
                 $pkg = \Package::getByHandle($type->getPackage());
             }
             Type::add($type->getHandle(), $type->getName(), $pkg);
         }
     }
 }
Exemple #4
0
 public static function add(Type $wt, $name)
 {
     $db = Loader::db();
     $wfID = $db->getOne('SELECT wfID FROM Workflows WHERE wfName=?', array($name));
     if (!$wfID) {
         $db->Execute('insert into Workflows (wftID, wfName) values (?, ?)', array($wt->getWorkflowTypeID(), $name));
         $wfID = $db->Insert_ID();
     }
     return self::getByID($wfID);
 }
 /**
  * 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 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);
 }
 public function getPackageItems(Package $package)
 {
     return Type::getListByPackage($package);
 }
 public function submit_add()
 {
     if (!Loader::helper('validation/token')->validate('add_workflow')) {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     $wfName = trim($this->post('wfName'));
     if (!$wfName) {
         $this->error->add(t('You must give the workflow a name.'));
     }
     if (!Loader::helper('validation/strings')->alphanum($wfName, true)) {
         $this->error->add(t('Workflow Names must only include alphanumerics and spaces.'));
     }
     $db = Loader::db();
     $wfID = $db->getOne('SELECT wfID FROM Workflows WHERE wfName=?', array($wfName));
     if ($wfID) {
         $this->error->add(t('Workflow with that name already exists.'));
     }
     if (!$this->error->has()) {
         $type = WorkflowType::getByID($this->post('wftID'));
         if (!is_object($type) || !$type instanceof WorkflowType) {
             $this->error->add(t('Invalid Workflow Type.'));
             $this->add();
             return;
         }
         $wf = Workflow::add($type, $wfName);
         $wf->updateDetails($this->post());
         $this->redirect('/dashboard/workflow/workflows/', 'view_detail', $wf->getWorkflowID(), 'workflow_created');
     }
     $this->add();
 }
 public function skipItem()
 {
     $type = \Concrete\Core\Workflow\Type::getByHandle($this->object->getHandle());
     return is_object($type);
 }
 public function submit_add()
 {
     if (!Loader::helper('validation/token')->validate('add_workflow')) {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     $wfName = trim($this->post('wfName'));
     if (!$wfName) {
         $this->error->add(t('You must give the workflow a name.'));
     } elseif (preg_match('/[<>{};?"`]/i', $wfName)) {
         $this->error->add(t('Invalid characters in workflow name.'));
     }
     $db = Loader::db();
     $wfID = $db->getOne('SELECT wfID FROM Workflows WHERE wfName=?', array($wfName));
     if ($wfID) {
         $this->error->add(t('Workflow with that name already exists.'));
     }
     if (!$this->error->has()) {
         $type = WorkflowType::getByID($this->post('wftID'));
         if (!is_object($type) || !$type instanceof WorkflowType) {
             $this->error->add(t('Invalid Workflow Type.'));
             $this->add();
             return;
         }
         $wf = Workflow::add($type, $wfName);
         $wf->updateDetails($this->post());
         $this->redirect('/dashboard/system/permissions/workflows/', 'view_detail', $wf->getWorkflowID(), 'workflow_created');
     }
     $this->add();
 }
Exemple #11
0
 protected function importWorkflowTypes(\SimpleXMLElement $sx)
 {
     if (isset($sx->workflowtypes)) {
         foreach ($sx->workflowtypes->workflowtype as $wt) {
             $pkg = static::getPackageObject($wt['package']);
             $name = $wt['name'];
             if (!$name) {
                 $name = Loader::helper('text')->unhandle($wt['handle']);
             }
             $type = \Concrete\Core\Workflow\Type::add($wt['handle'], $name, $pkg);
         }
     }
 }
Exemple #12
0
 public static function add(Type $wt, $name, \Concrete\Core\Entity\Package $pkg = null)
 {
     $db = Loader::db();
     $wfID = $db->getOne('SELECT wfID FROM Workflows WHERE wfName=?', array($name));
     if (!$wfID) {
         $pkgID = 0;
         if (is_object($pkg)) {
             $pkgID = $pkg->getPackageID();
         }
         $db->Execute('insert into Workflows (wftID, wfName, pkgID) values (?, ?, ?)', array($wt->getWorkflowTypeID(), $name, $pkgID));
         $wfID = $db->Insert_ID();
     }
     return self::getByID($wfID);
 }