src/AppBundle/Controller/TeacherController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller;
use AppBundle\Common\Paginator;
use AppBundle\Common\ArrayToolkit;
use Symfony\Component\HttpFoundation\Request;
class TeacherController extends BaseController
{
public function indexAction(Request $request)
{
$conditions = array(
'roles' => 'ROLE_TEACHER',
'locked' => 0,
);
$paginator = new Paginator(
$this->get('request'),
$this->getUserService()->countUsers($conditions),
20
);
$teachersCount = $this->getUserService()->countUsers($conditions);
$teachers = $this->getUserService()->searchUsers(
$conditions,
array(
'promoted' => 'DESC',
'promotedSeq' => 'ASC',
'promotedTime' => 'DESC',
'createdTime' => 'DESC',
),
$paginator->getOffsetCount(),
$paginator->getPerPageCount()
);
$user = $this->getCurrentUser();
$teacherIds = ArrayToolkit::column($teachers, 'id');
$profiles = $this->getUserService()->findUserProfilesByIds($teacherIds);
$myFollowings = $this->getUserService()->filterFollowingIds($user['id'], $teacherIds);
return $this->render('teacher/index.html.twig', array(
'teachers' => $teachers,
'profiles' => $profiles,
'paginator' => $paginator,
'Myfollowings' => $myFollowings,
));
}
public function searchAction($request, $keyword)
{
$conditions = array(
'roles' => 'ROLE_TEACHER',
'locked' => 0,
);
if (!empty($keyword)) {
$conditions['nickname'] = $keyword;
}
$teachers = $this->getUserService()->searchUsers($conditions, array(
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。