| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* @defgroup eventfinder_themes EventFinder Themeable Functions
|
| 4 |
*/
|
| 5 |
/**
|
| 6 |
* Main eventfinder page
|
| 7 |
* @ingroup eventfinder_themes
|
| 8 |
* @args - POST variables
|
| 9 |
*/
|
| 10 |
function theme_eventfinder_main($content){
|
| 11 |
$output = '<div id="eventfinder">';
|
| 12 |
$output .= $content;
|
| 13 |
$output .= "</div>";
|
| 14 |
return theme('page', $output);
|
| 15 |
}
|
| 16 |
/**
|
| 17 |
* Separate method for displaying the main search
|
| 18 |
* @ingroup eventfinder_themes
|
| 19 |
* @args - POST variables
|
| 20 |
*/
|
| 21 |
function theme_eventfinder_main_page($content){
|
| 22 |
$output = '<div id="eventfinder">';
|
| 23 |
$output .= $content;
|
| 24 |
$output .= "</div>";
|
| 25 |
return theme('page', $output);
|
| 26 |
}
|
| 27 |
/**
|
| 28 |
* Method for showing options within a node
|
| 29 |
* @ingroup eventfinder_themes
|
| 30 |
* @args - POST variables
|
| 31 |
*/
|
| 32 |
function theme_eventfinder_nodeoptions($content){
|
| 33 |
$output = '<div id="eventfinder">';
|
| 34 |
$output .= $content;
|
| 35 |
$output .= "</div>";
|
| 36 |
return $output;
|
| 37 |
}
|
| 38 |
/**
|
| 39 |
*
|
| 40 |
* Description goes here
|
| 41 |
*
|
| 42 |
* @ingroup groupname
|
| 43 |
* @return description of what is returned
|
| 44 |
*
|
| 45 |
*/
|
| 46 |
function theme_eventfinder_search_control($content, $name = '') {
|
| 47 |
$output = '<div class="ef_search_control ' . $name . '">';
|
| 48 |
$output .= $content;
|
| 49 |
$output .= '</div>';
|
| 50 |
return $output;
|
| 51 |
}
|
| 52 |
/**
|
| 53 |
* Displays Host an Event Page
|
| 54 |
*
|
| 55 |
* @ingroup eventfinder_themes
|
| 56 |
* @args - POST variables
|
| 57 |
*
|
| 58 |
*/
|
| 59 |
function theme_eventfinder_host($content){
|
| 60 |
$output = '<div class="ef_host_event">';
|
| 61 |
$output .= $content;
|
| 62 |
$output .= '</div>';
|
| 63 |
return theme('page', $output);
|
| 64 |
}
|
| 65 |
/**
|
| 66 |
* Displays Host an Event Page
|
| 67 |
*
|
| 68 |
* @ingroup eventfinder_themes
|
| 69 |
* @args - POST variables
|
| 70 |
*
|
| 71 |
*/
|
| 72 |
function theme_eventfinder_myevents($content){
|
| 73 |
$output .= '<div id="eventfinder">';
|
| 74 |
$output .= $content;
|
| 75 |
$output .= '</div>';
|
| 76 |
return theme('page', $output);
|
| 77 |
}
|
| 78 |
|
| 79 |
/**
|
| 80 |
* Displays MyEvents - Registered Events
|
| 81 |
*
|
| 82 |
* @ingroup eventfinder_themes
|
| 83 |
* @content
|
| 84 |
*
|
| 85 |
*/
|
| 86 |
function theme_eventfinder_my_events_reg($content){
|
| 87 |
$output .= '<div id="ef_reg_events">';
|
| 88 |
$output .= '<span>Registered Events</span>' . '<br>';
|
| 89 |
$output .= $content;
|
| 90 |
$output .= '</div>';
|
| 91 |
return $output;
|
| 92 |
}
|
| 93 |
|
| 94 |
/**
|
| 95 |
* Displays MyEvents - Hosted Events
|
| 96 |
*
|
| 97 |
* @ingroup eventfinder_themes
|
| 98 |
* @content
|
| 99 |
*
|
| 100 |
*/
|
| 101 |
function theme_eventfinder_my_events_host($content){
|
| 102 |
$output .= '<div id="ef_hosted_events">';
|
| 103 |
$output .= '<span>Hosted Events</span>' . '<br>';
|
| 104 |
$output .= $content;
|
| 105 |
$output .= '</div>';
|
| 106 |
return $output;
|
| 107 |
}
|
| 108 |
|
| 109 |
/**
|
| 110 |
*
|
| 111 |
* EevntFinder descriptions and instructions
|
| 112 |
*
|
| 113 |
* @ingroup eventfinder_themes
|
| 114 |
* @return DIV containing instructions for users
|
| 115 |
*
|
| 116 |
*/
|
| 117 |
function theme_eventfinder_desc ($arg1) {
|
| 118 |
$output .= '<div id="ef_desc">';
|
| 119 |
$output .= $arg1;
|
| 120 |
$output .= '</div>';
|
| 121 |
return $output;
|
| 122 |
}
|
| 123 |
|
| 124 |
/**
|
| 125 |
*
|
| 126 |
* Displays a node in the search results page
|
| 127 |
*
|
| 128 |
* @ingroup eventfinder_themes
|
| 129 |
* @return fully formatted node
|
| 130 |
*
|
| 131 |
*/
|
| 132 |
function theme_eventfinder_node_preview($node, $teaser = FALSE, $page = FALSE, $my = FALSE) {
|
| 133 |
// TODO: Clean up this theme, remove business logic
|
| 134 |
global $user;
|
| 135 |
$output .= '<div class="ef_node">';
|
| 136 |
if (module_exist('taxonomy')) {
|
| 137 |
$terms = taxonomy_link('taxonomy terms', $node);
|
| 138 |
}
|
| 139 |
if ($page == 0) {
|
| 140 |
$output .= '<h2 class="title">'. l(check_plain($node->title), 'eventfinder/search_events/' . $node->nid) .'</h2> by '. format_name($node);
|
| 141 |
} else {
|
| 142 |
$output .= 'by '. format_name($node);
|
| 143 |
}
|
| 144 |
if (count($terms)) {
|
| 145 |
$output .= ' <small>('. theme('links', $terms) .')</small><br />';
|
| 146 |
}
|
| 147 |
$output .= $node->teaser;
|
| 148 |
// checking to see if this node is being previewed in the myevents section
|
| 149 |
if(!$my){
|
| 150 |
$links[] = l(t('calendar'), 'event/'. format_date($node->event_start, 'custom', 'Y/m/d'));
|
| 151 |
$links[] = l(t('new search'), 'eventfinder');
|
| 152 |
$at_cap = $node->registered_users < $node->max_reg;
|
| 153 |
$u_reg = eventfinder_check_reg($node->nid);
|
| 154 |
if($node->enable_reg == 1){
|
| 155 |
if(!eventfinder_check_host($node->nid)){
|
| 156 |
$links[] = l(t(eventfinder_reg_users($node, TRUE)), 'eventfinder/search_events/' . $node->nid);
|
| 157 |
if(($node->registered_users >= $node->max_reg) && $node->max_reg > 0){
|
| 158 |
$links[] = t("event is at capacity");
|
| 159 |
} else if(!$u_reg && $node->max_reg > 0) {
|
| 160 |
if(variable_get('ef_reg_opt', 0) === 0){
|
| 161 |
$links[] = l(t('Register for this Event'), 'eventfinder/search_events/' . $node->nid . '/register/');
|
| 162 |
} else {
|
| 163 |
$links[] = l(t('Register for this Event'), 'eventfinder/register/' . $node->nid);
|
| 164 |
}
|
| 165 |
} else if($node->max_reg > 0) {
|
| 166 |
$links[] = t("you are registered for this event");
|
| 167 |
}
|
| 168 |
} else {
|
| 169 |
$links[] = l(t(eventfinder_reg_users($node, TRUE)), 'eventfinder/search_events/' . $node->nid);
|
| 170 |
}
|
| 171 |
} else {
|
| 172 |
$links[] = l('event details', 'eventfinder/search_events/' . $node->nid);
|
| 173 |
}
|
| 174 |
} else {
|
| 175 |
$links[] = l('event details', 'eventfinder/search_events/' . $node->nid);
|
| 176 |
}
|
| 177 |
$output .= '<div class="links">'. theme('links', $links) .'</div>';
|
| 178 |
$output .= '</div>';
|
| 179 |
return $output;
|
| 180 |
}
|
| 181 |
/**
|
| 182 |
*
|
| 183 |
* Displays a node in the details page
|
| 184 |
*
|
| 185 |
* @ingroup eventfinder_themes
|
| 186 |
* @return fully formatted node
|
| 187 |
*
|
| 188 |
*/
|
| 189 |
function theme_eventfinder_node_details($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
|
| 190 |
$output = '<div id="eventfinder">';
|
| 191 |
$output .= '<div class="ef_node">';
|
| 192 |
if (module_exist('taxonomy')) {
|
| 193 |
$terms = taxonomy_link('taxonomy terms', $node);
|
| 194 |
}
|
| 195 |
$output .= '<h2 class="title">'. check_plain($node->title) .'</h2> by '. format_name($node);
|
| 196 |
if (count($terms)) {
|
| 197 |
$output .= ' <small>('. theme('links', $terms) .')</small><br />';
|
| 198 |
}
|
| 199 |
$output .= $node->body;
|
| 200 |
node_invoke_nodeapi($node, 'view', $teaser, $page);
|
| 201 |
|
| 202 |
$new_links[] = l(t('calendar'), 'event/'. format_date($node->event_start, 'custom', 'Y/m/d'));
|
| 203 |
$new_links[] = l(t('new search'), 'eventfinder');
|
| 204 |
$new_links[] = l(t(eventfinder_get_registered($node->nid)), 'eventfinder');
|
| 205 |
|
| 206 |
$output .= '<div class="links">'. theme('links', $node->links) .'</div>';
|
| 207 |
$output .= '</div>';
|
| 208 |
$output .= '</div>';
|
| 209 |
return $output;
|
| 210 |
}
|
| 211 |
/**
|
| 212 |
* EventFinder options 'block'
|
| 213 |
* @ingroup eventfinder_themes
|
| 214 |
*/
|
| 215 |
function theme_eventfinder_options ($arg1) {
|
| 216 |
$output .= '<div id="ef_options">';
|
| 217 |
$output .= $arg1;
|
| 218 |
$output .= '</div>';
|
| 219 |
form_group('EventFinder Options', $arg1);
|
| 220 |
return $output;
|
| 221 |
}
|
| 222 |
|
| 223 |
/**
|
| 224 |
*
|
| 225 |
* Registration page
|
| 226 |
*
|
| 227 |
* @ingroup eventfinder_themes
|
| 228 |
*
|
| 229 |
*/
|
| 230 |
function theme_eventfinder_registration_form($title, $content) {
|
| 231 |
$output = '<div id="ef_reg_page">';
|
| 232 |
$info .= 'You are about to register for the following event:<br/>';
|
| 233 |
$info .= 'Title: ' . $title . '<br>';
|
| 234 |
$info .= 'Please fill out the following form to proceed.';
|
| 235 |
$output .= theme('eventfinder_desc', $info);
|
| 236 |
$output .= $content;
|
| 237 |
$output .= '</div>';
|
| 238 |
return $output;
|
| 239 |
}
|
| 240 |
?>
|