diff --git a/uitpas_ui/ctools/plugins/content_types/uitpas_activity.inc b/uitpas_ui/ctools/plugins/content_types/uitpas_activity.inc
deleted file mode 100644
index 677066a5..00000000
--- a/uitpas_ui/ctools/plugins/content_types/uitpas_activity.inc
+++ /dev/null
@@ -1,87 +0,0 @@
- TRUE,
- 'title' => t('Uitpas: activity'),
- 'description' => t('Uitpas: activity.'),
- 'category' => t('Uitpas'),
- 'required context' => array(
- new ctools_context_required(t('Uitpas activity'), 'uitpas_activity'),
- new ctools_context_required(t('Uitpas user'), 'uitpas_user'),
- ),
-);
-
-function uitpas_ui_uitpas_activity_content_type_edit_form($form, &$form_state) {
- return $form;
-}
-
-function uitpas_ui_uitpas_activity_content_type_render($subtype, $conf, $args, $context) {
- $activity = $context[0]->data;
- $uitpas_activity = '';
- $promotions_location = 0;
- $promotions_organiser = 0;
- try {
- $cf = DrupalCultureFeed::getConsumerInstance();
- //uitpas event
- $query = new CultureFeed_Uitpas_Event_Query_SearchEventsOptions();
- $query->cdbid = $activity['cdbid'];
- if ($context[1]->data && $context[1]->data->passholder) {
- $query->uitpasNumber = ($context[1]->data->passholder->uitpasNumber);
- }
- else {
- // workaround to show kansenstatuut price for anonymous user
- $query->uitpasNumber = '0930000221919';
- }
- $result = $cf->uitpas()->searchEvents($query);
-
- if ($result->total) {
- $uitpas_activity = $result->objects[0];
- }
- //promotions by location
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->balieConsumerKey = $activity['location']['actor']['cdbid'];
- //$query->cashingPeriodBegin = time();
- $query->unexpired = "TRUE";
- $result = $cf->uitpas()->getPromotionPoints($query);
- if ($result->total) {
- $promotions_location = $result->total;
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_activity_actor_' . $activity['location']['actor']['cdbid'], $e);
- }
- //promotions by organiser
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->balieConsumerKey = $activity['organiser']['cdbid'];
- //$query->cashingPeriodBegin = time();
- $query->unexpired = "TRUE";
- $result = $cf->uitpas()->getPromotionPoints($query);
- if ($result->total) {
- $promotions_organiser = $result->total;
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_activity_actor_' . $activity['organiser']['cdbid'], $e);
- }
-
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_activity', $e);
- }
- $block = new stdClass();
- $block->title = $activity['detail']['nl']['title'];
- $block->content = theme('uitpas_ui_activity', array(
- 'activity' => $activity,
- 'uitpas_activity' => $uitpas_activity,
- 'promotions_location' => $promotions_location,
- 'promotions_organiser' => $promotions_organiser,
- ));
- return $block;
-}
\ No newline at end of file
diff --git a/uitpas_ui/ctools/plugins/content_types/uitpas_actor.inc b/uitpas_ui/ctools/plugins/content_types/uitpas_actor.inc
deleted file mode 100644
index 7b93c698..00000000
--- a/uitpas_ui/ctools/plugins/content_types/uitpas_actor.inc
+++ /dev/null
@@ -1,70 +0,0 @@
- TRUE,
- 'title' => t('Uitpas: actor'),
- 'description' => t('Uitpas: actor.'),
- 'category' => t('Uitpas'),
- 'required context' => array(
- new ctools_context_required(t('Uitpas actor'), 'uitpas_actor'),
- new ctools_context_required(t('Uitpas user'), 'uitpas_user'),
- ),
-);
-
-function uitpas_ui_uitpas_actor_content_type_edit_form($form, &$form_state) {
- return $form;
-}
-
-function uitpas_ui_uitpas_actor_content_type_render($subtype, $conf, $args, $context) {
- $actor = $context[0]->data;
- $points = FALSE;
- $promotions = array();
- try {
- $cf = DrupalCultureFeed::getConsumerInstance();
- //event
- $query = new CultureFeed_Uitpas_Event_Query_SearchEventsOptions();
- $query->locatieId = $actor['cdbid'];
- if ($context[1]->data && $context[1]->data->passholder) {
- $query->uitpasNumber = ($context[1]->data->passholder->uitpasNumber);
- }
- $result = $cf->uitpas()->searchEvents($query);
- if ($result->total) {
- foreach ($result->objects as $event) {
- if ($event->numberOfPoints) {
- $points = TRUE;
- break;
- }
- }
- }
- //promotions
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->balieConsumerKey = $actor['cdbid'];
- //$query->cashingPeriodBegin = time();
- $query->unexpired = "TRUE";
- $result = $cf->uitpas()->getPromotionPoints($query);
- if ($result->total) {
- $promotions = $result->objects;
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_actor_' . $actor['cdbid'], $e);
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_actor', $e);
- }
- $block = new stdClass();
- $block->title = $actor['detail']['nl']['title'];
- $block->content = theme('uitpas_ui_actor', array(
- 'actor' => $actor,
- 'points' => $points,
- 'promotions' => $promotions,
- ));
- return $block;
-}
\ No newline at end of file
diff --git a/uitpas_ui/ctools/plugins/content_types/uitpas_advantages_promotions.inc b/uitpas_ui/ctools/plugins/content_types/uitpas_advantages_promotions.inc
deleted file mode 100644
index 700f3ff1..00000000
--- a/uitpas_ui/ctools/plugins/content_types/uitpas_advantages_promotions.inc
+++ /dev/null
@@ -1,108 +0,0 @@
- TRUE,
- 'title' => t('Uitpas: advantages and promotions'),
- 'description' => t('Uitpas: advantages and promotions.'),
- 'category' => t('Uitpas'),
- 'required context' => new ctools_context_required(t('Uitpas location'), 'uitpas_location'),
- 'defaults' => array(
- 'advantages_limit' => 10,
- 'promotions_limit' => 10,
- ),
-);
-
-function uitpas_ui_uitpas_advantages_promotions_content_type_edit_form($form, &$form_state) {
- $conf = $form_state['conf'];
- $form['advantages_limit'] = array(
- '#type' => 'textfield',
- '#title' => t('Advantages page limit'),
- '#default_value' => $conf['advantages_limit'],
- );
- $form['promotions_limit'] = array(
- '#type' => 'textfield',
- '#title' => t('Promotions page limit'),
- '#default_value' => $conf['promotions_limit'],
- );
- return $form;
-}
-
-function uitpas_ui_uitpas_advantages_promotions_content_type_edit_form_submit($form, &$form_state) {
- $form_state['conf']['advantages_limit'] = $form_state['values']['advantages_limit'];
- $form_state['conf']['promotions_limit'] = $form_state['values']['promotions_limit'];
-}
-
-function uitpas_ui_uitpas_advantages_promotions_content_type_render($subtype, $conf, $args, $context) { $location = $context->data->cf_query_argument;
-
-
-
- $advantages = array();
- $advantages_limit = $conf['advantages_limit'];
- $advantages_page = pager_find_page(0);
- $advantages_total = 0;
- $promotions = array();
- $promotions_limit = $conf['promotions_limit'];
- $promotions_page = pager_find_page(1);
- $promotions_total = 0;
- try {
- $cf = DrupalCultureFeed::getConsumerInstance();
- //advantages
- $query = new CultureFeed_Uitpas_Promotion_Query_WelcomeAdvantagesOptions();
- $query->start = $advantages_page * $advantages_limit;
- $query->max = $advantages_limit;
- if ($location) {
- $query->city = $location;
- }
- //$query->cashingPeriodBegin = time();
- $result = $cf->uitpas()->searchWelcomeAdvantages($query);
- $advantages_page = pager_default_initialize($result->total, $advantages_limit, 0);
- $advantages = $result->objects;
- uitpas_ui_helpers_process_counters($advantages);
- $advantages_total = $result->total;
-
- //promotions
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->start = $promotions_page * $promotions_limit;
- $query->max = $promotions_limit;
- $query->unexpired = "TRUE";
- if ($location) {
- $query->city = $location;
- }
- //$query->cashingPeriodBegin = time();
-
- $query->sort = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::SORT_POINTS;
- $query->order = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::ORDER_ASC;
- $result = $cf->uitpas()->getPromotionPoints($query);
-
-
- $objects = array();
- foreach( $result->objects as $k => $v ) {
- if(($v->cashInState == "POSSIBLE" || $v->cashInState == "NOT_POSSIBLE_DATE_CONSTRAINT") && ($v->publicationPeriodBegin <= time() || $v->publicationPeriodBegin == "")) {
- $objects[] = $v;
- }
- }
-
- $promotions_page = pager_default_initialize(count($objects), $promotions_limit, 1);
- $promotions = $objects; //$result->objects;
- //$promotions = $result->objects;
- uitpas_ui_helpers_process_counters($promotions);
- $promotions_total = count($objects);
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_advantages_promotions', $e);
- }
- $block = new stdClass();
- $block->title = t('Advantages and promotions');
- $block->content = theme('uitpas_ui_advantages_promotions', array(
- 'advantages' => $advantages,
- 'advantages_total' => $advantages_total,
- 'promotions' => $promotions,
- 'promotions_total' => $promotions_total,
- ));
- return $block;
-}
diff --git a/uitpas_ui/ctools/plugins/content_types/uitpas_promotions_highlight.inc b/uitpas_ui/ctools/plugins/content_types/uitpas_promotions_highlight.inc
deleted file mode 100644
index 44e7ea77..00000000
--- a/uitpas_ui/ctools/plugins/content_types/uitpas_promotions_highlight.inc
+++ /dev/null
@@ -1,60 +0,0 @@
- TRUE,
- 'title' => t('Uitpas: promotions highlight'),
- 'description' => t('Uitpas: promotions highlight.'),
- 'category' => t('Uitpas'),
- 'required context' => new ctools_context_required(t('Uitpas location'), 'uitpas_location'),
-);
-
-function uitpas_ui_uitpas_promotions_highlight_content_type_edit_form($form, &$form_state) {
- return $form;
-}
-
-function uitpas_ui_uitpas_promotions_highlight_content_type_render($subtype, $conf, $args, $context) {
- $location = $context->data->cf_query_argument;
- try {
- $cf = DrupalCultureFeed::getConsumerInstance();
- $highlights = variable_get('uitpas_ui_promotions_highlight', array());
- $promotions = array();
- foreach ($highlights as $highlight) {
- try {
- $promotions[] = $cf->uitpas()->getPointsPromotion($highlight);
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_promotions_highlight', $e);
- }
- }
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->sort = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::SORT_CASHING_PERIOD_END;
- $query->max = 4 - count($highlights);
- //$query->cashingPeriodBegin = time();
- if ($location) {
- $query->city = $location;
- }
- $query->unexpired = "TRUE";
- $result = $cf->uitpas()->getPromotionPoints($query);
- foreach ($result->objects as $object) {
- if (!in_array($object->id, $highlights)) {
- $promotions[] = $object;
- }
- }
- $block = new stdClass();
- $block->title = t("Spotlight promotions");
- if ($location) {
- $city = $context->data->locations[$context->data->location]['name'];
- $block->title = t("Spotlight promotions in !city", array('!city' => $city));
- }
- $block->content = theme('uitpas_ui_promotions_highlight', array('promotions' => $promotions));
- return $block;
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_promotions_highlight', $e);
- }
-}
\ No newline at end of file
diff --git a/uitpas_ui/ctools/plugins/content_types/uitpas_user_profile.inc b/uitpas_ui/ctools/plugins/content_types/uitpas_user_profile.inc
deleted file mode 100644
index 51b66b50..00000000
--- a/uitpas_ui/ctools/plugins/content_types/uitpas_user_profile.inc
+++ /dev/null
@@ -1,100 +0,0 @@
- TRUE,
- 'title' => t('Uitpas: user profile'),
- 'description' => t('Uitpas: user profile.'),
- 'category' => t('Uitpas'),
- 'required context' => new ctools_context_required(t('Uitpas user'), 'uitpas_user'),
-);
-
-function uitpas_ui_uitpas_user_profile_content_type_edit_form($form, &$form_state) {
- return $form;
-}
-
-function uitpas_ui_uitpas_user_profile_content_type_render($subtype, $conf, $args, $context) {
- if ($context->data && $context->data->passholder) {
- $uitpas_user = $context->data->user;
- $passholder = $context->data->passholder;
- $cf = $context->data->cf;
- $advantages = array();
- $promotions = array();
- $coming_promotions = array();
- //welcome advantages
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_WelcomeAdvantagesOptions();
- $query->uitpas_number = $passholder->uitpasNumber;
- $query->cashedIn = FALSE;
- $query->max = 2;
- $result = $cf->uitpas()->getWelcomeAdvantagesForPassholder($query);
- if ($result->total) {
- $advantages = $result->objects;
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_welcome_advantages', $e);
- }
- //promotions
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->maxPoints = $passholder->points;
- //$query->cashingPeriodBegin = time();
- $query->sort = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::SORT_POINTS;
- $query->order = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::ORDER_DESC;
- $query->max = 4;
- $query->unexpired = "TRUE";
- $result = $cf->uitpas()->getPromotionPoints($query);
- if ($result->total) {
- $objects = array();
- foreach( $result->objects as $k => $v ) {
- if( $v->cashInState == "POSSIBLE" ) {
- $objects[] = $v;
- }
- }
- $promotions = $objects;
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_promotions', $e);
- }
- //coming promotions
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->minPoints = $passholder->points + 1;
- $query->max = 2;
- $query->cashingPeriodBegin = time();
- $query->unexpired = "TRUE";
- $query->sort = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::SORT_POINTS;
- $query->order = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::ORDER_ASC;
- $result = $cf->uitpas()->getPromotionPoints($query);
- if ($result->total) {
- $objects = array();
- foreach( $result->objects as $k => $v ) {
- if( $v->cashingPeriodBegin <= time() ) {
- $objects[] = $v;
- }
- }
- $coming_promotions = $objects;
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_promotions_nearby', $e);
- }
- //ctools block
- $block = new stdClass();
- $block->title = t('My UITPAS');
- $block->content = theme('uitpas_ui_user_profile', array(
- 'uitpas_user' => $uitpas_user,
- 'passholder' => $passholder,
- 'advantages' => $advantages,
- 'promotions' => $promotions,
- 'coming_promotions' => $coming_promotions,
- ));
- return $block;
- }
-}
\ No newline at end of file
diff --git a/uitpas_ui/ctools/plugins/content_types/uitpas_user_profile_advantages.inc b/uitpas_ui/ctools/plugins/content_types/uitpas_user_profile_advantages.inc
deleted file mode 100644
index 2afa7260..00000000
--- a/uitpas_ui/ctools/plugins/content_types/uitpas_user_profile_advantages.inc
+++ /dev/null
@@ -1,136 +0,0 @@
- TRUE,
- 'title' => t('Uitpas: user profile advantages'),
- 'description' => t('Uitpas: user profile advantages.'),
- 'category' => t('Uitpas'),
- 'required context' => new ctools_context_required(t('Uitpas user'), 'uitpas_user'),
-);
-
-function uitpas_ui_uitpas_user_profile_advantages_content_type_edit_form($form, &$form_state) {
- return $form;
-}
-
-function uitpas_ui_uitpas_user_profile_advantages_content_type_render($subtype, $conf, $args, $context) {
- if ($context->data && $context->data->passholder) {
- $uitpas_user = $context->data->user;
- $passholder = $context->data->passholder;
- $cf = $context->data->cf;
- $consumer_cf = DrupalCultureFeed::getConsumerInstance();
- $advantages = array();
- $promotions = array();
- $coming_promotions = array();
- $cashed_in_promotions = array();
- $cashed_in_advantages = array();
- //welcome advantages
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_WelcomeAdvantagesOptions();
- $query->uitpas_number = $passholder->uitpasNumber;
- $query->cashedIn = FALSE;
- $result = $cf->uitpas()->getWelcomeAdvantagesForPassholder($query);
- if ($result->total) {
- $advantages = $result->objects;
- uitpas_ui_helpers_process_counters($advantages);
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_advantages', $e);
- }
- //promotions
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->uitpasNumber = $passholder->uitpasNumber;
- $query->maxPoints = $passholder->points;
- //$query->cashingPeriodBegin = time();
- $query->unexpired = "TRUE";
- $query->sort = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::SORT_POINTS;
- $query->order = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::ORDER_ASC;
- $result = $cf->uitpas()->getPromotionPoints($query);
- if ($result->total) {
- $objects = array();
- foreach( $result->objects as $k => $v ) {
- if( $v->cashInState == "POSSIBLE" ) {
- $objects[] = $v;
- }
- }
- $promotions = $objects;
- uitpas_ui_helpers_process_counters($promotions);
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_promotions', $e);
- }
- //coming promotions
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions();
- $query->uitpasNumber = $passholder->uitpasNumber;
- $query->minPoints = $passholder->points + 1;
- $query->cashingPeriodBegin = time();
- $query->unexpired = "TRUE";
- $query->sort = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::SORT_POINTS;
- $query->order = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::ORDER_ASC;
- $result = $cf->uitpas()->getPromotionPoints($query);
- if ($result->total) {
- $objects = array();
- foreach( $result->objects as $k => $v ) {
- if( $v->cashingPeriodBegin <= time() ) {
- $objects[] = $v;
- }
- }
- $coming_promotions = $objects;
- uitpas_ui_helpers_process_counters($coming_promotions);
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_promotions_nearby', $e);
- }
- //cashed in advantages
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_WelcomeAdvantagesOptions();
- $query->uitpas_number = $passholder->uitpasNumber;
- $query->cashedIn = TRUE;
- $result = $cf->uitpas()->getWelcomeAdvantagesForPassholder($query);
- if ($result->total) {
- $cashed_in_advantages = $result->objects;
- uitpas_ui_helpers_process_counters($cashed_in_advantages);
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_promotions', $e);
- }
- //cashed in promotions
- try {
- $query = new CultureFeed_Uitpas_Passholder_Query_SearchCashedInPromotionPointsOptions();
- $query->uitpasNumber = $passholder->uitpasNumber;
- $result = $cf->uitpas()->getCashedInPromotionPoints($query);
- if ($result->total) {
- $cashed_in_promotions = $result->objects;
- uitpas_ui_helpers_process_counters($cashed_in_promotions);
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_content_type_user_profile_promotions_cashed_in', $e);
- }
- //ctools block
- $block = new stdClass();
- $singular = t('My advantages (1 point saved)');
- $plural = t('My advantages (!points points saved)', array('!points' => $passholder->points));
- $block->title = format_plural($passholder->points, $singular, $plural);
- $block->content = theme('uitpas_ui_user_profile_advantages', array(
- 'uitpas_user' => $uitpas_user,
- 'passholder' => $passholder,
- 'advantages' => $advantages,
- 'promotions' => $promotions,
- 'coming_promotions' => $coming_promotions,
- 'cashed_in_advantages' => $cashed_in_advantages,
- 'cashed_in_promotions' => $cashed_in_promotions,
- ));
- return $block;
- }
-}
\ No newline at end of file
diff --git a/uitpas_ui/theme/theme.inc b/uitpas_ui/theme/theme.inc
deleted file mode 100755
index c46560d0..00000000
--- a/uitpas_ui/theme/theme.inc
+++ /dev/null
@@ -1,825 +0,0 @@
- array(t('Promotion'), t('Weight')),
- 'rows' => array(),
- 'attributes' => array('id' => $table_id),
- 'caption' => '',
- 'colgroups' => array(),
- 'sticky' => '',
- 'empty' => '',
- );
- $rows = array();
- foreach (element_children($form['promotions']) as $element) {
- $form['promotions'][$element]['weight']['#attributes']['class'] = array($weight_class);
- $table['rows'][] = array(
- 'data' => array(
- drupal_render($form['promotions'][$element]['value']),
- drupal_render($form['promotions'][$element]['weight']),
- ),
- 'class' => array('draggable'),
- );
- }
- $output = theme_table($table);
- $output .= drupal_render_children($form);
- drupal_add_tabledrag($table_id, 'order', 'sibling', $weight_class);
- return $output;
-}
-
-/**
- * Implements hook_preprocess_uitpas_ui_activity() for uitpas-ui-activity.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_activity(&$vars) {
- $activity = $vars['event'] = $vars['activity'];
- $uitpas_activity = $vars['uitpas_activity'];
- template_preprocess_cnapi_ui_event($vars);
- //icons and legend are the same html wise for accessibility reasons
- $list = array(
- 'title' => t('UITPAS advantages'),
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => array(),
- );
- if ($uitpas_activity && $uitpas_activity->numberOfPoints) {
- $singular = 'Save point';
- $plural = 'Save !points points';
- $options = array('!points' => $uitpas_activity->numberOfPoints);
- $list['items'][] = array(
- 'data' => format_plural($uitpas_activity->numberOfPoints, $singular, $plural, $options),
- 'class' => array('uitpas_activity_has_points'),
- );
- }
- if ($vars['promotions_location']) {
- $path = uitpas_ui_helpers_link_object('actor', $activity['location']['actor']);
- $list['items'][] = array(
- 'data' => l(t('Show advantages at this location'), $path),
- 'class' => array('uitpas_activity_has_promotion'),
- );
- }
- if ($vars['promotions_organiser'] && $vars['promotions_organiser'] != $vars['promotions_location']) {
- $path = uitpas_ui_helpers_link_object('actor', $activity['organiser']);
- $list['items'][] = array(
- 'data' => l(t('Show advantages for this organiser'), $path),
- 'class' => array('uitpas_activity_has_promotion'),
- );
- }
- if ($uitpas_activity && $uitpas_activity->price != 0) {
-
- $list['items'][] = array(
- 'data' => t('Reduction for opportunity groups'),
- 'class' => array('uitpas_activity_has_tariff'),
- );
-
- if (DrupalCultureFeed::isCultureFeedUser()) {
- try {
- $cf_user = DrupalCultureFeed::getLoggedInUser();
- $cf = DrupalCultureFeed::getLoggedInUserInstance();
- $passholder = $cf->uitpas()->getPassholderByUser($cf_user->id);
-
- if ($passholder->kansenStatuut) {
- // user with kansenstatuut
- $vars['price'] = '€ ' . $uitpas_activity->tariff . ' (standaardtarief: € ' . $uitpas_activity->price . ')';
- }
- else {
- // user with no kansenstatuut
- $vars['price'] = '€ ' . $uitpas_activity->price;
- }
- }
- catch (Exception $e) {
- watchdog_exception('uitpas_ui_get_passholder', $e);
- }
- }
- else {
- // anonymous user
- $vars['price'] = '€ ' . $uitpas_activity->price . ' (kansentarief: € ' . $uitpas_activity->tariff . ')';
- }
-
- }
- $vars['icons'] = (count($list['items'])) ? theme_item_list($list) : '';
- //headings
- if ($vars['headings']) {
- $list = array(
- 'title' => '',
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => $vars['headings'],
- );
- $vars['headings'] = (count($list['items'])) ? theme_item_list($list) : '';
- }
- //when
- $vars['when'] = $vars['when'];
- //where
- $path = uitpas_ui_helpers_link_object('actor', $activity['location']['actor']);
- $where = l($vars['location']['title'], $path) . "
";
- $where .= $vars['location']['address'];
- $vars['where'] = $where;
- //organisation
- $vars['organisation'] = '';
- if ($vars['organiser'] && ($vars['organiser']['title'] != $vars['location']['title'])) {
- $path = uitpas_ui_helpers_link_object('actor', $activity['organiser']);
- $organisation = l($vars['organiser']['title'], $path);
- $vars['organisation'] = $organisation;
- }
- //price
- $vars['price'] = $vars['price'];
- //links
- $list = array(
- 'title' => '',
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => $vars['links'],
- );
- $vars['links'] = (count($list['items'])) ? theme_item_list($list) : '';
- //image
- $vars['image'] = (isset($vars['images'][0]['image'])) ? $vars['images'][0]['image'] : '';
-}
-
-/**
- * Implements hook_preprocess_uitpas_ui_actor() for uitpas-ui-actor.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_actor(&$vars) {
- $actor = $vars['actor'];
- $promotions = $vars['promotions'];
- template_preprocess_cnapi_ui_actor($vars);
- //icons and legend are the same html wise for accessibility reasons
- $icons_list = $legend_list = array(
- 'title' => t('UiTPAS advantages at this location'),
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => array(),
- );
- if ($vars['points']) {
- $icons_list['items'][] = $legend_list['items'][] = array(
- 'data' => t('Save points'),
- 'class' => array('uitpas_actor_has_points'),
- );
- }
- if (count($promotions)) {
- $icons_list['items'][] = array(
- 'data' => t('Has promotions'),
- 'class' => array('uitpas_actor_has_promotions'),
- );
- foreach ($promotions as $promotion) {
- $legend_list['items'][] = array(
- 'data' => l($promotion->title, uitpas_ui_helpers_link_object('promotion', $promotion)),
- 'class' => array('uitpas_actor_has_promotions'),
- );
- }
- }
- $vars['icons'] = (count($icons_list['items'])) ? theme_item_list($icons_list) : '';
- $vars['legend'] = theme_item_list($legend_list) . l(t('Show all advantages and promotions'), 'advantages_promotions');
- //address
- $vars['address'] = $vars['address'];
- //contact
- $contact = (isset($vars['contact']['mail'])) ? $vars['contact']['mail'] . "
" : '';
- $contact .= (isset($vars['contact']['phone'])) ? t('telephone') . ': ' . $vars['contact']['phone'] . "
" : '';
- $contact .= (isset($vars['contact']['fax'])) ? t('fax') . ': ' . $vars['contact']['fax'] : '';
- $vars['contact'] = ($contact) ? $contact : '';
- //links
- $list = array(
- 'title' => '',
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => $vars['links'],
- );
- $vars['links'] = (count($list['items'])) ? theme_item_list($list) : '';
- //image
- $vars['image'] = (isset($vars['images'][0]['image'])) ? $vars['images'][0]['image'] : '';
-}
-
-/**
- * Implements hook_preprocess_uitpas_ui_advantage() for uitpas-ui-advantage.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_advantage(&$vars) {
- $advantage = $vars['advantage'];
- $vars['period'] = '';
- if ($advantage->cashingPeriodBegin) {
- $period = t('From !date', array('!date' => date('j/m/Y', $advantage->cashingPeriodBegin)));
- if ($advantage->publicationPeriodEnd) {
- $period .= ' ' . t('to !date', array('!date' => date('j/m/Y', $advantage->publicationPeriodEnd)));
- }
- elseif ($advantage->cashingPeriodEnd) {
- $period .= ' ' . t('to !date', array('!date' => date('j/m/Y', $advantage->cashingPeriodEnd)));
- }
- else {
- $period .= ' ' . t('till end of stock');
- }
- $vars['period'] = $period;
- }
- $pictures = array();
- foreach ($advantage->pictures as $picture) {
- $pictures[] = theme_image(array('path' => $picture . '?width=180', 'attributes' => array()));;
- }
- $vars['pictures'] = $pictures;
- $vars['description1'] = $advantage->description1;
- $vars['description2'] = $advantage->description2;
- $location = array();
- foreach ($advantage->counters as $counter) {
- $location[] = $counter->name;
- }
- $vars['location'] = t('At') . " " . implode(', ', $location);
- $location_options = variable_get_value('uitpas_ui_locations');
- $location_options = array_map('trim', explode("\n", $location_options));
- $valid_for_cities = array_intersect($location_options, $advantage->validForCities);
- asort($valid_for_cities);
- $list = array(
- 'title' => t('Valid for inhabitants of'),
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => $valid_for_cities,
- );
- $vars['available'] = theme_item_list($list);
-}
-
- /**
- * Implements hook_preprocess_uitpas_ui_advantages_promotions() for uitpas-ui-advantages_promotions.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_advantages_promotions(&$vars) {
- $advantages = $vars['advantages'];
- $advantages_total = $vars['advantages_total'];
- $promotions = $vars['promotions'];
- $promotions_total = $vars['promotions_total'];
- $base_table = array(
- 'attributes' => array(),
- 'caption' => '',
- 'colgroups' => array(),
- 'sticky' => '',
- 'empty' => '',
- );
- $base_pager = array('tags' => array(), 'parameters' => array());
- //advantages
- $header = array(t('Welcome advantages'), t('valid till'));
- $rows = array();
- if (count($advantages)) {
- foreach ($advantages as $advantage) {
- $rows[] = array(
- l($advantage->title, uitpas_ui_helpers_link_object('advantage', $advantage)),
- ($advantage->cashingPeriodEnd) ? date('j/n/Y', $advantage->cashingPeriodEnd) : t('end of stock')
- );
- }
- }
- else {
- $rows[] = array(array('data' => t('No results found'), 'colspan' => 2));
- }
- $table = $base_table + array('header' => $header, 'rows' => $rows);
- $pager = $base_pager + array('element' => 0, 'quantity' => $advantages_total);
- $vars['advantages'] = theme_table($table) . theme_pager($pager);
- //promotions
- $header = array(array('data' => t('Promotions'), 'colspan' => 2), t('valid till'));
- $rows = array();
- if (count($promotions)) {
- foreach ($promotions as $promotion) {
- $singular = '%points point';
- $plural = '%points points';
- $points = format_plural($promotion->points, $singular, $plural, array('%points' => $promotion->points));
- $rows[] = array(
- array('data' => $points, 'class' => array('uitpas_ui_points')),
- l($promotion->title, uitpas_ui_helpers_link_object('promotion', $promotion)),
- ($promotion->cashingPeriodEnd) ? date('j/n/Y', $promotion->cashingPeriodEnd) : t('end of stock')
- );
- }
- }
- else {
- $rows[] = array(array('data' => t('No results found'), 'colspan' => 3));
- }
- $table = $base_table + array('header' => $header, 'rows' => $rows);
- $pager = $base_pager + array('element' => 1, 'quantity' => $promotions_total);
- $vars['promotions'] = theme_table($table) . theme_pager($pager);
- //info
- $vars['info'] = variable_format_value('uitpas_ui_advantages_promotions_info');
-}
-
-/**
- * Implements hook_preprocess_uitpas_ui_promotion() for uitpas-ui-promotion.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_promotion(&$vars) {
- $promotion = $vars['promotion'];
- $singular = 'Needed points: !points point';
- $plural = 'Needed points: !points points';
- $vars['points'] = format_plural($promotion->points, $singular, $plural, array('!points' => $promotion->points));
- $vars['period'] = '';
- if ($promotion->cashingPeriodBegin) {
- $period = t('From !date', array('!date' => date('j/m/Y', $promotion->cashingPeriodBegin)));
- if ($promotion->publicationPeriodEnd) {
- $period .= ' ' . t('to !date', array('!date' => date('j/m/Y', $promotion->publicationPeriodEnd)));
- }
- elseif ($promotion->cashingPeriodEnd) {
- $period .= ' ' . t('to !date', array('!date' => date('j/m/Y', $promotion->cashingPeriodEnd)));
- }
- else {
- $period .= ' ' . t('till end of stock');
- }
- $vars['period'] = $period;
- }
- $pictures = array();
- foreach ($promotion->pictures as $picture) {
- $pictures[] = theme_image(array('path' => $picture . '?width=180', 'attributes' => array()));;
- }
- $vars['pictures'] = $pictures;
- $vars['description1'] = $promotion->description1;
- $vars['description2'] = $promotion->description2;
- $location = array();
- foreach ($promotion->counters as $counter) {
- $location[] = $counter->name;
- }
- $vars['location'] = t('At') . " " . implode(', ', $location);
- $location_options = variable_get_value('uitpas_ui_locations');
- $location_options = array_map('trim', explode("\n", $location_options));
- $valid_for_cities = array_intersect($location_options, $promotion->validForCities);
- asort($valid_for_cities);
- $list = array(
- 'title' => t('Valid for inhabitants of'),
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => $valid_for_cities,
- );
- $vars['available'] = theme_item_list($list);
-}
-
-/**
- * Implements hook_preprocess_uitpas_ui_promotions_highlight() for uitpas-ui-promotions_highlight.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_promotions_highlight(&$vars) {
- $promotions = $vars['promotions'];
- $rows = array();
- foreach ($promotions as $promotion) {
- $singular = '%points point';
- $plural = '%points points';
- $rows[] = array(
- array(
- 'data' =>format_plural($promotion->points, $singular, $plural, array('%points' => $promotion->points)),
- 'class' => array('uitpas_ui_points'),
- ),
- l($promotion->title, uitpas_ui_helpers_link_object('promotion', $promotion)),
- );
- }
- $table = array(
- 'header' => array(),
- 'rows' => $rows,
- 'attributes' => array(),
- 'caption' => '',
- 'colgroups' => array(),
- 'sticky' => '',
- 'empty' => '',
- );
- $vars['promotions'] = theme_table($table);
- $vars['more'] = l(t('Show all promotions'), 'advantages_promotions');
-}
-
-/**
- * Implements hook_preprocess_uitpas_ui_recent_actions() for uitpas-ui-recent-actions.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_recent_actions(&$vars) {
- $actions = $vars['actions'];
- $list = array(
- 'title' => '',
- 'attributes' => array(),
- 'type' => 'ul',
- 'items' => array(),
- );
- foreach ($actions as $action) {
- //subject
- $url = 'activity/' . cnapi_ui_slug($action->nodeTitle) . '/'. $action->nodeId;
- $subject = l($action->nodeTitle, $url);
- //args
- $args = array(
- '!name' => ($action->nick) ? $action->nick : t('Anonymous'),
- '!points' => $action->points,
- '!location' => $action->createdVia,
- '!time_ago' => format_interval(time() - $action->creationDate, 1),
- '!subject' => $subject,
- );
- $singular = "!name saved 1 point at !subject, !time_ago ago";
- $plural = "!name saved !points points at !subject, !time_ago ago";
- $default_image = variable_get_value('uitpas_ui_user_default_image');
- $image = ($action->depiction) ? $action->depiction : variable_get_value('uitpas_ui_user_default_image');
- $image = theme_image(array('path' => $image, 'attributes' => array()));
- $list['items'][] = $image . format_plural($action->points, $singular, $plural, $args);
- }
-
- $vars['actions'] = theme_item_list($list);
- $vars['form'] = (count($vars['form'])) ? drupal_render($vars['form']) : '';
-}
-
-/**
- * Implements hook_preprocess_uitpas_ui_register_where() for uitpas-ui-register-where.tpl.php.
- */
-function uitpas_ui_preprocess_uitpas_ui_register_where(&$vars) {
- $table = array(
- 'header' => array(),
- 'rows' => array(),
- 'attributes' => array(),
- 'caption' => '',
- 'colgroups' => array(),
- 'sticky' => '',
- 'empty' => '',
- );
- if (count($vars['pos'])) {
- foreach ($vars['pos'] as $pos) {
- $path = '';
- $details = "