示例#1
0
 /**
  * Views the composer edit page.
  * @param string|int $ctID The collection type
  * @param string|int $cPublishParentID The parent page under which to publish
  */
 public function view($ctID = false, $cPublishParentID = false)
 {
     // Load Page objects from their IDs
     $ct = $this->setCollectionType($ctID);
     $cPublishParent = Page::getByID($cPublishParent);
     // If we couldn't load a collection type, send them to the composer menu
     if (!is_object($ct)) {
         $ctArray = CollectionType::getComposerPageTypes();
         // If there's only one collection type, just choose that one
         if (count($ctArray) === 1) {
             $ct = $ctArray[0];
             $this->redirect('/dashboard/composer/write', $ct->getCollectionTypeID());
             exit;
         }
         // Otherwise, they need to choose the CT from this array of types
         $this->set('ctArray', $ctArray);
     } else {
         // CT was set, so create a draft of this type
         $entry = ComposerPage::createDraft($ct);
         if (is_object($entry)) {
             // Check if we have a parent specified to create this draft under
             if ($cPublishParentID && is_object($cPublishParent)) {
                 // Make this draft under the specified parent
                 $entry->setComposerDraftPublishParentID($cPublishParentID);
             }
             // New draft is created, so start editing it
             $this->redirect('/dashboard/composer/write', 'edit', $entry->getCollectionID());
         } else {
             // Something failed when trying to create a draft, so send back to drafts folder
             $this->redirect('/dashboard/composer/drafts');
         }
     }
 }
示例#2
0
 public function view()
 {
     parent::view();
     $bg = $this->city->fullbg;
     if ($bg) {
         $this->bodyData['bg'] = $bg->getURL();
     }
     $this->bodyData['classes'][] = 'city-page';
     $this->bodyData['pageViewName'] = 'CityPageView';
     $this->set('bodyData', $this->bodyData);
     $this->set('pageType', 'city-page');
     $this->set('isCityOrganizer', (new User())->getUserID() === $this->city->cityOrganizer->getUserID());
     $this->set('isLoggedIn', (bool) Loader::helper('concrete/dashboard')->canRead());
     $this->set('isCampaignActive', false);
     // Is the donations campaign running?
     $this->set('canEdit', is_object(ComposerPage::getByID($this->c->getCollectionID())));
     $this->set('city', $this->city);
     // Make JSON available
     $this->addToJanesWalk(['city' => $this->city]);
     // Are there blog entries for this city?
     $blog = new PageList();
     $blog->filterByCollectionTypeHandle('city_blog');
     $blog->filterByParentID($this->c->getCollectionID());
     $this->set('blog', $blog->get(1)[0]);
 }
示例#3
0
	public function view() {
		Loader::model("composer_page");
		$drafts = ComposerPage::getMyDrafts();
		if (count($drafts) > 0) {
			$this->redirect('/dashboard/composer/drafts');
		} else {
			$this->redirect('/dashboard/composer/write');
		}
	}
示例#4
0
 public function view()
 {
     parent::view();
     $dh = Loader::helper('concrete/dashboard');
     $im = Loader::helper('image');
     $c = Page::getCurrentPage();
     $ui = UserInfo::getByID($c->getCollectionUserID());
     if ($imAtt = $c->getAttribute('main_image')) {
         $this->set('headImage', $im->getThumbnail($imAtt, 800, 800));
     }
     $this->set('isLoggedIn', $dh->canRead());
     $this->set('canEdit', is_object(ComposerPage::getByID($c->getCollectionID())));
     $this->set('authorName', ($first_name = $ui->getAttribute('first_name')) ? "{$first_name} {$ui->getAttribute('last_name')}" : $ui->getUserObject()->getUserName());
     $this->set('publishDate', $c->getCollectionDatePublic(DATE_APP_GENERIC_MDY_FULL));
     $this->set('pageType', 'blog');
 }
示例#5
0
 public function on_start()
 {
     $this->set('disableThirdLevelNav', true);
     $this->set('drafts', ComposerPage::getMyDrafts());
 }
示例#6
0
 public function getMyDrafts()
 {
     $db = Loader::db();
     $u = new User();
     $r = $db->Execute('select ComposerDrafts.cID from ComposerDrafts inner join Pages on ComposerDrafts.cID = Pages.cID inner join Collections on Collections.cID = Pages.cID where uID = ? order by cDateModified desc', array($u->getUserID()));
     $pages = array();
     while ($row = $r->FetchRow()) {
         $entry = ComposerPage::getByID($row['cID']);
         if (is_object($entry)) {
             $pages[] = $entry;
         }
     }
     return $pages;
 }
<?php 
defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('collection_types');
$dh = Loader::helper('date');
$dt = Loader::helper('form/date_time');

if ($cp->canAdminPage()) {
	// if it's composer mode and we have a target, then we hack the permissions collection id
	if (isset($isComposer) && $isComposer) {
		$cd = ComposerPage::getByID($c->getCollectionID());
		if ($cd->isComposerDraft()) {
			if ($cd->getComposerDraftPublishParentID() > 0) {
				if ($cd->getCollectionInheritance() == 'PARENT') {
					$c->cParentID = $cd->getComposerDraftPublishParentID();
					$cpID = $c->getParentPermissionsCollectionID();
					$c->cInheritPermissionsFromCID = $cpID;
				}
			}
		}
	}

	$gl = new GroupList($c);
	$gArray = $gl->getGroupList();
	$ul = new UserInfoList($c);
	$ulArray = $ul->getUserInfoList();
	$ctArray = CollectionType::getList($c);
}
$saveMsg = t('Save permissions first.');
?>
<div class="ccm-pane-controls">
示例#8
0
	public function view($ctID = false) {
		$ct = $this->setCollectionType($ctID);		
		if (!is_object($ct)) {
			$ctArray = CollectionType::getComposerPageTypes();
			if (count($ctArray) == 1) {
				$ct = $ctArray[0];
				$this->redirect('/dashboard/composer/write', $ct->getCollectionTypeID());
				exit;
			}
			$this->set('ctArray', $ctArray);
			//$this->redirect('/dashboard/composer');
		} else {
			// create a new page of this type
			$entry = ComposerPage::createDraft($ct);
			$this->redirect('/dashboard/composer/write', 'edit', $entry->getCollectionID());
		}
	}
示例#9
0
<?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>