当前位置: 首页>>代码示例>>PHP>>正文


PHP UserAttributeKey::add方法代码示例

本文整理汇总了PHP中UserAttributeKey::add方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAttributeKey::add方法的具体用法?PHP UserAttributeKey::add怎么用?PHP UserAttributeKey::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserAttributeKey的用法示例。


在下文中一共展示了UserAttributeKey::add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_user_attribute_key

 public function add_user_attribute_key($handle, $name, $type = 'text')
 {
     $ak = UserAttributeKey::getByHandle($handle);
     if (!is_object($ak)) {
         UserAttributeKey::add($type, array('akHandle' => $handle, 'akName' => t($name)), $pkg);
     }
 }
开发者ID:remo,项目名称:social,代码行数:7,代码来源:controller.php

示例2: install

 public function install()
 {
     Loader::library('mootools/attribute', FRONTEND_DEVELOPER_PACKAGE_HANDLE);
     $pkg = parent::install();
     Loader::model('single_page');
     Loader::model('attribute/categories/user');
     Loader::model('attribute/categories/file');
     $singlePages = array("/dashboard/mootools" => array('cName' => t('Mootools Plugin Developer'), 'cDescription' => t('Management of mootools plugin')), "/dashboard/mootools/plugin" => array('cName' => t('plugin'), 'cDescription' => t('Management of Mootools Plugin that does import')), "/dashboard/mootools/importer" => array('cName' => t('import'), 'cDescription' => t('Import from repository')));
     foreach ($singlePages as $key => $page) {
         $collection = SinglePage::add($key, $pkg);
         if (!empty($collection)) {
             $collection->update($page);
         }
     }
     //The name of the user of github is added to the attribute.
     $values = array("akHandle" => MOOTOOLS_GITHUB_USER, "akName" => t("Name of user of github"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true);
     $key = UserAttributeKey::add("text", $values, $pkg);
     $fileAttributes = array(array("type" => "boolean", "values" => array("akHandle" => MOOTOOLS_PLUGIN, "akName" => t("This file is a plugin of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_COMPONENT_NAME, "akName" => t("Component name of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_LICENSE, "akName" => t("License of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_AUTHORS, "akName" => t("Authors of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "select", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DEPENDENCES, "akName" => t("Dependence of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "number", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DISPLAY_ORDER, "akName" => t("The order of display of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)));
     $attributesKeys = array();
     foreach ($fileAttributes as $key => $attr) {
         $type = $attr["type"];
         $values = $attr["values"];
         $handle = $values["akHandle"];
         $attributesKeys[$handle] = FileAttributeKey::add($type, $values, $pkg);
     }
     if (!empty($attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES])) {
         $key = $attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES];
         $db = Loader::db();
         $db->Replace('atSelectSettings', array('akID' => $key->getAttributeKeyID(), 'akSelectAllowMultipleValues' => true), array('akID'), true);
     }
     BlockType::installBlockTypeFromPackage("mootools_plugin_build_form", $pkg);
     BlockType::installBlockTypeFromPackage("github_tags", $pkg);
     BlockType::installBlockTypeFromPackage("github_issues", $pkg);
     BlockType::installBlockTypeFromPackage("github_repository", $pkg);
     PageTheme::add('small_project', $pkg);
 }
开发者ID:holyshared,项目名称:developer-package,代码行数:36,代码来源:controller.php

示例3: add

 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');
     }
 }
开发者ID:nveid,项目名称:concrete5,代码行数:14,代码来源:attributes.php

示例4: 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);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:10,代码来源:user.php

示例5: installUserAttributes

 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);
     }
 }
开发者ID:janzenz,项目名称:c5_boilerplate,代码行数:20,代码来源:controller.php

示例6: upgradeUserAttributes

	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;
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:65,代码来源:version_532.php

示例7: add

	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'));
			$args = array(
				'akHandle' => $this->post('akHandle'),
				'akName' => $this->post('akName'),
				'akIsSearchable' => $this->post('akIsSearchable'),
				'akIsSearchableIndexed' => $this->post('akIsSearchableIndexed'),
				'uakProfileDisplay' => $this->post('uakProfileDisplay'),
				'uakMemberListDisplay' => $this->post('uakMemberListDisplay'),
				'uakProfileEdit' => $this->post('uakProfileEdit'),
				'uakProfileEditRequired' => $this->post('uakProfileEditRequired'),
				'uakRegisterEdit' => $this->post('uakRegisterEdit'),
				'uakRegisterEditRequired' => $this->post('uakRegisterEditRequired'),				
				'akIsAutoCreated' => 0,
				'akIsEditable' => 1
			);
			$ak = UserAttributeKey::add($type, $this->post());
			$this->redirect('/dashboard/users/attributes/', 'attribute_created');
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:27,代码来源:attributes.php


注:本文中的UserAttributeKey::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。