本文整理汇总了PHP中CB\User::getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getDisplayName方法的具体用法?PHP User::getDisplayName怎么用?PHP User::getDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CB\User
的用法示例。
在下文中一共展示了User::getDisplayName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: getName
public function getName($id = false)
{
if ($id === false) {
$id = $this->id;
}
switch ($id) {
case 'tasks':
return L\get('MyTasks');
case 2:
return L\get('AssignedToMe');
case 3:
return L\get('CreatedByMe');
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';
}
示例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: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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']);
}
示例12: getData
public function getData($id = false)
{
$rez = array('success' => true, 'data' => array());
parent::getData($id);
$obj = $this->getObjectClass();
if (!is_object($obj)) {
return $rez;
}
$data = $obj->getData();
$rez['data'] = array_intersect_key($data, array('id' => 1, 'name' => 1, 'template_id' => 1, 'cid' => 1, 'cdate' => 1, 'uid' => 1, 'udate' => 1, 'dstatus' => 1, 'did' => 1, 'ddate' => 1, 'size' => 1));
$d =& $rez['data'];
$pids = Util\toNumericArray($data['pids']);
array_pop($pids);
$d['pids'] = $d['path'] = implode('/', $pids);
$arr = array(&$d);
Search::setPaths($arr);
$d['template_name'] = Objects::getName($d['template_id']);
$sd = $obj->getSysData();
$userId = User::getId();
$d['subscription'] = 'ignore';
if (!empty($sd['fu']) && in_array($userId, $sd['fu'])) {
$d['subscription'] = 'watch';
//follow
}
if (!empty($sd['wu']) && in_array($userId, $sd['wu'])) {
$d['subscription'] = 'watch';
}
$d['cid_text'] = User::getDisplayName($d['cid']);
$d['cdate_ago_text'] = Util\formatAgoTime($d['cdate']);
$d['cdate'] = Util\dateMysqlToISO($d['cdate']);
$d['udate'] = Util\dateMysqlToISO($d['udate']);
$d['uid_text'] = User::getDisplayName($d['uid']);
$d['udate_ago_text'] = Util\formatAgoTime($d['udate']);
if (!empty($d['dstatus'])) {
$d['did_text'] = User::getDisplayName($d['did']);
$d['ddate_text'] = Util\formatAgoTime($d['ddate']);
}
return $rez;
}
示例13: 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;
default:
$rez = Objects::getName($id);
}
} else {
switch ($id) {
case 'root':
$cfg =& $this->config;
$l = Config::get('user_language');
if (empty($cfg['title_' . $l])) {
$l = Config::get('language');
if (empty($cfg['title_' . $l])) {
if (!empty($cfg['title'])) {
$rez = $cfg['title'];
}
} else {
$rez = $cfg['title_' . $l];
}
} else {
$rez = $cfg['title_' . $l];
}
break;
}
}
return $rez;
}
示例14: getExistentFilenames
public function getExistentFilenames($F, $pid)
{
//if no filenames already exists in target then the result will be an empty array
$rez = array();
$userLanguageIndex = Config::get('user_language_index');
foreach ($F as $fk => $f) {
if ($this->fileExists($pid, $f['name'], @$f['dir'])) {
$rez[] = $f;
}
}
switch (sizeof($rez)) {
case 0:
break;
case 1:
//single match: retreive match info for content
//(if matches with current version or to an older version)
$existentFileId = $this->getFileId($pid, $rez[0]['name'], @$rez[0]['dir']);
$rez[0]['existentFileId'] = $existentFileId;
$md5 = $this->getFileMD5($rez[0]);
$res = DB\dbQuery('SELECT
f.cid
,f.cdate
FROM files f
JOIN files_content c ON f.content_id = c.id
AND c.md5 = $2
WHERE f.id = $1', array($existentFileId, $md5)) or die(DB\dbQueryError());
if ($r = $res->fetch_assoc()) {
$r['user'] = User::getDisplayName($r['cid']);
$agoTime = Util\formatAgoTime($r['cdate']);
$rez[0]['msg'] = str_replace(array('{timeAgo}', '{user}'), array($agoTime, $r['user']), L\get('FileContentsIdentical'));
}
$res->close();
if (empty($rez[0]['msg'])) {
$res = DB\dbQuery('SELECT
f.cid
,f.cdate
FROM files_versions f
JOIN files_content c ON f.content_id = c.id
AND c.md5 = $2
WHERE f.file_id = $1', array($existentFileId, $md5)) or die(DB\dbQueryError());
if ($r = $res->fetch_assoc()) {
$r['user'] = User::getDisplayName($r['cid']);
$agoTime = Util\formatAgoTime($r['cdate']);
$rez[0]['msg'] = str_replace(array('{timeAgo}', '{user}'), array($agoTime, $r['user']), L\get('FileContentsIdenticalToAVersion'));
}
}
/* suggested new filename */
$subdirId = $pid;
if (!empty($rez[0]['dir'])) {
$subdirId = $this->getFileId($pid, '', $rez[0]['dir']);
}
$rez[0]['suggestedFilename'] = Objects::getAvailableName($subdirId, $rez[0]['name']);
/* end of suggested new filename */
break;
default:
// multiple files match
break;
}
return $rez;
}
示例15: analizeGrouping
/**
* method to analize grouping params and add group column to result
* @param array $p search params
* @return void
*/
protected function analizeGrouping(&$p)
{
if (empty($p['result']['view']['group']['property'])) {
return;
}
//sync grouping sort direction with sorting if same column
$result =& $p['result'];
$view =& $result['view'];
$group =& $view['group'];
if (!empty($view['sort'])) {
if (@$group['property'] == $view['sort']['property']) {
$group['direction'] = $view['sort']['direction'];
} else {
$group['direction'] = 'ASC';
}
}
//end of sync
$field = $group['property'];
$data =& $p['result']['data'];
$count = sizeof($data);
for ($i = 0; $i < $count; $i++) {
$d =& $data[$i];
$v = @$d[$field];
switch ($field) {
case 'cid':
case 'uid':
case 'oid':
if (empty($v)) {
$d['group'] = '';
$d['groupText'] = 'none';
} else {
$d['group'] = $v;
$d['groupText'] = User::getDisplayName($d[$field]);
}
break;
case 'date':
case 'date_end':
case 'cdate':
case 'udate':
case 'ddate':
case 'task_d_closed':
if (empty($v)) {
$d['group'] = 'empty';
$d['groupText'] = 'empty';
} else {
$d['group'] = substr($v, 0, 7) . '-01T00:00:00Z';
$d['groupText'] = Util\formatMysqlDate($d['group'], 'Y, F');
}
break;
case 'size':
if (empty($v)) {
$d['group'] = 'up to 1 MB';
} else {
$t = Util\formatFileSize($v);
$d['size'] .= ' - ' . $t;
$t = explode(' ', $t);
if (@$t[1] == 'KB' || $t[0] <= 1) {
$t = 1;
} else {
$q = floor($t[0] / 10) * 10;
$t = $t[0] > $q ? $q + 10 : $q;
}
$d['size'] .= ' - ' . $t;
$d['group'] = $t < 1 ? 'up to 1 MB' : 'up to ' . $t . ' MB';
}
break;
default:
if (empty($d[$field])) {
$d['group'] = 'empty';
} else {
//split values by comma and duplicate records if multivalued
$values = is_array($d[$field]) ? $d[$field] : explode(',', $d[$field]);
$d['group'] = trim(array_shift($values));
for ($j = 0; $j < sizeof($values); $j++) {
$newRecord = $d;
$newRecord['group'] = trim($values[$j]);
array_push($data, $newRecord);
}
}
}
}
}