本文整理汇总了PHP中CB\User类的典型用法代码示例。如果您正苦于以下问题:PHP User类的具体用法?PHP User怎么用?PHP User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getName
public function getName($id = false)
{
if ($id === false) {
$id = $this->id;
}
switch ($id) {
case 'tasks':
return L\get('Tasks');
case 2:
return L\get('AssignedToMe');
case 3:
return L\get('Created');
case 4:
return lcfirst(L\get('Overdue'));
case 5:
return lcfirst(L\get('Ongoing'));
case 6:
return lcfirst(L\get('Closed'));
case 'assignee':
return lcfirst(L\get('Assignee'));
default:
if (substr($id, 0, 3) == 'au_') {
return \CB\User::getDisplayName(substr($id, 3));
}
}
return 'none';
}
开发者ID:austinvernsonger,项目名称:casebox,代码行数:27,代码来源:Tasks.php
示例2: getName
public function getName($id = false)
{
$rez = 'no name';
if ($id === false) {
$id = $this->id;
}
if (!empty($id) && is_numeric($id)) {
$facetConfig = $this->getFacetFieldConfig($this->getClassDepth() - 1);
switch (@$facetConfig['type']) {
case 'users':
$rez = User::getDisplayName($id);
break;
case 'varchar':
$rez = $id;
break;
default:
$rez = Objects::getName($id);
}
} else {
switch ($id) {
case 'root':
$rez = parent::getName('root');
break;
}
}
return $rez;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:27,代码来源:FacetNav.php
示例3: getClientData
public function getClientData()
{
$rez = array('f' => $this->field, 'title' => $this->getTitle(), 'items' => array());
foreach ($this->solrData as $k => $v) {
$rez['items'][$k] = array('name' => User::getDisplayName($k), 'count' => $v);
}
return $rez;
}
开发者ID:austinvernsonger,项目名称:casebox,代码行数:8,代码来源:UsersFacet.php
示例4: beforeLock
public function beforeLock($path, \Sabre\DAV\Locks\LockInfo $lock)
{
$path = $path;
//dummy codacy assignment
$lock->owner = \CB\User::getDisplayName($_SESSION['user']['id']);
// error_log('beforeLock: ' . $lock->owner);
return true;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:8,代码来源:LockPlugin.php
示例5: deleteByNodeId
public static function deleteByNodeId($nodeId, $userId = false)
{
if ($userId == false) {
$userId = \CB\User::getId();
}
DB\dbQuery('DELETE FROM ' . static::getTableName() . ' WHERE user_id = $1 AND node_id = $2', array($userId, $nodeId)) or die(DB\dbQueryError());
$rez = DB\dbAffectedRows() > 0;
return $rez;
}
开发者ID:youprofit,项目名称:casebox,代码行数:9,代码来源:Favorites.php
示例6: testsetAsLoged
/**
* @depends testCreate
*/
public function testsetAsLoged()
{
$id = DM\Users::create(array('name' => $this->testName, 'password' => 'qq'));
$this->assertTrue(is_numeric($id), 'Cant create User');
\CB\User::setAsLoged($id, 'tests_key');
$this->assertTrue(\CB\User::isLoged(), ' Error: user is not logged');
$this->assertEquals($id, $_SESSION['user']['id'], 'Sessions user is not equal with setted users');
$this->assertEquals('tests_key', $_SESSION['key'], 'Sessions key is not equal with setted keys');
}
开发者ID:youprofit,项目名称:casebox,代码行数:12,代码来源:UserTest.php
示例7: init
/**
*
* @param type $corename
*/
public static function init($corename = DEFAULT_TEST_CORENAME)
{
$CB_PATH = \CB_DOC_ROOT;
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_NAME'] = static::getHost();
$_GET['core'] = $corename;
$_SESSION['user'] = array('id' => 1, 'groups' => [1]);
require_once $CB_PATH . '/config.php';
require_once $CB_PATH . '/lib/language.php';
L\initTranslations();
Config::setEnvVar('user_language_index', 1);
\CB\User::setAsLoged(1, 'AbrACadaBraK333y');
}
开发者ID:youprofit,项目名称:casebox,代码行数:17,代码来源:Helpers.php
示例8: getClientData
public function getClientData($options = array())
{
$rez = array('f' => $this->field, 'title' => $this->getTitle(), 'items' => array());
// $colors = empty($options['colors'])
// ? array()
// : Users::getColors();
foreach ($this->solrData as $k => $v) {
$rez['items'][$k] = array('name' => User::getDisplayName($k), 'count' => $v);
if (!empty($options['colors'])) {
$rez['items'][$k]['cls'] = 'user-color-' . $k;
}
}
return $rez;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:14,代码来源:UsersFacet.php
示例9: set
/**
* set state
* @param array $p
*/
public function set($p)
{
$rez = array('success' => true);
$state = User::getUserState();
if (!empty($p['value']) || isset($state[$p['name']])) {
if (empty($p['value'])) {
unset($state[$p['name']]);
} else {
$state[$p['name']] = $p['value'];
}
User::setUserState($state);
}
return $rez;
}
开发者ID:austinvernsonger,项目名称:casebox,代码行数:18,代码来源:DBProvider.php
示例10: saveObjectAttachments
/**
* save attachments array for a given object id
* @param int $objectId
* @param array &$attachments attachments array as from getMailContentAndAtachment
* @return void
*/
function saveObjectAttachments($objectId, &$attachments)
{
$filesApiObject = new \CB\Api\Files();
foreach ($attachments as $d) {
if (empty($d['attachment'])) {
continue;
}
//safe content to a temporary file
$tmpName = tempnam(sys_get_temp_dir(), 'cbMailAtt');
file_put_contents($tmpName, $d['content']);
//call the api method
$filesApiObject->upload(array('pid' => $objectId, 'localFile' => $tmpName, 'oid' => \CB\User::getId(), 'filename' => $d['filename'], 'content-type' => $d['content-type'], 'fileExistAction' => 'autorename'));
}
}
开发者ID:sebbie42,项目名称:casebox,代码行数:20,代码来源:mail_functions.php
示例11: getData
public function getData($id = false)
{
$rez = array('success' => true);
parent::getData($id);
$o = Objects::getCachedObject($this->id);
$data = $o->getData();
//show current version only if have more other versions
if (!empty($data['versions'])) {
$data['ago_text'] = Util\formatAgoTime($data['cdate']);
$data['user'] = User::getDisplayName($data['oid'], true);
$data['cls'] = 'sel';
$rez['data'] = array($data);
}
return $rez;
}
开发者ID:austinvernsonger,项目名称:casebox,代码行数:15,代码来源:CurrentVersion.php
示例12: getName
public function getName($id = false)
{
if ($id == false) {
$id = $this->id;
}
$rez = 'no name';
switch ($id) {
case 'users':
$rez = L\get('Users');
break;
default:
$rez = \CB\User::getDisplayName($id);
}
return $rez;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:15,代码来源:OfficeUsers.php
示例13: getData
public function getData($id = false)
{
$rez = array('success' => true);
parent::getData($id);
// echo $this->id.'!!';
$o = Objects::getCachedObject($this->id);
$data = $o->getData();
if (!empty($data['versions'])) {
$rez['data'] = $data['versions'];
foreach ($rez['data'] as &$version) {
$version['ago_text'] = Util\formatAgoTime($version['cdate']);
$version['user'] = User::getDisplayName($version['cid'], true);
}
}
return $rez;
}
开发者ID:austinvernsonger,项目名称:casebox,代码行数:16,代码来源:Versions.php
示例14: getData
public function getData($id = false)
{
$rez = array('success' => true);
if (empty(parent::getData($id))) {
return $rez;
}
$params = array('pid' => $this->id, 'fq' => array('(template_type:task) OR (target_type:task)'), 'fl' => 'id,pid,name,template_id,date,date_end,cid,cdate,status', 'sort' => 'cdate', 'dir' => 'desc');
$s = new \CB\Search();
$sr = $s->query($params);
foreach ($sr['data'] as $d) {
$d['ago_text'] = @Util\formatDateTimePeriod($d['date'], null, @$_SESSION['user']['cfg']['timezone']);
$d['user'] = User::getDisplayName($d['cid'], true);
\CB\Tasks::setTaskActionFlags($d);
$rez['data'][] = $d;
}
return $rez;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:17,代码来源:Tasks.php
示例15: setUserStatus
/**
* set complete or incomplete status for a task responsible user
* @param array $p params
*/
public function setUserStatus($p)
{
$rez = array('success' => true, 'id' => $p['id']);
$obj = Objects::getCachedObject($p['id']);
$data = $obj->getData();
if (User::getId() != $data['cid'] && !Security::isAdmin()) {
throw new \Exception(L\get('Access_denied'));
}
if ($obj->getUserStatus($p['user_id']) == Objects\Task::$USERSTATUS_NONE) {
throw new \Exception(L\get('Wrong_id'));
}
$status = $p['status'] == 1 ? Objects\Task::$USERSTATUS_DONE : Objects\Task::$USERSTATUS_ONGOING;
$obj->setUserStatus($status, $p['user_id']);
// $obj->updateSysData();
$this->afterUpdate($p['id']);
return $rez;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:21,代码来源:Tasks.php
示例16: create
public function create($p)
{
$rez = array('succes' => false, 'data' => array());
if (empty($p['node_id']) || empty($p['data'])) {
return $rez;
}
$data = array('name' => Purify::filename($p['data']['name']), 'path' => $p['data']['path'], 'pathText' => empty($p['data']['pathText']) ? '' : $p['data']['pathText']);
if (is_numeric($p['node_id'])) {
$data['template_id'] = Objects::getTemplateId($p['node_id']);
$data['iconCls'] = Browser::getIcon($data);
} elseif (!empty($p['data']['iconCls'])) {
$data['iconCls'] = $p['data']['iconCls'];
}
$d = array('user_id' => User::getId(), 'node_id' => $p['node_id'], 'data' => Util\jsonEncode($data));
$id = DM\Favorites::create($d);
$rez = array('success' => true, 'data' => array('id' => $id, 'node_id' => $d['node_id'], 'data' => $data));
return $rez;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:18,代码来源:Favorites.php
示例17: test_checkLogined
/**
* @depends test_getLoginUrl
*/
public function test_checkLogined()
{
unset($_SESSION['key']);
$this->assertFalse(\CB\User::isLoged(), 'ERROR checkLogined \\CB\\Users::isLoged = true');
$url = $this->getUrl();
$this->assertTrue(isset($url), 'ERROR checkLogined getGoogleLoginUrl ' . $url);
$uri = parse_url($url);
$Oauth2Query = [];
parse_str($uri['query'], $Oauth2Query);
$_GET = $Oauth2Query;
$state = \CB\Oauth2Utils::decodeState($Oauth2Query['state']);
$state['email'] = $this->email;
$_GET['state'] = \CB\Oauth2Utils::encodeState($state);
$check = \CB\Oauth2Utils::checkLogined();
$this->assertTrue($check['success'], '\\CB\\Oauth2Utils::checkLogined() return success false');
$this->assertTrue($check['user_id'] == 1, '\\CB\\Oauth2Utils::checkLogined() WRONG USER ID');
$this->assertTrue($check['session_id'] == $state['state'], '\\CB\\Oauth2Utils::checkLogined() WRON SESSION ID');
$r = \CB\User::setAsLoged($check['user_id'], $check['session_id']);
$this->assertTrue($r['success'], ' User can\'t be set as logined');
}
开发者ID:youprofit,项目名称:casebox,代码行数:23,代码来源:Oauth2UtilsTest.php
示例18: getData
public function getData($id = false)
{
$rez = array('success' => true);
if (empty(parent::getData($id))) {
return $rez;
}
$params = array('pid' => $this->id, 'fq' => array('(template_type:object) OR (target_type:object)'), 'fl' => 'id,pid,name,template_id,cdate,cid', 'sort' => 'cdate', 'dir' => 'desc');
$folderTemplates = \CB\Config::get('folder_templates');
if (!empty($folderTemplates)) {
$params['fq'][] = '!template_id:(' . implode(' OR ', Util\toNumericArray($folderTemplates)) . ')';
}
$s = new \CB\Search();
$sr = $s->query($params);
foreach ($sr['data'] as $d) {
$d['ago_text'] = Util\formatAgoTime($d['cdate']);
$d['user'] = @User::getDisplayName($d['cid']);
$rez['data'][] = $d;
}
return $rez;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:20,代码来源:ContentItems.php
示例19: loadComment
/**
* load a single comment by id
* used for add/update operations on comments
* @param int $id
* @return json response
*/
public static function loadComment($id)
{
$rez = array('success' => true, 'data' => array());
if (empty($id)) {
return $rez;
}
$params = array('system' => '[0 TO 2]', 'fq' => array('id:' . intval($id)), 'fl' => 'id,pid,template_id,cid,cdate,content', 'rows' => 1);
$s = new \CB\Search();
$sr = $s->query($params);
foreach ($sr['data'] as $d) {
$d['cdate_text'] = Util\formatAgoTime($d['cdate']);
$d['user'] = User::getDisplayName($d['cid'], true);
//data in solr has already encoded html special chars
// so we need to decode it and to format the message (where the chars will be encoded again)
$d['content'] = htmlspecialchars_decode($d['content'], ENT_COMPAT);
$d['content'] = \CB\Objects\Comment::processAndFormatMessage($d['content']);
array_unshift($rez['data'], $d);
}
static::addAttachmentLinks($rez);
return @array_shift($rez['data']);
}
开发者ID:sebbie42,项目名称:casebox,代码行数:27,代码来源:Comments.php
示例20: extDirectShutdownFunction
/**
* catch server side errors and return json encoded exception
* @return void
*/
function extDirectShutdownFunction()
{
$data = \CB\Cache::get('ExtDirectData');
$error = error_get_last();
if (in_array($error['type'], array(1, 4))) {
$data['type'] = 'exception';
$data['result'] = array('success' => false);
$data['msg'] = 'Internal server error.';
if (\CB\IS_DEBUG_HOST) {
$data['msg'] = $error['message'];
$data['where'] = print_r(debug_backtrace(false), true);
}
//notify admin
if (!(php_sapi_name() == "cli")) {
@mail(Config::get('ADMIN_EMAIL'), 'Remote router error on ' . Config::get('core_url'), var_export($data, true), 'From: ' . Config::get('SENDER_EMAIL') . "\r\n");
}
echo Util\jsonEncode($data);
}
if (\CB\User::isLoged()) {
\CB\User::updateLastActionTime();
}
}
开发者ID:youprofit,项目名称:casebox,代码行数:26,代码来源:router.php
注:本文中的CB\User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论