本文整理汇总了PHP中DocumentManager::replace_user_info_into_html方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentManager::replace_user_info_into_html方法的具体用法?PHP DocumentManager::replace_user_info_into_html怎么用?PHP DocumentManager::replace_user_info_into_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::replace_user_info_into_html方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_table_data
//.........这里部分代码省略.........
$row[] = null;
}
}
$row['child_of'] = $parent_id;
$sortable_data[] = $row;
}
//"Warning row"
if (!empty($data_array)) {
if (api_is_allowed_to_edit()) {
// Compare the category weight to the sum of all weights inside the category
if (intval($total_weight) == $category_weight) {
$label = null;
$total = score_badges(array($total_weight . ' / ' . $category_weight, '100'));
} else {
$label = Display::return_icon('warning.png', sprintf(get_lang('TotalWeightMustBeX'), $category_weight));
$total = Display::badge($total_weight . ' / ' . $category_weight, 'warning');
}
$row = array(null, null, " <h5>" . get_lang('SubTotal') . '</h5>', null, $total . ' ' . $label, 'child_of' => $parent_id);
$sortable_data[] = $row;
}
}
}
}
//end looping categories
}
//end looping categories
if (api_is_allowed_to_edit()) {
if (count($main_cat) > 1) {
$main_weight = intval($main_cat[0]->get_weight());
if (intval($total_categories_weight) == $main_weight) {
$total = score_badges(array($total_categories_weight . ' / ' . $main_weight, '100'));
} else {
$total = Display::badge($total_categories_weight . ' / ' . $main_weight, 'warning');
}
$row = array(null, null, '<h3>' . get_lang('Total') . '</h3>', null, $total);
$sortable_data[] = $row;
}
}
// warning messages
$view = isset($_GET['view']) ? $_GET['view'] : null;
if (api_is_allowed_to_edit()) {
if (isset($_GET['selectcat']) && $_GET['selectcat'] > 0 && $view != 'presence') {
$id_cat = intval($_GET['selectcat']);
$category = Category::load($id_cat);
//$weight_category = intval($this->build_weight($category[0]));
$weight_category = intval($this->build_weight($category[0]));
$course_code = $this->build_course_code($category[0]);
$weight_total_links = round($weight_total_links);
if ($weight_total_links > $weight_category || $weight_total_links < $weight_category || $weight_total_links > $weight_category) {
$warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
$modify_icons = '<a class="right_link" href="gradebook_edit_cat.php?editcat=' . $id_cat . '&cidReq=' . $course_code . '">' . Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL) . '</a>';
$warning_message .= $modify_icons;
Display::display_warning_message($warning_message, false);
}
$content_html = DocumentManager::replace_user_info_into_html(api_get_user_id(), $course_code);
if (!empty($content_html)) {
$new_content = explode('</head>', $content_html['content']);
}
if (empty($new_content[0])) {
$warning_message = get_lang('ThereIsNotACertificateAvailableByDefault');
$cert_icon = '<a class="right_link" href="../document/document.php?curdirpath=/certificates&' . $course_code . '&origin=gradebook&selectcat=' . $id_cat . '">' . Display::return_icon('certificate.png', get_lang('AttachCertificate'), array(), ICON_SIZE_SMALL) . '</a>';
Display::display_warning_message($warning_message . $cert_icon, false);
}
}
if (empty($_GET['selectcat'])) {
$categories = Category::load();
$weight_categories = $certificate_min_scores = $course_codes = array();
foreach ($categories as $category) {
$course_code_category = $this->build_course_code($category);
if (!empty($course_code)) {
if ($course_code_category == $course_code) {
$weight_categories[] = intval($this->build_weight($category));
$certificate_min_scores[] = intval($this->build_certificate_min_score($category));
$course_codes[] = $course_code;
break;
}
} else {
$weight_categories[] = intval($this->build_weight($category));
$certificate_min_scores[] = intval($this->build_certificate_min_score($category));
$course_codes[] = $course_code_category;
}
}
if (is_array($weight_categories) && is_array($certificate_min_scores) && is_array($course_codes)) {
$warning_message = '';
for ($x = 0; $x < count($weight_categories); $x++) {
$weight_category = intval($weight_categories[$x]);
$certificate_min_score = intval($certificate_min_scores[$x]);
$course_code = $course_codes[$x];
if (empty($certificate_min_score) || $certificate_min_score > $weight_category) {
$warning_message .= $course_code . ' - ' . get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan') . ' ' . $weight_category . '<br />';
}
}
if (!empty($warning_message)) {
Display::display_warning_message($warning_message, false);
}
}
}
}
return $sortable_data;
}
示例2: api_get_course_id
}
$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
$parent_id = $document_data['parent_id'];
}
if (isset($document_data) && $document_data['path'] == '/certificates') {
$is_certificate_mode = true;
}
if (!$parent_id) {
$parent_id = 0;
}
$current_folder_id = $document_id;
// Show preview
if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isset($_GET['set_preview']) && $_GET['set_preview'] == strval(intval($_GET['set_preview']))) {
if (isset($_GET['set_preview'])) {
// Generate document HTML
$content_html = DocumentManager::replace_user_info_into_html(api_get_user_id(), api_get_course_id(), api_get_session_id(), true);
$filename = 'certificate_preview/' . api_get_unique_id() . '.png';
$qr_code_filename = api_get_path(SYS_ARCHIVE_PATH) . $filename;
$temp_folder = api_get_path(SYS_ARCHIVE_PATH) . 'certificate_preview';
if (!is_dir($temp_folder)) {
mkdir($temp_folder, api_get_permissions_for_new_directories());
}
$qr_code_web_filename = api_get_path(WEB_ARCHIVE_PATH) . $filename;
$certificate = new Certificate();
$text = $certificate->parse_certificate_variables($content_html['variables']);
$result = $certificate->generate_qr($text, $qr_code_filename);
$new_content_html = $content_html['content'];
$path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/images/gallery';
$new_content_html = str_replace('../images/gallery', $path_image, $new_content_html);
$path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document';
$new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html);
示例3: get_user_certificate_content
/**
* @param $user_id
* @param $course_code
* @param bool $is_preview
* @param bool $hide_print_button
* @return array
*/
public static function get_user_certificate_content($user_id, $course_code, $is_preview = false, $hide_print_button = false)
{
// Generate document HTML
$content_html = DocumentManager::replace_user_info_into_html($user_id, $course_code, $is_preview);
$new_content_html = null;
$variables = null;
$contentHead = null;
if (isset($content_html['content'])) {
$new_content = explode('</head>', $content_html['content']);
$new_content_html = $new_content[1];
$contentHead = $new_content[0];
}
if (isset($content_html['variables'])) {
$variables = $content_html['variables'];
}
$path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery';
$new_content_html = str_replace('../images/gallery', $path_image, $new_content_html);
$path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document';
$new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html);
$new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
//add print header
if ($hide_print_button == false) {
$print = '<style media="print" type="text/css">#print_div {visibility:hidden;}</style>';
$print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="' . api_get_path(WEB_CODE_PATH) . 'img/printmgr.gif" alt="' . get_lang('Print') . '" /> ' . get_lang('Print') . '</a>';
}
// Add header
$new_content_html = $contentHead . $print . '</head>' . $new_content_html;
return array('content' => $new_content_html, 'variables' => $variables);
}
示例4: get_table_data
//.........这里部分代码省略.........
// Total for student.
if (count($main_cat) > 1) {
$main_weight = intval($main_cat[0]->get_weight());
$global = null;
$average = null;
// Overwrite main weight
$totalResult[1] = $main_weight;
$totalResult = $scoredisplay->display_score($totalResult, SCORE_DIV);
$totalRanking = array();
$invalidateRanking = true;
$average = 0;
foreach ($this->studentList as $student) {
$score = $main_cat[0]->calc_score($student['user_id']);
if (!empty($score[0])) {
$invalidateRanking = false;
}
$totalRanking[$student['user_id']] = $score[0];
$average += $score[0];
}
$totalRanking = AbstractLink::getCurrentUserRanking($user_id, $totalRanking);
$totalRanking = $scoredisplay->display_score($totalRanking, SCORE_DIV, SCORE_BOTH, true);
if ($invalidateRanking) {
$totalRanking = null;
}
// Overwrite main weight
$totalBest[1] = $main_weight;
$totalBest = $scoredisplay->display_score($totalBest, SCORE_DIV, SCORE_BOTH, true);
// Overwrite main weight
$totalAverage[0] = $average / count($this->studentList);
$totalAverage[1] = $main_weight;
$totalAverage = $scoredisplay->display_score($totalAverage, SCORE_DIV, SCORE_BOTH, true);
if ($this->exportToPdf) {
$row = array(null, '<h3>' . get_lang('Total') . '</h3>', $main_weight, $totalResult, $totalRanking, $totalBest, $totalAverage);
} else {
$row = array(null, '<h3>' . get_lang('Total') . '</h3>', null, $main_weight, $totalResult, $totalRanking, $totalBest, $totalAverage);
}
$sortable_data[] = $row;
}
}
// Warning messages
$view = isset($_GET['view']) ? $_GET['view'] : null;
if ($this->teacherView) {
if (isset($_GET['selectcat']) && $_GET['selectcat'] > 0 && $view != 'presence') {
$id_cat = intval($_GET['selectcat']);
$category = Category::load($id_cat);
$weight_category = intval($this->build_weight($category[0]));
$course_code = $this->build_course_code($category[0]);
$weight_total_links = round($weight_total_links);
if ($weight_total_links > $weight_category || $weight_total_links < $weight_category || $weight_total_links > $weight_category) {
$warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
$modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $id_cat . '&cidReq=' . $course_code . '&id_session=' . api_get_session_id() . '">' . Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL) . '</a>';
$warning_message .= $modify_icons;
Display::display_warning_message($warning_message, false);
}
$content_html = DocumentManager::replace_user_info_into_html(api_get_user_id(), $course_code);
if (!empty($content_html)) {
$new_content = explode('</head>', $content_html['content']);
}
if (empty($new_content[0])) {
// Set default certificate
$courseData = api_get_course_info($course_code);
DocumentManager::generateDefaultCertificate($courseData);
}
}
if (empty($_GET['selectcat'])) {
$categories = Category::load();
$weight_categories = $certificate_min_scores = $course_codes = array();
foreach ($categories as $category) {
$course_code_category = $this->build_course_code($category);
if (!empty($course_code)) {
if ($course_code_category == $course_code) {
$weight_categories[] = intval($this->build_weight($category));
$certificate_min_scores[] = intval($this->build_certificate_min_score($category));
$course_codes[] = $course_code;
break;
}
} else {
$weight_categories[] = intval($this->build_weight($category));
$certificate_min_scores[] = intval($this->build_certificate_min_score($category));
$course_codes[] = $course_code_category;
}
}
if (is_array($weight_categories) && is_array($certificate_min_scores) && is_array($course_codes)) {
$warning_message = '';
for ($x = 0; $x < count($weight_categories); $x++) {
$weight_category = intval($weight_categories[$x]);
$certificate_min_score = intval($certificate_min_scores[$x]);
$course_code = $course_codes[$x];
if (empty($certificate_min_score) || $certificate_min_score > $weight_category) {
$warning_message .= $course_code . ' - ' . get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan') . ' ' . $weight_category . '<br />';
}
}
if (!empty($warning_message)) {
Display::display_warning_message($warning_message, false);
}
}
}
}
return $sortable_data;
}