本文整理汇总了PHP中CollectionType::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CollectionType::getByID方法的具体用法?PHP CollectionType::getByID怎么用?PHP CollectionType::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CollectionType
的用法示例。
在下文中一共展示了CollectionType::getByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$this->verify($this->post('ctID'));
if ($this->post('ctIncludeInComposer')) {
switch ($this->post('ctComposerPublishPageMethod')) {
case 'PARENT':
$page = Page::getByID($this->post('ctComposerPublishPageParentID'));
if ($page->isError()) {
$this->error->add(t('Parent page not selected'));
} else {
$this->ct->saveComposerPublishTargetPage($page);
}
break;
case 'PAGE_TYPE':
$ct = CollectionType::getByID($this->post('ctComposerPublishPageTypeID'));
$this->ct->saveComposerPublishTargetPageType($ct);
break;
default:
$this->ct->saveComposerPublishTargetAll();
break;
}
if (!$this->error->has()) {
$this->ct->saveComposerAttributeKeys($this->post('composerAKID'));
$this->redirect('/dashboard/pages/types/composer', 'view', $this->ct->getCollectionTypeID(), 'updated');
} else {
$this->view($this->ct->getCollectionTypeID());
}
} else {
$this->ct->resetComposerData();
$this->redirect("/dashboard/pages/types", "clear_composer");
}
}
示例2: createPage
public function createPage()
{
Loader::model('page');
$parent = Page::getByID($this->location);
$ct = CollectionType::getByID($this->ctID);
$data = array('cName' => $this->post->title, 'cHandle' => $this->post->page_title, 'cDescription' => $this->post->description, 'cDatePublic' => $this->post->pubDate);
$p = $parent->add($ct, $data);
return $p;
}
示例3: isValidComposerPage
/**
* Checks to see if the page in question is a valid composer draft for the logged in user
*/
protected static function isValidComposerPage($entry) {
$ct = CollectionType::getByID($entry->getCollectionTypeID());
if (!$ct->isCollectionTypeIncludedInComposer()) {
return false;
}
$cp = new Permissions($entry);
if (!$cp->canEditPageContents()) {
return false;
}
return true;
}
示例4: delete
public function delete($ctID, $token = '') {
$db = Loader::db();
$valt = Loader::helper('validation/token');
if (!$valt->validate('delete_page_type', $token)) {
$this->set('message', $valt->getErrorMessage());
} else {
// check to make sure we
$pageCount = $db->getOne("SELECT COUNT(*) FROM Pages WHERE cIsTemplate = 0 and ctID = ?",array($ctID));
if($pageCount == 0) {
$ct = CollectionType::getByID($ctID);
$ct->delete();
$this->redirect("/dashboard/pages/types");
} else {
$this->set("error", array(t("You must delete all pages of this type before deleting this page type.")));
}
}
}
示例5: show
/**
* Gets a list of all pages of the collection type
* specified by $ctID
*
* @param int $ctID ID of collection type
*/
public function show($ctID)
{
$hh = Loader::helper('html');
$th = Loader::helper('text');
$emptyList = false;
$this->view(false);
Loader::model('page_list');
$pl = new PageList();
$pl->filterByCollectionTypeID($ctID);
if (array_key_exists('cvName', $_REQUEST)) {
$cvName = $th->sanitize($_REQUEST['cvName']);
$this->set('cvName', $cvName);
$pl->filterByName($cvName);
if (count($pl->getPage()) <= 0) {
$pl = new PageList();
$emptyList = true;
}
}
if (!$emptyList) {
$pl->addtoQuery('left join Pages parent ON(p1.cParentID = parent.cID)');
$pl->sortByMultiple('parent.cDisplayOrder asc', 'p1.cDisplayOrder asc');
$pages = $pl->getPage();
} else {
$pages = '';
$this->set('emptyList', t('No entries found'));
}
$ct = CollectionType::getByID($ctID);
// add all necessary header items like JavaScript and CSS files
if (!array_key_exists('cvName', $_REQUEST) || $cvName == '') {
$this->addHeaderItem($hh->css('composer.sort.css', 'remo_composer_list'));
$this->addHeaderItem($hh->javascript('composer.sort.js', 'remo_composer_list'));
}
$this->addHeaderItem($hh->javascript('composer.overview.js', 'remo_composer_list'));
// add variables used by view
$this->set('customColumns', $this->loadCustomColumns($ctID));
$this->set('ctID', $ctID);
$this->set('ctPublishMethod', $ct->getCollectionTypeComposerPublishMethod());
$this->set('pages', $pages);
$this->set('displaySearchBox', $this->displaySearchBox());
$this->set('composerListTitel', $ct->getCollectionTypeName());
$this->set('pagesPagination', $pl->displayPaging(false, true));
}
示例6: update
public function update()
{
$valt = Loader::helper('validation/token');
$ct = CollectionType::getByID($_REQUEST['ctID']);
$ctName = $_POST['ctName'];
$ctHandle = $_POST['ctHandle'];
$vs = Loader::helper('validation/strings');
if (!$ctHandle) {
$this->error->add(t("Handle required."));
} else {
if (!$vs->handle($ctHandle)) {
$this->error->add(t('Handles must contain only letters, numbers or the underscore symbol.'));
}
}
if (!$ctName) {
$this->error->add(t("Name required."));
} else {
if (preg_match('/[<>;{}?"`]/i', $ctName)) {
$this->error->add(t('Invalid characters in page type name.'));
}
}
if (!$valt->validate('update_page_type')) {
$this->error->add($valt->getErrorMessage());
}
if (!$this->error->has()) {
try {
if (is_object($ct)) {
$ct->update($_POST);
$this->redirect('/dashboard/pages/types', 'page_type_updated');
}
} catch (Exception $e1) {
$this->error->add($e1->getMessage());
}
}
$this->view();
}
示例7: array
} else {
if ($striped == '') {
$striped = 'ccm-list-record-alt';
}
}
$canEditPageProperties = $cpobj->canEditPageProperties();
$canEditPageSpeedSettings = $cpobj->canEditPageSpeedSettings();
$canEditPagePermissions = $cpobj->canEditPagePermissions();
$canEditPageDesign = $cpobj->canEditPageTheme() || $cpobj->canEditPageType();
$canViewPageVersions = $cpobj->canViewPageVersions();
$canDeletePage = $cpobj->canDeletePage();
$canAddSubpages = $cpobj->canAddSubpage();
$canAddExternalLinks = $cpobj->canAddExternalLink();
$permissionArray = array('canEditPageProperties' => $canEditPageProperties, 'canEditPageSpeedSettings' => $canEditPageSpeedSettings, 'canEditPagePermissions' => $canEditPagePermissions, 'canEditPageDesign' => $canEditPageDesign, 'canViewPageVersions' => $canViewPageVersions, 'canDeletePage' => $canDeletePage, 'canAddSubpages' => $canAddSubpages, 'canAddExternalLinks' => $canAddExternalLinks);
$canCompose = false;
$ct = CollectionType::getByID($cobj->getCollectionTypeID());
if (is_object($ct)) {
if ($ct->isCollectionTypeIncludedInComposer()) {
if ($canEditPageProperties && $h->canAccessComposer()) {
$canCompose = 1;
}
}
}
?>
<tr class="ccm-list-record <?php
echo $striped;
?>
"
cName="<?php
echo htmlentities($cobj->getCollectionName(), ENT_QUOTES, APP_CHARSET);
?>
示例8: setBlockComposerProperties
protected function setBlockComposerProperties()
{
$this->bIncludeInComposerIsSet = true;
$db = Loader::db();
if ($this->c != null) {
$ct = CollectionType::getByID($this->c->getCollectionTypeID());
if (is_object($ct)) {
if ($ct->isCollectionTypeIncludedInComposer()) {
if ($this->c->isMasterCollection()) {
$ctID = $this->c->getCollectionTypeID();
$ccbID = $this->bID;
} else {
$tempBID = $this->getBlockID();
while ($tempBID != false && $tempBID != 0) {
$originalBID = $tempBID;
$tempBID = $db->GetOne('select distinct br.originalBID from BlockRelations br inner join CollectionVersionBlocks cvb on cvb.bID = br.bID where br.bID = ? and cvb.cID = ?', array($tempBID, $this->c->getCollectionID()));
}
if ($originalBID && is_object($this->c)) {
$ctID = $this->c->getCollectionTypeID();
$ccbID = $originalBID;
}
}
if ($ctID && $ccbID) {
$cb = $db->GetRow('select bID, ccFilename from ComposerContentLayout where ctID = ? and bID = ?', array($ctID, $ccbID));
if (is_array($cb) && $cb['bID'] == $ccbID) {
$this->bIncludeInComposer = 1;
$this->cbFilename = $cb['ccFilename'];
}
}
}
}
}
}
示例9: validate
protected function validate()
{
$vt = Loader::helper('validation/strings');
$vn = Loader::Helper('validation/numbers');
$dt = Loader::helper("form/date_time");
if (!$vn->integer($this->post('cParentID'))) {
$this->error->add(t('You must choose a parent page for this News entry.'));
}
if (!$vn->integer($this->post('ctID'))) {
$this->error->add(t('You must choose a page type for this News entry.'));
}
if (!$vt->notempty($this->post('newsTitle'))) {
$this->error->add(t('Title is required'));
}
if (!$this->error->has()) {
Loader::model('collection_types');
$ct = CollectionType::getByID($this->post('ctID'));
$parent = Page::getByID($this->post('cParentID'));
$parentPermissions = new Permissions($parent);
if (!$parentPermissions->canAddSubCollection($ct)) {
$this->error->add(t('You do not have permission to add a page of that type to that area of the site.'));
}
}
}
示例10: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$form = Loader::helper('form');
$sh = Loader::helper('concrete/dashboard/sitemap');
if (!$sh->canRead()) {
die(t('Access Denied'));
}
if ($_POST['task'] == 'design_pages') {
$json['error'] = false;
if ($_POST['plID'] > 0) {
$pl = PageTheme::getByID($_POST['plID']);
}
if ($_POST['ctID'] > 0) {
$ct = CollectionType::getByID($_POST['ctID']);
}
if (is_array($_POST['cID'])) {
foreach ($_POST['cID'] as $cID) {
$c = Page::getByID($cID);
$cp = new Permissions($c);
if ($cp->canEditPageTheme($pl)) {
if ($_POST['plID'] > 0) {
$c->setTheme($pl);
}
if ($_POST['ctID'] > 0 && (!$c->isMasterCollection() && !$c->isGeneratedCollection())) {
$parentC = Page::getByID($c->getCollectionParentID());
$parentCP = new Permissions($parentC);
if ($c->getCollectionID() == HOME_CID || $parentCP->canAddSubCollection($ct)) {
$data = array('ctID' => $_POST['ctID']);
$c->update($data);
示例11: add
public static function add($data, $pkg = null)
{
$db = Loader::db();
$pkgID = $pkg == null ? 0 : $pkg->getPackageID();
$ctIcon = FILENAME_COLLECTION_TYPE_DEFAULT_ICON;
if (isset($data['ctIcon'])) {
$ctIcon = $data['ctIcon'];
}
$ctIsInternal = 0;
if (isset($data['ctIsInternal']) && $data['ctIsInternal']) {
$ctIsInternal = 1;
}
$v = array($data['ctHandle'], $data['ctName'], $ctIcon, $ctIsInternal, $pkgID);
$q = "insert into PageTypes (ctHandle, ctName, ctIcon, ctIsInternal, pkgID) values (?, ?, ?, ?, ?)";
$r = $db->prepare($q);
$res = $db->execute($r, $v);
if ($res) {
$ctID = $db->Insert_ID();
// metadata
if (is_array($data['akID'])) {
foreach ($data['akID'] as $ak) {
$v2 = array($ctID, $ak);
$db->query("insert into PageTypeAttributes (ctID, akID) values (?, ?)", $v2);
}
}
// now that we've created the collection type, we create the master collection
$dh = Loader::helper('date');
$cDate = $dh->getSystemDateTime();
$data['ctID'] = $ctID;
$cobj = Collection::add($data);
$cID = $cobj->getCollectionID();
$mcName = $data['cName'] ? $data['cName'] : "MC: {$data['ctName']}";
$mcDescription = $data['cDescription'] ? $data['cDescription'] : "Master Collection For {$data['ctName']}";
$v2 = array($cID, 1, $pkgID);
$q2 = "insert into Pages (cID, cIsTemplate, pkgID) values (?, ?, ?)";
$r2 = $db->prepare($q2);
$res2 = $db->execute($r2, $v2);
if ($res2) {
return CollectionType::getByID($ctID);
}
}
}
示例12: User
$valt = Loader::helper('validation/token');
$valc = Loader::helper('concrete/validation');
$form = Loader::helper('form');
$ctArray = CollectionType::getList();
$args['section'] = 'collection_types';
$u = new User();
Loader::model('file_set');
$pageTypeIconsFS = FileSet::getByName("Page Type Icons");
$cID = Loader::helper('security')->sanitizeInt($_GET['cID']);
if ($cID && $_GET['task'] == 'load_master') {
$u->loadMasterCollectionEdit($cID, 1);
header('Location: ' . BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $cID . '&mode=edit');
exit;
}
if ($_REQUEST['task'] == 'edit') {
$ct = CollectionType::getByID($_REQUEST['ctID']);
if (is_object($ct)) {
$ctName = $ct->getCollectionTypeName();
$ctHandle = $ct->getCollectionTypeHandle();
$ctName = Loader::helper("text")->entities($ctName);
$ctHandle = Loader::helper('text')->entities($ctHandle);
$ctEditMode = true;
}
}
?>
<?php
if ($ctEditMode) {
$ct->populateAvailableAttributeKeys();
$akIDArray = $_POST['akID'];
if (!is_array($akIDArray)) {
示例13: getByID
public static function getByID($bID, $c = null, $a = null)
{
if ($c == null && $a == null) {
$cID = 0;
$arHandle = "";
$cvID = 0;
$b = Cache::get('block', $bID);
} else {
if (is_object($a)) {
$arHandle = $a->getAreaHandle();
} else {
if ($a != null) {
$arHandle = $a;
$a = Area::getOrCreate($c, $a);
}
}
$cID = $c->getCollectionID();
$cvID = $c->getVersionID();
$b = Cache::get('block', $bID . ':' . $cID . ':' . $cvID . ':' . $arHandle);
if ($b instanceof Block) {
return $b;
}
}
if ($b instanceof Block) {
return $b;
}
$db = Loader::db();
$b = new Block();
if ($c == null && $a == null) {
// just grab really specific block stuff
$q = "select bID, bIsActive, BlockTypes.btID, BlockTypes.btHandle, BlockTypes.pkgID, BlockTypes.btName, bName, bDateAdded, bDateModified, bFilename, Blocks.uID from Blocks inner join BlockTypes on (Blocks.btID = BlockTypes.btID) where bID = ?";
$b->isOriginal = 1;
$v = array($bID);
} else {
$b->arHandle = $arHandle;
$b->a = $a;
$b->cID = $cID;
$b->c = $c ? $c : '';
$vo = $c->getVersionObject();
$cvID = $vo->getVersionID();
$v = array($b->arHandle, $cID, $cvID, $bID);
$q = "select CollectionVersionBlocks.isOriginal, BlockTypes.pkgID, CollectionVersionBlocks.cbOverrideAreaPermissions, CollectionVersionBlocks.cbDisplayOrder,\n\t\t\tBlocks.bIsActive, Blocks.bID, Blocks.btID, bName, bDateAdded, bDateModified, bFilename, btHandle, Blocks.uID from CollectionVersionBlocks inner join Blocks on (CollectionVersionBlocks.bID = Blocks.bID)\n\t\t\tinner join BlockTypes on (Blocks.btID = BlockTypes.btID) where CollectionVersionBlocks.arHandle = ? and CollectionVersionBlocks.cID = ? and (CollectionVersionBlocks.cvID = ? or CollectionVersionBlocks.cbIncludeAll=1) and CollectionVersionBlocks.bID = ?";
}
$r = $db->query($q, $v);
$row = $r->fetchRow();
if (is_array($row)) {
$b->setPropertiesFromArray($row);
$b->csrID = $db->GetOne('select csrID from CollectionVersionBlockStyles where cID = ? and cvID = ? and arHandle = ? and bID = ?', array($cID, $cvID, $b->arHandle, $bID));
$r->free();
$bt = BlockType::getByID($b->getBlockTypeID());
$class = $bt->getBlockTypeClass();
if ($class == false) {
// we can't find the class file, so we return
return false;
}
$b->instance = new $class($b);
$b->populateIsGlobal();
if ($c != null) {
$ct = CollectionType::getByID($c->getCollectionTypeID());
if (is_object($ct)) {
if ($ct->isCollectionTypeIncludedInComposer()) {
if ($c->isMasterCollection()) {
$ctID = $c->getCollectionTypeID();
$ccbID = $bID;
} else {
$tempBID = $b->getBlockID();
while ($tempBID != false && $tempBID != 0) {
$originalBID = $tempBID;
$tempBID = $db->GetOne('select distinct br.originalBID from BlockRelations br inner join CollectionVersionBlocks cvb on cvb.bID = br.bID where br.bID = ? and cvb.cID = ?', array($tempBID, $cID));
}
if ($originalBID && is_object($c)) {
$ctID = $c->getCollectionTypeID();
$ccbID = $originalBID;
}
}
if ($ctID && $ccbID) {
$cb = $db->GetRow('select bID, ccFilename from ComposerContentLayout where ctID = ? and bID = ?', array($ctID, $ccbID));
if (is_array($cb) && $cb['bID'] == $ccbID) {
$b->bIncludeInComposer = 1;
$b->cbFilename = $cb['ccFilename'];
}
}
}
}
}
if ($c != null || $a != null) {
$ca = new Cache();
$ca->set('block', $bID . ':' . $cID . ':' . $cvID . ':' . $arHandle, $b);
} else {
$ca = new Cache();
$ca->set('block', $bID, $b);
}
return $b;
}
}
示例14: getNode
function getNode($cItem, $level = 0, $autoOpenNodes = true) {
if (!is_object($cItem)) {
$cID = $cItem;
$c = Page::getByID($cID, 'RECENT');
} else {
$cID = $cItem->getCollectionID();
$c = $cItem;
}
/*
$db = Loader::db();
$v = array($cID);
$q = "select cPointerID from Pages where cID = ?";
$cPointerID = $db->getOne($q, $v);
if ($cPointerID > 0) {
$v = array($cPointerID);
} else {
$cPointerID = 0;
}
//$q = "select Pages.cPendingAction, Pages.cChildren, CollectionVersions.cID, CollectionVersions.cvName, PageTypes.ctIcon, CollectionVersions.cvIsApproved from Pages left join PageTypes on Pages.ctID = PageTypes.ctID inner join CollectionVersions on Pages.cID = CollectionVersions.cID where CollectionVersions.cID = ? order by CollectionVersions.cvDateCreated desc limit 1";
//$r = $db->query($q, $v);
//$row = $r->fetchRow();
*/
$cp = new Permissions($c);
/*
if ($c->isSystemPage() && (!ConcreteDashboardSitemapHelper::showSystemPages())) {
return false;
}
if ((!$cp->canRead()) && ($c->getCollectionPointerExternalLink() == null)) {
return false;
}
*/
$canWrite = ($cp->canWrite()) ? true : false;
$nodeOpen = false;
if (is_array($_SESSION['dsbSitemapNodes'])) {
if (in_array($cID, $_SESSION['dsbSitemapNodes'])) {
$nodeOpen = true;
}
}
$status = '';
if ($c->getPendingAction() || ( $c->getVersionObject() && $c->getVersionObject()->isApproved()) ) {
$status = ucfirst($c->getPendingAction());
}
$cls = ($c->getNumChildren() > 0) ? "folder" : "file";
$leaf = ($c->getNumChildren() > 0) ? false : true;
$numSubpages = ($c->getNumChildren() > 0) ? $c->getNumChildren() : '';
$cvName = ($c->getCollectionName()) ? $c->getCollectionName() : '(No Title)';
$selected = (ConcreteDashboardSitemapHelper::isOneTimeActiveNode($cID)) ? true : false;
$ct = CollectionType::getByID($c->getCollectionTypeID());
$canCompose = false;
if (is_object($ct)) {
if ($ct->isCollectionTypeIncludedInComposer()) {
$h = Loader::helper('concrete/dashboard');
if ($cp->canWrite() && $h->canAccessComposer()) {
$canCompose = true;
}
}
}
$cIcon = $c->getCollectionIcon();
$cAlias = $c->isAlias();
$cPointerID = $c->getCollectionPointerID();
if ($cAlias) {
if ($cPointerID > 0) {
$cIcon = ASSETS_URL_IMAGES . '/icons/alias.png';
$cAlias = 'POINTER';
$cID = $c->getCollectionPointerOriginalID();
} else {
$cIcon = ASSETS_URL_IMAGES . '/icons/alias_external.png';
$cAlias = 'LINK';
}
}
$node = array(
'cvName'=> $cvName,
'cIcon' => $cIcon,
'cAlias' => $cAlias,
'numSubpages'=> $numSubpages,
'status'=> $status,
'canWrite'=>$canWrite,
'canCompose' => $canCompose,
'id'=>$cID,
'selected'=>$selected
);
if ($cID == 1 || ($nodeOpen && $autoOpenNodes)) {
// We open another level
$node['subnodes'] = $this->getSubNodes($cID, $level, false, $autoOpenNodes);
}
//.........这里部分代码省略.........
示例15: defined
<?php defined('C5_EXECUTE') or die("Access Denied.");
$navigation = Loader::helper('navigation');
$th = Loader::helper('text');
$sh = Loader::helper('concrete/dashboard');
if (!$sh->canAccessComposer()) {
die(t('Access Denied'));
}
$entry = ComposerPage::getByID($_REQUEST['cID'], 'RECENT');
if (!is_object($entry)) {
die(t('Access Denied'));
}
$ct = CollectionType::getByID($entry->getCollectionTypeID());
$function = 'ccm_composerSelectParentPage';
if ($_REQUEST['submitOnChoose']) {
$function = 'ccm_composerSelectParentPageAndSubmit';
}
switch($ct->getCollectionTypeComposerPublishMethod()) {
case 'PAGE_TYPE':
Loader::model('page_list');
$pages = array();
$pl = new PageList();
$pl->sortByName();
$pl->filterByCollectionTypeID($ct->getCollectionTypeComposerPublishPageTypeID());
$pages = $pl->get();
?>
<h1><?php echo t("Where do you want to publish this page?")?></h1>