php js css php js css

Changes

Changes to Page: placement-tests


System
Change
Can't Undo: The change does not exist
214109
Yesterday 8:08pm
Wilkie, Natasha
Created page
Id:
/home-new/placement-tests/
Title:
Placement Tests
Content Additional:
{"togglable_footerCTA":null,"togglable_memberCTA":"on","togglable_testCTA":null,"togglable_newslettercta":null}
Css:

														
													
													
													
												
Js:

														
													
													
													
												
Accept Child 404:
0
Search Title:

														
													
													
													
												
Search Title Prefix:

														
													
													
													
												
Search Description:

														
													
													
													
												
Search Keywords:

														
													
													
													
												
Search Noindex:
0
Search Nofollow:
0
Search Change Frequency:

														
													
													
													
												
Search Priority:
0.5
Search Canonical Override:

														
													
													
													
												
Is Offline:
0
Is Hidden In Navigation:
1
Is Hidden In Sitemap:
0
Security New:
0
Security Contact Mode:

														
													
													
													
												
Security Contact Squeeze Viewlimit:

														
													
													
													
												
Security Contact Require Login:

														
													
													
													
												
Security Contact Groups:

														
													
													
													
												
Security Condition Id:

														
													
													
													
												
Security Heading:

														
													
													
													
												
Security Description:

														
													
													
													
												
Other Fields:

														
													
													
													
												
Order:
2
Parent Id:
/home-new/
Contact Id:
0
Design Id:
0
Header Functions:

														
													
													
													
												
Header Category:

														
													
													
													
												
Is Domain:
0
Post Category Id:

														
													
													
													
												
Content:
<templates:section>
<h1>Placement Tests</h1>
<logic:if test="$_GET['from_cart']">
<p style="color: #b00;">
You have been redirected on this page because the course you are trying to enroll in has level requirements. If you believe this is a
mistake, please contact us.
</p>
</logic:if>

<logic:if test="!(\Components\Customers\Contacts::currentIsLoggedIn())" evaluateat="render">
<div style="float: right; width: 50%;">
<div style="padding-left: 20px;">
<h2>Existing Customer?</h2>
<p>If you already have an account, login below.</p>

<logic:include page="/community/login/form_include/" />
</div>
</div>

<div style="float: left; width: 50%">
<h2>New Customer?</h2>
<p>You will need to fill in some details.</p>

<logic:include page="/community/register/form_include/" />
</div>
</logic:if>
<logic:else test="\Components\AF\PlacementTests::getLastNonHandledSubmissionForContact(\Components\Customers\Contacts::currentContactId())">

<logic:variable as="test_and_submission" value="[? \Components\AF\PlacementTests::getLastNonHandledSubmissionForContact(\Components\Customers\Contacts::currentContactId()) ?]" />

<logic:variable as="test" value="[? $test_and_submission[0] ?]" />
<logic:variable as="submission" value="[? $test_and_submission[1] ?]" />

<h2>Welcome back [? \Components\Customers\Contacts::currentGetColumn('contact_first_name') ?] [? \Components\Customers\Contacts::currentGetColumn('contact_last_name') ?]</h2>

You have already completed a placement test. It now needs to be reviewed, and you will be contacted shortly by a teacher to finalise your level.
<br />Please complete <a href="/community/profile/">your profile</a> and you should receive a phone call in two working days.

<br /><br />Assessment: [? $test['placement_test_title'] ?]
<br />Assessment Date: [? formatDate($submission['submission_date']) ?]
</logic:else>
<logic:else>


[? \Framework\Assets\CSS::includeHead('/_public/Components/AF/PlacementTests/placementtests.css') ?]

<p>
To help us determine which course is the right one for you, please take a few minutes to assess yourself by selecting a level from the table below. This will lead you to a short evaluation.
<p>
<strong>Why do I need to take an evaluation?</strong><br />
The placement assessment was constructed to determine your level of French. Although it may look difficult at first sight, do not worry. It has been designed to recreate realistic daily situations in France. It will help to place you in the course best suited to your abilities, allowing you to improve quickly.
</p>

<p>
<strong>How long will it take?</strong><br />
It should not take you more than 10-15 minutes. All you need to do is follow the instructions.
<br /><br />If necessary, click on <a class="placement_button_stop_hard" href="javascript: return false;">Stop! It's too difficult!</a> or <a class="placement_button_stop_easy" href="javascript: return false;">Stop! It's too easy!</a>.
</p>

<p>Good luck!</p>

<style type="text/css">
.accordionMenu .header
{
padding: 20px;
color: #fff;
font-size: 16pt;
display: block;
}

.accordionMenu .accordionItem { display: none; margin: 5px; padding: 15px; border: 1px solid #ccc; border-radius: 5px; }
.cke_editable .accordionMenu .accordionItem { display: block; }

.accordionMenu .test
{
line-height: 160%;
width: 50%;
float: left;
margin-bottom: 25px;
}

</style>

<script type="text/javascript">
(function($) {
$(document).ready(function(){
$('div.accordionMenu>a').on('click', function(e) {
$(this).next('div.accordionItem').fadeToggle();
return false;
});
});
})(jQuery);
</script>

<logic:if test="$_GET['age_group_id'] && $_GET['type_id']">
<logic:variable as="sets" value="[? [\Components\AF\PlacementTests\Sets::getForAgeGroupAndType($_GET['age_group_id'], $_GET['type_id'])] ?]" />
</logic:if>
<logic:else>
<logic:variable as="sets" value="[? \Components\AF\PlacementTests\Sets::getAll() ?]" />
</logic:else>

<data:repeater datasource="$sets" as="set">

<h2>[? $set['placement_test_set_title'] ?]</h2>

<logic:variable as="set_placement_submission" value="[? \Components\AF\PlacementTests::getPlacementForContact(\Components\Customers\Contacts::currentContactId(), $set['placement_test_set_id']) ?]" />
<logic:variable as="level" value="[? $set_placement_submission ? getLevelsForPlacement($set_placement_submission['level_id'], $set['placement_test_set_id']) : null ?]" />

<logic:if test="$set_placement_submission && $level">
<logic:variable as="age_group_id" value="[? \Components\AF\Courses\Configuration\Levels::determineAgeGroupIdForLevel($level['level_id']) ?]" />

<div style="border: 1px solid #ccc; padding: 10px; margin: 15px;">

<strong>Congratulations! You can enroll in courses for this level:</strong>
<h1 style="margin-top: 2px">[? \Components\AF\Courses\Configuration\Levels::getColumn(intval($level['level_id']), 'level_name') ?]...</h1>
<p>Thank you for taking the test!</p>
<ul>
<li><big><a href="/af/course-selector/?age_group_id=[? $age_group_id ?]&amp;level_id=[? intval($level['level_id']) ?]&amp;step_order=agegroup,level">Click Here to Continue to Order a Course &gt;</a></big></li>
</ul>
</div>
</logic:if>
<logic:else>

<logic:variable as="set_categories" value="[? \Components\AF\PlacementTests\Categories::getAllForSet($set['placement_test_set_id']) ?]" />

<logic:if test="count($set_categories)">

<div class="accordionMenu">
<data:repeater datasource="$set_categories" as="category">
<a href="#" class="header" style="background: [? $category['placement_test_category_colour'] ?]">
<span style="float: right; display: inline-block;">
[? $category['placement_test_category_description'] ?]
</span>
[? $category['placement_test_category_title'] ?]
</a>
<div class="accordionItem">
<data:repeater datasource="\Components\AF\PlacementTests::getAll()" as="test" emptymessage="No tests configured for this level." datafilter="[? ['placement_test_category_id', '=', $category['placement_test_category_id']] ?]">
<div class="test">
<big><strong>[? $test['placement_test_title'] ?]</strong></big><br />
&bull; [?? str_replace('<br />', '<br />&bull; ', nl2br(str_replace('<br />', '', $test['placement_test_description']))) ??]<br /><br />
<a class="placement_button" href="[? \Components\AF\PlacementTests::getQuery($test['page_id']) ?]">Start at This Level</a>
</div>
</data:repeater>
<div style="clear: both;"></div>
</div>

<br />
</data:repeater>
</div>
</logic:if>

</logic:else>
</data:repeater>
</logic:else>
</templates:section>
Php Source:
<?php

\Framework\Assets\JavaScript::includeJQuery(true);


function getLevelsForPlacement($iPlacementTestLevelId, $iPlacementTestSetId)
{
// Get level from the form submission
$arrPlacementLevel = \Components\AF\Courses\Configuration\Levels::get($iPlacementTestLevelId);

// But we must also check to ensure a more recent placement hasn't occurred
$arrLevels = \Components\AF\Students\Levels::historyGetCurrentLevelsForContact(\Components\Customers\Contacts::currentContactId());

foreach ($arrLevels as $arrHistoryLevel)
{
if ($arrHistoryLevel['level_id'] == $iPlacementTestLevelId)
{
if ($arrHistoryLevel['level_status'] == 'passed' && count($arrHistoryLevel['next_levels']))
{
return \Components\AF\Courses\Configuration\Levels::get($arrHistoryLevel['next_levels'][0]);
}

break;
}
}

return $arrPlacementLevel;

}

?>