本文整理汇总了PHP中CB\User::getTemplateId方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getTemplateId方法的具体用法?PHP User::getTemplateId怎么用?PHP User::getTemplateId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CB\User
的用法示例。
在下文中一共展示了User::getTemplateId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProfileData
/**
* get profile data for a user.
* This function receives userId as param because
* user profile data can be edited by another user (owner).
*/
public function getProfileData($userId = false)
{
if (!$this->isVerified()) {
return array('success' => false, 'verify' => true);
}
if ($userId === false) {
$userId = static::getId();
}
if (!Security::canEditUser($userId)) {
throw new \Exception(L\get('Access_denied'));
}
$rez = array();
$languageSettings = Config::get('language_settings');
$r = $this->getPreferences($userId);
if (!empty($r)) {
$cfg = $r['cfg'];
unset($r['cfg']);
$language_index = empty($r['language_id']) ? Config::get('user_language_index') - 1 : $r['language_id'] - 1;
$r['language'] = Config::get('languages')[$language_index];
$r['long_date_format'] = empty($cfg['long_date_format']) ? $languageSettings[$r['language']]['long_date_format'] : $cfg['long_date_format'];
$r['short_date_format'] = empty($cfg['short_date_format']) ? $languageSettings[$r['language']]['short_date_format'] : $cfg['short_date_format'];
if (!empty($cfg['country_code'])) {
$r['country_code'] = $cfg['country_code'];
}
if (!empty($cfg['phone'])) {
$r['phone'] = $cfg['phone'];
}
if (!empty($cfg['timezone'])) {
$r['timezone'] = $cfg['timezone'];
}
if (!empty($cfg['canAddUsers'])) {
$r['canAddUsers'] = $cfg['canAddUsers'];
}
if (!empty($cfg['canAddGroups'])) {
$r['canAddGroups'] = $cfg['canAddGroups'];
}
$r['template_id'] = User::getTemplateId();
$rez = $r;
}
//get possible associated objects for display in grid
if (!empty($rez['data'])) {
$assocObjects = Objects::getAssociatedObjects(array('template_id' => $rez['template_id'], 'data' => $rez['data']));
if (!empty($assocObjects['data'])) {
$rez['assocObjects'] = $assocObjects['data'];
}
}
$rez['success'] = true;
return $rez;
}
示例2: getUserData
/**
* Retreive user details data to be displayed in user details window
*/
public function getUserData($p)
{
if (!User::isVerified()) {
return array('success' => false, 'verify' => true);
}
if ($_SESSION['user']['id'] != $p['data']['id'] && !Security::canManage()) {
throw new \Exception(L\get('Access_denied'));
}
$user_id = $p['data']['id'];
$rez = array('success' => false, 'msg' => L\get('Wrong_id'));
$res = DB\dbQuery('SELECT id
,cid
,name
,first_name
,last_name
,sex
,email
,enabled
,data
,last_action_time
,cdate
,cid
FROM users_groups u
WHERE id = $1', $user_id) or die(DB\dbQueryError());
if ($r = $res->fetch_assoc()) {
$r['title'] = User::getDisplayName($r);
$r['data'] = Util\toJSONArray($r['data']);
$r['last_action_time'] = Util\formatMysqlTime($r['last_action_time']);
$r['cdate'] = Util\formatMysqlTime($r['cdate']);
$r['owner'] = User::getDisplayName($r['cid']);
$rez = array('success' => true, 'data' => $r);
}
$res->close();
if ($rez['success'] == false) {
throw new \Exception(L\get('Wrong_id'));
}
$rez['data']['template_id'] = User::getTemplateId();
return $rez;
}