Beispiel #1
0
 function definition()
 {
     global $DB, $sessionid, $courseid, $OUTPUT, $action, $userid;
     $mform =& $this->_form;
     $actionOptions = array('mark_as_attended' => get_string('markattended', 'local_attendance'), 'mark_as_absent' => get_string('markabsent', 'local_attendance'));
     $actionGroup = array();
     $actionGroup[] =& $mform->createElement('select', 'action_for_checked', '', $actionOptions);
     $actionGroup[] =& $mform->createElement('submit', 'submitbutton', get_string('apply', 'local_attendance'));
     $actionGroup[] =& $mform->createElement('html', '<div id="filter">' . get_string('filter', 'local_attendance') . ': <input type="text"></div>');
     $mform->addGroup($actionGroup, 'actionGroup', get_string('chooseoption', 'local_attendance'), array(' '), false);
     $sessionsTable = tables::getAssistDateDetail($courseid, $sessionid);
     $mform->addElement('html', html_writer::table($sessionsTable));
     $mform->addElement('hidden', 'sessionid', $sessionid);
     $mform->setType('sessionid', PARAM_INT);
     $mform->addElement('hidden', 'courseid', $courseid);
     $mform->setType('courseid', PARAM_INT);
     $mform->addElement('hidden', 'action', 'modify_session_attendance');
     $mform->setType('action', PARAM_TEXT);
 }
Beispiel #2
0
<?php

class tables
{
    public function getTable($arr)
    {
        echo "<table cellpadding='5' cellspacing='0' border='1'>";
        foreach ($arr as $key => $val) {
            echo "<tr>";
            echo "<td>";
            echo $key;
            echo "</td>";
            echo "<td>";
            echo $val;
            echo "</td>";
            echo "</tr>";
        }
        echo "</table>";
    }
}
$array = array("name" => "Иванов И.И.", "age" => "25", "email" => "*****@*****.**");
$table = new tables();
echo $table->getTable($array);
            $DB->update_record('bookingrooms_bookings', $bookings);
            $action = "see";
        }
    }
}
// 'See' action implementation
// Shows a table per page of all the room reservations that are active in decreasing order by date
// with a link that allows you to add a comment or see, if exist, a comment
if ($action == "see") {
    $max = 15;
    $page = optional_param('page', 0, PARAM_INT);
    //$bokkings = $DB->get_records('bookingrooms_bookings');
    $bookings = $DB->get_records_sql('select * from {bookingrooms_bookings} where active = 1 order by date_bookings desc');
    $count = count($bookings);
    $totalpages = ceil($count / $max);
    $table = tables::allbookingdata($reservas, $max, $page);
}
//view of the actions: see & comment
$o = '';
$title = get_string('bookinghistory', 'local_bookingrooms');
$PAGE->navbar->add(get_string('roomsreserve', 'local_bookingrooms'));
$PAGE->navbar->add(get_string('adjustments', 'local_bookingrooms'));
$PAGE->navbar->add($title, 'bookinghistory.php');
if ($action == "see") {
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    $o .= $OUTPUT->header();
    $o .= $OUTPUT->heading($title);
    $o .= "version 2013031400";
    $o .= "<right><h4> " . get_string('totalbookings', 'local_bookingrooms') . " " . $count . "  </h4></right>";
    $o .= "<div class='no-overflow'>";
$PAGE->navbar->add(get_string('attendances', 'local_attendance'));
$PAGE->navbar->add(get_string('viewattendance', 'local_attendance'));
$PAGE->navbar->add(get_string('bystudents', 'local_attendance'), "/local/attendance/viewstudentrecord.php?courseid={$courseid}");
$action = optional_param('action', 'view_by_student', PARAM_TEXT);
echo $OUTPUT->header();
$toprow = array();
$toprow[] = new tabobject("bystudent", new moodle_url('/local/attendance/viewstudentrecord.php', array('courseid' => $courseid)), get_string('bystudents', 'local_attendance'));
$toprow[] = new tabobject("bysession", new moodle_url('/local/attendance/viewsessionrecord.php', array('courseid' => $courseid)), get_string('bysessions', 'local_attendance'));
echo $OUTPUT->tabtree($toprow, "bystudent");
if ($action == 'view_by_student') {
    $title = $courseName->fullname . ' - ' . get_string('attendancerecord', 'local_attendance');
    echo $OUTPUT->heading($title);
    echo '<br>';
    echo '<div id="filter"><strong>' . get_string('filter', 'local_attendance') . ': </strong> <input type="text"></div>';
    echo '<br>';
    $table = tables::getAssistByStudent($courseid);
    echo html_writer::table($table);
    $back = new moodle_url('/course/view.php?id=' . $courseid);
    echo $OUTPUT->single_button($back, get_string('back', 'local_attendance'));
}
if ($action == 'modify_student_attendance') {
    $subject = get_string('attendancemodified', 'local_attendance');
    $subjectTosend = $courseName->shortname . ': ' . $subject;
    $userid = required_param('userid', PARAM_INT);
    $actionsForm = new actionsForStudent();
    $username = $DB->get_record('user', array('id' => $userid));
    $table = new html_table();
    $table->head = array(get_string('sessionname', 'local_attendance'), get_string('changes', 'local_attendance'), get_string('report', 'local_attendance'));
    if ($fromform = $actionsForm->get_data()) {
        if (isset($_POST["sessions"])) {
            if ($fromform->action_for_checked == 'mark_as_absent') {
    $idresource = required_param('idresource', PARAM_INT);
    if (confirm_sesskey()) {
        $resources = $DB->get_records('bookingrooms_resources', array('id' => $idresource));
        foreach ($resources as $resource) {
            $DB->delete_records('bookingrooms_roomresource', array('resources_id' => $resource->id));
        }
        $DB->delete_records('bookingrooms_resources', array('id' => $idresource));
        $action = "view";
    } else {
        print_error("ERROR");
    }
}
// Implementation action view
// Displays a table with all the resources
if ($action == 'view') {
    $table = tables::getResources();
}
// Views of the action
//**************************************************************************************************************************************************
if ($action == 'edit') {
    $o = '';
    $title = get_string('editresource', 'local_bookingrooms');
    $PAGE->navbar->add(get_string('roomsreserve', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('adjustments', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('seeandmodresources', 'local_bookingrooms'), 'resources.php');
    $PAGE->navbar->add($title, '');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    $o .= $OUTPUT->header();
    $o .= $OUTPUT->heading(get_string('editresource', 'local_bookingrooms'));
    $o .= '<h4>' . get_string('resource', 'local_bookingrooms') . ': ' . $resourcename->name . '</h4>';
    } else {
        $DB->insert_record('local_attendance_attendance', array('sessionid' => $session->id, 'userid' => $USER->id));
        echo '<div class="alert alert-success">' . get_string('attendancemarkedon', 'local_attendance') . ' ' . $session->fullname . '</div>';
    }
    $action = 'startpage';
}
if ($action == 'startpage') {
    $sessions = $DB->get_records_sql('SELECT c.id,c.fullname,u.id as userid,s.id as sessionid FROM {user} u INNER JOIN {user_enrolments} ue ON (ue.userid = u.id) INNER JOIN {enrol} e ON (e.id = ue.enrolid) INNER JOIN {course} c ON (e.courseid = c.id) INNER JOIN {local_attendance_session} s ON (c.id=s.courseid) WHERE ue.userid = ' . $USER->id . ' AND s.open=1');
    if (empty($sessions)) {
        echo '<div class="alert alert-info">' . get_string('nosessions', 'local_attendance') . '</div>';
    } else {
        $n = 0;
        foreach ($sessions as $session) {
            $sessionContext = context_course::instance($session->id);
            if (!has_capability('local/attendance:teacherview', $sessionContext)) {
                $n++;
            }
        }
        if ($n > 0) {
            echo '<h3>' . get_string('followingopensessions', 'local_attendance') . '</h3>';
            $table = tables::getOpenSessions($sessions);
            echo html_writer::table($table);
        } else {
            echo '<div class="alert alert-info">' . get_string('nosessions', 'local_attendance') . '</div>';
        }
    }
}
echo $OUTPUT->single_button(new moodle_url('/'), get_string('back', 'local_attendance'));
echo $OUTPUT->footer();
?>
<link rel="stylesheet" type="text/css"  href= "scripts/style.css"/>
Beispiel #7
0
if (!$courseExists) {
    print_error(get_string('INVALID_ACCESS', 'local_attendance'));
}
$url = new moodle_url('/local/attendance/studentrecord.php');
$context = context_system::instance();
$PAGE->set_context($context);
$PAGE->set_url($url);
$PAGE->set_pagelayout('standard');
if (has_capability('local/attendance:teacherview', $context)) {
    print_error(get_string('INVALID_ACCESS', 'local_attendance'));
}
$courseName = $DB->get_record('course', array('id' => $courseid));
//breadcurmbs
$PAGE->navbar->add($courseName->shortname, '/course/view.php?id=' . $courseid);
$PAGE->navbar->add(get_string('attendances', 'local_attendance'));
$PAGE->navbar->add(get_string('record', 'local_attendance'), '/local/attendance/studentrecord.php?courseid=' . $courseid);
$percentage = $DB->get_record_sql('SELECT ROUND(100*(SELECT count(*) FROM {local_attendance_attendance} a WHERE a.sessionid
								  IN (SELECT s.id from {local_attendance_session} s WHERE s.courseid=' . $courseid . ') AND a.userid=' . $USER->id . ')/
								  (SELECT count(*) FROM {local_attendance_session} s WHERE s.courseid=' . $courseid . ')) as total');
$title = $courseName->fullname . ' - ' . get_string('attendancerecord', 'local_attendance') . ' (' . get_string('attendance', 'local_attendance') . ': ' . $percentage->total . '%)';
$PAGE->set_title($title);
$PAGE->set_heading($title);
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
echo '<br>';
$table = tables::getStudentHistory($courseid);
echo html_writer::table($table);
echo $OUTPUT->single_button(new moodle_url('/course/view.php?id=' . $courseid), get_string('back', 'local_attendance'));
global $local_attendance;
$local_attendance = true;
echo $OUTPUT->footer();
Beispiel #8
0
        foreach ($buildings as $building) {
            $rooms = $DB->get_records('bookingrooms_rooms', array('buildings_id' => $building->id));
            foreach ($rooms as $room) {
                $DB->delete_records('bookingrooms_reserves', array('rooms_id' => $room->id));
            }
            $DB->delete_records('bookingrooms_rooms', array('buildings_id' => $building->id));
        }
        $DB->delete_records('bookingrooms_buildings', array('campus_id' => $idcampus));
        $DB->delete_records('bookingrooms_campus', array('id' => $idcampus));
        $action = "view";
    } else {
        print_error("ERROR");
    }
}
if ($action == 'view') {
    $table = tables::getPlacesAdminRoom();
}
//View of the Actions
//**************************************************************************************************************************************************
if ($action == 'edit') {
    $o = '';
    $title = get_string('editcampus', 'local_bookingrooms');
    $PAGE->navbar->add(get_string('roomsreserve', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('adjustments', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('seeandmodplaces', 'local_bookingrooms'), 'campus.php');
    $PAGE->navbar->add($title, '');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    $o .= $OUTPUT->header();
    $o .= $OUTPUT->heading(get_string('editcampus', 'local_bookingrooms'));
    if (isset($placename->name)) {
Beispiel #9
0
<?php

session_start();
if (!$_SESSION[userPagos]) {
    die;
}
include_once 'table.php';
$oop = new tables();
if ($_POST[action] == 'reload') {
    $rta = $oop->getTable($_POST[mes], $_POST[anio], $_POST[tipo], 1);
    echo $rta;
} else {
    if ($_POST[action] == 'saldo') {
        $rta = $oop->reloadSaldo();
        echo $rta;
    }
}
Beispiel #10
0
<?php

include_once 'table.php';
$oop = new tables();
if ($_POST[action] == 'reload') {
    $rta = $oop->getTable($_POST[mes], $_POST[anio], $_POST[tipo], '../db.php');
    echo $rta;
} else {
    if ($_POST[action] == 'saldo') {
        $rta = $oop->reloadSaldo();
        echo $rta;
    }
}
Beispiel #11
0
//shows course students and starts getAttended function
if ($action == 'check_attendance') {
    $title = get_string('checkattendance', 'local_attendance');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($title);
    echo '<h3 id="sessionStatus">' . get_string('waitingfor', 'local_attendance') . '<span>. . . </span></h3>';
    echo '<script>var courseid = ' . $courseid . ';</script>';
    //course id that will be used inside javascript
    echo '<div class="alert alert-info">' . get_string('knowledgemessage', 'local_attendance') . ' <span id="remainingTime"></span> ' . get_string('minutes', 'local_attendance') . '</div>';
    echo '<h4 id="percentage">' . get_string('total', 'local_attendance') . ': <span>0</span>%</h4>';
    echo '<h4 id="numberAttended">' . get_string('attendants', 'local_attendance') . ': <span>0</span></h4>';
    echo '<script type="text/javascript" language="javascript" src="scripts/java.js"></script>';
    echo $OUTPUT->single_button(new moodle_url('/local/attendance/attendance.php', array('courseid' => $courseid, 'action' => 'close_session')), get_string('closesession', 'local_attendance'));
    $table = tables::getCourseStudents($courseid);
    echo html_writer::table($table);
}
//start page that lets the user continue or start a session
if ($action == 'startpage') {
    $title = get_string('checkattendance', 'local_attendance');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($title);
    echo '<h3>' . $courseName->fullname . '</h3>';
    if (isset($message)) {
        echo $message;
    }
    $session = $DB->get_record('local_attendance_session', array('courseid' => $courseid, 'open' => 1));
    if (empty($session)) {
Beispiel #12
0
                            $recordtwo->hour_end = $end_module;
                            $recordtwo->building_id = $buildingid->id;
                            $DB->insert_record('bookingrooms_modules', $recordtwo);
                        }
                    }
                }
            } else {
                print_error("ERROR");
            }
            $action = 'view';
        }
    }
}
// If the ACTION is seeing creates the table that displays all existing buildings
if ($action == 'view') {
    $table = tables::datasPlacesBuildingsAdminRoom();
}
//**************************************************************************************************
// ACTION views each previously implemented are created.
if ($action == 'edit') {
    $o = '';
    $title = get_string('editbuilding', 'local_bookingrooms');
    $PAGE->navbar->add(get_string('roomsreserve', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('adjustments', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('seeandmodbuildings', 'local_bookingrooms'), 'buildings.php');
    $PAGE->navbar->add($title, '');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    $o .= $OUTPUT->header();
    $o .= $OUTPUT->heading(get_string('editbuilding', 'local_bookingrooms'));
    ob_start();
Beispiel #13
0
            if (empty($id_rooms)) {
                $condition = '1';
            }
            if (!empty($id_rooms)) {
                $string_id_rooms = implode(",", $id_rooms);
                $select .= "AND rooms_id in ({$string_id_rooms}) ";
            }
        }
        $select .= "AND activa=1";
        //$result = $DB->get_records_select('reservarooms_reservas',$select);
        $result = $DB->get_records_select('bookingrooms_bookings', $select, $params);
        if (empty($result) || $condition == 1) {
            // $condition=1 significa que no hay rooms
            echo '<h5>' . get_string('noreservesarefound', 'local_bookingrooms') . '</h5>';
        } else {
            $table = tables::searchRooms($result);
            echo html_writer::tag('<form', '', array('name' => 'search', 'method' => 'POST'));
            echo html_writer::table($table);
            if (has_capability('local/bookingrooms:delete', $context)) {
                echo '<input type="submit" name="action" value="remove" onClick="return ComfirmDeleteOrder();">';
            }
            if (has_capability('local/bookingrooms:changewith', $context)) {
                echo '<input type="submit" name="action" value="swap">';
            }
            echo html_writer::end_tag('form');
        }
    }
} else {
    if ($action == "remove") {
        echo $OUTPUT->heading(get_string('reserveseliminated', 'local_bookingrooms') . '!');
        if (!has_capability('local/bookingrooms:delete', $context)) {
Beispiel #14
0
!
        <a class="logoutIcon" href="/ios/"><img title="Logout <?php 
echo ucfirst($_SESSION[userPagos]);
?>
" alt="Logout Icon" src="images/logout-icon.png" height="25" width="21"></a>
        <a href="javascript:;" onClick="toggleEditor(4)" ><img title="Notify <?php 
echo ucfirst($_SESSION[userPagos]);
?>
" alt="Notify Icon" src="images/notify-icon.png" height="21" width="30"></a>
    </h1>
</header>

<section id="table">
	<?php 
include_once 'php/table/table.php';
$table = new tables();
$rta = $table->getTable('', '', 0);
echo $rta;
?>
</section>

<section id="saldo">
	<?php 
$resumen = $table->reloadSaldo();
echo $resumen;
?>
</section>

<footer>
	<ul>
    	<li id="addPayment"><a href="javascript:;" onClick="toggleEditor(1)">Payment</a></li>
Beispiel #15
0
$selectHosting = new hostingFunctions();
$rta = $selectHosting->getSelects('php/db.php');
echo $rta;
?>
                </select>
            </div>
            <input type="submit" id="agregarHosting" value="Payed">
        </form>
    </div>
</section>

<section id="right">
	<div id="table">
        <?php 
include_once 'php/table/table.php';
$table = new tables();
$rta = $table->getTable('', '', 'php/db.php');
echo $rta;
?>
    </div>
</section>

<div id="divGastosMod">
	<h2>Modify Payment <a href="javascript:;" onClick="hideModGastos()">Close</a></h2>
    <form method="post" id="formGastosMod" onSubmit="return gastos('mod','','')">
            <div class="editRow">
            	<input type="text" id="conceptoMod" value="" autocomplete="off">
                <input type="hidden" id="idMod" value="">
	            <input type="hidden" id="fechaMod" value="">
            </div>
            <div class="editRow" id="monedaRadiosMod">
            $eventdata->userto = $email->id;
            //con id
            $send = message_send($eventdata);
        }
        if ($send) {
            echo '<div class="alert alert-info">' . get_string('alertsessioneliminated', 'local_attendance') . '</div>';
            echo '<div class="alert alert-success">' . get_string('emailsent', 'local_attendance') . '</div>';
        }
    }
    $action = 'view_by_session';
}
if ($action == 'view_by_session') {
    $title = $courseName->fullname . ' - ' . get_string('attendancerecord', 'local_attendance');
    echo $OUTPUT->heading($title);
    echo '<br>';
    $table = tables::getAssistByDate($courseid);
    echo html_writer::table($table);
    $back = new moodle_url('/course/view.php?id=' . $courseid);
    echo $OUTPUT->single_button($back, get_string('back', 'local_attendance'));
}
if ($action == 'modify_session_attendance') {
    $sessionid = required_param('sessionid', PARAM_INT);
    $sessionName = $DB->get_record('local_attendance_session', array('id' => $sessionid));
    $subject = get_string('attendancemodified', 'local_attendance');
    $subjectTosend = $courseName->shortname . ': ' . $subject;
    $actionsForm = new actionsForSession();
    if ($fromform = $actionsForm->get_data()) {
        $table = new html_table();
        $table->head = array(get_string('lastname', 'local_attendance'), get_string('firstname', 'local_attendance'), get_string('changes', 'local_attendance'), get_string('report', 'local_attendance'));
        $sessiondate = $DB->get_record('local_attendance_session', array('id' => $fromform->sessionid));
        $name = empty($sessiondate->comment) || is_null($sessiondate->comment) ? get_string('noname', 'local_attendance') : $sessiondate->comment;
Beispiel #17
0
            			}
            		}*/
            $action = "report";
        }
    }
}
//Implement the action view
//generates a table all existing rooms
if ($action == 'view') {
    $table = tables::getrooms();
} else {
    if ($action == 'viewbybuilding') {
        $buildingid = optional_param('building', NULL, PARAM_INT);
        $building = $DB->get_record('bookingrooms_buildings', array('id' => $buildingid));
        $campus = $DB->get_record('bookingrooms_campus', array('id' => $building->campus_id));
        $table = tables::getrooms($buildingid);
    }
}
//View of the Actions
//**************************************************************************************************************************************************
if ($action == 'view') {
    $o = '';
    $toprow = array();
    $toprow[] = new tabobject(get_string('sites', 'local_bookingrooms'), new moodle_url('/local/bookingrooms/settings/campus.php'), get_string('places', 'local_bookingrooms'));
    $toprow[] = new tabobject(get_string('buildings', 'local_bookingrooms'), new moodle_url('/local/bookingrooms/settings/buildings.php'), get_string('buildings', 'local_bookingrooms'));
    $toprow[] = new tabobject(get_string('studyrooms', 'local_bookingrooms'), new moodle_url('/local/bookingrooms/settings/rooms.php'), get_string('rooms', 'local_bookingrooms'));
    $toprow[] = new tabobject(get_string('resources', 'local_bookingrooms'), new moodle_url('/local/bookingrooms/settings/resources.php'), get_string('resources', 'local_bookingrooms'));
    $title = get_string('seeandmodrooms', 'local_bookingrooms');
    $PAGE->navbar->add(get_string('roomsreserve', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('adjustments', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('seeandmodrooms', 'local_bookingrooms'), 'rooms.php');
Beispiel #18
0
function ls_datosec2($id_dsec)
{
    $otables = new tables();
    $otables->setId_ds($id_dsec);
    return $otables->get_datosec2();
}
Beispiel #19
0
            $DB->update_record('bookingrooms_bookings', $bookings);
            $action = "see";
        }
    }
}
// 'See' action implementation
// Shows a table per page of all the room reservations that are active in decreasing order by date
// with a link that allows you to add a comment or see, if exist, a comment
if ($action == "see") {
    $max = 15;
    $page = optional_param('page', 0, PARAM_INT);
    //$bokkings = $DB->get_records('bookingrooms_bookings');
    $bookings = $DB->get_records_sql('SELECT * from {bookingrooms_bookings} WHERE active = 1 order by date_bookings desc');
    $count = count($bookings);
    $totalpages = ceil($count / $max);
    $table = tables::AlldataReservations($reservas, $max, $page);
}
//view of the actions: see & comment
$o = '';
$title = get_string('bookinghistory', 'local_bookingrooms');
$PAGE->navbar->add(get_string('roomsreserve', 'local_bookingrooms'));
$PAGE->navbar->add(get_string('adjustments', 'local_bookingrooms'));
$PAGE->navbar->add($title, 'bookinghistory.php');
if ($action == "see") {
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    $o .= $OUTPUT->header();
    $o .= $OUTPUT->heading($title);
    $o .= "version 2013031400";
    $o .= "<right><h4> " . get_string('totalbookings', 'local_bookingrooms') . " " . $count . "  </h4></right>";
    $o .= "<div class='no-overflow'>";