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


PHP ArrayToolkit::index方法代码示例

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


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

示例1: mobileAction

 public function mobileAction(Request $request)
 {
     $mobile = $this->getSettingService()->get('mobile', array());
     $default = array('enabled' => 0, 'about' => '', 'logo' => '', 'splash1' => '', 'splash2' => '', 'splash3' => '', 'splash4' => '', 'splash5' => '', 'banner1' => '', 'banner2' => '', 'banner3' => '', 'banner4' => '', 'banner5' => '', 'bannerUrl1' => '', 'bannerUrl2' => '', 'bannerUrl3' => '', 'bannerUrl4' => '', 'bannerUrl5' => '', 'bannerClick1' => '', 'bannerClick2' => '', 'bannerClick3' => '', 'bannerClick4' => '', 'bannerClick5' => '', 'bannerJumpToCourseId1' => ' ', 'bannerJumpToCourseId2' => ' ', 'bannerJumpToCourseId3' => ' ', 'bannerJumpToCourseId4' => ' ', 'bannerJumpToCourseId5' => ' ', 'notice' => '', 'courseIds' => '');
     $mobile = array_merge($default, $mobile);
     if ($request->getMethod() == 'POST') {
         $mobile = $request->request->all();
         $this->getSettingService()->set('mobile', $mobile);
         $this->getLogService()->info('system', 'update_settings', "更新移动客户端设置", $mobile);
         $this->setFlashMessage('success', '移动客户端设置已保存!');
     }
     $courseIds = explode(",", $mobile['courseIds']);
     $courses = $this->getCourseService()->findCoursesByIds($courseIds);
     $courses = ArrayToolkit::index($courses, 'id');
     $sortedCourses = array();
     foreach ($courseIds as $value) {
         if (!empty($value)) {
             $sortedCourses[] = $courses[$value];
         }
     }
     $bannerCourse1 = $mobile['bannerJumpToCourseId1'] != " " ? $this->getCourseService()->getCourse($mobile['bannerJumpToCourseId1']) : null;
     $bannerCourse2 = $mobile['bannerJumpToCourseId2'] != " " ? $this->getCourseService()->getCourse($mobile['bannerJumpToCourseId2']) : null;
     $bannerCourse3 = $mobile['bannerJumpToCourseId3'] != " " ? $this->getCourseService()->getCourse($mobile['bannerJumpToCourseId3']) : null;
     $bannerCourse4 = $mobile['bannerJumpToCourseId4'] != " " ? $this->getCourseService()->getCourse($mobile['bannerJumpToCourseId4']) : null;
     $bannerCourse5 = $mobile['bannerJumpToCourseId5'] != " " ? $this->getCourseService()->getCourse($mobile['bannerJumpToCourseId5']) : null;
     return $this->render('TopxiaAdminBundle:System:mobile.html.twig', array('mobile' => $mobile, 'courses' => $sortedCourses, "bannerCourse1" => $bannerCourse1, "bannerCourse2" => $bannerCourse2, "bannerCourse3" => $bannerCourse3, "bannerCourse4" => $bannerCourse4, "bannerCourse5" => $bannerCourse5));
 }
开发者ID:liugang19890719,项目名称:www.zesow.com,代码行数:27,代码来源:SettingController.php

示例2: coursesAction

 public function coursesAction(Request $request, $filter)
 {
     $user = $this->getCurrentUser();
     if (!$user->isTeacher()) {
         return $this->createMessageResponse('error', '您不是老师,不能查看此页面!');
     }
     $conditions = array('userId' => $user['id']);
     if ($filter == 'normal') {
         $conditions["parentId"] = 0;
     }
     if ($filter == 'classroom') {
         $conditions["parentId_GT"] = 0;
     }
     $paginator = new Paginator($this->get('request'), $this->getCourseService()->findUserTeachCourseCount($conditions, false), 12);
     $courses = $this->getCourseService()->findUserTeachCourses($conditions, $paginator->getOffsetCount(), $paginator->getPerPageCount(), false);
     $classrooms = array();
     if ($filter == 'classroom') {
         $classrooms = $this->getClassroomService()->findClassroomsByCoursesIds(ArrayToolkit::column($courses, 'id'));
         $classrooms = ArrayToolkit::index($classrooms, 'courseId');
         foreach ($classrooms as $key => $classroom) {
             $classroomInfo = $this->getClassroomService()->getClassroom($classroom['classroomId']);
             $classrooms[$key]['classroomTitle'] = $classroomInfo['title'];
         }
     }
     $courseSetting = $this->getSettingService()->get('course', array());
     return $this->render('TopxiaWebBundle:MyTeaching:teaching.html.twig', array('courses' => $courses, 'classrooms' => $classrooms, 'paginator' => $paginator, 'live_course_enabled' => empty($courseSetting['live_course_enabled']) ? 0 : $courseSetting['live_course_enabled'], 'filter' => $filter));
 }
开发者ID:ZHONG-GUO,项目名称:EduSoho,代码行数:27,代码来源:MyTeachingController.php

示例3: indexAction

 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));
 }
开发者ID:Loyalsoldier,项目名称:8000wei-v3,代码行数:29,代码来源:CourseFileManageController.php

示例4: indexAction

 public function indexAction(Request $request, $courseId)
 {
     $course = $this->getCourseService()->getCourse($courseId);
     $lessons = $this->getCourseService()->getCourseLessons($courseId);
     $lessons = ArrayToolkit::index($lessons, 'homeworkId');
     $homeworks = array();
     $homeworkService = $this->getHomeworkService();
     $conditions = array();
     $conditions['course_id'] = $course['id'];
     $orderBy = array();
     $orderBy[] = 'create_at';
     $orderBy[] = 'DESC';
     $count = $homeworkService->searchHomeworksCount($conditions);
     $page_size = 20;
     $paginator = new Paginator($request, $count, $page_size);
     $start = $paginator->getOffsetCount();
     $limit = $paginator->getPerPageCount();
     $homeworks = $homeworkService->searchHomeworks($conditions, $orderBy, $start, $limit);
     $homeworks = $this->addLessonName($homeworks, $lessons);
     $storageSetting = $this->getSettingService()->get("storage");
     $tpl = 'HomeworkBundle:Homework:index.html.twig';
     $assignBox = array();
     $assignBox['course'] = $course;
     $assignBox['homeworks'] = $homeworks;
     $assignBox['paginator'] = $paginator;
     $assignBox['now'] = $_SERVER['REQUEST_TIME'];
     $assignBox['storageSetting'] = $storageSetting;
     return $this->render($tpl, $assignBox);
 }
开发者ID:latticet,项目名称:EduSoho_jb51,代码行数:29,代码来源:HomeworkController.php

示例5: popularCoursesAction

 public function popularCoursesAction(Request $request)
 {
     $dateType = $request->query->get('dateType');
     $currentDay = $this->weekday(time());
     if ($dateType == "today") {
         $startTime = strtotime('today');
         $endTime = strtotime('tomorrow');
     }
     if ($dateType == "yesterday") {
         $startTime = strtotime('yesterday');
         $endTime = strtotime('today');
     }
     if ($dateType == "this_week") {
         if ($currentDay == '星期日') {
             $startTime = strtotime('Monday last week');
             $endTime = strtotime('Monday this week');
         } else {
             $startTime = strtotime('Monday this week');
             $endTime = strtotime('Monday next week');
         }
     }
     if ($dateType == "last_week") {
         if ($currentDay == '星期日') {
             $startTime = strtotime('Monday last week') - 7 * 24 * 60 * 60;
             $endTime = strtotime('Monday this week') - 7 * 24 * 60 * 60;
         } else {
             $startTime = strtotime('Monday last week');
             $endTime = strtotime('Monday this week');
         }
     }
     if ($dateType == "this_month") {
         $startTime = strtotime('first day of this month midnight');
         $endTime = strtotime('first day of next month midnight');
     }
     if ($dateType == "last_month") {
         $startTime = strtotime('first day of last month midnight');
         $endTime = strtotime('first day of this month midnight');
     }
     $members = $this->getCourseService()->countMembersByStartTimeAndEndTime($startTime, $endTime);
     $courseIds = ArrayToolkit::column($members, "courseId");
     $courses = $this->getCourseService()->findCoursesByIds($courseIds);
     $courses = ArrayToolkit::index($courses, "id");
     $sortedCourses = array();
     $orders = $this->getOrderService()->sumOrderAmounts($startTime, $endTime, $courseIds);
     $orders = ArrayToolkit::index($orders, "targetId");
     foreach ($members as $key => $value) {
         $course = array();
         $course['title'] = $courses[$value["courseId"]]['title'];
         $course['courseId'] = $courses[$value["courseId"]]['id'];
         $course['addedStudentNum'] = $value['co'];
         $course['studentNum'] = $courses[$value["courseId"]]['studentNum'];
         if (isset($orders[$value["courseId"]])) {
             $course['addedMoney'] = $orders[$value["courseId"]]['amount'];
         } else {
             $course['addedMoney'] = 0;
         }
         $sortedCourses[] = $course;
     }
     return $this->render('TopxiaAdminBundle:Default:popular-courses-table.html.twig', array('sortedCourses' => $sortedCourses));
 }
开发者ID:latticet,项目名称:EduSoho_jb51,代码行数:60,代码来源:DefaultController.php

示例6: indexAction

 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));
 }
开发者ID:styling,项目名称:LeesPharm,代码行数:28,代码来源:LiveCourseController.php

示例7: indexAction

 public function indexAction(Request $request, $id)
 {
     $course = $this->getCourseService()->tryManageCourse($id);
     $courseItems = $this->getCourseService()->getCourseItems($course['id']);
     $lessonIds = ArrayToolkit::column($courseItems, 'id');
     if ($this->isPluginInstalled('Homework')) {
         $exercises = $this->getServiceKernel()->createService('Homework:Homework.ExerciseService')->findExercisesByLessonIds($lessonIds);
         $homeworks = $this->getServiceKernel()->createService('Homework:Homework.HomeworkService')->findHomeworksByCourseIdAndLessonIds($course['id'], $lessonIds);
     }
     $mediaMap = array();
     foreach ($courseItems as $item) {
         if ($item['itemType'] != 'lesson') {
             continue;
         }
         if (empty($item['mediaId'])) {
             continue;
         }
         if (empty($mediaMap[$item['mediaId']])) {
             $mediaMap[$item['mediaId']] = array();
         }
         $mediaMap[$item['mediaId']][] = $item['id'];
     }
     $mediaIds = array_keys($mediaMap);
     $files = $this->getUploadFileService()->findFilesByIds($mediaIds);
     foreach ($files as $file) {
         $lessonIds = $mediaMap[$file['id']];
         foreach ($lessonIds as $lessonId) {
             $courseItems["lesson-{$lessonId}"]['mediaStatus'] = $file['convertStatus'];
         }
     }
     $default = $this->getSettingService()->get('default', array());
     return $this->render('TopxiaWebBundle:CourseLessonManage:index.html.twig', array('course' => $course, 'items' => $courseItems, 'exercises' => empty($exercises) ? array() : $exercises, 'homeworks' => empty($homeworks) ? array() : $homeworks, 'files' => ArrayToolkit::index($files, 'id'), 'default' => $default));
 }
开发者ID:bqx619,项目名称:edusoho_dev,代码行数:33,代码来源:CourseLessonManageController.php

示例8: exploreAction

 public function exploreAction(Request $request, $category)
 {
     $conditions = array('status' => 'published', 'private' => 0);
     $categoryArray = array();
     if (!empty($category)) {
         $categoryArray = $this->getCategoryService()->getCategoryByCode($category);
         $childrenIds = $this->getCategoryService()->findCategoryChildrenIds($categoryArray['id']);
         $categoryIds = array_merge($childrenIds, array($categoryArray['id']));
         $conditions['categoryIds'] = $categoryIds;
     }
     $paginator = new Paginator($this->get('request'), $this->getClassroomService()->searchClassroomsCount($conditions), 9);
     $classrooms = $this->getClassroomService()->searchClassrooms($conditions, array('createdTime', 'desc'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
     // $classroomIds = ArrayToolkit::column($classrooms, 'id');
     $allClassrooms = ArrayToolkit::index($classrooms, 'id');
     if (!$categoryArray) {
         $categoryArrayDescription = array();
     } else {
         $categoryArrayDescription = $categoryArray['description'];
         $categoryArrayDescription = strip_tags($categoryArrayDescription, '');
         $categoryArrayDescription = preg_replace("/ /", "", $categoryArrayDescription);
         $categoryArrayDescription = substr($categoryArrayDescription, 0, 100);
     }
     if (!$categoryArray) {
         $CategoryParent = '';
     } else {
         if (!$categoryArray['parentId']) {
             $CategoryParent = '';
         } else {
             $CategoryParent = $this->getCategoryService()->getCategory($categoryArray['parentId']);
         }
     }
     return $this->render("ClassroomBundle:Classroom:explore.html.twig", array('paginator' => $paginator, 'classrooms' => $classrooms, 'allClassrooms' => $allClassrooms, 'path' => 'classroom_explore', 'category' => $category, 'categoryArray' => $categoryArray, 'categoryArrayDescription' => $categoryArrayDescription, 'CategoryParent' => $CategoryParent));
 }
开发者ID:ZHONG-GUO,项目名称:EduSoho,代码行数:33,代码来源:ClassroomController.php

示例9: onSecurityInteractiveLogin

 /**
  * Do the magic.
  * 
  * @param InteractiveLoginEvent $event
  */
 public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
 {
     $user = ServiceKernel::instance()->getCurrentUser();
     list($courses, $courseMembers) = $this->getCourseService()->findWillOverdueCourses();
     $courseMembers = ArrayToolkit::index($courseMembers, "courseId");
     foreach ($courses as $key => $course) {
         $message = array('courseId' => $course['id'], 'courseTitle' => $course['title'], 'endtime' => date("Y年m月d日", $courseMembers[$course["id"]]["deadline"]));
         $this->getNotificationService()->notify($user["id"], "course-deadline", $message);
         $courseMemberId = $courseMembers[$course["id"]]["id"];
         $this->getCourseService()->updateCourseMember($courseMemberId, array("deadlineNotified" => 1));
     }
     $vipApp = $this->getAppService()->findInstallApp('Vip');
     if (!empty($vipApp) && version_compare($vipApp['version'], "1.0.5", ">=")) {
         $vipSetting = $this->getSettingService()->get('vip', array());
         if (array_key_exists("deadlineNotify", $vipSetting) && $vipSetting["deadlineNotify"] == 1) {
             $vip = $this->getVipService()->getMemberByUserId($user["id"]);
             $currentTime = time();
             if ($vip["deadlineNotified"] != 1 && $currentTime < $vip["deadline"] && $currentTime + $vipSetting["daysOfNotifyBeforeDeadline"] * 24 * 60 * 60 > $vip["deadline"]) {
                 $message = array('endtime' => date("Y年m月d日", $vip["deadline"]));
                 $this->getNotificationService()->notify($user["id"], "vip-deadline", $message);
                 $this->getVipService()->updateDeadlineNotified($vip["id"], 1);
             }
         }
     }
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:30,代码来源:GenerateNotificationHandler.php

示例10: listAction

 public function listAction(Request $request, $classroomId)
 {
     $classroom = $this->getClassroomService()->getClassroom($classroomId);
     $headTeacher = $this->getClassroomService()->findClassroomMembersByRole($classroomId, 'headTeacher', 0, 1);
     $assistants = $this->getClassroomService()->findClassroomMembersByRole($classroomId, 'assistant', 0, PHP_INT_MAX);
     $studentAssistants = $this->getClassroomService()->findClassroomMembersByRole($classroomId, 'studentAssistant', 0, PHP_INT_MAX);
     $members = $this->getClassroomService()->findClassroomMembersByRole($classroomId, 'teacher', 0, PHP_INT_MAX);
     $members = array_merge($headTeacher, $members, $assistants, $studentAssistants);
     $members = ArrayToolkit::index($members, 'userId');
     $teacherIds = ArrayToolkit::column($members, 'userId');
     $teachers = $this->getUserService()->findUsersByIds($teacherIds);
     $teachers = $this->sort($teachers, $members);
     $profiles = $this->getUserService()->findUserProfilesByIds($teacherIds);
     $user = $this->getCurrentUser();
     $myfollowings = $this->getUserService()->filterFollowingIds($user['id'], $teacherIds);
     $member = $user ? $this->getClassroomService()->getClassroomMember($classroom['id'], $user['id']) : null;
     $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\\Teacher:list.html.twig', array('layout' => $layout, 'canLook' => $this->getClassroomService()->canLookClassroom($classroom['id']), 'classroom' => $classroom, 'teachers' => $teachers, 'profiles' => $profiles, 'member' => $member, 'members' => $members, 'Myfollowings' => $myfollowings, 'classroomDescription' => $classroomDescription));
 }
开发者ID:ZHONG-GUO,项目名称:EduSoho,代码行数:29,代码来源:TeacherController.php

示例11: defaultCoursePictureCropAction

 public function defaultCoursePictureCropAction(Request $request)
 {
     if ($request->getMethod() == 'POST') {
         $options = $request->request->all();
         $data = $options["images"];
         $fileIds = ArrayToolkit::column($data, "id");
         $files = $this->getFileService()->getFilesByIds($fileIds);
         $files = ArrayToolkit::index($files, "id");
         $fileIds = ArrayToolkit::index($data, "type");
         $setting = $this->getSettingService()->get("default", array());
         $oldAvatars = array('course.png' => !empty($setting['course.png']) ? $setting['course.png'] : null);
         $setting['defaultCoursePicture'] = 1;
         unset($setting['defaultCoursePictureFileName']);
         $setting['course.png'] = $files[$fileIds["course.png"]["id"]]["uri"];
         $this->getSettingService()->set("default", $setting);
         $fileService = $this->getFileService();
         array_map(function ($oldAvatar) use($fileService) {
             if (!empty($oldAvatar)) {
                 $fileService->deleteFileByUri($oldAvatar);
             }
         }, $oldAvatars);
         return $this->redirect($this->generateUrl('admin_setting_course_avatar'));
     }
     $fileId = $request->getSession()->get("fileId");
     list($pictureUrl, $naturalSize, $scaledSize) = $this->getFileService()->getImgFileMetaInfo($fileId, 480, 270);
     return $this->render('TopxiaAdminBundle:System:default-course-picture-crop.html.twig', array('pictureUrl' => $pictureUrl, 'naturalSize' => $naturalSize, 'scaledSize' => $scaledSize));
 }
开发者ID:robert-li-2015,项目名称:EduSoho,代码行数:27,代码来源:SystemDefaultSettingController.php

示例12: getQuestionCountGroupByTypesAction

 public function getQuestionCountGroupByTypesAction(Request $request, $courseId)
 {
     $params = $request->query->all();
     $course = $this->getCourseService()->tryManageCourse($courseId);
     if (empty($course)) {
         return $this->createJsonResponse(array());
     }
     $typeNames = $this->get('topxia.twig.web_extension')->getDict('questionType');
     $types = array();
     foreach ($typeNames as $type => $name) {
         $typeObj = QuestionTypeFactory::create($type);
         $types[] = array('key' => $type, 'name' => $name, 'hasMissScore' => $typeObj->hasMissScore());
     }
     $conditions["types"] = ArrayToolkit::column($types, "key");
     if ($params["range"] == "course") {
         $conditions["courseId"] = $course["id"];
     } else {
         if ($params["range"] == "lesson") {
             $targets = $params["targets"];
             $targets = explode(',', $targets);
             $conditions["targets"] = $targets;
         }
     }
     $questionNums = $this->getQuestionService()->getQuestionCountGroupByTypes($conditions);
     $questionNums = ArrayToolkit::index($questionNums, "type");
     return $this->createJsonResponse($questionNums);
 }
开发者ID:ZHONG-GUO,项目名称:EduSoho,代码行数:27,代码来源:CourseTestpaperManageController.php

示例13: getData

 /**
  * 获取一个分类下的课程成员列表
  *
  * 可传入的参数:
  *   categoryId 选填 分类ID
  *   count    必需 学员数量,取值不能超过100
  * 
  * @param  array $arguments 参数
  * @return array 课程成员列表
  */
 public function getData(array $arguments)
 {
     $this->checkCount($arguments);
     if (empty($arguments['categoryId'])) {
         $conditions = array('status' => 'published');
     } else {
         $conditions = array('status' => 'published', 'categoryId' => $arguments['categoryId']);
     }
     $courses = $this->getCourseService()->searchCourses($conditions, 'latest', 0, 1000);
     $courseIds = ArrayToolkit::column($courses, 'id');
     $conditions = array('courseIds' => $courseIds, 'unique' => true, 'role' => 'student');
     $members = $this->getCourseService()->searchMembers($conditions, array('createdTime', 'DESC'), 0, $arguments['count']);
     $courseIds = ArrayToolkit::column($members, 'courseId');
     $userIds = ArrayToolkit::column($members, 'userId');
     $users = $this->getUserService()->findUsersByIds($userIds);
     $users = ArrayToolkit::index($users, 'id');
     $this->unsetUserPasswords($users);
     $courses = $this->getCourseService()->findCoursesByIds($courseIds);
     $courses = ArrayToolkit::index($courses, 'id');
     foreach ($members as &$member) {
         $member['course'] = $courses[$member["courseId"]];
         $member['user'] = $users[$member["userId"]];
     }
     return $members;
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:35,代码来源:LatestCourseMembers2DataTag.php

示例14: mobileSelectAction

 public function mobileSelectAction(Request $request)
 {
     $operationMobile = $this->getSettingService()->get('operation_mobile', array());
     $courseGrids = $this->getSettingService()->get('operation_course_grids', array());
     $settingMobile = $this->getSettingService()->get('mobile', array());
     $default = array('courseIds' => '');
     $mobile = array_merge($default, $courseGrids);
     if ($request->getMethod() == 'POST') {
         $courseGrids = $request->request->all();
         $mobile = array_merge($operationMobile, $settingMobile, $courseGrids);
         $this->getSettingService()->set('operation_mobile', $operationMobile);
         $this->getSettingService()->set('operation_course_grids', $courseGrids);
         $this->getSettingService()->set('mobile', $mobile);
         $this->getLogService()->info('system', 'update_settings', "更新移动客户端设置", $mobile);
         $this->setFlashMessage('success', '移动客户端设置已保存!');
     }
     $courseIds = explode(",", $mobile['courseIds']);
     $courses = $this->getCourseService()->findCoursesByIds($courseIds);
     $courses = ArrayToolkit::index($courses, 'id');
     $sortedCourses = array();
     foreach ($courseIds as $value) {
         if (!empty($value)) {
             $sortedCourses[] = $courses[$value];
         }
     }
     return $this->render('TopxiaAdminBundle:System:course-select.html.twig', array('mobile' => $mobile, 'courses' => $sortedCourses));
 }
开发者ID:ZHONG-GUO,项目名称:EduSoho,代码行数:27,代码来源:MobileController.php

示例15: approvedAction

 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));
 }
开发者ID:styling,项目名称:LeesPharm,代码行数:8,代码来源:UserApprovalController.php


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