本文整理汇总了PHP中AttributeType类的典型用法代码示例。如果您正苦于以下问题:PHP AttributeType类的具体用法?PHP AttributeType怎么用?PHP AttributeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AttributeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
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;
}
示例2: installOrUpgrade
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);
}
}
}
示例3: CoreAutoload
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);
}
}
}
}
示例4: getByHandle
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);
}
}
}
示例5: parseManual
/**
* {@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');
}
}
}
示例6: install
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'));
}
示例7: import
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);
}
示例8: run
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);
}
示例9: save_attribute_type_associations
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');
}
示例10: __autoload
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);
}
}
示例11: getByHandle
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);
}
}
}
示例12: exportAll
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);
}
示例13: getSelectOptions
/**
* 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;
}
示例14: run
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();
}
示例15: installPageLinkAttribute
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);
}
}
}