Specific physical attribute of an item.
Inheritance: extends XSDType
Esempio n. 1
0
 public function add($atHandle, $atName, $pkg = null)
 {
     $type = new AttributeType();
     $type->setAttributeTypeName($atName);
     $type->setAttributeTypeHandle($atHandle);
     if ($pkg) {
         $type->setPackage($pkg);
     }
     $this->entityManager->persist($type);
     $this->entityManager->flush();
     return $type;
 }
 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);
         }
     }
 }
Esempio n. 3
0
function CoreAutoload($class)
{
    $txt = Loader::helper('text');
    if ($class == 'DashboardBaseController') {
        Loader::controller('/dashboard/base');
    }
    if (strpos($class, 'BlockController') > 0) {
        $class = substr($class, 0, strpos($class, 'BlockController'));
        $handle = $txt->uncamelcase($class);
        Loader::block($handle);
    } else {
        if (strpos($class, 'Helper') > 0) {
            $class = substr($class, 0, strpos($class, 'Helper'));
            $handle = $txt->uncamelcase($class);
            $handle = preg_replace('/^site_/', '', $handle);
            Loader::helper($handle);
        } else {
            if (strpos($class, 'AttributeType') > 0) {
                $class = substr($class, 0, strpos($class, 'AttributeType'));
                $handle = $txt->uncamelcase($class);
                $at = AttributeType::getByHandle($handle);
            }
        }
    }
}
Esempio n. 4
0
	public static function getByHandle($akHandle) {
		$db = Loader::db();
		$q = "SELECT ak.akID 
			FROM AttributeKeys ak
			INNER JOIN AttributeKeyCategories akc ON ak.akCategoryID = akc.akCategoryID 
			WHERE ak.akHandle = ?
			AND akc.akCategoryHandle = 'file'";
		$akID = $db->GetOne($q, array($akHandle));
		if ($akID > 0) {
			$ak = FileAttributeKey::getByID($akID);
			return $ak;
		} else {
			 // else we check to see if it's listed in the initial registry
			 $ia = FileTypeList::getImporterAttribute($akHandle);
			 if (is_object($ia)) {
			 	// we create this attribute and return it.
			 	$at = AttributeType::getByHandle($ia->akType);
				$args = array(
					'akHandle' => $akHandle,
					'akName' => $ia->akName,
					'akIsSearchable' => 1,
					'akIsAutoCreated' => 1,
					'akIsEditable' => $ia->akIsEditable
				);
			 	return FileAttributeKey::add($at, $args);
			 }
		}	
	}
Esempio n. 5
0
 /**
  * {@inheritdoc}
  *
  * @see \C5TL\Parser\DynamicItem::parseManual()
  */
 public function parseManual(\Gettext\Translations $translations, $concrete5version)
 {
     if (class_exists('\\AttributeType', true)) {
         foreach (\AttributeType::getList() as $at) {
             $this->addTranslation($translations, $at->getAttributeTypeName(), 'AttributeTypeName');
         }
     }
 }
 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'));
 }
 /**
  * {@inheritdoc}
  *
  * @throws \UnexpectedValueException
  */
 public function __construct($code, $databaseType, $formType, array $formOptions = [])
 {
     if (!in_array($databaseType, ['stringIdentifier', 'integerIdentifier'], true)) {
         $m = "Identifier attribute {$code} can only be a stringIdentifier or an integerIdentifier, '{$databaseType}' given";
         throw new \UnexpectedValueException($m);
     }
     parent::__construct($code, $databaseType, $formType, $formOptions);
     $this->isRelation = false;
 }
Esempio n. 8
0
 public static function import(SimpleXMLElement $ak)
 {
     $type = AttributeType::getByHandle($ak['type']);
     $pkg = false;
     if ($ak['package']) {
         $pkg = Package::getByHandle($ak['package']);
     }
     $akn = UserAttributeKey::add($type, array('akHandle' => $ak['handle'], 'akName' => $ak['name'], 'akIsSearchableIndexed' => $ak['indexed'], 'akIsSearchable' => $ak['searchable'], 'uakProfileDisplay' => $ak['profile-displayed'], 'uakProfileEdit' => $ak['profile-editable'], 'uakProfileEditRequired' => $ak['profile-required'], 'uakRegisterEdit' => $ak['register-editable'], 'uakRegisterEditRequired' => $ak['register-required'], 'uakMemberListDisplay' => $ak['member-list-displayed']), $pkg);
     $akn->getController()->importKey($ak);
 }
Esempio n. 9
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);
 }
 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');
 }
Esempio n. 11
0
function __autoload($class) {
	$txt = Loader::helper('text');
	if (strpos($class, 'BlockController') > 0) {
		$class = substr($class, 0, strpos($class, 'BlockController'));
		$handle = $txt->uncamelcase($class);
		Loader::block($handle);
	} else if (strpos($class, 'Helper') > 0) {
		$class = substr($class, 0, strpos($class, 'Helper'));
		$handle = $txt->uncamelcase($class);
		$handle = preg_replace('/^site_/', '', $handle);
		Loader::helper($handle);
	} else if (strpos($class, 'AttributeType') > 0) {
		$class = substr($class, 0, strpos($class, 'AttributeType'));
		$handle = $txt->uncamelcase($class);
		$at = AttributeType::getByHandle($handle);
	}
}
Esempio n. 12
0
 public static function getByHandle($akHandle)
 {
     $db = Loader::db();
     $akID = $db->GetOne('select akID from AttributeKeys where akHandle = ?', array($akHandle));
     if ($akID > 0) {
         $ak = FileAttributeKey::getByID($akID);
         return $ak;
     } else {
         // else we check to see if it's listed in the initial registry
         $ia = FileTypeList::getImporterAttribute($akHandle);
         if (is_object($ia)) {
             // we create this attribute and return it.
             $at = AttributeType::getByHandle($ia->akType);
             $args = array('akHandle' => $akHandle, 'akName' => $ia->akName, 'akIsSearchable' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => $ia->akIsEditable);
             return FileAttributeKey::add($at, $args);
         }
     }
 }
Esempio n. 13
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);
 }
Esempio n. 14
0
 /**
  * Looks up the list of options from the DB
  * This is the only place where themes are 'categorized', which is purely for presentation in the walk create form
  *
  * @param string $type Which type of tag to return (e.g. theme, accessible)
  * @return array
  */
 public static function getSelectOptions($type = 'all')
 {
     $options = array();
     $satc = new SelectAttributeTypeController(AttributeType::getByHandle('select'));
     if ($type === 'all' || $type === 'theme') {
         $satc->setAttributeKey(CollectionAttributeKey::getByHandle('theme'));
         $themeAK = CollectionAttributeKey::getByHandle('theme');
         foreach ($satc->getOptions() as $v) {
             $category = $this->getCategory($v->value);
             $options['theme'][$category][] = ['handle' => $v->value, 'name' => self::getName($v->value)];
         }
     }
     if ($type === 'all' || $type === 'accessibile') {
         $satc->setAttributeKey(CollectionAttributeKey::getByHandle('accessible'));
         foreach ($satc->getOptions() as $v) {
             $options['accessible'][] = ['handle' => $v->value, 'name' => self::getName($v->value)];
         }
     }
     return $options;
 }
Esempio n. 15
0
 public function run()
 {
     $db = Loader::db();
     Cache::disableLocalCache();
     Loader::model('attribute/categories/collection');
     $cak = CollectionAttributeKey::getByHandle('exclude_page_list');
     if (!is_object($cak)) {
         $boolt = AttributeType::getByHandle('boolean');
         $cab4b = CollectionAttributeKey::add($boolt, array('akHandle' => 'exclude_page_list', 'akName' => t('Exclude From Page List'), 'akIsSearchable' => true));
         Loader::model('page_list');
         $pl = new PageList();
         $pl->filterByExcludeNav(1);
         $list = $pl->get();
         foreach ($list as $c) {
             $c->setAttribute('exclude_page_list', 1);
             $c->reindex();
         }
     }
     Cache::enableLocalCache();
 }
Esempio n. 16
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);
         }
     }
 }
 public function install()
 {
     $pkg = parent::install();
     Loader::model('single_page');
     $single_page = SinglePage::add('/dashboard/wordpress_import', $pkg);
     $single_page->update(array('cName' => t('WordPress Import'), 'cDescription' => t('Import WordPress Sites')));
     $import_stuff = SinglePage::add('/dashboard/wordpress_import/import', $pkg);
     $import_stuff->update(array('cName' => t('Import')));
     $import_stuff = SinglePage::add('/dashboard/wordpress_import/file', $pkg);
     $import_stuff->update(array('cName' => t('File')));
     $select = AttributeType::getByHandle('select');
     $wpCategory = CollectionAttributeKey::getByHandle('wordpress_category');
     if (!$wpCategory instanceof CollectionAttributeKey) {
         $wpCategory = CollectionAttributeKey::add($select, array('akSelectAllowMultipleValues' => 1, 'akSelectOptionDisplayOrder' => 'popularity_desc', 'akSelectAllowOtherValues' => 1, 'akHandle' => 'wordpress_category', 'akName' => t('Wordpress Category')), $pkg);
     }
     $tags = CollectionAttributeKey::getByHandle('tags');
     if (!$tags instanceof CollectionAttributeKey) {
         $tags = CollectionAttributeKey::add($select, array('akSelectAllowMultipleValues' => 1, 'akSelectOptionDisplayOrder' => 'popularity_desc', 'akSelectAllowOtherValues' => 1, 'akHandle' => 'tagsy', 'akName' => t('Tags')), $pkg);
     }
     $co = new Config();
     $co->setPackageObject($pkg);
     $co->save("WORDPRESS_IMPORT_FID", 0);
 }
 /** 
  * @private
  */
 public static function autoload($class)
 {
     $classes = self::$autoloadClasses;
     $cl = $classes[$class];
     if ($cl) {
         call_user_func_array(array(__CLASS__, $cl[0]), array($cl[1], $cl[2]));
     } else {
         /* lets handle some things slightly more dynamically */
         $txt = self::helper('text');
         if (strpos($class, 'BlockController') > 0) {
             $class = substr($class, 0, strpos($class, 'BlockController'));
             $handle = $txt->uncamelcase($class);
             self::block($handle);
         } else {
             if (strpos($class, 'AttributeType') > 0) {
                 $class = substr($class, 0, strpos($class, 'AttributeType'));
                 $handle = $txt->uncamelcase($class);
                 $at = AttributeType::getByHandle($handle);
             } else {
                 if (strpos($class, 'Helper') > 0) {
                     $class = substr($class, 0, strpos($class, 'Helper'));
                     $handle = $txt->uncamelcase($class);
                     $handle = preg_replace('/^site_/', '', $handle);
                     self::helper($handle);
                 }
             }
         }
     }
 }
Esempio n. 19
0
 public function add()
 {
     $this->select_type();
     $type = $this->get('type');
     $cnt = $type->getController();
     $e = $cnt->validateKey($this->post());
     if ($e->has()) {
         $this->set('error', $e);
     } else {
         $type = AttributeType::getByID($this->post('atID'));
         $ak = UserAttributeKey::add($type, $this->post());
         $this->redirect('/dashboard/users/attributes/', 'attribute_created');
     }
 }
Esempio n. 20
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">
	<?
Esempio n. 21
0
	public static function add($atHandle, $atName, $pkg = false) {
		$pkgID = 0;
		if (is_object($pkg)) {
			$pkgID = $pkg->getPackageID();
		}
		$db = Loader::db();
		$db->Execute('insert into AttributeTypes (atHandle, atName, pkgID) values (?, ?, ?)', array($atHandle, $atName, $pkgID));
		$id = $db->Insert_ID();
		$est = AttributeType::getByID($id);
		
		$path = $est->getAttributeTypeFilePath(FILENAME_ATTRIBUTE_DB);
		if ($path) {
			Package::installDB($path);
		}
		return $est;
	}
Esempio n. 22
0
	protected function upgradeUserAttributes() {
		$messages = array();
		$db = Loader::db();
		$r = $db->Execute('select _UserAttributeKeys.* from _UserAttributeKeys order by displayOrder asc');
		while ($row = $r->FetchRow()) {
			$cleanHandle = preg_replace("/[^A-Za-z0-9\_]/",'',$row['ukHandle']); // remove spaces, chars that'll mess up our index tables
			$existingAKID = $db->GetOne('select akID from AttributeKeys where akHandle = ?',  array($cleanHandle) );
			if ($existingAKID < 1) {
				if(!$row['ukHandle']) continue; 
				$args = array(
					'akHandle' => $cleanHandle, 
					'akIsSearchable' => 1,
					'akIsEditable' => 1,
					'akName' => $row['ukName'],
					'uakIsActive' => ($row['ukHidden']?0:1),
					'uakProfileEditRequired' => $row['ukRequired'],
					'uakProfileDisplay' => ($row['ukPrivate'] == 0),
					'uakRegisterEdit' => $row['ukDisplayedOnRegister']
				);
				$sttype = $row['ukType'];
				if ($sttype == 'TEXTAREA') {
					$sttype = 'TEXT';
				}
				if ($sttype == 'RADIO') {
					$sttype = 'SELECT';
				}
				$type = AttributeType::getByHandle(strtolower($sttype));
				$ak = UserAttributeKey::add($type, $args);
				if ($sttype == 'SELECT') {
					$selectOptions = explode("\n", $row['ukValues']);
					foreach($selectOptions as $so) {
						if ($so != '') {
							SelectAttributeTypeOption::add($ak, $so);
						}
					}
				}
			} else {
				$ak = UserAttributeKey::getByID($existingAKID);
			}
			
			$r2 = $db->Execute('select * from _UserAttributeValues where ukID = ? and isImported = 0', $row['ukID']);
			while ($row2 = $r2->FetchRow()) {
				$ui = UserInfo::getByID($row2['uID']);
				if(is_object($ui)) {
					$value = $row2['value'];
					$ui->setAttribute($ak, $value);
				}
				unset($ui);
				
				$db->Execute('update _UserAttributeValues set isImported = 1 where ukID = ? and uID = ?', array($row['ukID'], $row2['uID']));
				$this->incrementImported();

			}
			
			unset($ak);
			unset($row2);
			$r2->Close();
			unset($r2);
		}
		
		unset($row);
		$r->Close();
		unset($r);
		return $messages;
	}
Esempio n. 23
0
 public function getAttributeTypeObject()
 {
     $ato = AttributeType::getByID($this->atID);
     return $ato;
 }
<?php

defined('C5_EXECUTE') or die("Access Denied.");
if (isset($_REQUEST['akID'])) {
    $at = AttributeKey::getInstanceByID($_REQUEST['akID']);
} else {
    $at = AttributeType::getByID($_REQUEST['atID']);
}
if (is_object($at)) {
    $cnt = $at->getController();
    if (isset($_REQUEST['args']) && is_array($_REQUEST['args'])) {
        $args = $_REQUEST['args'];
    } else {
        $args = array();
    }
    if (method_exists($cnt, 'action_' . $_REQUEST['action'])) {
        //make sure the controller has the right method
        call_user_func_array(array($cnt, 'action_' . $_REQUEST['action']), $args);
    }
}
Esempio n. 25
0
 protected function setupDashboardIcons()
 {
     $cak = CollectionAttributeKey::getByHandle('icon_dashboard');
     if (!is_object($cak)) {
         $textt = AttributeType::getByHandle('text');
         $cab4b = CollectionAttributeKey::add($textt, array('akHandle' => 'icon_dashboard', 'akName' => t('Dashboard Icon'), 'akIsInternal' => true));
     }
     $iconArray = array('/dashboard/composer/write' => 'icon-pencil', '/dashboard/composer/drafts' => 'icon-book', '/dashboard/sitemap/full' => 'icon-home', '/dashboard/sitemap/explore' => 'icon-road', '/dashboard/sitemap/search' => 'icon-search', '/dashboard/files/search' => 'icon-picture', '/dashboard/files/attributes' => 'icon-cog', '/dashboard/files/sets' => 'icon-list-alt', '/dashboard/files/add_set' => 'icon-plus-sign', '/dashboard/users/search' => 'icon-user', '/dashboard/users/groups' => 'icon-globe', '/dashboard/users/attributes' => 'icon-cog', '/dashboard/users/add' => 'icon-plus-sign', '/dashboard/users/add_group' => 'icon-plus', '/dashboard/users/group_sets' => 'icon-list', '/dashboard/reports/statistics' => 'icon-signal', '/dashboard/reports/forms' => 'icon-briefcase', '/dashboard/reports/surveys' => 'icon-tasks', '/dashboard/reports/logs' => 'icon-time', '/dashboard/pages/themes' => 'icon-font', '/dashboard/pages/types' => 'icon-file', '/dashboard/pages/attributes' => 'icon-cog', '/dashboard/pages/single' => 'icon-wrench', '/dashboard/workflow/list' => 'icon-list', '/dashboard/workflow/me' => 'icon-user', '/dashboard/blocks/stacks' => 'icon-th', '/dashboard/blocks/permissions' => 'icon-lock', '/dashboard/blocks/types' => 'icon-wrench');
     foreach ($iconArray as $path => $icon) {
         $sp = Page::getByPath($path);
         if (is_object($sp) && !$sp->isError()) {
             $sp->setAttribute('icon_dashboard', $icon);
         }
     }
 }
Esempio n. 26
0
 public function edit($akID = 0)
 {
     if ($this->post('akID')) {
         $akID = $this->post('akID');
     }
     $key = CollectionAttributeKey::getByID($akID);
     if (!is_object($key) || $key->isAttributeKeyInternal()) {
         $this->redirect('/dashboard/pages/attributes');
     }
     $type = $key->getAttributeType();
     $this->set('key', $key);
     $this->set('type', $type);
     if ($this->isPost()) {
         $cnt = $type->getController();
         $cnt->setAttributeKey($key);
         $e = $cnt->validateKey($this->post());
         if ($e->has()) {
             $this->set('error', $e);
         } else {
             $type = AttributeType::getByID($this->post('atID'));
             $key->update($this->post());
             $this->redirect('/dashboard/pages/attributes/', 'attribute_updated');
         }
     }
 }
 /**
  * Gets an associative array of AttributeType objects for the specified
  * server. Each array entry's key is the name of the attributeType
  * in lower-case and the value is an AttributeType object.
  *
  * @param int $server_id The ID of the server whose AttributeTypes to fetch
  * @param string $dn (optional) It is easier to fetch schema if a DN is provided
  *             which defines the subschemaSubEntry attribute (all entries should).
  *
  * @return array An array of AttributeType objects.
  */
 function SchemaAttributes($dn = null)
 {
     debug_log('%s::SchemaAttributes(): Entered with (%s)', 25, get_class($this), $dn);
     # Set default return
     $return = null;
     if ($return = get_cached_item($this->server_id, 'schema', 'attributes')) {
         debug_log('%s::SchemaAttributes(): Returning CACHED [%s] (%s)', 25, get_class($this), $this->server_id, 'attributes');
         return $return;
     }
     $raw_attrs = $this->getRawSchema('attributeTypes', $dn);
     if ($raw_attrs) {
         # build the array of attribueTypes
         $syntaxes = $this->SchemaSyntaxes($dn);
         $attrs = array();
         /**
          * bug 856832: create two arrays - one indexed by name (the standard
          * $attrs array above) and one indexed by oid (the new $attrs_oid array
          * below). This will help for directory servers, like IBM's, that use OIDs
          * in their attribute definitions of SUP, etc
          */
         $attrs_oid = array();
         foreach ($raw_attrs as $attr_string) {
             if (is_null($attr_string) || !strlen($attr_string)) {
                 continue;
             }
             $attr = new AttributeType($attr_string);
             if (isset($syntaxes[$attr->getSyntaxOID()])) {
                 $syntax = $syntaxes[$attr->getSyntaxOID()];
                 $attr->setType($syntax->getDescription());
             }
             $attrs[strtolower($attr->getName())] = $attr;
             /**
              * bug 856832: create an entry in the $attrs_oid array too. This
              * will be a ref to the $attrs entry for maintenance and performance
              * reasons
              */
             $attrs_oid[$attr->getOID()] =& $attrs[strtolower($attr->getName())];
         }
         # go back and add data from aliased attributeTypes
         foreach ($attrs as $name => $attr) {
             $aliases = $attr->getAliases();
             if (is_array($aliases) && count($aliases) > 0) {
                 /* foreach of the attribute's aliases, create a new entry in the attrs array
                    with its name set to the alias name, and all other data copied.*/
                 foreach ($aliases as $alias_attr_name) {
                     # clone is a PHP5 function and must be used.
                     if (version_compare(PHP_VERSION, '5.0') > 0) {
                         $new_attr = clone $attr;
                     } else {
                         $new_attr = $attr;
                     }
                     $new_attr->setName($alias_attr_name);
                     $new_attr->addAlias($attr->getName());
                     $new_attr->removeAlias($alias_attr_name);
                     $new_attr_key = strtolower($alias_attr_name);
                     $attrs[$new_attr_key] = $new_attr;
                 }
             }
         }
         # go back and add any inherited descriptions from parent attributes (ie, cn inherits name)
         foreach ($attrs as $key => $attr) {
             $sup_attr_name = $attr->getSupAttribute();
             $sup_attr = null;
             if (trim($sup_attr_name)) {
                 /* This loop really should traverse infinite levels of inheritance (SUP) for attributeTypes,
                    but just in case we get carried away, stop at 100. This shouldn't happen, but for
                    some weird reason, we have had someone report that it has happened. Oh well.*/
                 $i = 0;
                 while ($i++ < 100) {
                     if (isset($attrs_oid[$sup_attr_name])) {
                         $attr->setSupAttribute($attrs_oid[$sup_attr_name]->getName());
                         $sup_attr_name = $attr->getSupAttribute();
                     }
                     if (!isset($attrs[strtolower($sup_attr_name)])) {
                         pla_error(sprintf('Schema error: attributeType "%s" inherits from "%s", but attributeType "%s" does not exist.', $attr->getName(), $sup_attr_name, $sup_attr_name));
                         return;
                     }
                     $sup_attr = $attrs[strtolower($sup_attr_name)];
                     $sup_attr_name = $sup_attr->getSupAttribute();
                     # Does this superior attributeType not have a superior attributeType?
                     if (is_null($sup_attr_name) || strlen(trim($sup_attr_name)) == 0) {
                         /* Since this attribute's superior attribute does not have another superior
                            attribute, clone its properties for this attribute. Then, replace
                            those cloned values with those that can be explicitly set by the child
                            attribute attr). Save those few properties which the child can set here:*/
                         $tmp_name = $attr->getName();
                         $tmp_oid = $attr->getOID();
                         $tmp_sup = $attr->getSupAttribute();
                         $tmp_aliases = $attr->getAliases();
                         $tmp_single_val = $attr->getIsSingleValue();
                         /* clone the SUP attributeType and populate those values
                            that were set by the child attributeType */
                         # clone is a PHP5 function and must be used.
                         if (function_exists('clone')) {
                             $attr = clone $sup_attr;
                         } else {
                             $attr = $sup_attr;
                         }
                         $attr->setOID($tmp_oid);
                         $attr->setName($tmp_name);
                         $attr->setSupAttribute($tmp_sup);
                         $attr->setAliases($tmp_aliases);
                         /* only overwrite the SINGLE-VALUE property if the child explicitly sets it
                            (note: All LDAP attributes default to multi-value if not explicitly set SINGLE-VALUE) */
                         if ($tmp_single_val) {
                             $attr->setIsSingleValue(true);
                         }
                         /* replace this attribute in the attrs array now that we have populated
                         		 new values therein */
                         $attrs[$key] = $attr;
                         # very important: break out after we are done with this attribute
                         $sup_attr_name = null;
                         $sup_attr = null;
                         break;
                     }
                 }
             }
         }
         ksort($attrs);
         # Add the used in and required_by values.
         $schema_object_classes = $this->SchemaObjectClasses();
         if (!is_array($schema_object_classes)) {
             return array();
         }
         foreach ($schema_object_classes as $object_class) {
             $must_attrs = $object_class->getMustAttrNames($schema_object_classes);
             $may_attrs = $object_class->getMayAttrNames($schema_object_classes);
             $oclass_attrs = array_unique(array_merge($must_attrs, $may_attrs));
             # Add Used In.
             foreach ($oclass_attrs as $attr_name) {
                 if (isset($attrs[strtolower($attr_name)])) {
                     $attrs[strtolower($attr_name)]->addUsedInObjectClass($object_class->getName());
                 } else {
                     #echo "Warning, attr not set: $attr_name<br />";
                 }
             }
             # Add Required By.
             foreach ($must_attrs as $attr_name) {
                 if (isset($attrs[strtolower($attr_name)])) {
                     $attrs[strtolower($attr_name)]->addRequiredByObjectClass($object_class->getName());
                 } else {
                     #echo "Warning, attr not set: $attr_name<br />";
                 }
             }
         }
         $return = $attrs;
         # cache the schema to prevent multiple schema fetches from LDAP server
         set_cached_item($this->server_id, 'schema', 'attributes', $return);
     }
     debug_log('%s::SchemaAttributes(): Returning (%s)', 25, get_class($this), $return);
     return $return;
 }
Esempio n. 28
0
	public function install() {
		$at = parent::add($this->atHandle, $this->atName);
	}
Esempio n. 29
0
 /** 
  * Returns an array of package items (e.g. blocks, themes)
  */
 public function getPackageItems()
 {
     $items = array();
     Loader::model('single_page');
     Loader::library('mail/importer');
     Loader::model('job');
     Loader::model('collection_types');
     Loader::model('system/captcha/library');
     Loader::model('system/antispam/library');
     $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this);
     $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this);
     $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this);
     $items['attribute_keys'] = AttributeKey::getListByPackage($this);
     $items['attribute_sets'] = AttributeSet::getListByPackage($this);
     $items['group_sets'] = GroupSet::getListByPackage($this);
     $items['page_types'] = CollectionType::getListByPackage($this);
     $items['mail_importers'] = MailImporter::getListByPackage($this);
     $items['configuration_values'] = Config::getListByPackage($this);
     $items['block_types'] = BlockTypeList::getByPackage($this);
     $items['page_themes'] = PageTheme::getListByPackage($this);
     $items['permissions'] = PermissionKey::getListByPackage($this);
     $items['single_pages'] = SinglePage::getListByPackage($this);
     $items['attribute_types'] = AttributeType::getListByPackage($this);
     $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this);
     $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this);
     $items['jobs'] = Job::getListByPackage($this);
     $items['workflow_types'] = WorkflowType::getListByPackage($this);
     ksort($items);
     return $items;
 }
Esempio n. 30
0
 /** 
  * Renders a view for this attribute key. If no view is default we display it's "view"
  * Valid views are "view", "form" or a custom view (if the attribute has one in its directory)
  * Additionally, an attribute does not have to have its own interface. If it doesn't, then whatever
  * is printed in the corresponding $view function in the attribute's controller is printed out.
  */
 public function render($view = 'view', $value = false, $return = false)
 {
     $at = AttributeType::getByHandle($this->atHandle);
     $resp = $at->render($view, $this, $value, $return);
     if ($return) {
         return $resp;
     }
 }