Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/report/completion/index.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00027 require('../../config.php');
00028 require_once($CFG->libdir.'/completionlib.php');
00029 
00033 define('COMPLETION_REPORT_PAGE',        25);
00034 define('COMPLETION_REPORT_COL_TITLES',  true);
00035 
00036 /*
00037  * Setup page, check permissions
00038  */
00039 
00040 // Get course
00041 $courseid = required_param('course', PARAM_INT);
00042 $format = optional_param('format','',PARAM_ALPHA);
00043 $sort = optional_param('sort','',PARAM_ALPHA);
00044 $edituser = optional_param('edituser', 0, PARAM_INT);
00045 
00046 
00047 $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
00048 $context = context_course::instance($course->id);
00049 
00050 $url = new moodle_url('/report/completion/index.php', array('course'=>$course->id));
00051 $PAGE->set_url($url);
00052 $PAGE->set_pagelayout('report');
00053 
00054 $firstnamesort = ($sort == 'firstname');
00055 $excel = ($format == 'excelcsv');
00056 $csv = ($format == 'csv' || $excel);
00057 
00058 // Paging
00059 $start   = optional_param('start', 0, PARAM_INT);
00060 $sifirst = optional_param('sifirst', 'all', PARAM_ALPHA);
00061 $silast  = optional_param('silast', 'all', PARAM_ALPHA);
00062 
00063 // Whether to show extra user identity information
00064 $extrafields = get_extra_user_fields($context);
00065 $leftcols = 1 + count($extrafields);
00066 
00067 // Function for quoting csv cell values
00068 function csv_quote($value) {
00069     global $excel;
00070     if ($excel) {
00071         $tl = textlib_get_instance();
00072         return $tl->convert('"'.str_replace('"',"'",$value).'"','UTF-8','UTF-16LE');
00073     } else {
00074         return '"'.str_replace('"',"'",$value).'"';
00075     }
00076 }
00077 
00078 
00079 // Check permissions
00080 require_login($course);
00081 
00082 require_capability('report/completion:view', $context);
00083 
00084 // Get group mode
00085 $group = groups_get_course_group($course, true); // Supposed to verify group
00086 if ($group === 0 && $course->groupmode == SEPARATEGROUPS) {
00087     require_capability('moodle/site:accessallgroups',$context);
00088 }
00089 
00094 // Get criteria for course
00095 $completion = new completion_info($course);
00096 
00097 if (!$completion->has_criteria()) {
00098     print_error('err_nocriteria', 'completion', $CFG->wwwroot.'/course/report.php?id='.$course->id);
00099 }
00100 
00101 // Get criteria and put in correct order
00102 $criteria = array();
00103 
00104 foreach ($completion->get_criteria(COMPLETION_CRITERIA_TYPE_COURSE) as $criterion) {
00105     $criteria[] = $criterion;
00106 }
00107 
00108 foreach ($completion->get_criteria(COMPLETION_CRITERIA_TYPE_ACTIVITY) as $criterion) {
00109     $criteria[] = $criterion;
00110 }
00111 
00112 foreach ($completion->get_criteria() as $criterion) {
00113     if (!in_array($criterion->criteriatype, array(
00114             COMPLETION_CRITERIA_TYPE_COURSE, COMPLETION_CRITERIA_TYPE_ACTIVITY))) {
00115         $criteria[] = $criterion;
00116     }
00117 }
00118 
00119 // Can logged in user mark users as complete?
00120 // (if the logged in user has a role defined in the role criteria)
00121 $allow_marking = false;
00122 $allow_marking_criteria = null;
00123 
00124 if (!$csv) {
00125     // Get role criteria
00126     $rcriteria = $completion->get_criteria(COMPLETION_CRITERIA_TYPE_ROLE);
00127 
00128     if (!empty($rcriteria)) {
00129 
00130         foreach ($rcriteria as $rcriterion) {
00131             $users = get_role_users($rcriterion->role, $context, true);
00132 
00133             // If logged in user has this role, allow marking complete
00134             if ($users && in_array($USER->id, array_keys($users))) {
00135                 $allow_marking = true;
00136                 $allow_marking_criteria = $rcriterion->id;
00137                 break;
00138             }
00139         }
00140     }
00141 }
00142 
00143 /*
00144  * Setup page header
00145  */
00146 if ($csv) {
00147     $shortname = format_string($course->shortname, true, array('context' => $context));
00148     $textlib = textlib_get_instance();
00149     header('Content-Disposition: attachment; filename=progress.'.
00150         preg_replace('/[^a-z0-9-]/','_',$textlib->strtolower(strip_tags($shortname))).'.csv');
00151     // Unicode byte-order mark for Excel
00152     if ($excel) {
00153         header('Content-Type: text/csv; charset=UTF-16LE');
00154         print chr(0xFF).chr(0xFE);
00155         $sep="\t".chr(0);
00156         $line="\n".chr(0);
00157     } else {
00158         header('Content-Type: text/csv; charset=UTF-8');
00159         $sep=",";
00160         $line="\n";
00161     }
00162 
00163 } else {
00164     // Navigation and header
00165     $strcompletion = get_string('coursecompletion');
00166 
00167     $PAGE->set_title($strcompletion);
00168     $PAGE->set_heading($course->fullname);
00169 
00170     echo $OUTPUT->header();
00171 
00172     $PAGE->requires->yui2_lib(
00173         array(
00174             'yahoo',
00175             'dom',
00176             'element',
00177             'event',
00178         )
00179     );
00180 
00181     $PAGE->requires->js('/report/completion/textrotate.js');
00182 
00183     // Handle groups (if enabled)
00184     groups_print_course_menu($course, $CFG->wwwroot.'/report/completion/?course='.$course->id);
00185 }
00186 
00187 
00188 // Generate where clause
00189 $where = array();
00190 $where_params = array();
00191 
00192 if ($sifirst !== 'all') {
00193     $where[] = $DB->sql_like('u.firstname', ':sifirst', false);
00194     $where_params['sifirst'] = $sifirst.'%';
00195 }
00196 
00197 if ($silast !== 'all') {
00198     $where[] = $DB->sql_like('u.lastname', ':silast', false);
00199     $where_params['silast'] = $silast.'%';
00200 }
00201 
00202 // Get user match count
00203 $total = $completion->get_num_tracked_users(implode(' AND ', $where), $where_params, $group);
00204 
00205 // Total user count
00206 $grandtotal = $completion->get_num_tracked_users('', array(), $group);
00207 
00208 // If no users in this course what-so-ever
00209 if (!$grandtotal) {
00210     echo $OUTPUT->container(get_string('err_nousers', 'completion'), 'errorbox errorboxcontent');
00211     echo $OUTPUT->footer();
00212     exit;
00213 }
00214 
00215 // Get user data
00216 $progress = array();
00217 
00218 if ($total) {
00219     $progress = $completion->get_progress_all(
00220         implode(' AND ', $where),
00221         $where_params,
00222         $group,
00223         $firstnamesort ? 'u.firstname ASC' : 'u.lastname ASC',
00224         $csv ? 0 : COMPLETION_REPORT_PAGE,
00225         $csv ? 0 : $start,
00226         $context
00227     );
00228 }
00229 
00230 
00231 // Build link for paging
00232 $link = $CFG->wwwroot.'/report/completion/?course='.$course->id;
00233 if (strlen($sort)) {
00234     $link .= '&amp;sort='.$sort;
00235 }
00236 $link .= '&amp;start=';
00237 
00238 // Build the the page by Initial bar
00239 $initials = array('first', 'last');
00240 $alphabet = explode(',', get_string('alphabet', 'langconfig'));
00241 
00242 $pagingbar = '';
00243 foreach ($initials as $initial) {
00244     $var = 'si'.$initial;
00245 
00246     $othervar = $initial == 'first' ? 'silast' : 'sifirst';
00247     $othervar = $$othervar != 'all' ? "&amp;{$othervar}={$$othervar}" : '';
00248 
00249     $pagingbar .= ' <div class="initialbar '.$initial.'initial">';
00250     $pagingbar .= get_string($initial.'name').':&nbsp;';
00251 
00252     if ($$var == 'all') {
00253         $pagingbar .= '<strong>'.get_string('all').'</strong> ';
00254     }
00255     else {
00256         $pagingbar .= "<a href=\"{$link}{$othervar}\">".get_string('all').'</a> ';
00257     }
00258 
00259     foreach ($alphabet as $letter) {
00260         if ($$var === $letter) {
00261             $pagingbar .= '<strong>'.$letter.'</strong> ';
00262         }
00263         else {
00264             $pagingbar .= "<a href=\"$link&amp;$var={$letter}{$othervar}\">$letter</a> ";
00265         }
00266     }
00267 
00268     $pagingbar .= '</div>';
00269 }
00270 
00271 // Do we need a paging bar?
00272 if ($total > COMPLETION_REPORT_PAGE) {
00273 
00274     // Paging bar
00275     $pagingbar .= '<div class="paging">';
00276     $pagingbar .= get_string('page').': ';
00277 
00278     $sistrings = array();
00279     if ($sifirst != 'all') {
00280         $sistrings[] =  "sifirst={$sifirst}";
00281     }
00282     if ($silast != 'all') {
00283         $sistrings[] =  "silast={$silast}";
00284     }
00285     $sistring = !empty($sistrings) ? '&amp;'.implode('&amp;', $sistrings) : '';
00286 
00287     // Display previous link
00288     if ($start > 0) {
00289         $pstart = max($start - COMPLETION_REPORT_PAGE, 0);
00290         $pagingbar .= "(<a class=\"previous\" href=\"{$link}{$pstart}{$sistring}\">".get_string('previous').'</a>)&nbsp;';
00291     }
00292 
00293     // Create page links
00294     $curstart = 0;
00295     $curpage = 0;
00296     while ($curstart < $total) {
00297         $curpage++;
00298 
00299         if ($curstart == $start) {
00300             $pagingbar .= '&nbsp;'.$curpage.'&nbsp;';
00301         }
00302         else {
00303             $pagingbar .= "&nbsp;<a href=\"{$link}{$curstart}{$sistring}\">$curpage</a>&nbsp;";
00304         }
00305 
00306         $curstart += COMPLETION_REPORT_PAGE;
00307     }
00308 
00309     // Display next link
00310     $nstart = $start + COMPLETION_REPORT_PAGE;
00311     if ($nstart < $total) {
00312         $pagingbar .= "&nbsp;(<a class=\"next\" href=\"{$link}{$nstart}{$sistring}\">".get_string('next').'</a>)';
00313     }
00314 
00315     $pagingbar .= '</div>';
00316 }
00317 
00318 
00319 /*
00320  * Draw table header
00321  */
00322 
00323 // Start of table
00324 if (!$csv) {
00325     print '<br class="clearer"/>'; // ugh
00326 
00327     $total_header = ($total == $grandtotal) ? $total : "{$total}/{$grandtotal}";
00328     echo $OUTPUT->heading(get_string('allparticipants').": {$total_header}", 3);
00329 
00330     print $pagingbar;
00331 
00332     if (!$total) {
00333         echo $OUTPUT->heading(get_string('nothingtodisplay'), 2);
00334         echo $OUTPUT->footer();
00335         exit;
00336     }
00337 
00338     print '<table id="completion-progress" class="generaltable flexible boxaligncenter completionreport" style="text-align: left" cellpadding="5" border="1">';
00339 
00340     // Print criteria group names
00341     print PHP_EOL.'<tr style="vertical-align: top">';
00342     echo '<th scope="row" class="rowheader" colspan="' . $leftcols . '">' .
00343             get_string('criteriagroup', 'completion') . '</th>';
00344 
00345     $current_group = false;
00346     $col_count = 0;
00347     for ($i = 0; $i <= count($criteria); $i++) {
00348 
00349         if (isset($criteria[$i])) {
00350             $criterion = $criteria[$i];
00351 
00352             if ($current_group && $criterion->criteriatype === $current_group->criteriatype) {
00353                 ++$col_count;
00354                 continue;
00355             }
00356         }
00357 
00358         // Print header cell
00359         if ($col_count) {
00360             print '<th scope="col" colspan="'.$col_count.'" class="colheader criteriagroup">'.$current_group->get_type_title().'</th>';
00361         }
00362 
00363         if (isset($criteria[$i])) {
00364             // Move to next criteria type
00365             $current_group = $criterion;
00366             $col_count = 1;
00367         }
00368     }
00369 
00370     // Overall course completion status
00371     print '<th style="text-align: center;">'.get_string('course').'</th>';
00372 
00373     print '</tr>';
00374 
00375     // Print aggregation methods
00376     print PHP_EOL.'<tr style="vertical-align: top">';
00377     echo '<th scope="row" class="rowheader" colspan="' . $leftcols . '">' .
00378             get_string('aggregationmethod', 'completion').'</th>';
00379 
00380     $current_group = false;
00381     $col_count = 0;
00382     for ($i = 0; $i <= count($criteria); $i++) {
00383 
00384         if (isset($criteria[$i])) {
00385             $criterion = $criteria[$i];
00386 
00387             if ($current_group && $criterion->criteriatype === $current_group->criteriatype) {
00388                 ++$col_count;
00389                 continue;
00390             }
00391         }
00392 
00393         // Print header cell
00394         if ($col_count) {
00395             $has_agg = array(
00396                 COMPLETION_CRITERIA_TYPE_COURSE,
00397                 COMPLETION_CRITERIA_TYPE_ACTIVITY,
00398                 COMPLETION_CRITERIA_TYPE_ROLE,
00399             );
00400 
00401             if (in_array($current_group->criteriatype, $has_agg)) {
00402                 // Try load a aggregation method
00403                 $method = $completion->get_aggregation_method($current_group->criteriatype);
00404 
00405                 $method = $method == 1 ? get_string('all') : get_string('any');
00406 
00407             } else {
00408                 $method = '-';
00409             }
00410 
00411             print '<th scope="col" colspan="'.$col_count.'" class="colheader aggheader">'.$method.'</th>';
00412         }
00413 
00414         if (isset($criteria[$i])) {
00415             // Move to next criteria type
00416             $current_group = $criterion;
00417             $col_count = 1;
00418         }
00419     }
00420 
00421     // Overall course aggregation method
00422     print '<th scope="col" class="colheader aggheader aggcriteriacourse">';
00423 
00424     // Get course aggregation
00425     $method = $completion->get_aggregation_method();
00426 
00427     print $method == 1 ? get_string('all') : get_string('any');
00428     print '</th>';
00429 
00430     print '</tr>';
00431 
00432 
00433     // Print criteria titles
00434     if (COMPLETION_REPORT_COL_TITLES) {
00435 
00436         print PHP_EOL.'<tr>';
00437         echo '<th scope="row" class="rowheader" colspan="' . $leftcols . '">' .
00438                 get_string('criteria', 'completion') . '</th>';
00439 
00440         foreach ($criteria as $criterion) {
00441             // Get criteria details
00442             $details = $criterion->get_title_detailed();
00443             print '<th scope="col" class="colheader criterianame">';
00444             print '<span class="completion-criterianame">'.$details.'</span>';
00445             print '</th>';
00446         }
00447 
00448         // Overall course completion status
00449         print '<th scope="col" class="colheader criterianame">';
00450 
00451         print '<span class="completion-criterianame">'.get_string('coursecomplete', 'completion').'</span>';
00452 
00453         print '</th></tr>';
00454     }
00455 
00456     // Print user heading and icons
00457     print '<tr>';
00458 
00459     // User heading / sort option
00460     print '<th scope="col" class="completion-sortchoice" style="clear: both;">';
00461 
00462     $sistring = "&amp;silast={$silast}&amp;sifirst={$sifirst}";
00463 
00464     if ($firstnamesort) {
00465         print
00466             get_string('firstname')." / <a href=\"./?course={$course->id}{$sistring}\">".
00467             get_string('lastname').'</a>';
00468     } else {
00469         print "<a href=\"./?course={$course->id}&amp;sort=firstname{$sistring}\">".
00470             get_string('firstname').'</a> / '.
00471             get_string('lastname');
00472     }
00473     print '</th>';
00474 
00475 
00476     // Print user identity columns
00477     foreach ($extrafields as $field) {
00478         echo '<th scope="col" class="completion-identifyfield">' .
00479                 get_user_field_name($field) . '</th>';
00480     }
00481 
00485     foreach ($criteria as $criterion) {
00486 
00487         // Generate icon details
00488         $icon = '';
00489         $iconlink = '';
00490         $icontitle = ''; // Required if $iconlink set
00491         $iconalt = ''; // Required
00492         switch ($criterion->criteriatype) {
00493 
00494             case COMPLETION_CRITERIA_TYPE_ACTIVITY:
00495                 // Load activity
00496                 $activity = $criterion->get_mod_instance();
00497 
00498                 // Display icon
00499                 $icon = $OUTPUT->pix_url('icon', $criterion->module);
00500                 $iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance;
00501                 $icontitle = $activity->name;
00502                 $iconalt = get_string('modulename', $criterion->module);
00503                 break;
00504 
00505             case COMPLETION_CRITERIA_TYPE_COURSE:
00506                 // Load course
00507                 $crs = $DB->get_record('course', array('id' => $criterion->courseinstance));
00508 
00509                 // Display icon
00510                 $iconlink = $CFG->wwwroot.'/course/view.php?id='.$criterion->courseinstance;
00511                 $icontitle = format_string($crs->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $crs->id, MUST_EXIST)));
00512                 $iconalt = format_string($crs->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $crs->id)));
00513                 break;
00514 
00515             case COMPLETION_CRITERIA_TYPE_ROLE:
00516                 // Load role
00517                 $role = $DB->get_record('role', array('id' => $criterion->role));
00518 
00519                 // Display icon
00520                 $iconalt = $role->name;
00521                 break;
00522         }
00523 
00524         // Print icon and cell
00525         print '<th class="criteriaicon">';
00526 
00527         // Create icon if not supplied
00528         if (!$icon) {
00529             $icon = $OUTPUT->pix_url('i/'.$COMPLETION_CRITERIA_TYPES[$criterion->criteriatype]);
00530         }
00531 
00532         print ($iconlink ? '<a href="'.$iconlink.'" title="'.$icontitle.'">' : '');
00533         print '<img src="'.$icon.'" class="icon" alt="'.$iconalt.'" '.(!$iconlink ? 'title="'.$iconalt.'"' : '').' />';
00534         print ($iconlink ? '</a>' : '');
00535 
00536         print '</th>';
00537     }
00538 
00539     // Overall course completion status
00540     print '<th class="criteriaicon">';
00541     print '<img src="'.$OUTPUT->pix_url('i/course').'" class="icon" alt="'.get_string('course').'" title="'.get_string('coursecomplete', 'completion').'" />';
00542     print '</th>';
00543 
00544     print '</tr>';
00545 
00546 
00547 } else {
00548     // The CSV file does not contain any headers
00549 }
00550 
00551 
00555 foreach ($progress as $user) {
00556 
00557     // User name
00558     if ($csv) {
00559         print csv_quote(fullname($user));
00560         foreach ($extrafields as $field) {
00561             echo $sep . csv_quote($user->{$field});
00562         }
00563     } else {
00564         print PHP_EOL.'<tr id="user-'.$user->id.'">';
00565 
00566         print '<th scope="row"><a href="'.$CFG->wwwroot.'/user/view.php?id='.
00567             $user->id.'&amp;course='.$course->id.'">'.fullname($user).'</a></th>';
00568         foreach ($extrafields as $field) {
00569             echo '<td>' . s($user->{$field}) . '</td>';
00570         }
00571     }
00572 
00573     // Progress for each course completion criteria
00574     foreach ($criteria as $criterion) {
00575 
00576         // Handle activity completion differently
00577         if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) {
00578 
00579             // Load activity
00580             $mod = $criterion->get_mod_instance();
00581             $activity = $DB->get_record('course_modules', array('id' => $criterion->moduleinstance));
00582             $activity->name = $mod->name;
00583 
00584 
00585             // Get progress information and state
00586             if (array_key_exists($activity->id,$user->progress)) {
00587                 $thisprogress=$user->progress[$activity->id];
00588                 $state=$thisprogress->completionstate;
00589                 $date=userdate($thisprogress->timemodified);
00590             } else {
00591                 $state=COMPLETION_INCOMPLETE;
00592                 $date='';
00593             }
00594 
00595             $criteria_completion = $completion->get_user_completion($user->id, $criterion);
00596 
00597             // Work out how it corresponds to an icon
00598             switch($state) {
00599                 case COMPLETION_INCOMPLETE : $completiontype='n'; break;
00600                 case COMPLETION_COMPLETE : $completiontype='y'; break;
00601                 case COMPLETION_COMPLETE_PASS : $completiontype='pass'; break;
00602                 case COMPLETION_COMPLETE_FAIL : $completiontype='fail'; break;
00603             }
00604 
00605             $completionicon='completion-'.
00606                 ($activity->completion==COMPLETION_TRACKING_AUTOMATIC ? 'auto' : 'manual').
00607                 '-'.$completiontype;
00608 
00609             $describe=get_string('completion-alt-auto-'.$completiontype,'completion');
00610             $a=new StdClass;
00611             $a->state=$describe;
00612             $a->date=$date;
00613             $a->user=fullname($user);
00614             $a->activity=strip_tags($activity->name);
00615             $fulldescribe=get_string('progress-title','completion',$a);
00616 
00617             if ($csv) {
00618                 print $sep.csv_quote($describe).$sep.csv_quote($date);
00619             } else {
00620                 print '<td class="completion-progresscell">';
00621 
00622                 print '<img src="'.$OUTPUT->pix_url('i/'.$completionicon).
00623                       '" alt="'.$describe.'" class="icon" title="'.$fulldescribe.'" />';
00624 
00625                 print '</td>';
00626             }
00627 
00628             continue;
00629         }
00630 
00631         // Handle all other criteria
00632         $criteria_completion = $completion->get_user_completion($user->id, $criterion);
00633         $is_complete = $criteria_completion->is_complete();
00634 
00635         $completiontype = $is_complete ? 'y' : 'n';
00636         $completionicon = 'completion-auto-'.$completiontype;
00637 
00638         $describe = get_string('completion-alt-auto-'.$completiontype, 'completion');
00639 
00640         $a = new stdClass();
00641         $a->state    = $describe;
00642         $a->date     = $is_complete ? userdate($criteria_completion->timecompleted) : '';
00643         $a->user     = fullname($user);
00644         $a->activity = strip_tags($criterion->get_title());
00645         $fulldescribe = get_string('progress-title', 'completion', $a);
00646 
00647         if ($csv) {
00648             print $sep.csv_quote($describe);
00649         } else {
00650 
00651             if ($allow_marking_criteria === $criterion->id) {
00652                 $describe = get_string('completion-alt-auto-'.$completiontype,'completion');
00653 
00654                 print '<td class="completion-progresscell">'.
00655                     '<a href="'.$CFG->wwwroot.'/course/togglecompletion.php?user='.$user->id.'&amp;course='.$course->id.'&amp;rolec='.$allow_marking_criteria.'&amp;sesskey='.sesskey().'">'.
00656                     '<img src="'.$OUTPUT->pix_url('i/completion-manual-'.($is_complete ? 'y' : 'n')).
00657                     '" alt="'.$describe.'" class="icon" title="'.get_string('markcomplete', 'completion').'" /></a></td>';
00658             } else {
00659                 print '<td class="completion-progresscell">'.
00660                     '<img src="'.$OUTPUT->pix_url('i/'.$completionicon).
00661                     '" alt="'.$describe.'" class="icon" title="'.$fulldescribe.'" /></td>';
00662             }
00663         }
00664     }
00665 
00666     // Handle overall course completion
00667 
00668     // Load course completion
00669     $params = array(
00670         'userid'    => $user->id,
00671         'course'    => $course->id
00672     );
00673 
00674     $ccompletion = new completion_completion($params);
00675     $completiontype =  $ccompletion->is_complete() ? 'y' : 'n';
00676 
00677     $describe = get_string('completion-alt-auto-'.$completiontype, 'completion');
00678 
00679     $a = new StdClass;
00680     $a->state    = $describe;
00681     $a->date     = '';
00682     $a->user     = fullname($user);
00683     $a->activity = strip_tags(get_string('coursecomplete', 'completion'));
00684     $fulldescribe = get_string('progress-title', 'completion', $a);
00685 
00686     if ($csv) {
00687         print $sep.csv_quote($describe);
00688     } else {
00689 
00690         print '<td class="completion-progresscell">';
00691 
00692         // Display course completion status icon
00693         print '<img src="'.$OUTPUT->pix_url('i/completion-auto-'.$completiontype).
00694                '" alt="'.$describe.'" class="icon" title="'.$fulldescribe.'" />';
00695 
00696         print '</td>';
00697     }
00698 
00699     if ($csv) {
00700         print $line;
00701     } else {
00702         print '</tr>';
00703     }
00704 }
00705 
00706 if ($csv) {
00707     exit;
00708 }
00709 print '</table>';
00710 print $pagingbar;
00711 
00712 print '<ul class="progress-actions"><li><a href="index.php?course='.$course->id.
00713     '&amp;format=csv">'.get_string('csvdownload','completion').'</a></li>
00714     <li><a href="index.php?course='.$course->id.'&amp;format=excelcsv">'.
00715     get_string('excelcsvdownload','completion').'</a></li></ul>';
00716 
00717 echo $OUTPUT->footer($course);
 All Data Structures Namespaces Files Functions Variables Enumerations