Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
/*
Template Name: Pre-Advising
*/
function getByCourse(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://web2.uconn.edu/ece/preadvising/pread_course.php");
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close ($ch);
libxml_use_internal_errors(true);
$dom = new DOMDocument;
$dom->loadHTML($output);
$xpath = new DOMXPath($dom);
$majorOptions = $xpath->query('//select[@name="discipline"]/option');
$majors = array();
foreach( $majorOptions as $m ){
$majors[] = $m->getAttribute('value');
}
return $majors;
}
function getByMajor(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://web2.uconn.edu/ece/preadvising/pread_major.php");
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close ($ch);
libxml_use_internal_errors(true);
$dom = new DOMDocument;
$dom->loadHTML($output);
$xpath = new DOMXPath($dom);
$majorOptions = $xpath->query('//select[@name="major"]/option');
$majors = array();
foreach( $majorOptions as $m ){
$majors[] = $m->getAttribute('value');
}
return $majors;
}
get_header();
?>
<div id="page-advising">
<div class="row">
<div class="col-sm-12">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_the_title() ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of the loop. ?>
<div class="col-sm-6 left-courses">
<h2> Select by Course</h2>
<?php
$majors = getByCourse();
echo '<select name="discipline" class="select-discipline">';
foreach( $majors as $k=>$m ){
if( empty($m) ){
$m = "Select a discipline";
}
echo '<option value="'.$k.'">'.$m.'</option>';
}
echo '</select>';
?>
<br>
<select name="course" style="display:none" class="select-course"><option value="0">Select a course</option></select>
<div id="ece-course" style="display:none">
<p id="ece-course-name"></p>
<p id="ece-course-learnmore">Learn more about the department at: </p>
<div id="ece-course-required">
<p>This course may be required by or can be used to fill requirements for the following majors:</p>
<ul></ul>
</div>
</div>
<br><br>
</div>
<div class="col-sm-6">
<h2> Select by Major</h2>
<?php
$getByMajor = getByMajor();
echo '<select name="major">';
foreach( $getByMajor as $k=>$m ){
if( empty($m) ){
$m = "Select a major";
}
echo '<option value="'.$k.'">'.$m.'</option>';
}
echo '</select>';
?>
<div id="ece-major" style="display:none">
<p id="ece-major-name"></p>
<p id="ece-major-url"></p>
<div id="ece-major-courses">
<p id="ece-major-text"></p>
<ul></ul>
</div>
<p>To see if your schools offers these courses, see the Guidance Director at your high school.</p>
</div>
</main>
</div>
</div>
</div>
</div>
<?php
get_footer();
?>