|
|
|
|
|
|
|
/wave/learn-french/course-selector/
/wave/learn-french/course-selector/
|
|
Course Selector
Course Selector
|
|
<ss:logic:include page="/af/course-selector/style/" />
<ss:logic:variable as="visible_steps" value="\Framework\AF\CourseSelector::getVisibleSteps()" parsenow="value" />
<ss:logic:variable as="current_step" value="\Framework\AF\CourseSelector::getCurrentStep($visible_steps)" parsenow="value" />
<ss:logic:variable as="current_step_entity" value="\Framework\AF\CourseSelector::getStepEntity($current_step)" parsenow="value" />
<ss:logic:variable as="previous_step" value="\Framework\AF\CourseSelector::getPreviousStep($visible_steps)" parsenow="value" />
<ss:logic:variable as="previous_step_entity" value="\Framework\AF\CourseSelector::getStepEntity($previous_step)" parsenow="value" />
[? urlCleanup($current_step) ?]
<div id="course_selector">
<ss:logic:variable as="course_selector_title" value="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_title')" parsenow="value" />
<ss:logic:if test="$course_selector_title">
<h1>[? $course_selector_title ?]</h1>
</ss:logic:if>
<ss:logic:if test="count($visible_steps)">
<script type="text/javascript">
(function($) {
$(document).ready(function() {
$('#course_selector_current_step_body div.item:not(.noCourses):not(.noHighLight)').click(function(e) {
if(e.target && e.target.nodeName && e.target.nodeName == 'A') {
return;
}
location.href = $('.itemUrl', $(this)).val();
});
});
})(jQuery);
</script>
<ss:logic:if test="\Framework\AF\CourseSelector::hasClickedLink()">
<script type="text/javascript">
(function($) {
$(document).ready(function() {
$('html, body').scrollTop($("#course_selector").offset().top - 40);
});
})(jQuery);
</script>
</ss:logic:if>
<div id="course_selector_header">
<ss:data:repeater as="step" datasource="$visible_steps">
<ss:logic:if test="$step['step_title'] == $current_step['step_title']">
<div class="stepTitle currentStep">
<strong>[? $step['step_title'] ?]</strong><br />
<small>[? \Framework\AF\CourseSelector::renderStepValue($step) ?]</small>
</div>
</ss:logic:if>
<ss:logic:else>
<ss:logic:if test="$step['step_component'] == 'Components\\AF\\Courses\\Configuration\\Levels' && \Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_use_placement_page')">
<ss:logic:variable as="back_url" value="\Framework\AF\CourseSelector::makeBackURL($step, array('level_id'))" parsenow="value" />
</ss:logic:if>
<ss:logic:else>
<ss:logic:variable as="back_url" value="\Framework\AF\CourseSelector::makeBackURL($step)" parsenow="value" />
</ss:logic:else>
<a href="[? $back_url ?]">
<div class="stepTitle">
<strong>[? $step['step_title'] ?]</strong><br />
<small>[? \Framework\AF\CourseSelector::renderStepValue($step) ?]</small>
</div>
</a>
</ss:logic:else>
</ss:data:repeater>
<ss:logic:if test="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_show_next_steps')">
<ss:data:repeater as="step" datasource="getRemainingSteps($visible_steps)">
<div class="stepTitle disabled">
<strong>[? $step['step_title'] ?]</strong>
</div>
</ss:data:repeater>
</ss:logic:if>
<div style="clear: both;"></div>
</div>
<div id="course_selector_body">
<ss:logic:if test="\Framework\AF\CourseSelector::getStepIsRecursing($current_step) && $current_step_entity">
<div id="previous_step_description">
<h2>Your previous selection: [? $current_step_entity['name'] ?]</h2>
<ss:logic:if test="getRealLength($current_step_entity['long_description'])">
<ss:logic:parse text="$current_step_entity['long_description']" parsenow="text" />
</ss:logic:if>
<ss:logic:else test="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_short_description_fallback') && getRealLength($current_step_entity['short_description'])">
<ss:logic:parse text="$current_step_entity['short_description']" parsenow="text" />
</ss:logic:else>
<ss:logic:if test="\Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_show_course_material_below_long_description')">
<ss:logic:if test="$current_step['step_component'] == 'Components\\AF\\Courses\\Configuration\\Levels'">
<ss:logic:variable as="books_required" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRequiredForLevel($current_step_entity['id'], true)" parsenow="value" />
<ss:logic:variable as="books_recommended" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRecommendedForLevel($current_step_entity['id'], true)" parsenow="value" />
<ss:logic:if test="count($books_required) || count($books_recommended)">
<div style="margin-top: 10px;">
<ss:logic:if test="count($books_required)">
<strong>Required Course Material</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_required">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
<ss:logic:if test="count($books_recommended)">
<strong>[? \Components\AF\Courses\CollectiveCourses::configGetValue('recommended_course_material_title') ?]</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_recommended">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
</div>
</ss:logic:if>
</ss:logic:if>
</ss:logic:if>
<div style="clear: both;"></div>
</div>
</ss:logic:if>
<ss:logic:else test="$previous_step_entity">
<div id="previous_step_description">
<h2>Your previous selection: [? $previous_step_entity['name'] ?]</h2>
<ss:logic:if test="getRealLength($previous_step_entity['long_description'])">
<ss:logic:parse text="$previous_step_entity['long_description']" parsenow="text" />
</ss:logic:if>
<ss:logic:else test="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_short_description_fallback') && getRealLength($previous_step_entity['short_description'])">
<ss:logic:parse text="$previous_step_entity['short_description']" parsenow="text" />
</ss:logic:else>
<ss:logic:if test="\Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_show_course_material_below_long_description')">
<ss:logic:if test="$previous_step && $previous_step['step_component'] == 'Components\\AF\\Courses\\Configuration\\Levels'">
<ss:logic:variable as="books_required" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRequiredForLevel($previous_step_entity['id'], true)" parsenow="value" />
<ss:logic:variable as="books_recommended" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRecommendedForLevel($previous_step_entity['id'], true)" parsenow="value" />
<ss:logic:if test="count($books_required) || count($books_recommended)">
<div style="margin-top: 10px;">
<ss:logic:if test="count($books_required)">
<strong>Required Course Material</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_required">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
<ss:logic:if test="count($books_recommended)">
<strong>[? \Components\AF\Courses\CollectiveCourses::configGetValue('recommended_course_material_title') ?]</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_recommended">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
</div>
</ss:logic:if>
</ss:logic:if>
</ss:logic:if>
<div style="clear: both;"></div>
</div>
</ss:logic:else>
<div id="course_selector_current_step_body">
<ss:logic:include page="$current_step['step_page_id']" parsenow="page" />
</div>
</div>
</ss:logic:if>
<ss:logic:else>
<div id="course_selector_body">
<div class="item noCourses" style="color: red; text-align: center;">
<h3>No course is currently available</h3>
</div>
</div>
</ss:logic:else>
</div>
<ss:logic:include page="/af/course-selector/style/" />
<ss:logic:variable as="visible_steps" value="\Framework\AF\CourseSelector::getVisibleSteps()" parsenow="value" />
<ss:logic:variable as="current_step" value="\Framework\AF\CourseSelector::getCurrentStep($visible_steps)" parsenow="value" />
<ss:logic:variable as="current_step_entity" value="\Framework\AF\CourseSelector::getStepEntity($current_step)" parsenow="value" />
<ss:logic:variable as="previous_step" value="\Framework\AF\CourseSelector::getPreviousStep($visible_steps)" parsenow="value" />
<ss:logic:variable as="previous_step_entity" value="\Framework\AF\CourseSelector::getStepEntity($previous_step)" parsenow="value" />
[? urlCleanup($current_step) ?]
<div id="course_selector">
<ss:logic:variable as="course_selector_title" value="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_title')" parsenow="value" />
<ss:logic:if test="$course_selector_title">
<h1>[? $course_selector_title ?]</h1>
</ss:logic:if>
<ss:logic:if test="count($visible_steps)">
<script type="text/javascript">
(function($) {
$(document).ready(function() {
$('#course_selector_current_step_body div.item:not(.noCourses):not(.noHighLight)').click(function(e) {
if(e.target && e.target.nodeName && e.target.nodeName == 'A') {
return;
}
location.href = $('.itemUrl', $(this)).val();
});
});
})(jQuery);
</script>
<ss:logic:if test="\Framework\AF\CourseSelector::hasClickedLink()">
<script type="text/javascript">
(function($) {
$(document).ready(function() {
$('html, body').scrollTop($("#course_selector").offset().top - 40);
});
})(jQuery);
</script>
</ss:logic:if>
<div id="course_selector_header">
<ss:data:repeater as="step" datasource="$visible_steps">
<ss:logic:if test="$step['step_title'] == $current_step['step_title']">
<div class="stepTitle currentStep">
<strong>[? $step['step_title'] ?]</strong><br />
<small>[? \Framework\AF\CourseSelector::renderStepValue($step) ?]</small>
</div>
</ss:logic:if>
<ss:logic:else>
<ss:logic:if test="$step['step_component'] == 'Components\\AF\\Courses\\Configuration\\Levels' && \Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_use_placement_page')">
<ss:logic:variable as="back_url" value="\Framework\AF\CourseSelector::makeBackURL($step, array('level_id'))" parsenow="value" />
</ss:logic:if>
<ss:logic:else>
<ss:logic:variable as="back_url" value="\Framework\AF\CourseSelector::makeBackURL($step)" parsenow="value" />
</ss:logic:else>
<a href="[? $back_url ?]">
<div class="stepTitle">
<strong>[? $step['step_title'] ?]</strong><br />
<small>[? \Framework\AF\CourseSelector::renderStepValue($step) ?]</small>
</div>
</a>
</ss:logic:else>
</ss:data:repeater>
<ss:logic:if test="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_show_next_steps')">
<ss:data:repeater as="step" datasource="getRemainingSteps($visible_steps)">
<div class="stepTitle disabled">
<strong>[? $step['step_title'] ?]</strong>
</div>
</ss:data:repeater>
</ss:logic:if>
<div style="clear: both;"></div>
</div>
<div id="course_selector_body">
<ss:logic:if test="\Framework\AF\CourseSelector::getStepIsRecursing($current_step) && $current_step_entity">
<div id="previous_step_description">
<h2>Your previous selection: [? $current_step_entity['name'] ?]</h2>
<ss:logic:if test="getRealLength($current_step_entity['long_description'])">
<ss:logic:parse text="$current_step_entity['long_description']" parsenow="text" />
</ss:logic:if>
<ss:logic:else test="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_short_description_fallback') && getRealLength($current_step_entity['short_description'])">
<ss:logic:parse text="$current_step_entity['short_description']" parsenow="text" />
</ss:logic:else>
<ss:logic:if test="\Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_show_course_material_below_long_description')">
<ss:logic:if test="$current_step['step_component'] == 'Components\\AF\\Courses\\Configuration\\Levels'">
<ss:logic:variable as="books_required" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRequiredForLevel($current_step_entity['id'], true)" parsenow="value" />
<ss:logic:variable as="books_recommended" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRecommendedForLevel($current_step_entity['id'], true)" parsenow="value" />
<ss:logic:if test="count($books_required) || count($books_recommended)">
<div style="margin-top: 10px;">
<ss:logic:if test="count($books_required)">
<strong>Required Course Material</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_required">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
<ss:logic:if test="count($books_recommended)">
<strong>[? \Components\AF\Courses\CollectiveCourses::configGetValue('recommended_course_material_title') ?]</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_recommended">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
</div>
</ss:logic:if>
</ss:logic:if>
</ss:logic:if>
<div style="clear: both;"></div>
</div>
</ss:logic:if>
<ss:logic:else test="$previous_step_entity">
<div id="previous_step_description">
<h2>Your previous selection: [? $previous_step_entity['name'] ?]</h2>
<ss:logic:if test="getRealLength($previous_step_entity['long_description'])">
<ss:logic:parse text="$previous_step_entity['long_description']" parsenow="text" />
</ss:logic:if>
<ss:logic:else test="\Components\AF\Courses\CollectiveCourses::configGetValue('course_selector_short_description_fallback') && getRealLength($previous_step_entity['short_description'])">
<ss:logic:parse text="$previous_step_entity['short_description']" parsenow="text" />
</ss:logic:else>
<ss:logic:if test="\Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_show_course_material_below_long_description')">
<ss:logic:if test="$previous_step && $previous_step['step_component'] == 'Components\\AF\\Courses\\Configuration\\Levels'">
<ss:logic:variable as="books_required" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRequiredForLevel($previous_step_entity['id'], true)" parsenow="value" />
<ss:logic:variable as="books_recommended" value="\Components\AF\Courses\Configuration\Levels\Books::getAllRecommendedForLevel($previous_step_entity['id'], true)" parsenow="value" />
<ss:logic:if test="count($books_required) || count($books_recommended)">
<div style="margin-top: 10px;">
<ss:logic:if test="count($books_required)">
<strong>Required Course Material</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_required">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
<ss:logic:if test="count($books_recommended)">
<strong>[? \Components\AF\Courses\CollectiveCourses::configGetValue('recommended_course_material_title') ?]</strong>
<ul>
<ss:data:repeater as="book" datasource="$books_recommended">
<li>
[? $book['product_title'] ?] ([? formatCurrency($book['product_price_base']) ?])
</li>
</ss:data:repeater>
</ul>
</ss:logic:if>
</div>
</ss:logic:if>
</ss:logic:if>
</ss:logic:if>
<div style="clear: both;"></div>
</div>
</ss:logic:else>
<div id="course_selector_current_step_body">
<ss:logic:include page="$current_step['step_page_id']" parsenow="page" />
</div>
</div>
</ss:logic:if>
<ss:logic:else>
<div id="course_selector_body">
<div class="item noCourses" style="color: red; text-align: center;">
<h3>No course is currently available</h3>
</div>
</div>
</ss:logic:else>
</div>
|
|
|
|
|
|
<?php
set_time_limit(10);
\Framework\Assets\JavaScript::includeJQuery(true);
function getRemainingSteps($arrVisibleSteps)
{
$arrRemainingSteps = array();
foreach(\Framework\AF\CourseSelector::getAvailableSteps() as $arrStep)
{
if(!in_array($arrStep, $arrVisibleSteps))
{
$arrRemainingSteps[] = $arrStep;
}
}
return $arrRemainingSteps;
}
function getRealLength($strVar)
{
// Because of a bug in the HTML Editor inserting the ​ character
return strlen(trim(strip_tags(str_replace('​', '', $strVar))));
}
function urlCleanup($arrCurrentStep)
{
$iInitialCount = count($_GET);
if($iInitialCount)
{
$arrParametersToClean = array('new_student', 'needs_test', 'reenroll');
if($arrCurrentStep && $arrCurrentStep['step_title'] !== 'Level' && \Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_use_placement_page'))
{
foreach($arrParametersToClean as $strParameter)
{
if(array_key_exists($strParameter, $_GET))
{
unset($_GET[$strParameter]);
}
}
if(count($_GET) !== $iInitialCount)
{
$arrQueryString = array();
foreach($_GET as $strKey => $strValue)
{
$arrQueryString[] = urlencode($strKey) . '=' . urlencode($strValue);
}
$strQueryString = '';
if(count($arrQueryString))
{
$strQueryString = '?' . implode('&', $arrQueryString);
}
\Framework\HTTP\Redirection::redirect(\Components\Website\Pages::currentPageId() . $strQueryString);
}
}
}
}
?>
<?php
set_time_limit(10);
\Framework\Assets\JavaScript::includeJQuery(true);
function getRemainingSteps($arrVisibleSteps)
{
$arrRemainingSteps = array();
foreach(\Framework\AF\CourseSelector::getAvailableSteps() as $arrStep)
{
if(!in_array($arrStep, $arrVisibleSteps))
{
$arrRemainingSteps[] = $arrStep;
}
}
return $arrRemainingSteps;
}
function getRealLength($strVar)
{
// Because of a bug in the HTML Editor inserting the ​ character
return strlen(trim(strip_tags(str_replace('​', '', $strVar))));
}
function urlCleanup($arrCurrentStep)
{
$iInitialCount = count($_GET);
if($iInitialCount)
{
$arrParametersToClean = array('new_student', 'needs_test', 'reenroll');
if($arrCurrentStep && $arrCurrentStep['step_title'] !== 'Level' && \Components\AF\Courses\Configuration\Levels::configGetValue('course_selector_use_placement_page'))
{
foreach($arrParametersToClean as $strParameter)
{
if(array_key_exists($strParameter, $_GET))
{
unset($_GET[$strParameter]);
}
}
if(count($_GET) !== $iInitialCount)
{
$arrQueryString = array();
foreach($_GET as $strKey => $strValue)
{
$arrQueryString[] = urlencode($strKey) . '=' . urlencode($strValue);
}
$strQueryString = '';
if(count($arrQueryString))
{
$strQueryString = '?' . implode('&', $arrQueryString);
}
\Framework\HTTP\Redirection::redirect(\Components\Website\Pages::currentPageId() . $strQueryString);
}
}
}
}
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/wave/learn-french/
/wave/learn-french/
|
|
|
|
|
|
|
|
|
|
|
|
|