From b8b267bea131c9993c9428074e687dd3c6a606df Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Mon, 16 Sep 2013 15:58:59 +0200 Subject: [PATCH] remove old uitpas_ui module --- .../plugins/content_types/uitpas_activity.inc | 87 -- .../plugins/content_types/uitpas_actor.inc | 70 -- .../uitpas_advantages_promotions.inc | 108 --- .../uitpas_promotions_highlight.inc | 60 -- .../content_types/uitpas_user_profile.inc | 100 --- .../uitpas_user_profile_advantages.inc | 136 --- uitpas_ui/theme/theme.inc | 825 ------------------ uitpas_ui/theme/uitpas-ui-activity.tpl.php | 159 ---- uitpas_ui/theme/uitpas-ui-actor.tpl.php | 99 --- uitpas_ui/theme/uitpas-ui-advantage.tpl.php | 22 - uitpas_ui/theme/uitpas-ui-promotion.tpl.php | 23 - .../uitpas-ui-user-profile-details.tpl.php | 32 - .../uitpas-ui-user-profile-uitid.tpl.php | 21 - uitpas_ui/uitpas_ui.admin.inc | 74 -- 14 files changed, 1816 deletions(-) delete mode 100644 uitpas_ui/ctools/plugins/content_types/uitpas_activity.inc delete mode 100644 uitpas_ui/ctools/plugins/content_types/uitpas_actor.inc delete mode 100644 uitpas_ui/ctools/plugins/content_types/uitpas_advantages_promotions.inc delete mode 100644 uitpas_ui/ctools/plugins/content_types/uitpas_promotions_highlight.inc delete mode 100644 uitpas_ui/ctools/plugins/content_types/uitpas_user_profile.inc delete mode 100644 uitpas_ui/ctools/plugins/content_types/uitpas_user_profile_advantages.inc delete mode 100755 uitpas_ui/theme/theme.inc delete mode 100644 uitpas_ui/theme/uitpas-ui-activity.tpl.php delete mode 100644 uitpas_ui/theme/uitpas-ui-actor.tpl.php delete mode 100644 uitpas_ui/theme/uitpas-ui-advantage.tpl.php delete mode 100644 uitpas_ui/theme/uitpas-ui-promotion.tpl.php delete mode 100644 uitpas_ui/theme/uitpas-ui-user-profile-details.tpl.php delete mode 100644 uitpas_ui/theme/uitpas-ui-user-profile-uitid.tpl.php delete mode 100644 uitpas_ui/uitpas_ui.admin.inc 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 = "
"; - $times = '-'; - if (isset($vars['actors'][$pos->id])) { - $actor = $vars['actors'][$pos->id]; - $address = $actor['contactinfo']['address']; - $details .= "
"; - if (isset($address['street'])) { - $details .= $address['street'] . ' ' . $address['housenr'] . "
"; - } - $details .= $address['zipcode'] . ' ' . $address['city']; - $details .= "
"; - if (isset($actor['detail']['nl']['calendarsummary'])) { - $times = $actor['detail']['nl']['calendarsummary']; - } - $path = uitpas_ui_helpers_link_object('actor', $actor); - } - else if ($pos->street || $pos->city) { - $details .= "
"; - if ($pos->street) { - $details .= $pos->street . ' ' . $pos->number . "
"; - } - $details .= $pos->postalCode . ' ' . $pos->city; - $details .= "
"; - } - //description - $title = ($path) ? l($pos->name, $path) : $pos->name; - $description = "
" . $title . "
"; - $description .= $details; - if ($path) { - $more = t('More info and contact information'); - $link = l($more, $path); - $description .= "
" . $link . "
"; - } - $description .= "
"; - $table['rows'][] = array($description, $times); - } - } - else { - $table['rows'][] = array(array('data' => t('No results found.'), 'colspan' => 2)); - } - $pager = array('tags' => array(), 'parameters' => array(), 'element' => 0, 'quantity' => $vars['total']); - $vars['pos'] = theme_table($table) . theme_pager($pager); - $vars['info'] = variable_format_value('uitpas_ui_register_where_info'); -} - -/** - * Implements hook_preprocess_uitpas_ui_user_profile() for uitpas-ui-user-profile.tpl.php. - */ -function uitpas_ui_preprocess_uitpas_ui_user_profile(&$vars) { - $uitpas_user = $vars['uitpas_user']; - $passholder = $vars['passholder']; - $advantages = $vars['advantages']; - $promotions = $vars['promotions']; - $coming_promotions = $vars['coming_promotions']; - if (isset($uitpas_user->depiction)) { - $vars['image'] = theme_image(array('path' => $uitpas_user->depiction, 'attributes' => array())); - } - else { - $vars['image'] = ''; - } - $vars['name'] = l($uitpas_user->nick, 'myprofile/details'); - $singular = t('1 point saved'); - $plural = t('%points points saved', array('%points' => $passholder->points)); - $vars['points'] = format_plural($passholder->points, $singular, $plural); - //advantages - $links = array('links' => array(), 'heading' => array(), 'attributes' => array()); - foreach ($advantages as $advantage) { - $links['links'][] = array( - 'title' => $advantage->title, - 'href' => uitpas_ui_helpers_link_object('advantage', $advantage), - ); - } - $vars['advantages'] = theme_links($links); - //promotions - $links = array('links' => array(), 'heading' => array(), 'attributes' => array()); - foreach ($promotions as $promotion) { - $links['links'][] = array( - 'title' => $promotion->title . ' (' . t('!points points', array('!points' => $promotion->points)) . ')', - 'href' => uitpas_ui_helpers_link_object('promotion', $promotion), - ); - } - $vars['promotions'] = theme_links($links); - //coming promotions - $links = array('links' => array(), 'heading' => array(), 'attributes' => array()); - foreach ($coming_promotions as $promotion) { - $links['links'][] = array( - 'title' => $promotion->title . ' (' . t('!points points', array('!points' => $promotion->points)) . ')', - 'href' => uitpas_ui_helpers_link_object('promotion', $promotion), - ); - } - $vars['coming_promotions'] = (count($coming_promotions)) ? theme_links($links) : ''; - $vars['all_promotions'] = l(t('Show all advantages'), 'myprofile/advantages'); -} - -/** - * Implements hook_preprocess_uitpas_ui_user_profile_activities() for uitpas-ui-user-profile-activities.tpl.php. - */ -function uitpas_ui_preprocess_uitpas_ui_user_profile_activities(&$vars) { - $activities = $vars['activities']; - $activities_total = $vars['activities_total']; - $header = array(t('Date'), t('Activity name'), t('Location'), t('Points')); - $rows = array(); - if (count($activities)) { - foreach ($activities as $activity) { - $singular = '!points point'; - $plural = '!points points'; - $rows[] = array( - date('j/m/Y', $activity->creationDate), - $activity->nodeTitle, - $activity->location, - format_plural($activity->points, $singular, $plural, array('!points' => $activity->points)), - ); - } - } - else { - $rows[] = array(array('data' => t('No results found.'), 'colspan' => 4)); - } - $table = array( - 'header' => $header, - 'rows' => $rows, - 'attributes' => array(), - 'caption' => '', - 'colgroups' => array(), - 'sticky' => '', - 'empty' => '', - ); - $pager = array('tags' => array(), 'parameters' => array(), 'element' => 0, 'quantity' => $activities_total); - $vars['activities'] = theme_table($table) . theme_pager($pager); -} - -/** - * Implements hook_preprocess_uitpas_ui_user_profile_advantages() for uitpas-ui-user-profile-advantages.tpl.php. - */ -function uitpas_ui_preprocess_uitpas_ui_user_profile_advantages(&$vars) { - $passholder = $vars['passholder']; - $advantages = $vars['advantages']; - $promotions = $vars['promotions']; - $coming_promotions = $vars['coming_promotions']; - $cashed_in_advantages = $vars['cashed_in_advantages']; - $cashed_in_promotions = $vars['cashed_in_promotions']; - $base_table = array( - 'attributes' => array(), - 'caption' => '', - 'colgroups' => array(), - 'sticky' => '', - 'empty' => '', - ); - //promotions - $header = array( - array('data' => t('Trade-in options'), 'colspan' => 2), - array('data' => t('valid till')), - ); - $rows = array(); - if (count($promotions)) { - foreach ($promotions as $promotion) { - if ($promotion->publicationPeriodEnd) { - $end_date = ' ' . t('to !date', array('!date' => date('j/m/Y', $promotion->publicationPeriodEnd))); - } - elseif ($promotion->cashingPeriodEnd) { - $end_date = ' ' . t('to !date', array('!date' => date('j/m/Y', $promotion->cashingPeriodEnd))); - } - else { - $end_date = ' ' . t('end of stock'); - } - $singular = t('1 point'); - $plural = t('!points points', array('!points' => $promotion->points)); - $points = format_plural($promotion->points, $singular, $plural); - $rows[] = array( - array('data' => $points, 'class' => array('uitpas_ui_points')), - l($promotion->title, uitpas_ui_helpers_link_object('promotion', $promotion)), - $end_date - ); - } - } - else { - $rows[] = array(array('data' => t('No results found.'), 'colspan' => 3)); - } - $table = $base_table + array('header' => $header, 'rows' => $rows); - $vars['promotions'] = theme_table($table); - //coming promotions - $header = array( - array('data' => t('Coming trade-in options'), 'colspan' => 2), - array('data' => t('valid till')), - ); - $rows = array(); - if (count($coming_promotions)) { - foreach ($coming_promotions as $promotion) { - if ($promotion->publicationPeriodEnd) { - $end_date = ' ' . t('to !date', array('!date' => date('j/m/Y', $promotion->publicationPeriodEnd))); - } - elseif ($promotion->cashingPeriodEnd) { - $end_date = ' ' . t('to !date', array('!date' => date('j/m/Y', $promotion->cashingPeriodEnd))); - } - else { - $end_date = ' ' . t('end of stock'); - } - $singular = t('1 point'); - $plural = t('!points points', array('!points' => $promotion->points)); - $points = format_plural($promotion->points, $singular, $plural); - $rows[] = array( - array('data' => $points, 'class' => array('uitpas_ui_points')), - l($promotion->title, uitpas_ui_helpers_link_object('promotion', $promotion)), - $end_date - ); - } - } - else { - $rows[] = array(array('data' => t('No results found.'), 'colspan' => 3)); - } - $table = $base_table + array('header' => $header, 'rows' => $rows); - $vars['coming_promotions'] = theme_table($table); - //advantages - $header = array( - array('data' => t('Advantages')), - array('data' => 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' => 3)); - } - $table = $base_table + array('header' => $header, 'rows' => $rows); - $vars['advantages'] = theme_table($table); - //cashed in promotions and advantages - $header = array( - array('data' => t('History of cashed in advantages and promotions'), 'colspan' => 3), - array('data' => t('Cashed in on ')), - ); - $rows = array(); - //cashed in promotions - foreach ($cashed_in_promotions as $promotion) { - $singular = t('1 point'); - $plural = t('!points points', array('!points' => $promotion->points)); - $rows[] = array( - format_plural($promotion->points, $singular, $plural), - l($promotion->title, uitpas_ui_helpers_link_object('promotion', $promotion)), - $promotion->counters[0]->name, - date('j/n/Y', $promotion->cashingDate), - ); - } - //cashed in advantages - foreach ($cashed_in_advantages as $advantage) { - $location = array(); - foreach ($advantage->counters as $counter) { - $location[] = $counter->name; - } - $rows[] = array( - t('Welcome'), - l($advantage->title, uitpas_ui_helpers_link_object('advantage', $advantage)), - $advantage->counters[0]->name, - date('j/n/Y', $advantage->cashingDate), - ); - } - if (!count($rows)) { - $rows[] = array(array('data' => t('No results found'), 'colspan' => 4)); - } - $table = $base_table + array('header' => $header, 'rows' => $rows); - $vars['cashed_in_promotions_advantages'] = theme_table($table); -} - -/** - * Implements hook_preprocess_uitpas_ui_user_profile_details() for uitpas-ui-user-profile-details.tpl.php. - */ -function uitpas_ui_preprocess_uitpas_ui_user_profile_details(&$vars) { - $uitpas_user = $vars['uitpas_user']; - $passholder = $vars['passholder']; - if (isset($uitpas_user->depiction)) { - $vars['image'] = theme_image(array('path' => $uitpas_user->depiction, 'attributes' => array())); - } - else { - $vars['image'] = ''; - } - $vars['uitpas_number'] = ' ' . $passholder->uitpasNumber; - $vars['intro'] = variable_format_value('uitpas_ui_user_profile_details_intro'); - $vars['national_identification_number'] = ' ' . $passholder->inszNumber; - $vars['first_name'] = ' ' . $passholder->firstName; - $vars['last_name'] = ' ' . $passholder->name; - $vars['dob'] = ' ' . date('j/m/Y', $passholder->dateOfBirth); - $vars['pob'] = ' ' . $passholder->placeOfBirth; - $vars['gender'] = ' ' . t(($passholder->gender == 'MALE') ? 'Male' : 'Female'); - $vars['nationality'] = ' ' . $passholder->nationality; - $vars['street'] = ' ' . $passholder->street; - $vars['nr'] = ' ' . $passholder->number; - $vars['bus'] = ' ' . $passholder->box; - $vars['zip'] = ' ' . $passholder->postalCode; - $vars['city'] = ' ' . $passholder->city; - $vars['tel'] = ' ' . $passholder->telephone; - $vars['mobile'] = ' ' . $passholder->gsm; - $vars['email'] = ' ' . $passholder->email; - $vars['status_title'] = t('Status'); - $vars['kansenStatuut'] = $passholder->kansenStatuut; - $vars['kansenStatuutValidEndDate'] = (time() < $passholder->kansenStatuutEndDate); - $status_end_date = t('valid till !date', array('!date' => date('j/m/Y', $passholder->kansenStatuutEndDate))); - $vars['status_valid_till'] = ' ' . $status_end_date; - if (count($passholder->memberships)) { - $memberships = array(); - foreach ($passholder->memberships as $membership) { - $endate = t('valid till !date', array('!date' => date('j/m/Y', $membership->endDate))); - $memberships[] = ' ' . $endate; - } - $vars['memberships'] = implode('
', $memberships); - } - else { - $vars['memberships'] = ''; - } -} - -/** - * Implements hook_preprocess_uitpas_ui_user_profile_navigation() for uitpas-ui-user-profile-navigation.tpl.php. - */ -function uitpas_ui_preprocess_uitpas_ui_user_profile_navigation(&$vars) { - $navigation = $vars['navigation']; - $output = ''; - foreach ($vars['navigation'] as $nav) { - $title = variable_get_value('uitpas_ui_user_profile_navigation_' . $nav . '_title'); - $path = variable_get_value('uitpas_ui_user_profile_navigation_' . $nav . '_path'); - $body = variable_format_value('uitpas_ui_user_profile_navigation_' . $nav . '_body'); - $output .= "

" . l($title, $path) . "

"; - $output .= "
" . $body . "
"; - } - $vars['navigation'] = $output; -} - -/** - * Implements hook_preprocess_uitpas_ui_user_profile_uitid() for uitpas-ui-user-profile-uitid.tpl.php. - */ -function uitpas_ui_preprocess_uitpas_ui_user_profile_uitid(&$vars) { - $uitpas_user = $vars['uitpas_user']; - $passholder = $vars['passholder']; - $actions = $vars['actions']; - if (isset($uitpas_user->depiction)) { - $vars['image'] = theme_image(array('path' => $uitpas_user->depiction, 'attributes' => array())); - } - else { - $vars['image'] = ''; - } - $vars['first_name'] = $uitpas_user->givenName; - $vars['dob'] = date('j/m/Y', $uitpas_user->dob); - $vars['city'] = $uitpas_user->city; - $vars['gender'] = $uitpas_user->gender; - $vars['gender'] = ''; - if (!empty($uitpas_user->gender)) { - $vars['gender'] = $uitpas_user->gender == CultureFeed_User::GENDER_MALE ? 'Man' : 'Vrouw'; - } - $vars['bio'] = $uitpas_user->bio; - $list = array('items' => array(), 'title' => t('Recent UITID actions'), 'type' => 'ul', 'attributes' => array()); - foreach ($actions as $action) { - //subject - if ($action->type == CultureFeed_Activity::TYPE_UITPAS) { - $url = 'activity'; - } - else if ($action->contentType == 'event') { - $url = 'http://www.uitinvlaanderen.be/agenda/e'; - } - else if ($action->contentType == 'actor') { - $url = 'http://www.uitinvlaanderen.be/agenda/a'; - } - $url .= "/" . 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, - ); - switch ($action->type) { - case CultureFeed_Activity::TYPE_UITPAS: - $singular = "!name saved 1 point at !subject, !time_ago ago"; - $plural = "!name saved !points points at !subject, !time_ago ago"; - $list['items'][] = format_plural($action->points, $singular, $plural, $args); - break; - case CultureFeed_Activity::TYPE_IK_GA: - $string = t("!name goes to !subject, !time_ago ago", $args); - $list['items'][] = $string; - break; - case CultureFeed_Activity::TYPE_LIKE: - $string = t("!name likes !subject, !time_ago ago", $args); - $list['items'][] = $string; - break; - } - } - $vars['actions'] = (count($list['items'])) ? theme_item_list($list) : ''; - $vars['form'] = drupal_render($vars['form']); - $vars['info'] = variable_format_value('uitpas_ui_user_profile_uitid_info'); -} diff --git a/uitpas_ui/theme/uitpas-ui-activity.tpl.php b/uitpas_ui/theme/uitpas-ui-activity.tpl.php deleted file mode 100644 index 086ab9f4..00000000 --- a/uitpas_ui/theme/uitpas-ui-activity.tpl.php +++ /dev/null @@ -1,159 +0,0 @@ -
- -
- - - - - - - - -
- -
-
- - -
- - -
- - -
Wanneer
-
- -
- - - -
Waar
-
- -
- - - -
Wie
-
- -
- - - -
Prijs
-
- -
- - - -
Reserveren
-
- -
- - - Telefoon:
- - - Fax: - -
- - - -
-
- -
- - - -
Organisatie
-
- -
- - - -
Contact
-
- -
- - - Telefoon:
- - - Fax: - -
- - - -
Links
-
- -
- - - -
Leeftijd
-
- - - - -
- - - -
Doelgroep
-
- -
- - - -
Voorzieningen
-
- -
- - - -
Meer info
-
- -
- - -
- -
- -
- -
- -
- -
- - -
- - -
- -
- -
-
- -
-
- -
\ No newline at end of file diff --git a/uitpas_ui/theme/uitpas-ui-actor.tpl.php b/uitpas_ui/theme/uitpas-ui-actor.tpl.php deleted file mode 100644 index 681e9d48..00000000 --- a/uitpas_ui/theme/uitpas-ui-actor.tpl.php +++ /dev/null @@ -1,99 +0,0 @@ -
- -
-
- - -
- - -
- - -
Waar
-
- - -
- - -
- - - -
Reserveren
-
- -
- - - Telefoon:
- - - Fax: - -
- - - -
Contact
-
- -
- - - -
Links
-
- -
- - -
- - -
Voorzieningen
-
- -
- - - - -
Meer info
-
-
- -
-
- - - -
- -
- - -
- -
- -
- -
- -
- - -
- -
-
- -
-
- -
- diff --git a/uitpas_ui/theme/uitpas-ui-advantage.tpl.php b/uitpas_ui/theme/uitpas-ui-advantage.tpl.php deleted file mode 100644 index d406581f..00000000 --- a/uitpas_ui/theme/uitpas-ui-advantage.tpl.php +++ /dev/null @@ -1,22 +0,0 @@ -
-
- -
- -
-
-
-
- 0) print $pictures[0]; ?> -
- -
-
- Meer info - 1): ?> -
- -
-
-
- diff --git a/uitpas_ui/theme/uitpas-ui-promotion.tpl.php b/uitpas_ui/theme/uitpas-ui-promotion.tpl.php deleted file mode 100644 index 4827db89..00000000 --- a/uitpas_ui/theme/uitpas-ui-promotion.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ -
-
-
- -
- -
-
-
-
- 0) print $pictures[0]; ?> -
- -
-
- Meer info - 1): ?> -
- -
-
-
- diff --git a/uitpas_ui/theme/uitpas-ui-user-profile-details.tpl.php b/uitpas_ui/theme/uitpas-ui-user-profile-details.tpl.php deleted file mode 100644 index 6fc5fb4a..00000000 --- a/uitpas_ui/theme/uitpas-ui-user-profile-details.tpl.php +++ /dev/null @@ -1,32 +0,0 @@ -
- - - - - -
diff --git a/uitpas_ui/theme/uitpas-ui-user-profile-uitid.tpl.php b/uitpas_ui/theme/uitpas-ui-user-profile-uitid.tpl.php deleted file mode 100644 index 08637d72..00000000 --- a/uitpas_ui/theme/uitpas-ui-user-profile-uitid.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -
- - - - - - -
diff --git a/uitpas_ui/uitpas_ui.admin.inc b/uitpas_ui/uitpas_ui.admin.inc deleted file mode 100644 index a5d195fa..00000000 --- a/uitpas_ui/uitpas_ui.admin.inc +++ /dev/null @@ -1,74 +0,0 @@ -unexpired = "TRUE"; - $query->sort = CultureFeed_Uitpas_Passholder_Query_SearchPromotionPointsOptions::SORT_CASHING_PERIOD_END; - $result = $cf->uitpas()->getPromotionPoints($query); - $promotions = variable_get('uitpas_ui_promotions_highlight', array()); - $weights = array(); - $max_weight = 0; - foreach ($promotions as $promotion) { - $weights[$promotion] = $max_weight++; - } - $weight = 0; - foreach ($result->objects as $promotion) { - $form['promotions'][$promotion->id] = array( - 'value' => array( - '#type' => 'checkbox', - '#default_value' => (in_array($promotion->id, $promotions)) ? 1 : 0, - '#title' => $promotion->title, - ), - 'weight' => array( - '#type' => 'weight', - '#title' => t('Weight for @title', array('@title' => $promotion->title)), - '#title_display' => 'invisible', - '#default_value' => (isset($weights[$promotion->id])) ? $weights[$promotion->id] : $max_weight++, - ), - ); - } - uasort($form['promotions'], 'uitpas_ui_admin_promotions_highlight_form_weight_sort'); - } - catch (Exception $e) { - watchdog_exception('uitpas_ui_admin_promotions_highlight', $e); - } - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save changes')); - return $form; -} - -/** - * Sorting function for uitpas_ui_admin_promotions_highlight_form(). - */ -function uitpas_ui_admin_promotions_highlight_form_weight_sort($a, $b) { - if ($a['weight']['#default_value'] == $b['weight']['#default_value']) { - return 0; - } - return ($a['weight']['#default_value'] < $b['weight']['#default_value']) ? -1 : 1; -} - -/** - * Submit callback form for uitpas promotions highlight. - */ -function uitpas_ui_admin_promotions_highlight_form_submit($form, &$form_state) { - uasort($form_state['values']['promotions'], 'drupal_sort_weight'); - $promotions = array(); - foreach ($form_state['values']['promotions'] as $key => $promotion) { - if ($promotion['value']) { - $promotions[] = $key; - } - } - variable_set('uitpas_ui_promotions_highlight', $promotions); -} \ No newline at end of file