本文整理汇总了PHP中UserAttributeKey类的典型用法代码示例。如果您正苦于以下问题:PHP UserAttributeKey类的具体用法?PHP UserAttributeKey怎么用?PHP UserAttributeKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserAttributeKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run() {
Cache::disableCache();
Loader::library('database_indexed_search');
$is = new IndexedSearch();
if ($_GET['force'] == 1) {
Loader::model('attribute/categories/collection');
Loader::model('attribute/categories/file');
Loader::model('attribute/categories/user');
$attributes = CollectionAttributeKey::getList();
$attributes = array_merge($attributes, FileAttributeKey::getList());
$attributes = array_merge($attributes, UserAttributeKey::getList());
foreach($attributes as $ak) {
$ak->updateSearchIndex();
}
$result = $is->reindexAll(true);
} else {
$result = $is->reindexAll();
}
if ($result->count == 0) {
return t('Indexing complete. Index is up to date');
} else {
if ($result->count == $is->searchBatchSize) {
return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count);
} else {
return t('Index updated. %s %s required reindexing.', $result->count, $result->count == 1 ? t('page') : t('pages'));
}
}
}
示例2: run
public function run()
{
Cache::disableAll();
$is = new IndexedSearch();
if ($_GET['force'] == 1) {
$attributes = \CollectionAttributeKey::getList();
$attributes = array_merge($attributes, \FileAttributeKey::getList());
$attributes = array_merge($attributes, \UserAttributeKey::getList());
foreach ($attributes as $ak) {
$ak->updateSearchIndex();
}
$result = $is->reindexAll(true);
} else {
$result = $is->reindexAll();
}
if ($result->count == 0) {
return t('Indexing complete. Index is up to date');
} else {
if ($result->count == $is->searchBatchSize) {
return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count);
} else {
return t('Index updated.') . ' ' . t2('%d page required reindexing.', '%d pages required reindexing.', $result->count, $result->count);
}
}
}
示例3: 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);
}
}
示例4: filterByKeywords
public function filterByKeywords($keywords) {
$db = Loader::db();
$qkeywords = $db->quote('%' . $keywords . '%');
$keys = UserAttributeKey::getSearchableIndexedList();
$emailSearchStr=' OR u.uEmail like '.$qkeywords.' ';
$attribsStr = '';
foreach ($keys as $ak) {
$cnt = $ak->getController();
$attribsStr.=' OR ' . $cnt->searchKeywords($keywords);
}
$this->filter(false, '( u.uName like ' . $qkeywords . $emailSearchStr . $attribsStr . ')');
}
示例5: view
public function view() {
$userList = new UserList();
$userList->sortBy('uName', 'asc');
$keywords = $this->get('keywords');
if ($keywords != '') {
$userList->filterByKeywords($keywords);
}
$users = $userList->getPage();
$this->set('userList', $userList);
$this->set('users', $users);
$this->set('attribs', UserAttributeKey::getMemberListList());
$this->set('keywords', htmlentities($keywords, ENT_COMPAT, APP_CHARSET));
$this->addHeaderItem(Loader::helper('html')->css('ccm.profile.css'));
}
示例6: start
public function start(Zend_Queue $q)
{
Loader::library('database_indexed_search');
$this->is = new IndexedSearch();
Loader::model('attribute/categories/collection');
Loader::model('attribute/categories/file');
Loader::model('attribute/categories/user');
$attributes = CollectionAttributeKey::getList();
$attributes = array_merge($attributes, FileAttributeKey::getList());
$attributes = array_merge($attributes, UserAttributeKey::getList());
foreach ($attributes as $ak) {
$ak->updateSearchIndex();
}
$db = Loader::db();
$db->Execute('truncate table PageSearchIndex');
$r = $db->Execute('select Pages.cID from Pages left join CollectionSearchIndexAttributes csia on Pages.cID = csia.cID where (ak_exclude_search_index is null or ak_exclude_search_index = 0) and cIsActive = 1');
while ($row = $r->FetchRow()) {
$q->send($row['cID']);
}
}
示例7: 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);
}
示例8: foreach
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;
?>
/users/customize_search_columns/">
<?php
echo $form->hidden('task', 'update_columns');
?>
<h1><?php
echo t('Additional Searchable Attributes');
?>
</h1>
示例9: do_register
public function do_register() {
$registerData['success']=0;
$userHelper = Loader::helper('concrete/user');
$e = Loader::helper('validation/error');
$ip = Loader::helper('validation/ip');
$txt = Loader::helper('text');
$vals = Loader::helper('validation/strings');
$valc = Loader::helper('concrete/validation');
$username = $_POST['uName'];
$password = $_POST['uPassword'];
$passwordConfirm = $_POST['uPasswordConfirm'];
// clean the username
$username = trim($username);
$username = preg_replace("/ +/", " ", $username);
if (!$ip->check()) {
$e->add($ip->getErrorMessage());
}
if (ENABLE_REGISTRATION_CAPTCHA) {
$captcha = Loader::helper('validation/captcha');
if (!$captcha->check()) {
$e->add(t("Incorrect image validation code. Please check the image and re-enter the letters or numbers as necessary."));
}
}
if (!$vals->email($_POST['uEmail'])) {
$e->add(t('Invalid email address provided.'));
} else if (!$valc->isUniqueEmail($_POST['uEmail'])) {
$e->add(t("The email address %s is already in use. Please choose another.", $_POST['uEmail']));
}
//if (USER_REGISTRATION_WITH_EMAIL_ADDRESS == false) {
if (strlen($username) < USER_USERNAME_MINIMUM) {
$e->add(t('A username must be between at least %s characters long.', USER_USERNAME_MINIMUM));
}
if (strlen($username) > USER_USERNAME_MAXIMUM) {
$e->add(t('A username cannot be more than %s characters long.', USER_USERNAME_MAXIMUM));
}
if (strlen($username) >= USER_USERNAME_MINIMUM && !$valc->username($username)) {
if(USER_USERNAME_ALLOW_SPACES) {
$e->add(t('A username may only contain letters, numbers and spaces.'));
} else {
$e->add(t('A username may only contain letters or numbers.'));
}
}
if (!$valc->isUniqueUsername($username)) {
$e->add(t("The username %s already exists. Please choose another", $username));
}
//}
if ($username == USER_SUPER) {
$e->add(t('Invalid Username'));
}
/*
if ((strlen($password) < USER_PASSWORD_MINIMUM) || (strlen($password) > USER_PASSWORD_MAXIMUM)) {
$e->add(t('A password must be between %s and %s characters', USER_PASSWORD_MINIMUM, USER_PASSWORD_MAXIMUM));
}
if (strlen($password) >= USER_PASSWORD_MINIMUM && !$valc->password($password)) {
$e->add(t('A password may not contain ", \', >, <, or any spaces.'));
}
*/
$userHelper->validNewPassword($password,$e);
if ($password) {
if ($password != $passwordConfirm) {
$e->add(t('The two passwords provided do not match.'));
}
}
$aks = UserAttributeKey::getRegistrationList();
foreach($aks as $uak) {
if ($uak->isAttributeKeyRequiredOnRegister()) {
$e1 = $uak->validateAttributeForm();
if ($e1 == false) {
$e->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
} else if ($e1 instanceof ValidationErrorHelper) {
$e->add($e1);
}
}
}
if (!$e->has()) {
// do the registration
$data = $_POST;
//.........这里部分代码省略.........
示例10: t
print t('Unknown');
break;
case '0':
print t('No');
break;
case '1':
print t('Yes');
break;
}?>
</strong></p>
<? } ?>
<br/>
<?
$attribs = UserAttributeKey::getList(true);
if (count($attribs) > 0) { ?>
<h3><?=t('User Attributes')?></h3><br/>
<?
for ($i = 0; $i < count($attribs); $i++) {
$uk = $attribs[$i];
if ($pk->validate($uk)) {
?>
<div class="row">
<div class="span5" style=""><p><strong><?=$uk->getAttributeKeyDisplayHandle()?></strong></p></div>
<div class="span5"><p>
<?=$uo->getAttribute($uk->getAttributeKeyHandle(), 'displaySanitized', 'display')?>
</p></div>
示例11: date
echo $ui->getUserEmail();
?>
"><?php
echo $txt->highlightSearch($ui->getUserEmail(), $keywords);
?>
</a></td>
<td><?php
echo date(DATE_APP_DASHBOARD_SEARCH_RESULTS_USERS, strtotime($ui->getUserDateAdded('user')));
?>
</td>
<td><?php
echo $ui->getNumLogins();
?>
</td>
<?php
$slist = UserAttributeKey::getColumnHeaderList();
foreach ($slist as $ak) {
?>
<td><?php
$vo = $ui->getAttributeValueObject($ak);
if (is_object($vo)) {
print $vo->getValue('display');
}
?>
</td>
<?php
}
?>
<td> </td>
</tr>
示例12: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$form = Loader::helper('form');
$searchFields = array('date_added' => t('Registered Between'), 'is_active' => t('Activated Users'));
if (Config::get('concrete.permissions_model') == 'advanced') {
$searchFields['group_set'] = t('Group Set');
}
$searchFieldAttributes = UserAttributeKey::getSearchableList();
foreach ($searchFieldAttributes as $ak) {
$searchFields[$ak->getAttributeKeyID()] = $ak->getAttributeKeyDisplayName();
}
$ek = PermissionKey::getByHandle('edit_user_properties');
$ik = PermissionKey::getByHandle('activate_user');
$dk = PermissionKey::getByHandle('delete_user');
$flr = new \Concrete\Core\Search\StickyRequest('users');
$searchRequest = $flr->getSearchRequest();
?>
<script type="text/template" data-template="search-form">
<form role="form" data-search-form="users" action="<?php
echo URL::to('/ccm/system/search/users/submit');
?>
" class="form-inline ccm-search-fields">
<div class="ccm-search-fields-row">
<div class="form-group">
<select data-bulk-action="users" disabled class="ccm-search-bulk-action form-control">
<option value=""><?php
echo t('Items Selected');
?>
</option>
示例13: createUser
protected function createUser()
{
// Make sure that this extractor supports everything we need.
if (!$this->supportsEmail() && $this->supportsUniqueId()) {
throw new Exception('Email and unique ID support are required for user creation.');
}
// Make sure that email is verified if the extractor supports it.
if ($this->supportsVerifiedEmail() && !$this->isEmailVerified()) {
throw new Exception('Please verify your email with this service before attempting to log in.');
}
$email = $this->getEmail();
if (\UserInfo::getByEmail($email)) {
throw new Exception('Email is already in use.');
}
$first_name = "";
$last_name = "";
$name_support = array('full' => $this->supportsFullName(), 'first' => $this->supportsFirstName(), 'last' => $this->supportsLastName());
if ($name_support['first'] && $name_support['last']) {
$first_name = $this->getFirstName();
$last_name = $this->getLastName();
} elseif ($name_support['full']) {
$reversed_full_name = strrev($this->getFullName());
list($reversed_last_name, $reversed_first_name) = explode(' ', $reversed_full_name, 2);
$first_name = strrev($reversed_first_name);
$last_name = strrev($reversed_last_name);
}
$username = null;
if ($this->supportsUsername()) {
$username = $this->getUsername();
}
if ($username === null) {
if ($first_name || $last_name) {
$username = preg_replace('/[^a-z0-9\\_]/', '_', strtolower($first_name . ' ' . $last_name));
$username = trim(preg_replace('/_{2,}/', '_', $username), '_');
} else {
$username = preg_replace('/[^a-zA-Z0-9\\_]/i', '_', strtolower(substr($email, 0, strpos($email, '@'))));
$username = trim(preg_replace('/_{2,}/', '_', $username), '_');
}
}
$unique_username = $username;
$append = 1;
while (\UserInfo::getByUserName($unique_username)) {
// This is a heavy handed way to do this, but it must be done.
$unique_username = $username . '_' . $append++;
}
$username = $unique_username;
$data = array();
$data['uName'] = $username;
$data['uPassword'] = "";
$data['uEmail'] = $email;
$data['uIsValidated'] = 1;
$user_info = \UserInfo::add($data);
if (!$user_info) {
throw new Exception('Unable to create new account.');
}
if ($group_id = intval($this->registrationGroupID(), 10)) {
$group = \Group::getByID($group_id);
if ($group && is_object($group) && !$group->isError()) {
$user = \User::getByUserID($user_info->getUserID());
$user->enterGroup($group);
}
}
$key = \UserAttributeKey::getByHandle('first_name');
if ($key) {
$user_info->setAttribute($key, $first_name);
}
$key = \UserAttributeKey::getByHandle('last_name');
if ($key) {
$user_info->setAttribute($key, $last_name);
}
\User::loginByUserID($user_info->getUserID());
$this->bindUser($user = \User::getByUserID($user_info->getUserID()), $this->getUniqueId());
return $user;
}
示例14: defined
defined('C5_EXECUTE') or die("Access Denied.");
$token = \Core::make('Concrete\\Core\\Validation\\CSRF\\Token');
?>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="page-header">
<h1><?php
echo t('Site Registration');
?>
</h1>
</div>
</div>
</div>
<?php
$attribs = UserAttributeKey::getRegistrationList();
if ($registerSuccess) {
?>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<?php
switch ($registerSuccess) {
case "registered":
?>
<p><strong><?php
echo $successMsg;
?>
</strong><br/><br/>
<a href="<?php
echo $view->url('/');
?>
示例15: 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);
}
}