public function render($properties) { ?> <div class="module module--padded"> <?php $moduleIdentifier = "selectedModules_" . chr(rand(65, 90)) . chr(rand(65, 90)) . chr(rand(65, 90)) . chr(rand(65, 90)) . chr(rand(65, 90)); $fagmod = new Fagmoduler(); if (is_page_template('gode-erfaringer-children.php')) { $field_fornavn = get_field('fornavn', get_the_ID()); if ($field_fornavn) { print '<h3>' . $properties['headline'] . ' som ' . $field_fornavn . '</h3>'; } else { print '<h3>' . $properties['headline'] . '</h3>'; } } else { print '<h2>' . $properties['headline'] . '</h2>'; } $fagList = array(); foreach ($properties['modules'] as $modul) { $f*g = $fagmod->getFag(get_field("fag_id", $modul['module_post']->ID)); $fagList[] = $f*g; } ?> <script> var <?php print $moduleIdentifier; ?> = <?php print json_encode($fagList); ?> ; </script> <div class="accordion accordion--trade panel-group" ng-controller="SelectedModulesCtrl as <?php print $moduleIdentifier; ?> " ng-init="<?php print $moduleIdentifier; ?> .init('<?php print $moduleIdentifier; ?> ')"> <?php set_query_var('moduleIdentifier', $moduleIdentifier); get_template_part('parts/fagmoduler-accordion-part'); ?> </div> </div> <?php }
public function render($properties) { $moduleIdentifier = "matchtest"; // print_r($properties['matchtest_step']); die(); // Add kursusstarter foreach ($properties['matchtest_step'] as $key1 => $choices) { // print_r($choices['choice']); die(); foreach ($choices['choice'] as $key2 => $choice) { if (isset($choice['result']) && count($choice['result']) > 0) { foreach ($choice['result'] as $key3 => $f*g) { // print_r(get_field('fag_id',$f*g['fagmodul']->ID)); die(); $fm = new Fagmoduler(); $properties['matchtest_step'][$key1]['choice'][$key2]['result'][$key3]['f*g'] = @$fm->getFag(get_field('fag_id', $f*g['fagmodul']->ID)); } } } } $autoStart = false; if (isset($_GET['auto'])) { $autoStart = $_GET['auto']; } print "<script> var " . $moduleIdentifier . " = " . json_encode($properties['matchtest_step']) . "; </script>"; ?> <div ng-controller="MatchTestCtrl as matchtest" ng-cloak ng-init="matchtest.begin('<?php print $moduleIdentifier; ?> ', '<?php print $autoStart; ?> ')"> <div class="matchtest__navigation"> <div class="matchtest__navigation__brand"> <a href="<?php print get_home_url(); ?> "><img-responsive src-xs="<?php print get_image('logo-mobile.png'); ?> " src-md="<?php print get_image('matchtest-desktop.png'); ?> "></img-responsive></a> </div> <div class="matchtest__navigation__control"> <a href="<?php print get_home_url(); ?> "><span class="glyphicon glyphicon-chevron-left"></span>Tilbage til sitet</a> </div> </div> <div class="matchtest"> <div class="matchtest__content" ng-class="{'table-cell vertical-align-middle' : !matchtest.startMatchTest}"> <div class="col-xs-12"> <div ng-if="!matchtest.startMatchTest"> <div class="matchtest__content__intro"> <h2>Hvordan vil du gerne arbejde?</h2> <p>Brænder du for at udvikle ting fra bunden? Er der en leder gemt i dig? Elsker du at sætte ting i system? Test dig selv. Måske vil det overraske dig, at der findes fagmoduler, som matcher lige præcis dine interesser.</p> <a ng-click="matchtest.startMatchTest = true" class="btn button"> <div class="label">Tag testen</div> <div class="arrow"> <span class="glyphicon glyphicon glyphicon-chevron-right"></span> </div> </a> </div> </div> <div ng-if="matchtest.startMatchTest && matchtest.currentStep >= 0 && !<?php print $moduleIdentifier; ?> .courses.length >= 1"> <div class="matchtest__content__app text-align-center"> <div class="matchtest__content__app__header" ng-if="matchtest.currentStep == 0"> <h2 class="color-orange">Hvordan vil du gerne arbejde?</h2> <p class="hide-if-mobile">Vælg det, som passer dig bedst</p> </div> <div class="matchtest__content__app__title" ng-if="matchtest.currentStep >= 1"> <div class="matchtest__content__app__title__thumbnail"> <img src="<?php print get_image('matchtest-overblik.png'); ?> " alt=""> </div> <div class="matchtest__content__app__title__text"> <h2 class="color-white">Hvad passer bedst på dig?</h2> <p>Vælg en</p> </div> </div> <ul class="matchtest__content__app__list" ng-class="{'matchtest__content__app__list--primary' : matchtest.currentStep == 0, 'matchtest__content__app__list--secondary' : matchtest.currentStep >= 1}"> <li ng-repeat="choice in <?php print $moduleIdentifier; ?> .currentStepData track by $index" ng-click="<?php print $moduleIdentifier; ?> .onClickStep(choice)" ng-class="{'length-2' : matchtest.currentStep >= 1 && matchtest.currentStepData.length == 2, 'length-3' : matchtest.currentStep >= 1 && matchtest.currentStepData.length == 3}"> <div class="matchtest__content__app__list__item"> <div ng-class="{'col-xs-2 col-sm-12 no-padding-left no-padding-right' : matchtest.currentStep == 0}"> <div class="matchtest__content__app__list__thumbnail" ng-if="choice.image"> <img ng-src="{{choice.image}}" alt=""> </div> </div> <div ng-class="{'col-xs-10 col-sm-12 no-padding-left no-padding-right' : matchtest.currentStep == 0}"> <div class="matchtest__content__app__list__details" ng-class="{'inline-table--desktop-only' : matchtest.currentStep == 0 }"> <h2 class="choice_text color-white">{{choice.choice_text}}</h2> <p ng-if="choice.caption_text">{{choice.caption_text}}</p> </div> </div> </div> </li> </ul> <div class="matchtest__content__app__button matchtest__content__app__button--orange" ng-click="<?php print $moduleIdentifier; ?> .goBack()" ng-if="<?php print $moduleIdentifier; ?> .currentStep > 0">Tilbage</div> </div> </div> <div class="matchtest__content__app" ng-if="<?php print $moduleIdentifier; ?> .courses.length >= 1"> <div class="matchtest__content__app__title"> <div class="matchtest__content__app__title__thumbnail"> <img src="<?php print get_image('matchtest-overblik.png'); ?> " alt=""> </div> <div class="matchtest__content__app__title__text"> <h2 class="color-orange">Resultat</h2> <p>Disse moduler er måske noget for dig</p> </div> </div> <div class="row row--padded"> <div class="col-xs-12"> <div class="advanced-accordion advanced-accordion--black"> <div class="row"> <div class="accordion accordion--black accordion--trade panel-group"> <div ng-repeat="course in <?php print $moduleIdentifier; ?> .courses track by $index" class="accordion-item panel" accordion-item matchtesten="true" parent=".accordion--trade"> <div class="accordion-item__heading accordion-item__heading--black"> <div class="inner"> <div class="accordion-wrapper"> <div class="accordion-thumbnail"> <img ng-src="{{::course.f*g.billede}}" alt=""> </div> <div class="accordion-headline"> <h4>{{course.f*g.post_title}}</h4> </div> <div class="accordion-icon"> <span class="glyphicon glyphicon-plus"></span> </div> </div> </div> </div> <div class="accordion-item__body accordion-item__body--black collapse" aria-expanded="false"> <trade-module-content data="::course.f*g" ></trade-module-content> </div> </div> <!-- ng-repeat --> </div> </div> </div> </div> </div> <a class="matchtest__content__app__button matchtest__content__app__button--orange" ng-click="matchtest.begin('<?php print $moduleIdentifier; ?> ', '<?php print $autoStart; ?> ')">Tag testen igen</a> </div> </div> </div> </div> </div> <?php }