Exemple #1
0
<?
defined('C5_EXECUTE') or die("Access Denied.");

Loader::model('collection_types');
$stringHelper=Loader::helper('text');
$tArray = PageTheme::getGlobalList();
$tArray2 = PageTheme::getLocalList();
$tArrayTmp = array_merge($tArray, $tArray2);
$tArray = array();
foreach($tArrayTmp as $pt) {
	if ($cp->canEditPageTheme($pt)) {
		$tArray[] = $pt;
	}
}
$ctArray = CollectionType::getList();

$cp = new Permissions($c);
if ($c->getCollectionID() > 1) {
	$parent = Page::getByID($c->getCollectionParentID());
	$parentCP = new Permissions($parent);
}
if (!$cp->canEditPageType() && !$cp->canEditPageTheme()) {
	die(t('Access Denied'));
}

$cnt = 0;
for ($i = 0; $i < count($ctArray); $i++) {
	$ct = $ctArray[$i];
	if ($c->getCollectionID() == 1 || $parentCP->canAddSubCollection($ct)) { 
		$cnt++;
	}