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


PHP User::getTemplateId方法代码示例

本文整理汇总了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;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:54,代码来源:User.php

示例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;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:42,代码来源:UsersGroups.php


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