-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoursesindex.php
More file actions
82 lines (71 loc) · 2.46 KB
/
coursesindex.php
File metadata and controls
82 lines (71 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
require_once('config.php');
require_once($CFG->dirroot . '/course/lib.php');
require_once($CFG->libdir . '/filelib.php');
include('function/emailfunction.php');
$site = get_site();
$activetrainings = get_string('activetrainings');
$mytraining = get_string('mytraining');
$home_enroll = get_string('enrollnow');
$select_programme = 'Select Program';
$title = "$SITE->shortname: Courses";
$PAGE->set_title($title);
$PAGE->set_heading($site->fullname);
$activetrainings_link = new moodle_url('/coursesindex.php?id=', array('id' => $USER->id)); //added by arizan
if (isloggedin()) {
$PAGE->navbar->add($mytraining, $activetrainings_link)->add($activetrainings, $activetrainings_link);
} else {
$PAGE->navbar->add($home_enroll)->add($select_programme);
}
echo $OUTPUT->header();
if (isloggedin()) {
if ($USER->id != '2') {
// redirect if poassword not change
$rselect = mysql_query("SELECT * FROM {$CFG->prefix}user_preferences WHERE userid='" . $USER->id . "' AND name='auth_forcepasswordchange' AND value='1'");
$srows = mysql_num_rows($rselect);
if ($srows != '0') {
?>
<script language="javascript">
window.location.href = '<?= $CFG->wwwroot . '/login/change_password.php'; ?>';
</script>
<?php
}
// redirect if profile not updated
$rsc = mysql_query("SELECT * FROM {$CFG->prefix}user WHERE id='" . $USER->id . "' AND (email='' OR college_edu='' OR highesteducation='' OR yearcomplete_edu='0')");
$srows2 = mysql_num_rows($rsc);
if ($srows2 != '0') {
?>
<script language="javascript">
window.location.href = '<?= $CFG->wwwroot . '/user/edit.php?id=' . $USER->id . '&course=1'; ?>';
</script>
<?php
}
}
}
?>
<?php
include("includes/functions.php");
if ($_REQUEST['command'] == 'add' && $_REQUEST['productid'] > 0) {
$pid = $_REQUEST['productid'];
//echo $pid;
addtocart($pid, 1);
//header("location:shoppingcart.php?pid=$pid");
//exit();
}
?>
<script language="javascript">
function addtocart(pid) {
document.formcart.productid.value = pid;
document.formcart.command.value = 'add';
document.formcart.submit();
}
</script>
<form name="formcart">
<input type="hidden" name="productid" />
<input type="hidden" name="command" />
</form>
<?php
$priceid = $_GET['priceid'];
include_once('courses.php');
echo $OUTPUT->footer();
?>