本文整理汇总了PHP中CB\User类的典型用法代码示例。如果您正苦于以下问题:PHP User类的具体用法?PHP User怎么用?PHP User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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';
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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');
}
示例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');
}
示例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;
}
示例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;
}
示例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'));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}