Ejemplo n.º 1
0
 /**
  * 获取所有用户的最新动态
  *
  * 可传入的参数:
  *   mode     必需 动态的模式(simple, full)
  *   count    必需 获取动态数量
  *   objectType 可选 动态所属对象类型
  *   objectId   可选 动态所属对象编号
  * 
  * @param  array $arguments 参数
  * @return array 用户列表
  */
 public function getData(array $arguments)
 {
     $conditions = array();
     if (isset($arguments['private'])) {
         if ($arguments['private'] == 0) {
             $conditions['private'] = 0;
         }
     }
     if (isset($arguments['objectType']) && isset($arguments['objectId'])) {
         if ($arguments['objectType'] == 'course') {
             $conditions['courseIds'] = array($arguments['objectId']);
         } else {
             $courses = $this->getClassroomService()->findActiveCoursesByClassroomId($classroom['id']);
             if ($courses) {
                 $courseIds = ArrayToolkit::column($courses, 'id');
                 $conditions['classroomCourseIds'] = $courseIds;
                 $conditions['classroomId'] = $arguments['objectId'];
             } else {
                 $conditions['onlyClassroomId'] = $arguments['objectId'];
             }
         }
     }
     $statuses = $this->getStatusService()->searchStatuses($conditions, array('createdTime', 'DESC'), 0, $arguments['count']);
     if ($statuses) {
         $userIds = ArrayToolkit::column($statuses, 'userId');
         $users = $this->getUserService()->findUsersByIds($userIds);
         $manager = ExtensionManager::instance();
         foreach ($statuses as &$status) {
             $status['user'] = $users[$status['userId']];
             $status['message'] = $manager->renderStatus($status, $arguments['mode']);
             unset($status);
         }
     }
     return $statuses;
 }
Ejemplo n.º 2
0
 public function __construct($environment, $debug)
 {
     parent::__construct($environment, $debug);
     date_default_timezone_set('Asia/Shanghai');
     $this->extensionManger = ExtensionManager::init($this);
 }
Ejemplo n.º 3
0
 public function getDict($type)
 {
     return ExtensionManager::instance()->getDataDict($type);
 }
Ejemplo n.º 4
0
 public function classroomStatusBlockAction($classroom, $count = 10)
 {
     $courses = $this->getClassroomService()->findActiveCoursesByClassroomId($classroom['id']);
     $conditions = array('private' => 0);
     $learns = array();
     if ($courses) {
         $courseIds = ArrayToolkit::column($courses, 'id');
         $conditions['classroomCourseIds'] = $courseIds;
         $conditions['classroomId'] = $classroom['id'];
     } else {
         $conditions['onlyClassroomId'] = $classroom['id'];
     }
     $learns = $this->getStatusService()->searchStatuses($conditions, array('createdTime', 'DESC'), 0, $count);
     if ($learns) {
         $ownerIds = ArrayToolkit::column($learns, 'userId');
         $owners = $this->getUserService()->findUsersByIds($ownerIds);
         $manager = ExtensionManager::instance();
         foreach ($learns as $key => $learn) {
             $learns[$key]['user'] = $owners[$learn['userId']];
             $learns[$key]['message'] = $manager->renderStatus($learn, 'simple');
             unset($learn);
         }
     }
     return $this->render('TopxiaWebBundle:Status:status-block.html.twig', array('learns' => $learns));
 }
Ejemplo n.º 5
0
 public function getData($name, $arguments)
 {
     $datatag = ExtensionManager::instance()->getDataTag($name);
     return $datatag->getData($arguments);
 }