public static function add(WorkflowType $wt, $name) { $db = Loader::db(); $db->Execute('insert into Workflows (wftID, wfName) values (?, ?)', array($wt->getWorkflowTypeID(), $name)); $wfID = $db->Insert_ID(); return self::getByID($wfID); }
public static function add(WorkflowType $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); }
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/list/', 'view_detail', $wf->getWorkflowID(), 'workflow_created'); } $this->add(); }
public function run() { $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>"); $this->x->addAttribute('version', '1.0'); // First, attribute categories AttributeKeyCategory::exportList($this->x); // attribute types AttributeType::exportList($this->x); // then block types BlockTypeList::exportList($this->x); // now attribute keys (including user) AttributeKey::exportList($this->x); // now attribute keys (including user) AttributeSet::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 Loader::model('job'); 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 page types CollectionType::exportList($this->x); // now stacks/global areas Loader::model('stack/list'); StackList::export($this->x); // now content pages $pages = $this->x->addChild("pages"); $db = Loader::db(); $r = $db->Execute('select Pages.cID from Pages left join ComposerDrafts on Pages.cID = ComposerDrafts.cID where ComposerDrafts.cID is null and cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); $pc->export($pages); } Loader::model("system/captcha/library"); SystemCaptchaLibrary::exportList($this->x); Config::exportList($this->x); }
public function submit_add() { if (!Loader::helper('validation/token')->validate('add_workflow')) { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } if (!$this->post('wfName')) { $this->error->add(t('You must give the workflow a name.')); } if (!$this->error->has()) { $type = WorkflowType::getByID($this->post('wftID')); $wf = Workflow::add($type, $this->post('wfName')); $wf->updateDetails($this->post()); $this->redirect('/dashboard/workflow/list/', 'view_detail', $wf->getWorkflowID(), 'workflow_created'); } $this->add(); }
public function exportAll() { $this->x = $this->getXMLRoot(); // First, attribute categories AttributeKeyCategory::exportList($this->x); // attribute types AttributeType::exportList($this->x); // then block types BlockTypeList::exportList($this->x); // now attribute keys (including user) AttributeKey::exportList($this->x); // now attribute keys (including user) AttributeSet::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 Loader::model('job'); 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 page types CollectionType::exportList($this->x); // now stacks/global areas Loader::model('stack/list'); StackList::export($this->x); $this->exportPages($this->x); Loader::model("system/captcha/library"); SystemCaptchaLibrary::exportList($this->x); Config::exportList($this->x); }
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); Loader::model('single_page'); Loader::library('mail/importer'); Loader::model('job'); Loader::model('collection_types'); Loader::model('system/captcha/library'); Loader::model('system/antispam/library'); $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'] = CollectionType::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['configuration_values'] = Config::getListByPackage($this); $items['block_types'] = BlockTypeList::getByPackage($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['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); $items['workflow_types'] = WorkflowType::getListByPackage($this); ksort($items); return $items; }
protected function installPermissionsAndWorkflow() { $sx = simplexml_load_file(DIR_BASE_CORE . '/config/install/base/permissions.xml'); foreach ($sx->permissioncategories->category as $pkc) { $handle = (string) $pkc['handle']; $pkca = PermissionKeyCategory::getByHandle($handle); if (!is_object($pkca)) { $pkx = PermissionKeyCategory::add((string) $pkc['handle']); } } foreach ($sx->workflowprogresscategories->category as $pkc) { $handle = (string) $pkc['handle']; $pkca = WorkflowProgressCategory::getByHandle($handle); if (!is_object($pkca)) { $pkx = WorkflowProgressCategory::add((string) $pkc['handle']); } } foreach ($sx->workflowtypes->workflowtype as $wt) { $handle = (string) $wt['handle']; $name = (string) $wt['name']; $wtt = WorkflowType::getByHandle($handle); if (!is_object($wtt)) { $pkx = WorkflowType::add($handle, $name); } } if (isset($sx->permissionaccessentitytypes)) { foreach ($sx->permissionaccessentitytypes->permissionaccessentitytype as $pt) { $name = $pt['name']; if (!$name) { $name = Loader::helper('text')->unhandle($pt['handle']); } $handle = (string) $pt['handle']; $patt = PermissionAccessEntityType::getByHandle($handle); if (!is_object($patt)) { $type = PermissionAccessEntityType::add((string) $pt['handle'], $name); if (isset($pt->categories)) { foreach ($pt->categories->children() as $cat) { $catobj = PermissionKeyCategory::getByHandle((string) $cat['handle']); $catobj->associateAccessEntityType($type); } } } } } $txt = Loader::helper('text'); foreach ($sx->permissionkeys->permissionkey as $pk) { $pkc = PermissionKeyCategory::getByHandle((string) $pk['category']); $className = $txt->camelcase($pkc->getPermissionKeyCategoryHandle()); $c1 = $className . 'PermissionKey'; $handle = (string) $pk['handle']; $pka = PermissionKey::getByHandle($handle); if (!is_object($pka)) { $pkx = call_user_func(array($c1, 'import'), $pk); } } }
protected function importWorkflowTypes(SimpleXMLElement $sx) { if (isset($sx->workflowtypes)) { foreach($sx->workflowtypes->workflowtype as $wt) { $pkg = ContentImporter::getPackageObject($wt['package']); $name = $wt['name']; if (!$name) { $name = Loader::helper('text')->unhandle($wt['handle']); } $type = WorkflowType::add($wt['handle'], $name, $pkg); } } }
public static function add($wftHandle, $wftName, $pkg = false) { $pkgID = 0; if (is_object($pkg)) { $pkgID = $pkg->getPackageID(); } $db = Loader::db(); $db->Execute('insert into WorkflowTypes (wftHandle, wftName, pkgID) values (?, ?, ?)', array($wftHandle, $wftName, $pkgID)); $id = $db->Insert_ID(); $est = WorkflowType::getByID($id); return $est; }