Exemplo n.º 1
0
 private function installOrUpgrade($pkg, $fromVersion)
 {
     $at = AttributeType::getByHandle('handle_https');
     if (!is_object($at)) {
         $at = AttributeType::add('handle_https', tc('AttributeTypeName', 'HTTPS handling'), $pkg);
     }
     $akc = AttributeKeyCategory::getByHandle('collection');
     if (is_object($akc)) {
         if (!$akc->hasAttributeKeyTypeAssociated($at)) {
             $akc->associateAttributeKeyType($at);
         }
     }
     if (empty($fromVersion)) {
         $ak = CollectionAttributeKey::getByHandle('handle_https');
         if (!is_object($ak)) {
             $hhh = Loader::helper('https_handling', 'handle_https');
             /* @var $hhh HttpsHandlingHelper */
             $httpDomain = defined('BASE_URL') ? BASE_URL : Config::get('BASE_URL');
             if (!$httpDomain) {
                 $httpDomain = 'http://' . $hhh->getRequestDomain();
             }
             $httpsDomain = defined('BASE_URL_SSL') ? BASE_URL_SSL : Config::get('BASE_URL_SSL');
             if (!$httpsDomain) {
                 $httpsDomain = 'https://' . $hhh->getRequestDomain();
             }
             $ak = CollectionAttributeKey::add($at, array('akHandle' => 'handle_https', 'akName' => tc('AttributeKeyName', 'Page HTTP/HTTPS'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => 1, 'akIsInternal' => 0, 'akEnabled' => 0, 'akDefaultRequirement' => HttpsHandlingHelper::SSLHANDLING_DOESNOT_MATTER, 'akCustomDomains' => 0, 'akHTTPDomain' => $httpDomain, 'akHTTPSDomain' => $httpsDomain), $pkg);
         }
     }
 }
 public function install()
 {
     $pkg = parent::install();
     $pkgh = Package::getByHandle('page_selector_attribute');
     Loader::model('attribute/categories/collection');
     $col = AttributeKeyCategory::getByHandle('collection');
     $pageselector = AttributeType::add('page_selector', t('Page Selector'), $pkgh);
     $col->associateAttributeKeyType(AttributeType::getByHandle('page_selector'));
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  *
  * @see \C5TL\Parser\DynamicItem::parseManual()
  */
 public function parseManual(\Gettext\Translations $translations, $concrete5version)
 {
     if (class_exists('\\AttributeKeyCategory', true) && class_exists('\\AttributeSet', true)) {
         foreach (\AttributeKeyCategory::getList() as $akc) {
             foreach ($akc->getAttributeSets() as $as) {
                 $this->addTranslation($translations, $as->getAttributeSetName(), 'AttributeSetName');
             }
         }
     }
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
	public function getAttributeKeys() {
		$db = Loader::db();
		$r = $db->Execute('select akID from AttributeSetKeys where asID = ? order by displayOrder asc', $this->getAttributeSetID());
		$keys = array();
		$cat = AttributeKeyCategory::getByID($this->akCategoryID);
		while ($row = $r->FetchRow()) {
			$ak = $cat->getAttributeKeyByID($row['akID']);
			if (is_object($ak)) {
				$keys[] = $ak;
			}
		}
		return $keys;		
	}
 public function save_attribute_type_associations()
 {
     $list = AttributeKeyCategory::getList();
     foreach ($list as $cat) {
         $cat->clearAttributeKeyCategoryTypes();
         if (is_array($this->post($cat->getAttributeKeyCategoryHandle()))) {
             foreach ($this->post($cat->getAttributeKeyCategoryHandle()) as $id) {
                 $type = AttributeType::getByID($id);
                 $cat->associateAttributeKeyType($type);
             }
         }
     }
     $this->redirect('dashboard/system/attributes/types', 'saved', 'associations_updated');
 }
Exemplo n.º 7
0
 /**
  * @see \C5TL\Parser\DynamicItem::parseManual()
  */
 public function parseManual(\Gettext\Translations $translations, $concrete5version)
 {
     if (class_exists('\\AttributeKeyCategory', true) && class_exists('\\AttributeKey', true) && class_exists('\\AttributeType', true)) {
         foreach (\AttributeKeyCategory::getList() as $akc) {
             $akcHandle = $akc->getAttributeKeyCategoryHandle();
             foreach (\AttributeKey::getList($akcHandle) as $ak) {
                 if ($ak->getAttributeType()->getAttributeTypeHandle() === 'select') {
                     foreach ($ak->getController()->getOptions() as $option) {
                         $this->addTranslation($translations, $option->getSelectAttributeOptionValue(false), 'SelectAttributeValue');
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 private function installPageLinkAttribute(&$pkg)
 {
     $at = AttributeType::getByHandle('page_selector');
     if ($at && intval($at->getAttributeTypeID())) {
         //Associate with "file" category (if not done alrady)
         Loader::model('attribute/categories/collection');
         $akc = AttributeKeyCategory::getByHandle('file');
         $sql = 'SELECT COUNT(*) FROM AttributeTypeCategories WHERE atID = ? AND akCategoryID = ?';
         $vals = array($at->getAttributeTypeID(), $akc->akCategoryID);
         $existsInCategory = Loader::db()->GetOne($sql, $vals);
         if (!$existsInCategory) {
             $akc->associateAttributeKeyType($at);
         }
         //Install the link-to-page attribute (if not done already)
         Loader::model('file_attributes');
         $akHandle = 'gallery_link_to_cid';
         $akGalleryLinkToCID = FileAttributeKey::getByHandle($akHandle);
         if (!is_object($akGalleryLinkToCID) || !intval($akGalleryLinkToCID->getAttributeKeyID())) {
             $akGalleryLinkToCID = FileAttributeKey::add($at, array('akHandle' => $akHandle, 'akName' => t('Gallery Link To Page')), $pkg);
         }
     }
 }
Exemplo n.º 10
0
 public function on_start()
 {
     $this->set('disableThirdLevelNav', true);
     $this->set('category', AttributeKeyCategory::getByHandle('collection'));
 }
Exemplo n.º 11
0
		public function validateKey($args = false) {
			if ($args == false) {
				$args =  $this->post();
			}
			$val = Loader::helper('validation/form');
			$valt = Loader::helper('validation/token');
			$val->setData($args);
			$val->addRequired("akHandle", t("Handle required."));
			$val->addRequired("akName", t('Name required.'));
			$val->addRequired("atID", t('Type required.'));
			$val->test();
			$error = $val->getError();
		
			if (!$valt->validate('add_or_update_attribute')) {
				$error->add($valt->getErrorMessage());
			}
			
			if(preg_match("/[^A-Za-z0-9\_]/", $args['akHandle'])) {
				$error->add(t('Attribute handles may only contain letters, numbers and underscore "_" characters'));
			}
			
			$akc = AttributeKeyCategory::getByID($args['akCategoryID']);
			if (is_object($akc)) {
				if ($akc->handleExists($args['akHandle'])) {
					if (is_object($this->attributeKey)) {
						$ak2 = $akc->getAttributeKeyByHandle($args['akHandle']);
						if ($ak2->getAttributeKeyID() != $this->attributeKey->getAttributeKeyID()) {
							$error->add(t("An attribute with the handle %s already exists.", $akHandle));
						}
					} else {
						$error->add(t("An attribute with the handle %s already exists.", $akHandle));
					}
				}
			} else {
				$error->add('Invalid attribute category.');
			}
			
			return $error;			
		}
Exemplo n.º 12
0
	protected function importAttributeSets(SimpleXMLElement $sx) {
		if (isset($sx->attributesets)) {
			foreach($sx->attributesets->attributeset as $as) {
				$akc = AttributeKeyCategory::getByHandle($as['category']);
				$pkg = ContentImporter::getPackageObject($as['package']);
				$set = $akc->addSet((string) $as['handle'], (string) $as['name'], $pkg, $as['locked']);
				foreach($as->children() as $ask) {
					$ak = $akc->getAttributeKeyByHandle((string) $ask['handle']);
					if (is_object($ak)) { 	
						$set->addKey($ak);
					}
				}
			}
		}
	}
Exemplo n.º 13
0
	public static function getItemName($item) {
		$txt = Loader::helper('text');
		Loader::model('single_page');
		Loader::model('dashboard/homepage');
		if ($item instanceof BlockType) {
			return $item->getBlockTypeName();
		} else if ($item instanceof PageTheme) {
			return $item->getThemeName();
		} else if ($item instanceof CollectionType) {
			return $item->getCollectionTypeName();
		} else if ($item instanceof MailImporter) {
			return $item->getMailImporterName();		
		} else if ($item instanceof SinglePage) {
			return $item->getCollectionPath();
		} else if ($item instanceof AttributeType) {
			return $item->getAttributeTypeName();
		} else if ($item instanceof AttributeKeyCategory) {
			return $txt->unhandle($item->getAttributeKeyCategoryHandle());
		} else if ($item instanceof AttributeSet) {
			$at = AttributeKeyCategory::getByID($item->getAttributeSetKeyCategoryID());
			return t('%s (%s)', $item->getAttributeSetName(), $txt->unhandle($at->getAttributeKeyCategoryHandle()));
		} else if (is_a($item, 'AttributeKey')) {
			$akc = AttributeKeyCategory::getByID($item->getAttributeKeyCategoryID());
			return t(' %s (%s)', $txt->unhandle($item->getAttributeKeyHandle()), $txt->unhandle($akc->getAttributeKeyCategoryHandle()));
		} else if ($item instanceof ConfigValue) {
			return ucwords(strtolower($txt->unhandle($item->key)));
		} else if ($item instanceof DashboardHomepage) {
			return t('%s (%s)', $item->dbhDisplayName, $txt->unhandle($item->dbhModule));
		} else if (is_a($item, 'TaskPermission')) {
			return $item->getTaskPermissionName();			
		} else if (is_a($item, 'Job')) {
			return $item->getJobName();
		}
	}
Exemplo n.º 14
0
	protected function installCoreAttributeItems() {
		$cakc = AttributeKeyCategory::getByHandle('collection');
		if (is_object($cakc)) {
			return false;
		}
		
		$cakc = AttributeKeyCategory::add('collection');
		$uakc = AttributeKeyCategory::add('user');
		$fakc = AttributeKeyCategory::add('file');
		
		$tt = AttributeType::add('text', t('Text'));
		$textareat = AttributeType::add('textarea', t('Text Area'));
		$boolt = AttributeType::add('boolean', t('Checkbox'));
		$dtt = AttributeType::add('date_time', t('Date/Time'));
		$ift = AttributeType::add('image_file', t('Image/File'));
		$nt = AttributeType::add('number', t('Number'));
		$rt = AttributeType::add('rating', t('Rating'));
		$st = AttributeType::add('select', t('Select'));
		$addresst = AttributeType::add('address', t('Address'));
		
		// assign collection attributes
		$cakc->associateAttributeKeyType($tt);
		$cakc->associateAttributeKeyType($textareat);
		$cakc->associateAttributeKeyType($boolt);
		$cakc->associateAttributeKeyType($dtt);
		$cakc->associateAttributeKeyType($ift);
		$cakc->associateAttributeKeyType($nt);
		$cakc->associateAttributeKeyType($rt);
		$cakc->associateAttributeKeyType($st);
		
		// assign user attributes
		$uakc->associateAttributeKeyType($tt);
		$uakc->associateAttributeKeyType($textareat);
		$uakc->associateAttributeKeyType($boolt);
		$uakc->associateAttributeKeyType($dtt);
		$uakc->associateAttributeKeyType($nt);
		$uakc->associateAttributeKeyType($st);
		$uakc->associateAttributeKeyType($addresst);
		
		// assign file attributes
		$fakc->associateAttributeKeyType($tt);
		$fakc->associateAttributeKeyType($textareat);
		$fakc->associateAttributeKeyType($boolt);
		$fakc->associateAttributeKeyType($dtt);
		$fakc->associateAttributeKeyType($nt);
		$fakc->associateAttributeKeyType($rt);
		$fakc->associateAttributeKeyType($st);
	}
Exemplo n.º 15
0
</h3>
	
		<form class="" method="post" action="<?php 
    echo $this->action('update_set_attributes');
    ?>
">
			<input type="hidden" name="asID" value="<?php 
    echo $set->getAttributeSetID();
    ?>
" />
			<?php 
    echo Loader::helper('validation/token')->output('update_set_attributes');
    ?>
	
			<?php 
    $cat = AttributeKeyCategory::getByID($set->getAttributeSetKeyCategoryID());
    $list = AttributeKey::getList($cat->getAttributeKeyCategoryHandle());
    $unassigned = $cat->getUnassignedAttributeKeys();
    if (count($list) > 0) {
        ?>
	
				<div class="clearfix">
					<ul class="inputs-list">
	
						<?php 
        foreach ($list as $ak) {
            $disabled = '';
            if (!in_array($ak, $unassigned) && !$ak->inAttributeSet($set)) {
                $disabled = array('disabled' => 'disabled');
            }
            ?>
Exemplo n.º 16
0
<? defined('C5_EXECUTE') or die("Access Denied.");

$types = AttributeType::getList();
$categories = AttributeKeyCategory::getList();
$txt = Loader::helper('text');
$form = Loader::helper('form');
$interface = Loader::helper('concrete/interface');

echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Attribute Type Associations'), false, 'span12 offset2');?>
<form method="post" class="" id="attribute_type_associations_form" action="<?=$this->action('save_attribute_type_associations')?>">
	<table border="0" cellspacing="1" cellpadding="0" border="0" class="zebra-striped">
		<tr>
			<th><?=t('Name')?></th>
			<? foreach($categories as $cat) { ?>
				<th><?=$txt->unhandle($cat->getAttributeKeyCategoryHandle())?></th>
			<? } ?>
		</tr>
		<?php foreach($types as $at) { ?>

			<tr>
				<td><?=$at->getAttributeTypeName()?></td>
				<? foreach($categories as $cat) { ?>
					<td style="width: 1px; text-align: center"><?=$form->checkbox($cat->getAttributeKeyCategoryHandle() . '[]', $at->getAttributeTypeID(), $at->isAssociatedWithCategory($cat))?></td>
				<? } ?>
			</tr>

		<? } ?>

	</table>
	<div class="well clearfix">
	<?
Exemplo n.º 17
0
 /** 
  * Updates an attribute key. 
  */
 public function update($args)
 {
     $prevHandle = $this->getAttributeKeyHandle();
     extract($args);
     if (!$akIsSearchable) {
         $akIsSearchable = 0;
     }
     if (!$akIsSearchableIndexed) {
         $akIsSearchableIndexed = 0;
     }
     $db = Loader::db();
     $akCategoryHandle = $db->GetOne("select akCategoryHandle from AttributeKeyCategories inner join AttributeKeys on AttributeKeys.akCategoryID = AttributeKeyCategories.akCategoryID where akID = ?", $this->getAttributeKeyID());
     $a = array($akHandle, $akName, $akIsSearchable, $akIsSearchableIndexed, $this->getAttributeKeyID());
     $r = $db->query("update AttributeKeys set akHandle = ?, akName = ?, akIsSearchable = ?, akIsSearchableIndexed = ? where akID = ?", $a);
     $category = AttributeKeyCategory::getByID($this->akCategoryID);
     switch ($category->allowAttributeSets()) {
         case AttributeKeyCategory::ASET_ALLOW_SINGLE:
             if ($asID > 0) {
                 $as = AttributeSet::getByID($asID);
                 if (!$this->inAttributeSet($as) && is_object($as)) {
                     $this->clearAttributeSets();
                     $this->setAttributeSet($as);
                 }
             } else {
                 // clear set
                 $this->clearAttributeSets();
             }
             break;
     }
     if ($r) {
         $txt = Loader::helper('text');
         $className = $txt->camelcase($akCategoryHandle) . 'AttributeKey';
         $ak = new $className();
         $ak->load($this->getAttributeKeyID());
         $at = $ak->getAttributeType();
         $cnt = $at->getController();
         $cnt->setAttributeKey($ak);
         $cnt->saveKey($args);
         $ak->updateSearchIndex($prevHandle);
         return $ak;
     }
 }
defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('user_attributes');
$form = Loader::helper('form');
$tp = new TaskPermission();
if (!$tp->canAccessUserSearch()) {
    die(t("Access Denied."));
}
$selectedAKIDs = array();
$slist = UserAttributeKey::getColumnHeaderList();
foreach ($slist as $sk) {
    $selectedAKIDs[] = $sk->getAttributeKeyID();
}
if ($_POST['task'] == 'update_columns') {
    Loader::model('attribute/category');
    $sc = AttributeKeyCategory::getByHandle('user');
    $sc->clearAttributeKeyCategoryColumnHeaders();
    if (is_array($_POST['akID'])) {
        foreach ($_POST['akID'] as $akID) {
            $ak = UserAttributeKey::getByID($akID);
            $ak->setAttributeKeyColumnHeader(1);
        }
    }
    exit;
}
$list = UserAttributeKey::getList();
?>

<form method="post" id="ccm-user-customize-search-columns-form" action="<?php 
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
Exemplo n.º 19
0
 private function installUserAttributes($pkg)
 {
     $uakc = AttributeKeyCategory::getByHandle('user');
     // Multiple means an attribute can be in more than one set, but you
     // can't choose what set they show up in for the gui
     // $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_MULTIPLE);
     // $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_NONE);
     $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
     $bua = $uakc->addSet('c5_boilerplate_user_attributes', t('Boilerplate User Attributes'), $pkg);
     //add boolean attributes
     $bp_boolean = UserAttributeKey::getByHandle('bp_boolean');
     if (!$bp_boolean instanceof UserAttributeKey) {
         $bp_boolean = UserAttributeKey::add('boolean', array('akHandle' => 'bp_boolean', 'akName' => t('Boolean Name'), 'akIsSearchable' => true, 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($bua);
     }
     //add text attributes
     $bp_text = UserAttributeKey::getByHandle('bp_text');
     if (!$bp_text instanceof UserAttributeKey) {
         $bp_text = UserAttributeKey::add('text', array('akHandle' => 'bp_text', 'akName' => t('Text Name'), 'akIsSearchable' => true, 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($bua);
     }
 }
Exemplo n.º 20
0
 public function on_start()
 {
     $this->set('category', AttributeKeyCategory::getByHandle('user'));
 }
Exemplo n.º 21
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$canRead = false;
$ch = Page::getByPath('/dashboard/settings/attributes/sets');
$cp = new Permissions($ch);
if ($cp->canViewPage()) {
    $canRead = true;
}
if (!$canRead) {
    die(t("Access Denied."));
}
$db = Loader::db();
$akc = AttributeKeyCategory::getByID($_POST['categoryID']);
$uats = $_REQUEST['asID'];
if (is_array($uats)) {
    $akc->updateAttributeSetDisplayOrder($uats);
}
Exemplo n.º 22
0
	<h6><?php 
echo t("All Attributes");
?>
</h6>
	<div class="ccm-block-type-search-wrapper ">

		<div class="ccm-block-type-search">
		<?php 
echo $form->text('ccmSearchAttributeListField', array('tabindex' => 1, 'autocomplete' => 'off', 'style' => 'width: 155px'));
?>
		</div>
		
	</div>
	
	<?
	$category = AttributeKeyCategory::getByHandle('collection');
	$sets = $category->getAttributeSets();
	?>

	<ul id="ccm-page-attribute-list" class="item-select-list">
	<? foreach($sets as $as) { ?>
		<li class="item-select-list-header ccm-attribute-available"><span><?php 
echo $as->getAttributeSetName();
?>
</span></li>
		<? 
		$setattribs = $as->getAttributeKeys();
		foreach($setattribs as $ak) { 
			if (!in_array($ak->getAttributeKeyID(), $allowedAKIDs)) {
				continue;
			}
Exemplo n.º 23
0
 public function update_set_attributes()
 {
     if ($this->token->validate('update_set_attributes')) {
         $as = AttributeSet::getByID($this->post('asID'));
         if (!is_object($as)) {
             $this->error->add(t('Invalid attribute set.'));
         }
         if (!$this->error->has()) {
             // go through and add all the attributes that aren't in another set
             $as->clearAttributeKeys();
             $cat = AttributeKeyCategory::getByID($as->getAttributeSetKeyCategoryID());
             $unassigned = $cat->getUnassignedAttributeKeys();
             if (is_array($this->post('akID'))) {
                 foreach ($unassigned as $ak) {
                     if (in_array($ak->getAttributeKeyID(), $this->post('akID'))) {
                         $as->addKey($ak);
                     }
                 }
             }
             $this->redirect('dashboard/system/attributes/sets', 'category', $cat->getAttributeKeyCategoryID(), 'set_updated');
         }
     } else {
         $this->error->add($this->token->getErrorMessage());
     }
     $this->edit($this->post('asID'));
 }
Exemplo n.º 24
0
 public static function getItemName($item)
 {
     $txt = Loader::helper('text');
     Loader::model('single_page');
     if ($item instanceof BlockType) {
         return t($item->getBlockTypeName());
     } else {
         if ($item instanceof PageTheme) {
             return $item->getThemeDisplayName();
         } else {
             if ($item instanceof CollectionType) {
                 return $item->getCollectionTypeName();
             } else {
                 if ($item instanceof MailImporter) {
                     return $item->getMailImporterName();
                 } else {
                     if ($item instanceof SinglePage) {
                         return $item->getCollectionPath();
                     } else {
                         if ($item instanceof AttributeType) {
                             return $item->getAttributeTypeDisplayName();
                         } else {
                             if ($item instanceof PermissionAccessEntityType) {
                                 return $item->getAccessEntityTypeDisplayName();
                             } else {
                                 if ($item instanceof PermissionKeyCategory) {
                                     return $txt->unhandle($item->getPermissionKeyCategoryHandle());
                                 } else {
                                     if ($item instanceof AttributeKeyCategory) {
                                         return $txt->unhandle($item->getAttributeKeyCategoryHandle());
                                     } else {
                                         if ($item instanceof AttributeSet) {
                                             $at = AttributeKeyCategory::getByID($item->getAttributeSetKeyCategoryID());
                                             return t('%s (%s)', $item->getAttributeSetDisplayName(), $txt->unhandle($at->getAttributeKeyCategoryHandle()));
                                         } else {
                                             if ($item instanceof GroupSet) {
                                                 return $item->getGroupSetDisplayName();
                                             } else {
                                                 if (is_a($item, 'AttributeKey')) {
                                                     $akc = AttributeKeyCategory::getByID($item->getAttributeKeyCategoryID());
                                                     return t(' %s (%s)', $txt->unhandle($item->getAttributeKeyHandle()), $txt->unhandle($akc->getAttributeKeyCategoryHandle()));
                                                 } else {
                                                     if ($item instanceof ConfigValue) {
                                                         return ucwords(strtolower($txt->unhandle($item->key)));
                                                     } else {
                                                         if ($item instanceof SystemAntispamLibrary) {
                                                             return $item->getSystemAntispamLibraryName();
                                                         } else {
                                                             if (is_a($item, 'PermissionKey')) {
                                                                 return $item->getPermissionKeyDisplayName();
                                                             } else {
                                                                 if (is_a($item, 'Job')) {
                                                                     return $item->getJobName();
                                                                 } else {
                                                                     if (is_a($item, 'WorkflowType')) {
                                                                         return $item->getWorkflowTypeName();
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 25
0
	public static function add($akCategoryHandle, $akCategoryAllowSets = AttributeKeyCategory::ASET_ALLOW_NONE, $pkg = false) {
		$db = Loader::db();
		if (is_object($pkg)) {
			$pkgID = $pkg->getPackageID();
		}
		$db->Execute('insert into AttributeKeyCategories (akCategoryHandle, akCategoryAllowSets, pkgID) values (?, ?, ?)', array($akCategoryHandle, $akCategoryAllowSets, $pkgID));
		$id = $db->Insert_ID();
		
		if ($pkgID > 0) {
			Loader::model('attribute/categories/' . $akCategoryHandle, $pkg->getPackageHandle());
		} else {
			Loader::model('attribute/categories/' . $akCategoryHandle);
		}		
		$txt = Loader::helper("text");
		$class = $txt->camelcase($akCategoryHandle) . 'AttributeKey';
		$obj = new $class;
		$obj->createIndexedSearchTable();
		
		return AttributeKeyCategory::getByID($id);
	}