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


PHP Export::convert_array_to_html方法代码示例

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


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

示例1: attendance_sheet_export_to_pdf


//.........这里部分代码省略.........
     } else {
         if (!empty($student_id)) {
             $user_id = intval($student_id);
         } else {
             $user_id = api_get_user_id();
         }
         $data_array['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, $user_id);
         $data_array['faults'] = $attendance->get_faults_of_user($user_id, $attendance_id);
         $data_array['user_id'] = $user_id;
     }
     $data_array['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
     //Set headers pdf
     $courseCategory = CourseManager::get_course_category($courseInfo['category_code']);
     $teacherInfo = CourseManager::get_teacher_list_from_course_code($courseInfo['real_id']);
     $teacherName = null;
     foreach ($teacherInfo as $dados) {
         if ($teacherName != null) {
             $teacherName = $teacherName . " / ";
         }
         $teacherName .= $dados['firstname'] . " " . $dados['lastname'];
     }
     // Get data table - Marco - ordenacao fixa - just fullname
     $data_table = array();
     $head_table = array('#', get_lang('Name'));
     foreach ($data_array['attendant_calendar'] as $class_day) {
         //$head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_SHORT).' <br />'.api_format_date($class_day['date_time'], TIME_NO_SEC_FORMAT);
         $head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_NUMBER_NO_YEAR);
     }
     $data_table[] = $head_table;
     $dataClass = array();
     $max_dates_per_page = 10;
     $data_attendant_calendar = $data_array['attendant_calendar'];
     $data_users_presence = $data_array['users_presence'];
     $count = 1;
     if (!empty($data_array['users_in_course'])) {
         foreach ($data_array['users_in_course'] as $user) {
             $cols = 1;
             $result = array();
             $result['count'] = $count;
             $result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']);
             foreach ($data_array['attendant_calendar'] as $class_day) {
                 if ($class_day['done_attendance'] == 1) {
                     if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) {
                         $result[$class_day['id']] = get_lang('UserAttendedSymbol');
                     } else {
                         $result[$class_day['id']] = get_lang('UserNotAttendedSymbol');
                     }
                 } else {
                     $result[$class_day['id']] = " ";
                 }
                 $cols++;
             }
             $count++;
             $data_table[] = $result;
         }
     }
     $max_cols_per_page = 12;
     //10 dates + 2 name and number
     $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;
     //10
     $rows = count($data_table);
     if ($cols > $max_cols_per_page) {
         $number_tables = round(($cols - 2) / $max_dates_per_page);
         $headers = $data_table[0];
         $all = array();
         $tables = array();
         $changed = 1;
         for ($i = 0; $i <= $rows; $i++) {
             $row = $data_table[$i];
             $key = 1;
             $max_dates_per_page = 10;
             $item = $data_table[$i];
             $count_j = 0;
             if (!empty($item)) {
                 foreach ($item as $value) {
                     if ($count_j >= $max_dates_per_page) {
                         $key++;
                         $max_dates_per_page = $max_dates_per_page_original * $key;
                         //magic hack
                         $tables[$key][$i][] = $tables[1][$i][0];
                         $tables[$key][$i][] = $tables[1][$i][1];
                     }
                     $tables[$key][$i][] = $value;
                     $count_j++;
                 }
             }
         }
         $content = null;
         if (!empty($tables)) {
             foreach ($tables as $sub_table) {
                 $content .= Export::convert_array_to_html($sub_table) . '<br /><br />';
             }
         }
     } else {
         $content .= Export::convert_array_to_html($data_table, array('header_attributes' => array('align' => 'center')));
     }
     $params = array('filename' => get_lang('Attendance') . '-' . api_get_local_time(), 'pdf_title' => $courseInfo['title'], 'course_code' => $courseInfo['code'], 'add_signatures' => true, 'orientation' => 'landscape', 'pdf_teachers' => $teacherName, 'pdf_course_category' => $courseCategory['name'], 'format' => 'A4-L', 'orientation' => 'L');
     Export::export_html_to_pdf($content, $params);
     exit;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:attendance_controller.php

示例2: array

        $timeReport->data[] = array('session' => ['id' => $session->getId(), 'name' => $session->getName()], 'course' => array('id' => $course->getId(), 'name' => $course->getTitle()), 'coach' => $teacherData, 'totalTime' => $formattedTime);
    }
}
if (empty($selectedCourse) && empty($selectedSession) && empty($selectedTeacher)) {
    foreach ($teacherList as &$teacher) {
        $timeReport->data[] = array('coach' => array('username' => $teacher['username'], 'completeName' => $teacher['completeName']), 'totalTime' => SessionManager::getTotalUserTimeInPlatform($teacher['user_id'], $selectedFrom, $selectedUntil));
    }
}
$timeReport->sortData($withFilter);
if (isset($_GET['export'])) {
    $dataToExport = $timeReport->prepareDataToExport($withFilter);
    $fileName = get_lang('TeacherTimeReport') . ' ' . api_get_local_time();
    switch ($_GET['export']) {
        case 'pdf':
            $params = array('add_signatures' => false, 'filename' => $fileName, 'pdf_title' => "{$reportTitle} - {$reportSubTitle}", 'pdf_description' => get_lang('TeacherTimeReport'), 'format' => 'A4-L', 'orientation' => 'L');
            $pdfContent = Export::convert_array_to_html($dataToExport);
            Export::export_html_to_pdf($pdfContent, $params);
            break;
        case 'xls':
            array_unshift($dataToExport, array($reportTitle), array($reportSubTitle), array());
            Export::export_table_xls_html($dataToExport, $fileName);
            break;
    }
    die;
}
$form->addSelect('course', get_lang('Course'), $optionsCourses, ['id' => 'courses']);
$form->addSelect('session', get_lang('Session'), $optionsSessions, ['id' => 'session']);
$form->addSelect('teacher', get_lang('Teacher'), $optionsTeachers, ['id' => 'teacher']);
$form->addDateRangePicker('daterange', get_lang('Date'), false, ['id' => 'daterange', 'maxDate' => $limitDate->format('Y-m-d'), 'format' => 'YYYY-MM-DD', 'timePicker' => 'false', 'value' => "{$selectedFrom} / {$selectedUntil}"]);
$form->addButtonFilter(get_lang('Filter'));
$form->addHidden('from', '');
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:teacher_time_report.php


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