public function indexAction(Request $request)
 {
     $total = $this->getTagService()->getAllTagCount();
     $paginator = new Paginator($request, $total, 20);
     $tags = $this->getTagService()->findAllTags($paginator->getOffsetCount(), $paginator->getPerPageCount());
     return $this->render('TopxiaAdminBundle:Tag:index.html.twig', array('tags' => $tags, 'paginator' => $paginator));
 }
 public function indexAction(Request $request, $courseId)
 {
     $course = $this->getCourseService()->tryManageCourse($courseId);
     $conditions = $request->query->all();
     if (empty($conditions['target'])) {
         $conditions['targetPrefix'] = "course-{$course['id']}";
     }
     if (!empty($conditions['keyword'])) {
         $conditions['stem'] = $conditions['keyword'];
     }
     //现实所有的题目包括设置为中间题的题目
     $conditions['isMiddle'] = 'all';
     if (!empty($conditions['parentId'])) {
         $parentQuestion = $this->getQuestionService()->getQuestion($conditions['parentId']);
         if (empty($parentQuestion)) {
             return $this->redirect($this->generateUrl('course_manage_question', array('courseId' => $courseId)));
         }
         $orderBy = array('createdTime', 'ASC');
     } else {
         $conditions['parentId'] = 0;
         $parentQuestion = null;
         $orderBy = array('createdTime', 'DESC');
     }
     $paginator = new Paginator($this->get('request'), $this->getQuestionService()->searchQuestionsCount($conditions), 10);
     $questions = $this->getQuestionService()->searchQuestions($conditions, $orderBy, $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($questions, 'userId'));
     $targets = $this->get('topxia.target_helper')->getTargets(ArrayToolkit::column($questions, 'target'));
     return $this->render('TopxiaWebBundle:CourseQuestionManage:index.html.twig', array('course' => $course, 'questions' => $questions, 'users' => $users, 'targets' => $targets, 'paginator' => $paginator, 'parentQuestion' => $parentQuestion, 'conditions' => $conditions, 'targetChoices' => $this->getQuestionTargetChoices($course)));
 }
 public function lessonHomeworkListAction(Request $request, $courseId, $lessonId)
 {
     $course = ServiceKernel::instance()->createService('Course.CourseService')->getCourse($courseId);
     $lesson = ServiceKernel::instance()->createService('Course.CourseService')->getCourseLesson($courseId, $lessonId);
     $homeworkService = $this->getHomeworkService();
     $homework = $homeworkService->findHomeworkByLessonId($lessonId);
     $homeworkMemberService = $this->getHomeworkMemberService();
     $homework_members = $homeworkMemberService->findHomeworkMembersByLessonId($lessonId);
     $conditions = array();
     $conditions['lesson_id'] = $lesson['id'];
     $orderBy = array();
     $orderBy[] = 'create_at';
     $orderBy[] = 'DESC';
     $count = $homeworkMemberService->searchHomeworkMembersCount($conditions);
     $page_size = 20;
     $paginator = new Paginator($request, $count, $page_size);
     $start = $paginator->getOffsetCount();
     $limit = $paginator->getPerPageCount();
     $homework_members = $homeworkMemberService->searchHomeworkMembers($conditions, $orderBy, $start, $limit);
     $homework_members = $this->addUser($homework_members);
     $tpl = 'HomeworkBundle:Homework:lesson-homework-list.html.twig';
     $assignBox = array();
     $assignBox['course'] = $course;
     $assignBox['lesson'] = $lesson;
     $assignBox['homework'] = $homework;
     $assignBox['homework_members'] = $homework_members;
     $assignBox['paginator'] = $paginator;
     return $this->render($tpl, $assignBox);
 }
 public function indexAction(Request $request, $postStatus)
 {
     $conditions = $request->query->all();
     if (isset($conditions['keywordType']) && $conditions['keywordType'] == 'courseTitle') {
         $courses = $this->getCourseService()->findCoursesByLikeTitle(trim($conditions['keyword']));
         $conditions['courseIds'] = ArrayToolkit::column($courses, 'id');
         if (count($conditions['courseIds']) == 0) {
             return $this->render('TopxiaAdminBundle:CourseQuestion:index.html.twig', array('paginator' => new Paginator($request, 0, 20), 'questions' => array(), 'users' => array(), 'courses' => array(), 'lessons' => array(), 'type' => $postStatus));
         }
     }
     $conditions['type'] = 'question';
     $paginator = new Paginator($request, $this->getThreadService()->searchThreadCount($conditions), 20);
     $questions = $this->getThreadService()->searchThreads($conditions, 'createdNotStick', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $unPostedQuestion = array();
     foreach ($questions as $key => $value) {
         if ($value['postNum'] == 0) {
             $unPostedQuestion[] = $value;
         } else {
             $threadPostsNum = $this->getThreadService()->getThreadPostCountByThreadId($value['id']);
             $userPostsNum = $this->getThreadService()->getPostCountByuserIdAndThreadId($value['userId'], $value['id']);
             if ($userPostsNum == $threadPostsNum) {
                 $unPostedQuestion[] = $value;
             }
         }
     }
     if ($postStatus == 'unPosted') {
         $questions = $unPostedQuestion;
     }
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($questions, 'userId'));
     $courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($questions, 'courseId'));
     $lessons = $this->getCourseService()->findLessonsByIds(ArrayToolkit::column($questions, 'lessonId'));
     return $this->render('TopxiaAdminBundle:CourseQuestion:index.html.twig', array('paginator' => $paginator, 'questions' => $questions, 'users' => $users, 'courses' => $courses, 'lessons' => $lessons, 'type' => $postStatus));
 }
 public function pointsBillAction(Request $request)
 {
     $user = $this->getCurrentUser();
     $conditions = array('userId' => $user['id']);
     $conditions['startTime'] = 0;
     $conditions['endTime'] = time();
     switch ($request->get('lastHowManyMonths')) {
         case 'oneWeek':
             $conditions['startTime'] = $conditions['endTime'] - 7 * 24 * 3600;
             break;
         case 'twoWeeks':
             $conditions['startTime'] = $conditions['endTime'] - 14 * 24 * 3600;
             break;
         case 'oneMonth':
             $conditions['startTime'] = $conditions['endTime'] - 30 * 24 * 3600;
             break;
         case 'twoMonths':
             $conditions['startTime'] = $conditions['endTime'] - 60 * 24 * 3600;
             break;
         case 'threeMonths':
             $conditions['startTime'] = $conditions['endTime'] - 90 * 24 * 3600;
             break;
     }
     $paginator = new Paginator($request, $this->getPointsService()->searchFlowsCount($conditions), 20);
     $cashes = $this->getPointsService()->searchFlows($conditions, array('ID', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $conditions['type'] = 'inflow';
     $amountInflow = $this->getPointsService()->analysisAmount($conditions);
     $conditions['type'] = 'outflow';
     $amountOutflow = $this->getPoinsService()->analysisAmount($conditions);
     return $this->render('TopxiaWebBundle:Points:points_bill.html.twig', array('cashes' => $cashes, 'paginator' => $paginator, 'amountInflow' => $amountInflow ?: 0, 'amountOutflow' => $amountOutflow ?: 0));
 }
 public function indexAction(Request $request, $id)
 {
     $course = $this->getCourseService()->tryManageCourse($id);
     $type = $request->query->get('type');
     $type = in_array($type, array('courselesson', 'coursematerial')) ? $type : 'courselesson';
     $conditions = array('targetType' => $type, 'targetId' => $course['id']);
     if (array_key_exists('targetId', $conditions) && !empty($conditions['targetId'])) {
         $course = $this->getCourseService()->getCourse($conditions['targetId']);
         if ($course['parentId'] > 0 && $course['locked'] == 1) {
             $conditions['targetId'] = $course['parentId'];
         }
     }
     $paginator = new Paginator($request, $this->getUploadFileService()->searchFileCount($conditions), 20);
     $files = $this->getUploadFileService()->searchFiles($conditions, 'latestCreated', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     foreach ($files as $key => $file) {
         $files[$key]['metas2'] = json_decode($file['metas2'], true) ?: array();
         $files[$key]['convertParams'] = json_decode($file['convertParams']) ?: array();
         $useNum = $this->getCourseService()->searchLessonCount(array('mediaId' => $file['id']));
         $manageFilesUseNum = $this->getMaterialService()->getMaterialCountByFileId($file['id']);
         if ($files[$key]['targetType'] == 'coursematerial') {
             $files[$key]['useNum'] = $manageFilesUseNum;
         } else {
             $files[$key]['useNum'] = $useNum;
         }
     }
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($files, 'updatedUserId'));
     $storageSetting = $this->getSettingService()->get("storage");
     return $this->render('TopxiaWebBundle:CourseFileManage:index.html.twig', array('type' => $type, 'course' => $course, 'courseLessons' => $files, 'users' => ArrayToolkit::index($users, 'id'), 'paginator' => $paginator, 'now' => time(), 'storageSetting' => $storageSetting));
 }
Beispiel #7
0
 public function logsAction(Request $request)
 {
     $paginator = new Paginator($this->get('request'), $this->getAppService()->findLogCount(), 30);
     $logs = $this->getAppService()->findLogs($paginator->getOffsetCount(), $paginator->getPerPageCount());
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($logs, 'userId'));
     return $this->render('TopxiaAdminBundle:App:logs.html.twig', array('logs' => $logs, 'users' => $users));
 }
 public function indexAction(Request $request)
 {
     $conditions = $request->query->all();
     $conditions = ArrayToolkit::parts($conditions, array('nickname'));
     $paginator = new Paginator($this->get('request'), $this->getUserService()->searchUserCount($conditions), 20);
     $users = $this->getUserService()->searchUsers($conditions, array('id', 'ASC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $inviteInformations = array();
     foreach ($users as $key => $user) {
         $invitedRecords = $this->getInviteRecordService()->findRecordsByInviteUserId($user['id']);
         $payingUserCount = 0;
         $coinAmountTotalPrice = 0;
         $amountTotalPrice = 0;
         $totalPrice = 0;
         $totalCoinAmount = 0;
         $totalAmount = 0;
         foreach ($invitedRecords as $keynum => $invitedRecord) {
             $coinAmountTotalPrice = $this->getOrderService()->analysisCoinAmount(array('userId' => $invitedRecord['invitedUserId'], 'coinAmount' => 0, 'status' => 'paid', 'paidStartTime' => $invitedRecord['inviteTime']));
             $amountTotalPrice = $this->getOrderService()->analysisAmount(array('userId' => $invitedRecord['invitedUserId'], 'amount' => 0, 'status' => 'paid', 'paidStartTime' => $invitedRecord['inviteTime']));
             $tempPrice = $this->getOrderService()->analysisTotalPrice(array('userId' => $invitedRecord['invitedUserId'], 'status' => 'paid', 'paidStartTime' => $invitedRecord['inviteTime']));
             if ($coinAmountTotalPrice || $amountTotalPrice) {
                 $payingUserCount = $payingUserCount + 1;
             }
             $totalCoinAmount = $totalCoinAmount + $coinAmountTotalPrice;
             $totalAmount = $totalAmount + $amountTotalPrice;
             $totalPrice = $totalPrice + $tempPrice;
         }
         $inviteInformations[] = array('id' => $user['id'], 'nickname' => $user['nickname'], 'payingUserCount' => $payingUserCount, 'payingUserTotalPrice' => $totalPrice, 'coinAmountPrice' => $totalCoinAmount, 'amountPrice' => $totalAmount, 'count' => count($invitedRecords));
     }
     return $this->render('TopxiaAdminBundle:Invite:index.html.twig', array('paginator' => $paginator, 'inviteInformations' => $inviteInformations));
 }
 public function indexBatchAction(Request $request)
 {
     $conditions = $request->query->all();
     $paginator = new Paginator($this->get('request'), $this->getMoneyCardService()->searchBatchsCount($conditions), 20);
     $batchs = $this->getMoneyCardService()->searchBatchs($conditions, array('id', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     return $this->render('TopxiaAdminBundle:MoneyCard:index-batch.html.twig', array('batchs' => $batchs, 'paginator' => $paginator));
 }
 public function exploreAction(Request $request)
 {
     if (!$this->setting('course.live_course_enabled')) {
         return $this->createMessageResponse('info', '直播频道已关闭');
     }
     $recenntLessonsCondition = array('status' => 'published', 'endTimeGreaterThan' => time());
     $paginator = new Paginator($this->get('request'), $this->getCourseService()->searchLessonCount($recenntLessonsCondition), 30);
     $recentlessons = $this->getCourseService()->searchLessons($recenntLessonsCondition, array('startTime', 'ASC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($recentlessons, 'courseId'));
     $recentCourses = array();
     foreach ($recentlessons as $lesson) {
         $course = $courses[$lesson['courseId']];
         if ($course['status'] != 'published') {
             continue;
         }
         $course['lesson'] = $lesson;
         $recentCourses[] = $course;
     }
     $liveCourses = $this->getCourseService()->searchCourses(array('status' => 'published', 'type' => 'live'), 'lastest', 0, 10);
     $userIds = array();
     foreach ($liveCourses as $course) {
         $userIds = array_merge($userIds, $course['teacherIds']);
     }
     $users = $this->getUserService()->findUsersByIds($userIds);
     $default = $this->getSettingService()->get('default', array());
     return $this->render('TopxiaWebBundle:LiveCourse:index.html.twig', array('recentCourses' => $recentCourses, 'liveCourses' => $liveCourses, 'users' => $users, 'paginator' => $paginator, 'default' => $default));
 }
 public function indexAction(Request $request, $status)
 {
     $courses = $this->getCourseService()->searchCourses(array('type' => 'live', 'status' => 'published'), $sort = 'latest', 0, 1000);
     $courseIds = ArrayToolkit::column($courses, 'id');
     $courses = ArrayToolkit::index($courses, 'id');
     $conditions['type'] = "live";
     switch ($status) {
         case 'coming':
             $conditions['startTimeGreaterThan'] = time();
             break;
         case 'end':
             $conditions['endTimeLessThan'] = time();
             break;
         case 'underway':
             $conditions['startTimeLessThan'] = time();
             $conditions['endTimeGreaterThan'] = time();
             break;
     }
     $conditions['courseIds'] = $courseIds;
     $conditions['status'] = 'published';
     $paginator = new Paginator($request, $this->getCourseService()->searchLessonCount($conditions), 20);
     if ($status == 'end') {
         $lessons = $this->getCourseService()->searchLessons($conditions, array('startTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     } else {
         $lessons = $this->getCourseService()->searchLessons($conditions, array('startTime', 'ASC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     }
     return $this->render('TopxiaAdminBundle:LiveCourse:index.html.twig', array('status' => $status, 'lessons' => $lessons, 'courses' => $courses, 'paginator' => $paginator));
 }
 public function showAction(Request $request, $id)
 {
     $buyer = $this->getCurrentUser();
     $ex = $request->query->all();
     $myexchangeid = $ex['ex'];
     $applyid = $ex[applyid];
     $exchange = $this->getExchangeService()->getExchange($id);
     $condition = array('exchangeId' => $exchange['id'], 'userId' => $buyer['id']);
     $buyerapplys = $this->getApplyService()->searchApplys($condition, 'latest', 0, 10);
     $buyerapplyIds = ArrayToolkit::column($buyerapplys, 'id');
     $sellerId = $exchange['userId'];
     $seller = $this->getUserService()->getUser($sellerId);
     if (empty($exchange)) {
         throw $this->createNotFoundException("宝贝不存在");
     }
     $conditions = array('exchangeId' => $exchange['id']);
     $paginator = new Paginator($this->get('request'), $this->getApplyService()->searchApplyCount($conditions), 5);
     $applys = $this->getApplyService()->searchApplys($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $applysIds = ArrayToolkit::column($applys, 'id');
     // dump($applysIds);
     //  die;
     $flag = 0;
     if (!empty($applysIds)) {
         foreach ($buyerapplyIds as $val) {
             if (in_array($val, $applysIds)) {
                 $flag = 1;
                 break;
             }
         }
     }
     $userIds = ArrayToolkit::column($applys, 'userId');
     $users = $this->getUserService()->findUsersByIds($userIds);
     return $this->render("TopxiaWebBundle:Exchange:show.html.twig", array('flag' => $flag, 'seller' => $seller, 'applyid' => $applyid, 'myexchangeid' => $myexchangeid, 'exchange' => $exchange, 'applys' => $applys, 'users' => $users, 'paginator' => $paginator));
 }
 public function ordersAction(Request $request)
 {
     $fields = $request->query->all();
     $conditions = array();
     if (!empty($fields)) {
         $conditions = $fields;
     }
     if (isset($conditions['keywordType'])) {
         if ($conditions['keywordType'] == 'userName') {
             $conditions['keywordType'] = 'userId';
             $userFindbyNickName = $this->getUserService()->getUserByNickname($conditions['keyword']);
             $conditions['keyword'] = $userFindbyNickName ? $userFindbyNickName['id'] : -1;
         }
     }
     if (isset($conditions['keywordType'])) {
         $conditions[$conditions['keywordType']] = $conditions['keyword'];
         unset($conditions['keywordType']);
         unset($conditions['keyword']);
     }
     $paginator = new Paginator($this->get('request'), $this->getCashOrdersService()->searchOrdersCount($conditions), 20);
     $orders = $this->getCashOrdersService()->searchOrders($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $userIds = ArrayToolkit::column($orders, 'userId');
     $users = $this->getUserService()->findUsersByIds($userIds);
     return $this->render('TopxiaAdminBundle:Coin:coin-orders.html.twig', array('users' => $users, 'orders' => $orders, 'paginator' => $paginator));
 }
 public function indexAction(Request $request)
 {
     $fields = $request->query->all();
     $conditions = array('roles' => '', 'keywordType' => '', 'keyword' => '', 'keywordUserType' => '');
     if (empty($fields)) {
         $fields = array();
     }
     $conditions = array_merge($conditions, $fields);
     //根据mobile查询user_profile获得userIds
     if (isset($conditions['keywordType']) && $conditions['keywordType'] == 'verifiedMobile') {
         $profilesCount = $this->getUserService()->searchUserProfileCount(array('mobile' => $conditions['keyword']));
         $userProfiles = $this->getUserService()->searchUserProfiles(array('mobile' => $conditions['keyword']), array('id', 'DESC'), 0, $profilesCount);
         $userIds = ArrayToolkit::column($userProfiles, 'id');
         if (!empty($userIds)) {
             unset($conditions['keywordType']);
             unset($conditions['keyword']);
             $conditions['userIds'] = $userIds;
         }
     }
     $userCount = $this->getUserService()->searchUserCount($conditions);
     $paginator = new Paginator($this->get('request'), $userCount, 20);
     $users = $this->getUserService()->searchUsers($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $app = $this->getAppService()->findInstallApp("UserImporter");
     $showUserExport = false;
     if (!empty($app) && array_key_exists('version', $app)) {
         $showUserExport = version_compare($app['version'], "1.0.2", ">=");
     }
     $userIds = ArrayToolkit::column($users, 'id');
     $profiles = $this->getUserService()->findUserProfilesByIds($userIds);
     return $this->render('TopxiaAdminBundle:User:index.html.twig', array('users' => $users, 'userCount' => $userCount, 'paginator' => $paginator, 'profiles' => $profiles, 'showUserExport' => $showUserExport));
 }
 public function showAction(Request $request, $courseId, $threadId)
 {
     list($course, $member) = $this->buildLayoutDataWithTakenAccess($request, $courseId);
     $user = $this->getCurrentUser();
     if ($member && !$this->getCourseService()->isMemberNonExpired($course, $member)) {
         $isMemberNonExpired = false;
     } else {
         $isMemberNonExpired = true;
     }
     $thread = $this->getThreadService()->getThread($course['id'], $threadId);
     if (empty($thread)) {
         throw $this->createNotFoundException("话题不存在,或已删除。");
     }
     $paginator = new Paginator($request, $this->getThreadService()->getThreadPostCount($course['id'], $thread['id']), 30);
     $posts = $this->getThreadService()->findThreadPosts($thread['courseId'], $thread['id'], 'default', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     if ($thread['type'] == 'question' && $paginator->getCurrentPage() == 1) {
         $elitePosts = $this->getThreadService()->findThreadElitePosts($thread['courseId'], $thread['id'], 0, 10);
     } else {
         $elitePosts = array();
     }
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($posts, 'userId'));
     $this->getThreadService()->hitThread($courseId, $threadId);
     $isManager = $this->getCourseService()->canManageCourse($course['id']);
     $lesson = $this->getCourseService()->getCourseLesson($course['id'], $thread['lessonId']);
     return $this->render("TopxiaWebBundle:CourseThread:show.html.twig", array('course' => $course, 'member' => $member, 'lesson' => $lesson, 'thread' => $thread, 'author' => $this->getUserService()->getUser($thread['userId']), 'posts' => $posts, 'elitePosts' => $elitePosts, 'users' => $users, 'isManager' => $isManager, 'isMemberNonExpired' => $isMemberNonExpired, 'paginator' => $paginator));
 }
 public function listAction(Request $request, $id)
 {
     $classroom = $this->getClassroomService()->getClassroom($id);
     $courses = $this->getClassroomService()->findActiveCoursesByClassroomId($id);
     $coursesNum = count($courses);
     $user = $this->getCurrentUser();
     $member = $user ? $this->getClassroomService()->getClassroomMember($classroom['id'], $user['id']) : null;
     if (!$this->getClassroomService()->canLookClassroom($classroom['id'])) {
         return $this->createMessageResponse('info', "非常抱歉,您无权限访问该{$classroomSetting['name']},如有需要请联系客服", '', 3, $this->generateUrl('homepage'));
     }
     $conditions = array('classroomId' => $id);
     $reviewsNum = $this->getClassroomReviewService()->searchReviewCount($conditions);
     $paginator = new Paginator($this->get('request'), $reviewsNum, 20);
     $reviews = $this->getClassroomReviewService()->searchReviews($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $reviewUserIds = ArrayToolkit::column($reviews, 'userId');
     $reviewUsers = $this->getUserService()->findUsersByIds($reviewUserIds);
     $classroom = $this->getClassroomService()->getClassroom($id);
     $review = $this->getClassroomReviewService()->getUserClassroomReview($user['id'], $classroom['id']);
     $layout = 'ClassroomBundle:Classroom:layout.html.twig';
     if ($member && !$member['locked']) {
         $layout = 'ClassroomBundle:Classroom:join-layout.html.twig';
     }
     if (!$classroom) {
         $classroomDescription = array();
     } else {
         $classroomDescription = $classroom['about'];
         $classroomDescription = strip_tags($classroomDescription, '');
         $classroomDescription = preg_replace("/ /", "", $classroomDescription);
     }
     return $this->render("ClassroomBundle:Classroom\\Review:list.html.twig", array('classroom' => $classroom, 'courses' => $courses, 'paginator' => $paginator, 'reviewsNum' => $reviewsNum, 'reviews' => $reviews, 'userReview' => $review, 'reviewSaveUrl' => $this->generateUrl('classroom_review_create', array('id' => $id)), 'users' => $reviewUsers, 'member' => $member, 'layout' => $layout, 'classroomDescription' => $classroomDescription, 'canReview' => $this->isClassroomMember($classroom, $user['id'])));
 }
Beispiel #17
0
 public function ordersAction(Request $request)
 {
     $fields = $request->query->all();
     $conditions = array();
     if (!empty($fields)) {
         $conditions = $fields;
     }
     if (isset($conditions['keywordType'])) {
         if ($conditions['keywordType'] == 'userName') {
             $conditions['keywordType'] = 'userId';
             $userFindbyNickName = $this->getUserService()->getUserByNickname($conditions['keyword']);
             $conditions['keyword'] = $userFindbyNickName ? $userFindbyNickName['id'] : -1;
         }
     }
     if (isset($conditions['keywordType'])) {
         $conditions[$conditions['keywordType']] = $conditions['keyword'];
         unset($conditions['keywordType']);
         unset($conditions['keyword']);
     }
     if (!empty($conditions['startDateTime']) && !empty($conditions['endDateTime'])) {
         $conditions['startTime'] = strtotime($conditions['startDateTime']);
         $conditions['endTime'] = strtotime($conditions['endDateTime']);
     }
     $paginator = new Paginator($this->get('request'), $this->getCashOrdersService()->searchOrdersCount($conditions), 20);
     $orders = $this->getCashOrdersService()->searchOrders($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     foreach ($orders as $index => $expiredOrderToBeUpdated) {
         if ($expiredOrderToBeUpdated["createdTime"] + 48 * 60 * 60 < time() && $expiredOrderToBeUpdated["status"] == 'created') {
             $this->getOrderService()->cancelOrder($expiredOrderToBeUpdated['id']);
             $orders[$index]['status'] = 'cancelled';
         }
     }
     $userIds = ArrayToolkit::column($orders, 'userId');
     $users = $this->getUserService()->findUsersByIds($userIds);
     return $this->render('TopxiaAdminBundle:Coin:coin-orders.html.twig', array('request' => $request, 'users' => $users, 'orders' => $orders, 'paginator' => $paginator));
 }
 public function learnAction(Request $request, $id)
 {
     $user = $this->getUserService()->getUser($id);
     $paginator = new Paginator($this->get('request'), $this->getCourseService()->findUserLearnCourseCount($user['id']), 10);
     $courses = $this->getCourseService()->findUserLearnCourses($user['id'], $paginator->getOffsetCount(), $paginator->getPerPageCount());
     return $this->render('TopxiaAdminBundle:User:user-courses.html.twig', array('user' => $user, 'courses' => $courses));
 }
Beispiel #19
0
 public function indexAction()
 {
     $conditions = array('roles' => 'ROLE_TEACHER', 'locked' => 0);
     $paginator = new Paginator($this->get('request'), $this->getUserService()->searchUserCount($conditions), 20);
     $teachers = $this->getUserService()->searchUsers($conditions, array('promotedTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $profiles = $this->getUserService()->findUserProfilesByIds(ArrayToolkit::column($teachers, 'id'));
     return $this->render('TopxiaWebBundle:Teacher:index.html.twig', array('teachers' => $teachers, 'profiles' => $profiles, 'paginator' => $paginator));
 }
Beispiel #20
0
 public function indexAction(Request $request)
 {
     $fields = $request->query->all();
     $fields = ArrayToolkit::filter($fields, array('nextExcutedStartTime' => '', 'nextExcutedEndTime' => '', 'name' => '', 'cycle' => ''));
     $paginator = new Paginator($this->get('request'), $this->getJobService()->searchJobsCount($fields), 30);
     $jobs = $this->getJobService()->searchJobs($fields, 'nextExcutedTime', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     return $this->render('TopxiaAdminBundle:System:jobs.html.twig', array('jobs' => $jobs, 'paginator' => $paginator));
 }
 public function refundsAction(Request $request)
 {
     $user = $this->getCurrentUser();
     $paginator = new Paginator($request, $this->getOrderService()->findUserRefundCount($user['id']), 20);
     $refunds = $this->getOrderService()->findUserRefunds($user['id'], $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $orders = $this->getOrderService()->findOrdersByIds(ArrayToolkit::column($refunds, 'orderId'));
     return $this->render('TopxiaWebBundle:MyOrder:refunds.html.twig', array('refunds' => $refunds, 'orders' => $orders, 'paginator' => $paginator));
 }
Beispiel #22
0
 public function indexAction(Request $request)
 {
     $conditions = $request->query->all();
     $paginator = new Paginator($request, $this->getCourseDiskService()->searchFileCount($conditions), 20);
     $files = $this->getCourseDiskService()->searchFiles($conditions, 'latestCreated', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($files, 'userId'));
     return $this->render('TopxiaAdminBundle:CourseDisk:index.html.twig', array('files' => $files, 'paginator' => $paginator, 'users' => $users));
 }
 public function indexAction(Request $request, $id)
 {
     list($course, $member) = $this->buildCourseLayoutData($request, $id);
     $paginator = new Paginator($request, $this->getMaterialService()->getMaterialCount($id), 20);
     $materials = $this->getMaterialService()->findMaterialsByTargetId($id, $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $teachers = $this->getUserService()->findUsersByIds(ArrayToolkit::column($materials, 'userId'));
     return $this->render("TopxiaWebBundle:CourseMaterial:material-index.html.twig", array('course' => $course, 'member' => $member, 'teachers' => $teachers, 'materials' => $materials, 'paginator' => $paginator));
 }
 public function showUserLoginRecordAction(Request $request, $id)
 {
     $user = $this->getUserService()->getUser($id);
     $paginator = new Paginator($this->get('request'), $this->getLogService()->searchLogCount(array('userId' => $user['id'])), 8);
     $loginRecords = $this->getLogService()->searchLogs(array('userId' => $user['id']), 'created', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $loginRecords = ConvertIpToolkit::ConvertIps($loginRecords);
     return $this->render('TopxiaAdminBundle:LoginRecord:login-record-details.html.twig', array('user' => $user, 'loginRecords' => $loginRecords, 'loginRecordPaginator' => $paginator));
 }
Beispiel #25
0
 public function indexAction(Request $request)
 {
     $fields = $request->query->all();
     $conditions = array('roles' => 'ROLE_TEACHER');
     $paginator = new Paginator($this->get('request'), $this->getUserService()->searchUserCount($conditions), 20);
     $users = $this->getUserService()->searchUsers($conditions, array('promotedTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     return $this->render('TopxiaAdminBundle:Teacher:index.html.twig', array('users' => $users, 'paginator' => $paginator));
 }
 public function approvedAction(Request $request)
 {
     $paginator = new Paginator($this->get('request'), $this->getUserService()->getUserCountByApprovalStatus('approved'), 20);
     $users = $this->getUserService()->getUsersByApprovalStatus('approved', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $userProfiles = $this->getUserService()->findUserProfilesByIds(ArrayToolkit::column($users, 'id'));
     $userProfiles = ArrayToolkit::index($userProfiles, 'id');
     return $this->render('TopxiaAdminBundle:User:approved.html.twig', array('users' => $users, 'paginator' => $paginator, 'userProfiles' => $userProfiles));
 }
Beispiel #27
0
 public function payoutAction(Request $request)
 {
     $user = $this->getCurrentUser();
     $conditions = array('userId' => $user['id'], 'type' => 'payout', 'status' => 'finished');
     $paginator = new Paginator($request, $this->getMoneyService()->searchMoneyRecordsCount($conditions), 15);
     $payoutRecords = $this->getMoneyService()->searchMoneyRecords($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     return $this->render('TopxiaWebBundle:MoneyRecord:payout.html.twig', array('payoutRecords' => $payoutRecords, 'paginator' => $paginator));
 }
Beispiel #28
0
 public function subpostsAction(Request $request, $threadId, $postId, $less = false)
 {
     $post = $this->getThreadService()->getPost($postId);
     $paginator = new Paginator($request, $this->getThreadService()->findPostsCountByParentId($postId), 10);
     $paginator->setBaseUrl($this->generateUrl('thread_post_subposts', array('threadId' => $post['threadId'], 'postId' => $postId)));
     $posts = $this->getThreadService()->findPostsByParentId($postId, $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($posts, 'userId'));
     return $this->render('TopxiaWebBundle:Thread:subposts.html.twig', array('parentId' => $postId, 'posts' => $posts, 'users' => $users, 'paginator' => $paginator, 'less' => $less, 'service' => $this->getThreadService()));
 }
Beispiel #29
0
 public function indexAction(Request $request)
 {
     $conditions = $request->query->all();
     $paginator = new Paginator($request, $this->getReviewService()->searchReviewsCount($conditions), 20);
     $reviews = $this->getReviewService()->searchReviews($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($reviews, 'userId'));
     $courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($reviews, 'courseId'));
     return $this->render('TopxiaAdminBundle:Review:index.html.twig', array('reviews' => $reviews, 'users' => $users, 'courses' => $courses, 'paginator' => $paginator));
 }
Beispiel #30
0
 public function indexAction(Request $request)
 {
     $user = $this->getCurrentUser();
     $conditions = array('userId' => $user['id'], 'noteNumGreaterThan' => 0.1);
     $paginator = new Paginator($request, $this->getCourseService()->searchMemberCount($conditions), 10);
     $courseMembers = $this->getCourseService()->searchMember($conditions, $paginator->getOffsetCount(), $paginator->getPerPageCount());
     $courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($courseMembers, 'courseId'));
     return $this->render('TopxiaWebBundle:MyNotebook:index.html.twig', array('courseMembers' => $courseMembers, 'paginator' => $paginator, 'courses' => $courses));
 }