예제 #1
0
 public function view($ptID = false, $message = false)
 {
     $this->pagetype = PageType::getByID($ptID);
     if (!$this->pagetype) {
         $this->redirect('/dashboard/pages/types');
     }
     switch ($message) {
         case 'layout_set_added':
             $this->set('success', t('Form layout set added.'));
             break;
         case 'layout_set_deleted':
             $this->set('success', t('Form layout set deleted.'));
             break;
         case 'layout_set_updated':
             $this->set('success', t('Form layout set updated.'));
             break;
     }
     $this->set('pagetype', $this->pagetype);
     $this->set('sets', PageTypeComposerFormLayoutSet::getList($this->pagetype));
 }
예제 #2
0
 public function view($ptID = false, $message = false)
 {
     $this->pagetype = PageType::getByID($ptID);
     if (!$this->pagetype) {
         $this->redirect('/dashboard/pages/types');
     }
     $cmp = new \Permissions($this->pagetype);
     if (!$cmp->canEditPageType()) {
         throw new \Exception(t('You do not have access to edit this page type.'));
     }
     switch ($message) {
         case 'layout_set_added':
             $this->set('success', t('Form layout set added.'));
             break;
         case 'layout_set_deleted':
             $this->set('success', t('Form layout set deleted.'));
             break;
         case 'layout_set_updated':
             $this->set('success', t('Form layout set updated.'));
             break;
     }
     $this->set('pagetype', $this->pagetype);
     $this->set('sets', PageTypeComposerFormLayoutSet::getList($this->pagetype));
 }
예제 #3
0
파일: form.php 프로젝트: ceko/concrete5-1
<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Page\Type\Composer\FormLayoutSet as PageTypeComposerFormLayoutSet;
use Concrete\Core\Page\Type\Composer\FormLayoutSetControl as PageTypeComposerFormLayoutSetControl;
$fieldsets = PageTypeComposerFormLayoutSet::getList($pagetype);
$cmp = new Permissions($pagetype);
// $targetPage comes from renderComposerOutputForm($page, $targetPage); only
// set in dialog page.
$targetParentPageID = 0;
if (is_object($targetPage)) {
    $targetParentPageID = $targetPage->getCollectionID();
}
?>

<div class="ccm-ui">

<div class="alert alert-info" style="display: none" id="ccm-page-type-composer-form-save-status"></div>

    <input type="hidden" name="ptID" value="<?php 
echo $pagetype->getPageTypeID();
?>
" />

<?php 
foreach ($fieldsets as $cfl) {
    ?>
	<fieldset>
		<?php 
    if ($cfl->getPageTypeComposerFormLayoutSetDisplayName()) {
        ?>
예제 #4
0
 public static function getList(PageType $pagetype)
 {
     $sets = PageTypeComposerFormLayoutSet::getList($pagetype);
     $controls = array();
     foreach ($sets as $s) {
         $setControls = PageTypeComposerFormLayoutSetControl::getList($s);
         foreach ($setControls as $sc) {
             $cnt = $sc->getPageTypeComposerControlObject();
             $cnt->setPageTypeComposerFormLayoutSetControlObject($sc);
             $cnt->setPageTypeComposerFormControlRequired($sc->isPageTypeComposerFormLayoutSetControlRequired());
             $controls[] = $cnt;
         }
     }
     return $controls;
 }
예제 #5
0
파일: Type.php 프로젝트: ceko/concrete5-1
 public function rescanFormLayoutSetDisplayOrder()
 {
     $sets = PageTypeComposerFormLayoutSet::getList($this);
     $displayOrder = 0;
     foreach ($sets as $s) {
         $s->updateFormLayoutSetDisplayOrder($displayOrder);
         $displayOrder++;
     }
 }
예제 #6
0
파일: controller.php 프로젝트: baardev/lbtb
 public function upgrade()
 {
     $db = Loader::db();
     $pkg = Package::getByHandle('problog');
     $eaku = AttributeKeyCategory::getByHandle('collection');
     $multiuserpicker = AttributeType::getByHandle('multi_user_picker');
     if (!is_object($multiuserpicker) || !intval($multiuserpicker->getAttributeTypeID())) {
         $multiuserpicker = AttributeType::add('multi_user_picker', tc('AttributeTypeName', 'Multi User Picker'), $pkg);
         $eaku->associateAttributeKeyType($multiuserpicker);
         $users = CollectionAttributeKey::getByHandle('subscription');
         if (!is_object($users)) {
             $users = array('akHandle' => 'subscription', 'akName' => 'Subscribed Members', 'akIsSearchable' => 0, 'akIsSearchableIndexed' => 0, 'akIsAutoCreated' => 1, 'akIsEditable' => 1);
             $users = CollectionAttributeKey::add($multiuserpicker, $users, $pkg);
         }
     }
     $subscribe = AttributeType::getByHandle('subscribe');
     if (!is_object($subscribe) || !intval($subscribe->getAttributeTypeID())) {
         $subscribe = AttributeType::add('subscribe', tc('AttributeTypeName', 'Subscribe'), $pkg);
         $eaku->associateAttributeKeyType($subscribe);
         $evset = AttributeSet::getByHandle('problog');
         $send_subscribe = CollectionAttributeKey::getByHandle('send_subscription');
         if (!is_object($send_subscribe)) {
             CollectionAttributeKey::add($subscribe, array('akHandle' => 'send_subscription', 'akName' => t('Send To Subscribers')), $pkg)->setAttributeSet($evset);
         }
         $page_att_controls = PageTypeComposerControlType::getByHandle('collection_attribute');
         $type = CollectionType::getByHandle('pb_post');
         $lsl = FormLayoutSet::getList($type);
         foreach ($lsl as $ls) {
             if ($ls->ptComposerFormLayoutSetName == 'Post Options') {
                 $options = $ls;
             }
         }
         /* Send to subscribers */
         $control_id = CollectionAttributeKey::getByHandle('send_subscription')->getAttributeKeyID();
         $send_subscribe = $page_att_controls->getPageTypeComposerControlByIdentifier($control_id);
         $send_subscribe->addToPageTypeComposerFormLayoutSet($options);
     }
     $checkn = AttributeType::getByHandle('boolean');
     $cannonpage = CollectionAttributeKey::getByHandle('is_canonical_page');
     if (!is_object($cannonpage)) {
         $evset = AttributeSet::getByHandle('problog');
         CollectionAttributeKey::add($checkn, array('akHandle' => 'is_canonical_page', 'akName' => t('Is Canonical Page'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1), $pkg)->setAttributeSet($evset);
         //loop through all existing canonical pages and add the attribute
         $canPages = new PageList();
         $canPages->filter(false, "(CHAR_LENGTH(cv.cvName) < 5 AND cv.cvName REGEXP '^[0-9]')");
         $canPagesList = $canPages->get();
         foreach ($canPagesList as $cp) {
             $cp->setAttribute('is_canonical_page', 1);
         }
     }
     parent::upgrade();
 }