function get_content()
 {
     global $CFG, $USER, $COURSE;
     if (!empty($this->content)) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->footer = '';
     $this->content->text = '';
     if (!($att = array_pop(get_all_instances_in_course('attforblock', $COURSE, NULL, true)))) {
         $this->content->text = get_string('needactivity', 'block_attendance');
         return $this->content;
     }
     $cmid = $att->coursemodule;
     require_once $CFG->dirroot . '/mod/attforblock/locallib.php';
     if (!($context = get_context_instance(CONTEXT_MODULE, $cmid))) {
         print_error('badcontext');
     }
     // link to attendance
     if (has_capability('mod/attforblock:takeattendances', $context) or has_capability('mod/attforblock:changeattendances', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/manage.php?id=' . $cmid . '&amp;from=block">' . get_string('takeattendance', 'attforblock') . '</a><br />';
     }
     if (has_capability('mod/attforblock:manageattendances', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/sessions.php?id=' . $cmid . '&amp;action=add">' . get_string('add', 'attforblock') . '</a><br />';
     }
     if (has_capability('mod/attforblock:viewreports', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/report.php?id=' . $cmid . '&amp;view=weeks">' . get_string('report', 'attforblock') . '</a><br />';
     }
     if (has_capability('mod/attforblock:export', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/export.php?id=' . $cmid . '">' . get_string('export', 'quiz') . '</a><br />';
     }
     if (has_capability('mod/attforblock:changepreferences', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/attsettings.php?id=' . $cmid . '">' . get_string('settings', 'attforblock') . '</a><br />';
     }
     $context2 = get_context_instance(CONTEXT_COURSE, $COURSE->id);
     if (has_capability('moodle/course:view', $context) && has_capability('mod/attforblock:view', $context)) {
         $complete = get_attendance($USER->id, $COURSE);
         if ($complete == 0) {
             //attendance not generated yet
             $this->content->text .= get_string('attendancenotstarted', 'attforblock');
         } else {
             //attendance taken
             $statuses = get_statuses($COURSE->id);
             foreach ($statuses as $st) {
                 $this->content->text .= $st->description . ':&nbsp;' . get_attendance($USER->id, $COURSE, $st->id) . '<br />';
             }
             $percent = get_percent($USER->id, $COURSE);
             $grade = get_grade($USER->id, $COURSE);
             $this->content->text .= get_string('attendancepercent', 'attforblock') . ':&nbsp;' . $percent . '&nbsp;%<br />';
             $this->content->text .= get_string('attendancegrade', 'attforblock') . ":&nbsp;{$grade}<br />";
             $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/view.php?id=' . $cmid . '">' . get_string('indetail', 'attforblock') . '</a>';
         }
     }
     return $this->content;
 }
<?php

include_once '../includes/connection.php';
include_once '../includes/functions.php';
// include_once '../pages/index.php';
// $results = get_all_identifications($dbh);
$header = get_incident($_GET['id'], $dbh);
$detail = get_incident_history($_GET['id'], $dbh);
$statuses = get_statuses($dbh);
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Routerboard Resources</title>

    <!-- Bootstrap Core CSS -->
    <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <!-- Timeline CSS -->
    <link href="../dist/css/timeline.css" rel="stylesheet">
    logme('no fbid or token in cookie');
    die('no fbid or token in cookie');
}
$graph_url = "https://graph.facebook.com/{$fbid}/";
$execution_time['totalstart'] = get_time();
$execution_time['start'] = get_time();
$param->fbid = $fbid;
$param->token = $token;
$param->graph_url = $graph_url;
$param->limit = 25;
$param->offset = 0;
//me/statuses
echo 'processing fb statuses...';
$param->connection = 'statuses';
$param->table_name = 'statuses_raw_data';
get_statuses($param);
echo "done<br/>";
$execution_time['end'] = get_time();
$totaltime = $execution_time['end'] - $execution_time['start'];
echo "<br/>totaltime : {$totaltime}";
logme("Facebook ID:{$fbid}");
logme("Total Execution Time: {$totaltime}");
logme("============================================================================");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//MY STATUS UPDATES
function get_graphapi_data($graph_url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $graph_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            AND u.id IN (SELECT userid FROM {groups_members} gm WHERE gm.groupid = ?)
        ORDER BY u.$sort ASC";
    $params = array($cm->course, $currentgroup);
    $students = $DB->get_records_sql($sql, $params);
    */
    $students = $manager->get_users($sort);
    // FIXME add $currentgroup somehow
} else {
    $students = $manager->get_users($sort);
}
$sort = $sort == 'firstname' ? 'firstname' : 'lastname';
/// Now we need a menu for separategroups as well!
if ($groupmode == VISIBLEGROUPS || $groupmode && has_capability('moodle/site:accessallgroups', $context)) {
    groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/attforblock/attendances.php?id={$id}&sessionid={$sessionid}&sort={$sort}");
}
$statuses = get_statuses($course->id);
if (count($statuses) == 0) {
    // maybe we don't have them set yet? no sense in doing everything else
    echo '<p>';
    echo get_string('settingsareempty', 'attforblock');
    echo ': <a href="attsettings.php?id=' . $cm->id . '">' . get_string('settings', 'attforblock') . '</a>';
    echo '</p>';
    echo $OUTPUT->footer($course);
    exit;
}
$table = new html_table();
$table->data[][] = '<b>' . get_string('sessiondate', 'attforblock') . ': ' . userdate($sessdata->sessdate, get_string('strftimedate') . ', ' . get_string('str_ftimehm', 'attforblock')) . ', "' . ($sessdata->description ? $sessdata->description : get_string('nodescription', 'attforblock')) . '"</b>';
echo html_writer::table($table);
echo '<script type="text/javascript">';
// substitute for select_all_in() function which does not seem to work with Moodle 2.0
echo 'function att_select_column(cl) {';
Example #5
0
/**
 * Generating module settings form.
 * 
 * @return string 
 */
function dibspayment_paywin_form()
{
    $lang = array('da_DK' => 'Danish', 'en_UK' => 'English', 'nb_NO' => 'Norwegian', 'sv_SE' => 'Swedish');
    $dibs_params = '<tr> 
      <td>Merchant ID:</td>
            <td><input type="text" name="dibspw_mid" value="' . get_option('dibspw_mid') . '" /></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Your merchant ID in DIBS system.
                </span>
            </td>
        </tr><tr>
          <td>Partner ID:</td>
            <td><input type="text" name="dibspw_pid" value="' . get_option('dibspw_pid') . '" /></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Partner ID.
                </span>
            </td>
        </tr><tr>
          <td>HMAC:</td>
            <td><input type="text" name="dibspw_hmac" value="' . get_option('dibspw_hmac') . '" /></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Key for transactions security.
                </span>
            </td>
        </tr><tr>
          <td>Test mode:</td>
            <td><input type="checkbox" name="dibspw_testmode" value="yes"' . checkbox_checked(get_option('dibspw_testmode')) . '/></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Run transactions in test mode.
                </span>
            </td>
        </tr><tr>
          <td>Add fee:</td>
            <td><input type="checkbox" name="dibspw_fee" value="yes" ' . checkbox_checked(get_option('dibspw_fee')) . '/></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Customer pays fee.
                </span>
            </td>
        </tr><tr>
          <td>Capture now:</td>
            <td><input type="checkbox" name="dibspw_capturenow" value="yes"' . checkbox_checked(get_option('dibspw_capturenow')) . '/></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Make attempt to capture the transaction upon a successful authorization. (DIBS PW only)
                </span>
            </td>
        </tr>
        <tr>
          <td>Paytype:</td>
            <td><input type="text" name="dibspw_paytype" value="' . get_option('dibspw_paytype') . '" /></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Paytypes available to customer (e.g.: VISA,MC)
                </span>
            </td>
        </tr><tr>
          <td>Language:</td>
            <td><select name="dibspw_lang">' . dibspayment_paywin_build_select($lang, get_option('dibspw_lang')) . '</select></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Language of payment window interface.
                </span>
            </td>
        </tr><tr>
          <td>Account:</td>
            <td><input type="text" name="dibspw_account" value="' . get_option('dibspw_account') . '" /></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Account id used to visually separate transactions in merchant admin.
                </span>
            </td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    
                </span>
            </td>
        </tr><tr>
          <td>Success payment status:</td>
            <td><select name="dibspw_status">' . get_statuses(get_option('dibspw_status')) . '</select></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Order status after success transaction.
                </span>
            </td>
        </tr><tr>
          <td>Pending payment status:</td>
            <td><select name="dibspw_statusp">
              ' . get_statuses(get_option('dibspw_statusp')) . '
            </select></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Order status before payment.
                </span>
            </td>
        </tr><tr>
          <td>Cancel payment status:</td>
            <td><select name="dibspw_statusc">
                ' . get_statuses(get_option('dibspw_statusc')) . '
            </select></td>
        </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <span class="small description">
                    Order status on cancellation.
                </span>
            </td>
        </tr>';
    $address_fields = '<tr class="update_gateway" >
                        <td colspan="2">
                 <div class="submit">
                     <input type="submit" value="' . __('Update &raquo;', 'wpsc') . '" name="updateoption" />
                 </div>
             </td>
         </tr>
         <tr class="firstrowth">
             <td style="border-bottom: medium none;" colspan="2">
                 <strong class="form_group">Billing Form Sent to Gateway</strong>
             </td>
         </tr>
         <tr>
             <td>First Name Field</td>
             <td>
                 <select name="dibspw_form[first_name_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_first_name_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Last Name Field</td>
             <td>
                 <select name="dibspw_form[last_name_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_last_name_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Address Field</td>
             <td>
                 <select name="dibspw_form[address_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_address_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td>City Field</td>
             <td>
                 <select name="dibspw_form[city_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_city_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td>State Field</td>
             <td>
                 <select name="dibspw_form[state_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_state_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Postal/Zip code Field</td>
             <td>
                 <select name="dibspw_form[post_code_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_post_code_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Country Field</td>
             <td>
                 <select name="dibspw_form[country_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_country_b')) . '</select>
             </td>
         </tr>
         <tr class="firstrowth">
             <td style="border-bottom: medium none;" colspan="2">
                 <strong class="form_group">Shipping Form Sent to Gateway</strong>
             </td>
         </tr>
         <tr>
             <td>First Name Field</td>
             <td>
                 <select name="dibspw_form[first_name_d]">' . nzshpcrt_form_field_list(get_option('dibspw_form_first_name_d')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Last Name Field</td>
             <td>
                 <select name="dibspw_form[last_name_d]">' . nzshpcrt_form_field_list(get_option('dibspw_form_last_name_d')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Address Field</td>
             <td>
                 <select name="dibspw_form[address_d]">' . nzshpcrt_form_field_list(get_option('dibspw_form_address_d')) . '</select>
             </td>
         </tr>
         <tr>
             <td>City Field</td>
             <td>
                 <select name="dibspw_form[city_d]">' . nzshpcrt_form_field_list(get_option('dibspw_form_city_d')) . '</select>
             </td>
         </tr>
         <tr>
             <td>State Field</td>
             <td>
                 <select name="dibspw_form[state_d]">' . nzshpcrt_form_field_list(get_option('dibspw_form_state_d')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Postal/Zip code Field</td>
             <td>
                 <select name="dibspw_form[post_code_d]">' . nzshpcrt_form_field_list(get_option('dibspw_form_post_code_d')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Country Field</td>
             <td>
                 <select name="dibspw_form[country_d]">' . nzshpcrt_form_field_list(get_option('dibspw_form_country_d')) . '</select>
             </td>
         </tr>
         <tr class="firstrowth">
             <td style="border-bottom: medium none;" colspan="2">
                 <strong class="form_group">Contacts Form Sent to Gateway</strong>
             </td>
         </tr>
         <tr>
             <td>Email</td>
             <td>
                 <select name="dibspw_form[email_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_email_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td>Phone</td>
             <td>
                 <select name="dibspw_form[phone_b]">' . nzshpcrt_form_field_list(get_option('dibspw_form_phone_b')) . '</select>
             </td>
         </tr>
         <tr>
             <td colspan="2">
                 <span  class="wpscsmall description">
                     For more help configuring DIBS Payment Window, 
                     please read our documentation 
                     <a href="http://tech.dibs.dk/integration_methods/dibs_payment_window/">here</a>.
                 </span>
             </td>
         </tr>';
    return $dibs_params . $address_fields;
}
function get_status_abbr($n)
{
    $statuses = get_statuses();
    return $statuses[$n]["abbr"];
}
         }
     }
 }
 $found = false;
 for ($i = count($list) - 1; $i >= 0; $i--) {
     if ($list[$i] <= $current && !$found) {
         $found = true;
         $current = $list[$i];
         $out = '<b>' . userdate($list[$i], $format) . '</b> / ' . $out;
     } else {
         $out = "\n<a href=\"report.php?id={$id}&amp;current={$list[$i]}&amp;sort={$sort}\">" . userdate($list[$i], $format) . "</a> / " . $out;
     }
 }
 echo substr($out, 0, -2) . "\n";
 $statuses = get_statuses($course->id);
 $allstatuses = get_statuses($course->id, false);
 if ($view === 'weeks') {
     $where = "courseid={$course->id} AND sessdate >= {$course->startdate} AND sessdate >= {$current} AND sessdate < " . ($current + ONE_WEEK);
 } elseif ($view === 'months') {
     list(, , , , $syear, $smonth, $sday) = array_values(usergetdate($current));
     $where = "courseid={$course->id} AND sessdate >= {$course->startdate} AND sessdate >= {$current} AND sessdate < " . make_timestamp($syear, $smonth + 1, 1);
 } else {
     $where = "courseid={$course->id} AND sessdate >= {$course->startdate} AND sessdate <= " . time();
 }
 if ($students and $course_sess = get_records_select('attendance_sessions', $where, 'sessdate ASC')) {
     $firstname = "<a href=\"report.php?id={$id}&amp;sort=firstname\">" . get_string('firstname') . '</a>';
     $lastname = "<a href=\"report.php?id={$id}&amp;sort=lastname\">" . get_string('lastname') . '</a>';
     if ($CFG->fullnamedisplay == 'lastname firstname') {
         // for better view (dlnsk)
         $fullnamehead = "{$lastname} / {$firstname}";
     } else {
function print_user_attendaces($user, $cm, $course = 0, $printing = null)
{
    global $CFG, $COURSE, $DB, $OUTPUT, $mode;
    echo '<table class="userinfobox">';
    if (!$printing) {
        echo '<tr>';
        echo '<td colspan="2" class="generalboxcontent"><div align="right">';
        echo $OUTPUT->help_icon('studentview', 'attforblock', get_string('attendancereport', 'attforblock'));
        //helpbutton(, , , true, false, '', true).
        //"<a href=\"view.php?id={$cm->id}&amp;student={$user->id}&amp;mode=$mode&amp;printing=yes\" target=\"_blank\">[".get_string('versionforprinting','attforblock').']</a></div></td>';
        echo '</tr>';
    }
    //    echo '<tr>';
    //    echo '<th colspan="2"><h2 class="main help"><center>'.get_string('attendancereport','attforblock').helpbutton('studentview', get_string('attendancereport','attforblock'), 'attforblock', true, false, '', true).'</center></h1></th>';
    //    echo '</tr>';
    echo '<tr>';
    echo '<td class="left side">';
    echo $OUTPUT->user_picture($user, array($COURSE->id));
    echo '</td>';
    echo '<td class="generalboxcontent">';
    echo '<font size="+1"><b>' . fullname($user) . '</b></font>';
    if ($course) {
        echo '<hr />';
        $complete = get_attendance($user->id, $course);
        if ($complete) {
            print_attendance_table($user, $course);
        } else {
            echo get_string('attendancenotstarted', 'attforblock');
        }
    } else {
        $stqry = "SELECT ats.courseid \n\t\t\t\t\tFROM {attendance_log} al \n\t\t\t\t\tJOIN {attendance_sessions} ats \n\t\t\t\t\t  ON al.sessionid = ats.id\n\t\t\t\t   WHERE al.studentid = ?\n\t\t\t\tGROUP BY ats.courseid\n\t\t\t\tORDER BY ats.courseid asc";
        $recs = $DB->get_records_sql_menu($stqry, array($user->id));
        foreach ($recs as $courseid => $value) {
            echo '<hr />';
            echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="list1">';
            $nextcourse = $DB->get_record('course', array('id' => $courseid));
            echo '<tr><td valign="top"><strong>' . $nextcourse->fullname . '</strong></td>';
            echo '<td align="right">';
            $complete = get_attendance($user->id, $nextcourse);
            if ($complete) {
                print_attendance_table($user, $nextcourse);
            } else {
                echo get_string('attendancenotstarted', 'attforblock');
            }
            echo '</td></tr>';
            echo '</table>';
        }
    }
    if ($course) {
        $stqry = "SELECT ats.sessdate,ats.description,al.statusid,al.remarks \n\t\t\t\t\tFROM {attendance_log} al \n\t\t\t\t\tJOIN {attendance_sessions} ats \n\t\t\t\t\t  ON al.sessionid = ats.id\n\t\t\t\t   WHERE ats.courseid = ? AND al.studentid = ? \n\t\t\t\tORDER BY ats.sessdate asc";
        if ($sessions = $DB->get_records_sql($stqry, array($course->id, $user->id))) {
            $statuses = get_statuses($course->id);
            ?>
			<div id="mod-assignment-submissions">
			<table align="left" cellpadding="3" cellspacing="0" class="submissions">
			  <tr>
				<th>#</th>
				<th align="center"><?php 
            print_string('date');
            ?>
</th>
				<th align="center"><?php 
            print_string('time');
            ?>
</th>
				<th align="center"><?php 
            print_string('description', 'attforblock');
            ?>
</th>
				<th align="center"><?php 
            print_string('status', 'attforblock');
            ?>
</th>
				<th align="center"><?php 
            print_string('remarks', 'attforblock');
            ?>
</th>
			  </tr>
			  <?php 
            $i = 1;
            foreach ($sessions as $key => $session) {
                ?>
			  <tr>
				<td align="center"><?php 
                echo $i++;
                ?>
</td>
				<td><?php 
                echo userdate($session->sessdate, get_string('str_ftimedmyw', 'attforblock'));
                //userdate($students->sessdate,'%d.%m.%y&nbsp;(%a)', 99, false);
                ?>
</td>
				<td><?php 
                echo userdate($session->sessdate, get_string('str_ftimehm', 'attforblock'));
                ?>
</td>
				<td><?php 
                echo empty($session->description) ? get_string('nodescription', 'attforblock') : $session->description;
                ?>
</td>
				<td><?php 
                echo $statuses[$session->statusid]->description;
                ?>
</td>
				<td><?php 
                echo $session->remarks;
                ?>
</td>
			  </tr>
			  <?php 
            }
            echo '</table>';
        } else {
            echo $OUTPUT->heading(get_string('noattforuser', 'attforblock'));
        }
    }
    echo '</td></tr><tr><td>&nbsp;</td></tr></table></div>';
}
function print_detailed_report($user, $cm, $course = 0, $printing = null)
{
    global $CFG, $COURSE, $mode, $whereclause, $id, $student, $courseselected, $studentselected, $course, $reportselected;
    $statuses = get_statuses($courseselected);
    //	Define the options of the drop down menu for make up notes and sicknotes
    $optionlist = array('notrequired' => get_string('notrequired', 'attforblock'), 'outstanding' => get_string('outstanding', 'attforblock'), 'submitted' => get_string('submitted', 'attforblock'), 'cleared' => get_string('cleared', 'attforblock'));
    if ($course) {
        $stqry = "\n            SELECT ats.id,ats.groupid,ats.courseid,ats.sessdate,ats.sessiontitle,ats.subject,ats.teacher,ats.description, al.id, al.studentid, al.statusid,al.remarks,al.makeupnotes,al.sicknote\n            FROM {$CFG->prefix}attendance_log al\n            JOIN {$CFG->prefix}attendance_sessions ats\n            ON al.sessionid = ats.id\n            WHERE " . $whereclause . ' ORDER BY ats.sessdate asc';
        if ($logs = get_records_sql($stqry)) {
            $statuses = get_allstatuses();
            if ($reportselected === 'all') {
                ?>
		<table class="generaltable">
		    <tr>
		        <th id="tshowstudent" name="tshowstudent"><?php 
                print_string('student', 'attforblock');
                ?>
</th>
		        <th id="tshowcourse" name="tshowcourse"><?php 
                print_string('course');
                ?>
</th>
		        <th><?php 
                print_string('date');
                ?>
</th>
		        <th id="tshowstatus" name="tshowstatus"><?php 
                print_string('status', 'attforblock');
                ?>
</th>
		        <th id="tshowtitle" name="tshowtitle"><?php 
                print_string('sessiontitle', 'attforblock');
                ?>
</th>
		        <th id="tshowsubject" name="tshowsubject"><?php 
                print_string('subject', 'attforblock');
                ?>
</th>
		        <th id="tshowteacher" name="tshowteacher"><?php 
                print_string('teacher', 'attforblock');
                ?>
</th>
		        <th id="tshowdescription" name="tshowdescription"><?php 
                print_string('description', 'attforblock');
                ?>
</th>
		        <th id="tshowmakeupnotes" name="tshowmakeupnotes"><?php 
                print_string('makeupnotes', 'attforblock');
                ?>
</th>
		        <th id="tshowsicknotes" name="tshowsicknotes"><?php 
                print_string('sicknote', 'attforblock');
                ?>
</th>
		        <th id="tshowremarks" name="tshowremarks"><?php 
                print_string('remarks', 'attforblock');
                ?>
</th>
		    </tr>
		<?php 
            }
            $i = 1;
            foreach ($logs as $log) {
                ?>
    <tr>
        <td id="tshowstudent" name="tshowstudent">
        <?php 
                echo "<a href=\"view.php?id={$id}&amp;student={$student->id}\">" . ' ' . fullname($student);
                ?>
        </td>
        <td id="tshowcourse" name="tshowcourse">
        <?php 
                echo "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">" . $course->fullname . '</a>';
                ?>
</td>  
        <td><?php 
                echo "<a href=\"attendances.php?id={$id}&amp;sessionid={$log->id}\">" . userdate($log->sessdate, get_string('strftimedmyw', 'attforblock') . '(' . get_string('strftimehm', 'attforblock') . ')') . '</a>';
                ?>
</td>
        <td id="tshowstatus" name="tshowstatus"><?php 
                echo $statuses[$log->statusid]->description;
                ?>
</td>
        <td id="tshowtitle" name="tshowtitle"><?php 
                echo empty($log->sessiontitle) ? get_string('notitle', 'attforblock') : $log->sessiontitle;
                ?>
</td>
        <td id="tshowsubject" name="tshowsubject"><?php 
                echo empty($log->subject) ? get_string('nosubject', 'attforblock') : $log->subject;
                ?>
</td>
        <td id="tshowteacher" name="tshowteacher"><?php 
                echo empty($log->teacher) ? get_string('noteacher', 'attforblock') : $log->teacher;
                ?>
</td>
        <td id="tshowdescription" name="tshowdescription"><?php 
                echo empty($log->description) ? get_string('nodescription', 'attforblock') : $log->description;
                ?>
</td>
        <td id="tshowmakeupnotes" name="tshowmakeupnotes"><?php 
                echo choose_from_menu($optionlist, 'makenote' . '[' . $log->id . ']', $log ? $log->makeupnotes : '', '', "showUser(this.name, this.value)", '', true);
                ?>
</td>
        <td id="tshowsicknotes" name="tshowsicknotes"><?php 
                echo choose_from_menu($optionlist, 'sicknote' . '[' . $log->id . ']', $log ? $log->sicknote : '', '', "showUser(this.name, this.value)", '', true);
                ?>
</td>
        <td id="tshowremarks" name="tshowremarks"><?php 
                echo '<input type="text" name="myremark[' . $log->id . ']" size="10" onchange="showUser(this.name, this.value)" value="' . ($log ? $log->remarks : '') . '">';
                ?>
</td>
    </tr>
<?php 
            }
            if ($reportselected === 'all') {
                echo '</table>';
            }
        } else {
            echo '<p>' . get_string('noattforperiod', 'attforblock') . '</p>';
        }
    }
}
 function definition()
 {
     global $CFG, $USER, $currentgroup, $students, $context, $sort;
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $cm = $this->_customdata['cm'];
     $modcontext = $this->_customdata['modcontext'];
     //	Add date selectors for from and to dates
     $mform->addElement('date_selector', 'fdatefrom', get_string('datefrom', 'attforblock'));
     $mform->addElement('date_selector', 'fdateto', get_string('dateto', 'attforblock'));
     //	add radio buttons to select the report type
     $reporttype = array();
     $reporttype[] =& MoodleQuickForm::createElement('radio', 'reporttype', '', get_string('all'), 'all', '');
     $reporttype[] =& MoodleQuickForm::createElement('radio', 'reporttype', '', get_string('summaryonly', 'attforblock'), 'summary', '');
     $reporttype[] =& MoodleQuickForm::createElement('radio', 'reporttype', '', get_string('detailonly', 'attforblock'), 'detailed', '');
     $mform->addGroup($reporttype, 'reporttype', get_string('reporttype', 'attforblock'), array(' '), false);
     $mform->setDefault('reporttype', 'all');
     //  add a course select element to the form
     $courselist = array('-1' => get_string('all'));
     $courses = get_my_courses($USER->id, 'fullname ASC, sortorder ASC,visible DESC', '*', false, 21);
     foreach ($courses as $course) {
         $courselist[$course->id] = $course->fullname;
     }
     $mform->addElement('select', 'coursemenu', get_string('course'), $courselist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     //  add a group select element to the form
     $grouplist = array('-1' => get_string('all'));
     $groups = get_records('groups');
     foreach ($groups as $group) {
         $grouplist[$group->id] = $group->name;
     }
     $mform->addElement('select', 'groupmenu', get_string('group'), $grouplist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     if ($currentgroup) {
         $students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.{$sort} ASC", '', '', $currentgroup, '', false);
     } else {
         $students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.{$sort} ASC", '', '', '', '', false);
     }
     //	add a student select element to the form
     $studentlist = array();
     $studentlist[0] = get_string('all');
     foreach ($students as $student) {
         $studentlist[$student->id] = fullname($student);
     }
     $mform->addElement('select', 'studentmenu', get_string('student', 'attforblock'), $studentlist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     //  add a subject select element to the form
     $subjectlist = array('-1' => get_string('all'));
     if (count_records_select('attendance_subjects')) {
         // check if subjects exist
         $subjects = get_subjects($course->id, true);
         foreach ($subjects as $subject) {
             $subjectlist[$subject->subject] = $subject->subject;
         }
     }
     $mform->addElement('select', 'subjectmenu', get_string('subject', 'attforblock'), $subjectlist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     //  add a teacher select element to the form
     $teacherlist = array('-1' => get_string('all'));
     if (count_records_select('attendance_teachers')) {
         // check if teachers exist
         $teachers = get_teachers($course->id, true);
         foreach ($teachers as $teacher) {
             $teacherlist[$teacher->teacher] = $teacher->teacher;
         }
     }
     $mform->addElement('select', 'teachermenu', get_string('teacher', 'attforblock'), $teacherlist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     //	Define the options of the drop down menu for make up notes and sicknote
     $optionlist = array('all' => get_string('all'), 'notrequired' => get_string('notrequired', 'attforblock'), 'outstanding' => get_string('outstanding', 'attforblock'), 'submitted' => get_string('submitted', 'attforblock'), 'cleared' => get_string('cleared', 'attforblock'));
     $mform->addElement('select', 'makeupnotemenu', get_string('makeupnote', 'attforblock'), $optionlist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     $mform->addElement('select', 'sicknotemenu', get_string('sicknote', 'attforblock'), $optionlist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     //  	add a status select element to the form
     $statuslist = array('-1' => get_string('all'));
     if (count_records_select('attendance_statuses')) {
         // check if statuses exist
         $courses = get_my_courses($USER->id, 'fullname ASC, sortorder ASC,visible DESC', '*', false, 21);
         foreach ($courses as $course) {
             //$statuslist['-1'.$course->id] = $course->fullname;
             $statuses = get_statuses($course->id);
             // add a check to see if all courses or only one has been selected:  get_statuses for the course selected and get_status for all courses
             foreach ($statuses as $status) {
                 $statuslist[$status->id] = $course->fullname . ' - * ' . $status->description;
             }
         }
     }
     $select = $mform->addElement('select', 'statusmenu', get_string('status', 'attforblock'), $statuslist, array('size' => 1, 'class' => 'pool', 'style' => 'width:220px;'));
     //	add radio buttons to select the sort order
     $sortmenu = array();
     $sortmenu[] =& MoodleQuickForm::createElement('radio', 'sortmenu', '', get_string('firstname'), 'firstname', '');
     $sortmenu[] =& MoodleQuickForm::createElement('radio', 'sortmenu', '', get_string('lastname'), 'lastname', '');
     $mform->addGroup($sortmenu, 'yesno', get_string('sortby', 'attforblock'), array(' '), false);
     $mform->setDefault('sortmenu', 'lastname');
     $lastquery = get_records('attendance_report_query');
     if ($lastquery) {
         foreach ($lastquery as $field) {
             $mform->setDefaults(array('fdatefrom' => $field->datefrom, 'fdateto' => $field->dateto, 'coursemenu' => $field->course, 'studentmenu' => $field->student, 'teachermenu' => $field->teacher, 'subjectmenu' => $field->subject, 'makeupnotemenu' => $field->makeupnote, 'sicknotemenu' => $field->sicknote, 'statusmenu' => $field->status, 'yesno' => $field->sortby, 'reporttype' => $field->reporttype));
         }
     }
     //  add hidden buttons for course module id and action type
     $submit_string = get_string('update');
     $this->add_action_buttons(false, $submit_string);
     //  hidden elements
     $mform->addElement('hidden', 'id', $cm->id);
     $mform->addElement('hidden', 'action', 'update');
 }
Example #11
0
 /* Изменение титула */
 case "editTitle":
     edit_title($postdata);
     break;
     /* Получение узлов титула */
 /* Получение узлов титула */
 case "getTitleNodes":
     get_title_nodes($postdata);
     break;
 case "getBoundaryNodes":
     get_boundary_nodes($postdata);
     break;
     /* Получение всех статусов титула */
 /* Получение всех статусов титула */
 case "getStatuses":
     get_statuses();
     break;
 case "getBuildingPlans":
     get_building_plans();
     break;
     /* Добавление этапа плана работ строительства титула */
 /* Добавление этапа плана работ строительства титула */
 case "addBuildingPlan":
     add_building_plan_item($postdata);
     break;
     /* Изменение этапа работ плана строительства титула */
 /* Изменение этапа работ плана строительства титула */
 case "editBuildingPlan":
     edit_building_plan($postdata);
     break;
     /* Удаление этапа работ плана строительства титула */
                 $currentrule = $rule->id;
                 $currentsicknote = $rule->sicknote;
                 $currentmakeupnote = $rule->makeupnote;
                 $ruleset = 1;
             } elseif ($rule->percentageattended > 0 && $timepresent >= $rule->percentageattended && $rule->logicoperator == 'greater') {
                 $currentrule = $rule->id;
                 $currentsicknote = $rule->sicknote;
                 $currentmakeupnote = $rule->makeupnote;
                 $ruleset = 1;
             }
         }
     }
     // echo '</td></tr></table>';
     // Log the result of applying all the rules in sequence in ascending order of severity in attendance_logs
     if ($ruleset == 1) {
         $statlist = implode(',', array_keys((array) get_statuses($course->id)));
         $rec = new Object();
         $rec->sessionid = $session->id;
         $rec->studentid = $student->id;
         $rec->statusid = $currentrule;
         $rec->statusset = $statlist;
         $rec->timetaken = $timenow;
         $rec->takenby = $USER->id;
         $rec->makeupnotes = $currentmakeupnote;
         $rec->sicknote = $currentsicknote;
         // insert_record('attendance_log', $rec);
     }
 } else {
     echo '<p></p>';
     echo ' No rules were found';
     echo '<p><hr /></p>';
function print_cleared_items($user, $cm, $course = 0, $printing = null)
{
    global $CFG, $COURSE, $mode;
    echo '<table class="userinfobox">';
    if (!$printing) {
        echo '<tr>';
        echo '<td colspan="2">' . helpbutton('studentview', get_string('attendancereport', 'attforblock'), 'attforblock', true, false, '', true) . "<a href=\"view.php?id={$cm->id}&amp;student={$user->id}&amp;mode={$mode}&amp;printing=yes\" >[" . get_string('versionforprinting', 'attforblock') . ']</a></td>';
        echo '</tr>';
    }
    echo '<tr>';
    echo '<td class="left side">';
    print_user_picture($user->id, $COURSE->id, $user->picture, true);
    echo '</td>';
    echo '<td class="generalboxcontent">';
    echo '<h1><b>' . fullname($user) . '</b></h1>';
    if ($course) {
        echo '<hr />';
        $complete = get_attendance($user->id, $course);
        if ($complete) {
            print_attendance_table($user, $course);
        } else {
            echo get_string('nocleareditems', 'attforblock');
        }
    } else {
        $stqry = "\n            SELECT ats.id,ats.courseid\n            FROM {$CFG->prefix}attendance_log al\n            JOIN {$CFG->prefix}attendance_sessions ats\n            ON al.sessionid = ats.id\n            WHERE al.studentid = {$user->id}\n            GROUP BY ats.courseid\n            ORDER BY ats.courseid asc";
        $recs = get_records_sql_menu($stqry);
        foreach ($recs as $id => $courseid) {
            echo '<hr />';
            echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="list1">';
            $nextcourse = get_record('course', 'id', $courseid);
            echo '<tr><td valign="top"><strong>' . $nextcourse->fullname . '</strong></td>';
            echo '<td align="right">';
            $complete = get_attendance($user->id, $nextcourse);
            if ($complete) {
                print_attendance_table($user, $nextcourse);
            } else {
                echo get_string('nocleareditems', 'attforblock');
            }
            echo '</td></tr>';
            echo '</table>';
        }
    }
    if ($course) {
        $stqry = "\n            SELECT ats.sessdate,ats.sessiontitle,ats.subject,ats.teacher,ats.description,al.statusid,al.remarks,al.makeupnotes,al.sicknote\n            FROM {$CFG->prefix}attendance_log al\n            JOIN {$CFG->prefix}attendance_sessions ats\n            ON al.sessionid = ats.id\n            WHERE al.studentid = {$user->id} AND al.makeupnotes = 'cleared' AND (al.sicknote = 'cleared' OR al.sicknote = 'notrequired')\n            ORDER BY ats.sessdate asc";
        if ($sessions = get_records_sql($stqry)) {
            $statuses = get_statuses($course->id);
            ?>
            <div id="mod-assignment-submissions">
            <table
                align="left"
                cellpadding="3"
                cellspacing="0"
                class="submissions"
            >
                <tr>
                    <th>#</th>
                    <th align="center"><?php 
            print_string('date');
            ?>
</th>
                    <th align="center"><?php 
            print_string('time');
            ?>
</th>
                    <th align="center"><?php 
            print_string('status', 'attforblock');
            ?>
</th>
                    <th align="center"><?php 
            print_string('sessiontitle', 'attforblock');
            ?>
</th>
                    <th align="center"><?php 
            print_string('subject', 'attforblock');
            ?>
</th>
                    <th align="center"><?php 
            print_string('teacher', 'attforblock');
            ?>
</th>
                    <th align="center"><?php 
            print_string('description', 'attforblock');
            ?>
</th>
                    <th align="center"><?php 
            print_string('makeupnotes', 'attforblock');
            ?>
</th>
                    <th align="center"><?php 
            print_string('sicknote', 'attforblock');
            ?>
</th>
                    <th align="center"><?php 
            print_string('remarks', 'attforblock');
            ?>
</th>
                </tr>
                <?php 
            $i = 1;
            foreach ($sessions as $key => $session) {
                ?>
                <tr>
                    <td align="center"><?php 
                echo $i++;
                ?>
</td>
                    <td><?php 
                echo userdate($session->sessdate, get_string('strftimedmyw', 'attforblock'));
                //userdate($students->sessdate,'%d.%m.%y&nbsp;(%a)', 99, false);
                ?>
</td>
                    <td><?php 
                echo userdate($session->sessdate, get_string('strftimehm', 'attforblock'));
                ?>
</td>
                    <td><?php 
                echo $statuses($session->statusid)->description;
                ?>
</td>
                    <td><?php 
                echo empty($session->sessiontitle) ? get_string('notitle', 'attforblock') : $session->sessiontitle;
                ?>
</td>
                    <td><?php 
                echo empty($session->subject) ? get_string('nosubject', 'attforblock') : $session->subject;
                ?>
</td>
                    <td><?php 
                echo empty($session->teacher) ? get_string('noteacher', 'attforblock') : $session->teacher;
                ?>
</td>
                    <td><?php 
                echo empty($session->description) ? get_string('nodescription', 'attforblock') : $session->description;
                ?>
</td>
                    <td><?php 
                echo get_string($session->makeupnotes, 'attforblock');
                ?>
</td>
                    <td><?php 
                echo get_string($session->sicknote, 'attforblock');
                ?>
</td>
                    <td><?php 
                echo $session->remarks;
                ?>
</td>
                </tr>
                <?php 
            }
            echo '</table>';
        } else {
            print_heading(get_string('nocleareditems', 'attforblock'));
        }
    }
    echo '</td></tr><tr><td>&nbsp;</td></tr></table></div>';
}