src/AppBundle/Component/Export/Course/OverviewTaskExporter.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace AppBundle\Component\Export\Course;

use AppBundle\Common\ArrayToolkit;
use AppBundle\Component\Export\Exporter;

class OverviewTaskExporter extends Exporter
{
    public function canExport()
    {
        $user = $this->getUser();
        try {
            $tryManageCourse = $this->getCourseService()->tryManageCourse($this->parameter['courseId']);
        } catch (\Exception $e) {
            return false;
        }

        return $user->isAdmin() || !empty($tryManageCourse);
    }

    public function getCount()
    {
        return $this->getTaskService()->countTasks($this->conditions);
    }

    public function getTitles()
    {
        return array(
            'task.learn_data_detail.task_title',
            'task.learn_data_detail.completed_number',
            'task.learn_data_detail.unfinished_number',
            'task.learn_data_detail.unstarted_number',
            'task.learn_data_detail.finished_rate',
        );
    }

    public function getContent($start, $limit)
    {
        $course = $this->getCourseService()->getCourse($this->parameter['courseId']);
        $tasks = $this->getTaskservice()->searchTasks(
            $this->conditions,
            array('seq' => 'asc'),
            $start,
            $limit
        );

        $tasks = $this->getReportService()->getCourseTaskLearnData($tasks, $course['id']);
        $datas = array();
        foreach ($tasks as $task) {
            $data = array();
            $data[] = $task['title'];
            $data[] = $task['finishedNum'];
            $data[] = $task['learnNum'];
            $data[] = $task['notStartedNum'];
            $data[] = $task['rate'];

            $datas[] = $data;
        }

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。