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


PHP USER::getDisplayName方法代码示例

本文整理汇总了PHP中OCP\USER::getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::getDisplayName方法的具体用法?PHP USER::getDisplayName怎么用?PHP USER::getDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\USER的用法示例。


在下文中一共展示了USER::getDisplayName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addComment

 /**
  * @NoAdminRequired
  */
 public function addComment()
 {
     $taskId = $this->params('taskID');
     $comment = $this->params('comment');
     $userId = $this->api->getUserId();
     $response = new JSONResponse();
     try {
         $vcalendar = \OC_Calendar_App::getVCalendar($taskId);
         $vtodo = $vcalendar->VTODO;
         // Determine new commentId by looping through all comments
         $commentIds = array();
         foreach ($vtodo->COMMENT as $com) {
             $commentIds[] = (int) $com['ID']->value;
         }
         $commentId = 1 + max($commentIds);
         $now = new \DateTime();
         $vtodo->addProperty('COMMENT', $comment, array('ID' => $commentId, 'USERID' => $userId, 'DATE-TIME' => $now->format('Ymd\\THis\\Z')));
         \OC_Calendar_Object::edit($taskId, $vcalendar->serialize());
         $user_timezone = \OC_Calendar_App::getTimezone();
         $now->setTimezone(new \DateTimeZone($user_timezone));
         $comment = array('taskID' => $taskId, 'id' => $commentId, 'tmpID' => $this->params('tmpID'), 'name' => \OCP\USER::getDisplayName(), 'userID' => $userId, 'comment' => $comment, 'time' => $now->format('Ymd\\THis'));
         $result = array('data' => array('comment' => $comment));
         $response->setData($result);
     } catch (\Exception $e) {
         // throw new BusinessLayerException($e->getMessage());
     }
     return $response;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:31,代码来源:taskscontroller.php

示例2: arrayForJSON


//.........这里部分代码省略.........
         try {
             $due = $due->getDateTime();
             $due->setTimezone(new \DateTimeZone($user_timezone));
             $task['due'] = $due->format('Ymd\\THis');
         } catch (\Exception $e) {
             $task['due'] = null;
             \OCP\Util::writeLog('tasks_enhanced', $e->getMessage(), \OCP\Util::ERROR);
         }
     } else {
         $task['due'] = null;
     }
     $reminder = $vtodo->VALARM;
     if ($reminder) {
         try {
             $reminderType = $reminder->TRIGGER['VALUE']->value;
             $reminderAction = $reminder->ACTION->value;
             $reminderDate = null;
             $reminderDuration = null;
             if ($reminderType == 'DATE-TIME') {
                 $reminderDate = $reminder->TRIGGER->getDateTime();
                 $reminderDate->setTimezone(new \DateTimeZone($user_timezone));
                 $reminderDate = $reminderDate->format('Ymd\\THis');
             } elseif ($reminderType == 'DURATION' && ($start || $due)) {
                 $parsed = VObject\DateTimeParser::parseDuration($reminder->TRIGGER, true);
                 // Calculate the reminder date from duration and start date
                 $related = null;
                 if (is_object($reminder->TRIGGER['RELATED'])) {
                     $related = $reminder->TRIGGER['RELATED']->value;
                     if (is_object($reminder->TRIGGER['RELATED']) && $reminder->TRIGGER['RELATED']->value == 'END' && $due) {
                         $reminderDate = $due->modify($parsed)->format('Ymd\\THis');
                     } elseif ($start) {
                         $reminderDate = $start->modify($parsed)->format('Ymd\\THis');
                     }
                 } else {
                     throw new \Exception('Reminder duration related to not available date.');
                 }
                 $result = preg_match('/^(?P<plusminus>\\+|-)?P((?P<week>\\d+)W)?((?P<day>\\d+)D)?(T((?P<hour>\\d+)H)?((?P<minute>\\d+)M)?((?P<second>\\d+)S)?)?$/', $reminder->TRIGGER, $matches);
                 $invert = false;
                 if ($matches['plusminus'] === '-') {
                     $invert = true;
                 }
                 $parts = array('week', 'day', 'hour', 'minute', 'second');
                 $reminderDuration = array('token' => null);
                 foreach ($parts as $part) {
                     $matches[$part] = isset($matches[$part]) && $matches[$part] ? (int) $matches[$part] : 0;
                     $reminderDuration[$part] = $matches[$part];
                     if ($matches[$part] && !$reminderDuration['token']) {
                         $reminderDuration['token'] = $part;
                     }
                 }
                 if ($reminderDuration['token'] == null) {
                     $reminderDuration['token'] = $parts[0];
                 }
                 $reminderDuration['params'] = array('id' => (int) $invert . (int) ($related == 'END'), 'related' => $related ? $related : 'START', 'invert' => $invert);
             } else {
                 $reminderDate = null;
                 $reminderDuration = null;
             }
             $task['reminder'] = array('type' => $reminderType, 'action' => $reminderAction, 'date' => $reminderDate, 'duration' => $reminderDuration);
         } catch (\Exception $e) {
             $task['reminder'] = null;
             \OCP\Util::writeLog('tasks_enhanced', $e->getMessage(), \OCP\Util::ERROR);
         }
     } else {
         $task['reminder'] = null;
     }
     $starred = $vtodo->getAsString('PRIORITY');
     if ($starred) {
         $task['starred'] = true;
     } else {
         $task['starred'] = false;
     }
     $completed = $vtodo->COMPLETED;
     if ($completed) {
         try {
             $completed = $completed->getDateTime();
             $completed->setTimezone(new \DateTimeZone($user_timezone));
             $task['completed_date'] = $completed->format('Ymd\\THis');
             $task['completed'] = true;
         } catch (\Exception $e) {
             $task['completed'] = false;
             \OCP\Util::writeLog('tasks_enhanced', $e->getMessage(), \OCP\Util::ERROR);
         }
     } else {
         $task['completed'] = false;
     }
     $task['complete'] = $vtodo->getAsString('PERCENT-COMPLETE') == '' ? '0' : $vtodo->getAsString('PERCENT-COMPLETE');
     $comments = $vtodo->COMMENT;
     if ($comments) {
         $comments_parsed = array();
         foreach ($comments as $com) {
             $time = new \DateTime($com['DATE-TIME']->value);
             $time->setTimezone(new \DateTimeZone($user_timezone));
             $time = $time->format('Ymd\\THis');
             $comments_parsed[] = array('id' => (int) $com['ID']->value, 'userID' => $com['USERID']->value, 'name' => \OCP\USER::getDisplayName($com['USERID']->value), 'comment' => $com->value, 'time' => $time);
         }
         $task['comments'] = $comments_parsed;
     }
     return $task;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:101,代码来源:helper.php


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