本文整理汇总了PHP中UserAttributeKey::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAttributeKey::getByID方法的具体用法?PHP UserAttributeKey::getByID怎么用?PHP UserAttributeKey::getByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAttributeKey
的用法示例。
在下文中一共展示了UserAttributeKey::getByID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit($akID = 0)
{
if ($this->post('akID')) {
$akID = $this->post('akID');
}
$key = UserAttributeKey::getByID($akID);
if (!is_object($key) || $key->isAttributeKeyInternal()) {
$this->redirect('/dashboard/users/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 {
$key->update($this->post());
$this->redirect('/dashboard/users/attributes', 'attribute_updated');
}
}
}
示例2: TaskPermission
$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;
?>
/users/customize_search_columns/">
<?php
echo $form->hidden('task', 'update_columns');
?>
示例3: updateAttributesDisplayOrder
function updateAttributesDisplayOrder($uats)
{
$db = Loader::db();
for ($i = 0; $i < count($uats); $i++) {
$uak = UserAttributeKey::getByID($uats[$i]);
$uak->refreshCache();
$v = array($uats[$i]);
$db->query("update UserAttributeKeys set displayOrder = {$i} where akID = ?", $v);
}
}
示例4: delete
/**
* Deletes a user
* @return void
*/
public function delete(){
// we will NOT let you delete the admin user
if ($this->uID == USER_SUPER_ID) {
return false;
}
// run any internal event we have for user deletion
$ret = Events::fire('on_user_delete', $this);
if ($ret < 0) {
return false;
}
$db = Loader::db();
$r = $db->Execute('select avID, akID from UserAttributeValues where uID = ?', array($this->uID));
Loader::model('attribute/categories/user');
while ($row = $r->FetchRow()) {
$uak = UserAttributeKey::getByID($row['akID']);
$av = $this->getAttributeValueObject($uak);
if (is_object($av)) {
$av->delete();
}
}
$r = $db->query("DELETE FROM UsersFriends WHERE friendUID = ?",array(intval($this->uID)) );
$r = $db->query("DELETE FROM UserGroups WHERE uID = ?",array(intval($this->uID)) );
$r = $db->query("DELETE FROM UserOpenIDs WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM Users WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM UserValidationHashes WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM AreaGroupBlockTypes WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM CollectionVersionBlockPermissions WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM PagePermissionPageTypes WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM AreaGroups WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM PagePermissions WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("DELETE FROM Piles WHERE uID = ?",array(intval($this->uID)));
$r = $db->query("UPDATE Blocks set uID=? WHERE uID = ?",array( intval(USER_SUPER_ID), intval($this->uID)));
$r = $db->query("UPDATE Pages set uID=? WHERE uID = ?",array( intval(USER_SUPER_ID), intval($this->uID)));
}
示例5: 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;
}
示例6: edit
public function edit($akID = 0) {
if ($this->post('akID')) {
$akID = $this->post('akID');
}
$key = UserAttributeKey::getByID($akID);
$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 {
$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
);
$key->update($this->post());
$this->redirect('/dashboard/users/attributes', 'attribute_updated');
}
}
}