Skip to content
Snippets Groups Projects
Commit a65f9563 authored by Andrew Brunet's avatar Andrew Brunet
Browse files

Replace wf2.tpl.php

parent e82ace27
No related branches found
No related tags found
No related merge requests found
......@@ -137,15 +137,15 @@
}
/**
* Checks if user is an international student
* Will assume non-international until sees "YESINTL"
* Checks if user has identified with a disability or declined to disclose
* Will assume user is not a student with a disability until sees "YESACCESSA" or "YESACCESSB"
*
* @param $data
* @param $rule
*
* @return bool
*/
function is_international($data) {
function is_accessability($data) {
$length = count($data);
// Reindex array since page breaks will break the indexing sequence.
$data = array_values($data);
......@@ -153,7 +153,10 @@ function is_international($data) {
if (isset($data[$i])) {
$number_of_selections = count($data[$i]);
for ($j = 0; $j < $number_of_selections; $j++) {
if($data[$i][$j] == 'YESINTL') {
if($data[$i][$j] == 'YESACCESSA') {
return true;
}
elseif($data[$i][$j] == 'YESACCESSB') {
return true;
}
}
......@@ -207,14 +210,15 @@ function is_international($data) {
* @param $sid
* @param $skill_name
* @param $learn_skill
* @param $pd_course
* @param $practice_skill
* @param $get_advice
*/
function pdf_store_results($node, $sid, $skill_name, $learn_skill, $practice_skill, $get_advice) {
function pdf_store_results($node, $sid, $skill_name, $learn_skill, $pd_course, $practice_skill, $get_advice) {
// If for some reason the Webform is set up wrong, return immediately to avoid errors.
if (!isset($skill_name['cid']) || !isset($learn_skill['cid']) ||
!isset($practice_skill['cid']) || !isset($get_advice['cid'])) {
!isset($practice_skill['cid']) || !isset($get_advice['cid']) || !isset($pd_course['cid'])) {
return;
}
......@@ -252,7 +256,25 @@ function is_international($data) {
->condition('cid', $learn_skill['cid'])
->execute();
// Store practice_skill info.
// Store component pd_course info.
foreach ($pd_course['rulesets'] as $index => $ruleset) {
$pd_course ['rulesets'][$index]['description'] = pdf_process($ruleset['description']);
}
db_update('conditional_rulesets_results')
->fields(array(
'nid' => $node->nid,
'sid' => $sid,
'cid' => $pd_course ['cid'],
'rulesets' => json_encode($pd_course['rulesets'])
))
->condition('nid', $node->nid)
->condition('sid', $sid)
->condition('cid', $pd_course ['cid'])
->execute();
// Store practice_skill info.
foreach ($practice_skill['rulesets'] as $index => $ruleset) {
$practice_skill['rulesets'][$index]['description'] = pdf_process($ruleset['description']);
}
......@@ -389,10 +411,11 @@ function is_international($data) {
*
* @param $skill_name
* @param $learn_skill
* @param $pd_course
* @param $practice_skill
* @param $get_advice
*/
function validate(&$skill_name, &$learn_skill, &$practice_skill, &$get_advice) {
function validate(&$skill_name, &$learn_skill, &$pd_course, &$practice_skill, &$get_advice) {
$empty_ruleset = array(
'result' => '',
'description' => '',
......@@ -400,6 +423,7 @@ function is_international($data) {
);
$skill_name['rulesets'][0] = !isset($skill_name['rulesets'][0]) ? $empty_ruleset : $skill_name['rulesets'][0];
$learn_skill['rulesets'][0] = !isset($learn_skill['rulesets'][0]) ? $empty_ruleset : $learn_skill['rulesets'][0];
$pd_course['rulesets'][0] = !isset($pd_course['rulesets'][0]) ? $empty_ruleset : $pd_course['rulesets'][0];
$practice_skill['rulesets'][0] = !isset($practice_skill['rulesets'][0]) ? $empty_ruleset : $practice_skill['rulesets'][0];
$get_advice['rulesets'][0] = !isset($get_advice['rulesets'][0]) ? $empty_ruleset : $get_advice['rulesets'][0];
}
......@@ -431,6 +455,7 @@ function is_international($data) {
$fids = explode(',', str_replace(' ', '', $configurations['fid']));
$skill_name = array();
$learn_skill = array();
$pd_course = array();
$practice_skill = array();
$get_advice = array();
......@@ -445,6 +470,10 @@ function is_international($data) {
$learn_skill = get_component_results($node, $cid, $info);
break;
case 'pd_course':
$pd_course = get_component_results($node, $cid, $info);
break;
case 'practice_skill':
$practice_skill = get_component_results($node, $cid, $info);
break;
......@@ -452,18 +481,20 @@ function is_international($data) {
case 'get_advice':
$get_advice = get_component_results($node, $cid, $info);
break;
}
}
// Avoid offset errors in case webform is set up incorrectly.
validate($skill_name, $learn_skill, $practice_skill, $get_advice);
validate($skill_name, $learn_skill, $pd_course, $practice_skill, $get_advice);
// Store results for PDF use.
pdf_store_results($node, $sid, $skill_name, $learn_skill, $practice_skill, $get_advice);
pdf_store_results($node, $sid, $skill_name, $learn_skill, $pd_course, $practice_skill, $get_advice);
$international = false;
if (is_international($submission->data)) {
$international = true;
$accessability = false;
if (is_accessability($submission->data)) {
$accessability = true;
}
drupal_add_css(drupal_get_path('module', 'uw_conditional_rulesets') .
......@@ -471,14 +502,12 @@ function is_international($data) {
?>
<div class="flex-container">
<div class="flex-message">
<p>Here is a list of campus resources for developing the skill you selected.
Each resource has a corresponding website, which can be accessed by clicking the call to action box next to every description.
<p>Here is a list of resources to help develop your selected employability skill. Each resource has a corresponding website, which can be accessed by clicking the black button next to the resource description.
</p>
</div>
<div class="flex-message">
<p> Any questions regarding this process or the tool in general should be directed to:
<a href="mailto:abrunet@uwaterloo.ca">Andrew Brunet</a>
<p>If you have any questions, contact <a href="mailto:ceca.accessability@uwaterloo.ca">Andrew Brunet</a>.
</p>
<hr>
</div>
......@@ -567,12 +596,33 @@ function is_international($data) {
<h2 class="edge-header">Practice the Skill</h2>
</div>
<div class="flex-component-block">
<div class="pd-block">
<div class="component_square">
<div class="call-to-action-top-wrapper">
<?php gen_href_start($pd_course['rulesets'][0]['result'], $pd_course['rulesets'][0]['url']); ?>
<div class="call-to-action-wrapper">
<div class="call-to-action-theme-uWaterloo">
<div class="call-to-action-big-text"> <?php print $pd_course ['rulesets'][0]['result'] ?> </div>
</div>
</div>
<?php gen_href_end($pd_course['rulesets'][0]['result']); ?>
</div>
</div>
</div>
<div class="pd-description">
<div>
<?php print $pd_course ['rulesets'][0]['description'] ?>
</div>
</div>
<div class="flex-component-block">
<div class="component_square">
<div class="call-to-action-top-wrapper">
<?php gen_href_start($practice_skill['rulesets'][0]['result'], $practice_skill['rulesets'][0]['url']); ?>
<div class="call-to-action-wrapper">
<div class="call-to-action-theme-uWaterloo">
<div class="call-to-action-theme-science">
<div class="call-to-action-big-text"> <?php print $practice_skill['rulesets'][0]['result'] ?> </div>
</div>
</div>
......@@ -592,7 +642,7 @@ function is_international($data) {
<div class="call-to-action-top-wrapper">
<?php gen_href_start($practice_skill['rulesets'][1]['result'], $practice_skill['rulesets'][1]['url']); ?>
<div class="call-to-action-wrapper">
<div class="call-to-action-theme-uWaterloo">
<div class="call-to-action-theme-science">
<div class="call-to-action-big-text"> <?php print $practice_skill['rulesets'][1]['result'] ?> </div>
</div>
</div>
......@@ -618,7 +668,7 @@ function is_international($data) {
<div class="call-to-action-top-wrapper">
<?php gen_href_start($get_advice['rulesets'][0]['result'], $get_advice['rulesets'][0]['url']); ?>
<div class="call-to-action-wrapper">
<div class="call-to-action-theme-uWaterloo">
<div class="call-to-action-theme-arts">
<div class="call-to-action-big-text"> <?php print $get_advice['rulesets'][0]['result'] ?> </div>
</div>
</div>
......@@ -632,18 +682,44 @@ function is_international($data) {
<?php print $get_advice['rulesets'][0]['description'] ?>
</div>
</div>
<?php
if (isset($accessability) && $accessability) {
print '<div id="pd-description-international" class="flex-component-description pd-block">';
}
else {
print '<div id="pd-description" class="flex-component-description pd-block">';
}
?>
<div>
<?php print $component_pd['rulesets'][0]['description'] ?>
</div>
</div>
<div>
<?php
if (isset($accessability) && $accessability) {
print '<p> AccessAbility Services offers co-op support if you have any permanent, temporary or suspected disabilities. Topics for discussion can include accommodations, developing a care and support plan and/or receiving referrals to additional on-campus services. Contact <a href="https://uwaterloo.ca/accessability-services/" target="_blank">AccessAbility Services</a> to learn more.</p>';
}
?>
</div>
<div class="flex-message margin-top">
<p> View a
<?php
{
print l("PDF version of your skills development planner.", fillpdf_pdf_link($form_id = $fids[0], null, $webform = array('nid'=>$node->nid,'sid'=>$sid)) . '&token=' . $access_token);
// Students who identify with disabilities
if (isset($accessability) && $accessability) {
print l("PDF version of your skills development planner.", fillpdf_pdf_link($form_id = $fids[988], null, $webform = array('nid'=>$node->nid,'sid'=>$sid)) . '&token=' . $access_token);
}
// Students without disabilities
else {
print l("PDF version of your skills development planner.", fillpdf_pdf_link($form_id = $fids[0], null, $webform = array('nid'=>$node->nid,'sid'=>$sid)) . '&token=' . $access_token);
}
?>
</p>
</div>
<div>
<p class="caption"> <strong> *If you cannot find what you were looking for: </strong>
click "refresh results" to generate new resources for your selected skill or
......@@ -685,7 +761,7 @@ function is_international($data) {
</div>
<div class="text-box-hover-wrapper">
<p class="text-box-hover">Refreshing results may yield new resources.
Make sure to click on any resources that interest you before refreshing.
Make sure to click on resources that interest you before refreshing.
</p>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment