J. Doe can't have a profile

skala
Julio Montoya 15 years ago
parent 283fb9bebb
commit f315d411e0
  1. 5
      main/gradebook/gradebook_view_result.php
  2. 129
      main/gradebook/lib/fe/exportgradebook.php
  3. 6
      main/social/profile.php

@ -20,7 +20,10 @@ require_once api_get_path(LIBRARY_PATH).'ezpdf/class.ezpdf.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
api_block_anonymous_users();
block_students();
if(!api_is_drh()){
block_students();
}
$interbreadcrumb[]= array (
'url' => $_SESSION['gradebook_dest'],

@ -80,6 +80,135 @@ a:active {text-decoration: none; font-weight : bold; color : black;}
return $printdata;
}
/**
* This function get a content html for export inside a pdf file
* @param array table headers
* @param array table body
* @param array pdf headers
* @param array pdf footers
* @return void
*/
function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf) {
require_once api_get_path(LIBRARY_PATH).'mpdf/mpdf.php';
$mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L');
$mpdf->useOnlyCoreFonts = true;
$mpdf->mirrorMargins = 0; // Use different Odd/Even headers and footers and mirror margins
if (is_array($headers_pdf)) {
// preparing headers pdf
$header = '<table width="100%" cellspacing="1" cellpadding="1" border="0" class="strong">
<tr>
<td ROWSPAN="3" style="text-align: left;" class="title"><img src="'.api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/images/header-logo.png"></td><td colspan="3"><h1>'.$title_pdf.'</h1></td>
<tr>
<td></td>
<td><strong>'.$headers_pdf[0][0].'</strong> </td><td> <strong>'.$headers_pdf[0][1].'</strong></td>
<td><strong>'.$headers_pdf[1][0].'</strong> </td><td> <strong>'.$headers_pdf[1][1].'</strong></td>
</tr>
<tr>
<td></td>
<td><strong>'.$headers_pdf[2][0].'</strong> </td><td> <strong>'.$headers_pdf[2][1].'</strong></td>
<td><strong>'.$headers_pdf[3][0].' </strong></td><td> <strong>'.$headers_pdf[3][1].'</strong></td>
</tr>
<tr>
<td></td><td></td>
<td><strong>'.$headers_pdf[4][0].'</strong></td><td> <strong>'.$headers_pdf[4][1].'</strong></td>
<td><strong>'.$headers_pdf[5][0].'</strong> </td><td> <strong>'.$headers_pdf[5][1].'</strong></td>
</tr>
</table>';
}
// preparing footer pdf
$footer = '<table width="100%" cellspacing="2" cellpadding="10" border="0">';
if (is_array($footers_pdf)) {
$footer .= '<tr>';
foreach ($footers_pdf as $foot_pdf) {
$footer .= '<td width="33%" style="text-align: center;">'.$foot_pdf.'</td>';
}
$footer .= '</tr>';
}
$footer .= '</table>';
$footer .= '<div align="right" style="font-weight: bold;">{PAGENO}/{nb}</div>';
// preparing content pdf
$css_file = api_get_path(TO_SYS, WEB_CSS_PATH).api_get_setting('stylesheets').'/print.css';
if (file_exists($css_file)) {
$css = @file_get_contents($css_file);
} else {
$css = '';
}
if(count($data_table) > 30)
$items_per_page = (count($data_table)/2);
else
$items_per_page = count($data_table);
$count_pages = ceil(count($data_table) / $items_per_page);
for ($x = 0; $x<$count_pages; $x++) {
$content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
// header table
$content_table .= '<tr>';
$i = 0;
if (is_array($headers_table)) {
foreach ($headers_table as $head_table) {
if (!empty($head_table[0])) {
$width = (!empty($head_table[1])?$head_table[1].'%':'');
$content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
$i++;
}
}
}
$content_table .= '</tr>';
// body table
if (is_array($data_table) && count($data_table) > 0) {
$offset = $x*$items_per_page;
$data_table = array_slice ($data_table, $offset, count($data_table));
$i = 1;
$item = $offset+1;
foreach ($data_table as $data) {
$content_table .= '<tr>';
$content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
foreach ($data as $key => $content) {
if (isset($content)) {
$key == 1 ? $align='align="left"':$align='align="center"';
$content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
}
}
$content_table .= '</tr>';
$i++;
$item++;
if ($i > $items_per_page) { break; }
}
} else {
$content_table .= '<tr colspan="'.$i.'"><td>'.get_lang('Empty').'</td></tr>';
}
$content_table .= '</table>';
if ($x < ($count_pages - 1)) { $content_table .= '<pagebreak />'; }
}
$html = $content_table;
// set attributes for pdf
$mpdf->SetHTMLHeader($header);
$mpdf->SetHTMLFooter($footer);
if (!empty($css)) {
$mpdf->WriteHTML($css, 1);
$mpdf->WriteHTML($html, 2);
} else {
$mpdf->WriteHTML($html);
}
$mpdf->Output(replace_dangerous_char($title_pdf.'.pdf'), 'D');
exit;
}
/**
* This function get a content html for export inside a pdf file
* @param array table headers

@ -16,6 +16,7 @@ require_once api_get_path(LIBRARY_PATH).'array.lib.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
$user_id = api_get_user_id();
$show_full_profile = true;
//social tab
$this_section = SECTION_SOCIAL;
@ -23,6 +24,9 @@ $this_section = SECTION_SOCIAL;
//I'm your friend? I can see your profile?
if (isset($_GET['u'])) {
$user_id = (int) Database::escape_string($_GET['u']);
if (api_is_anonymous($user_id, true)) {
api_not_allowed();
}
// It's me!
if (api_get_user_id() != $user_id) {
$user_info = UserManager::get_user_info_by_id($user_id);
@ -61,8 +65,6 @@ require_once $libpath.'magpierss/rss_fetch.inc';
api_block_anonymous_users();
//jquery thickbox already called from main/inc/header.inc.php
$htmlHeadXtra[] = '
<script type="text/javascript">
function toogle_course (element_html, course_code){

Loading…
Cancel
Save