function theme_header($pageid, $title, $include_menu, $mode, $user_id) { global $PHP_SELF; global $HTTP_VARS; global $ADMIN_TYPE; if ($pageid == 'install') { $pageTitle = get_opendb_title_and_version() . " Installation"; } else { $pageTitle = get_opendb_title(); } echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" . "\n<html>" . "\n<head>" . "\n<title>" . $pageTitle . (!empty($title) ? " - {$title}" : "") . "</title>" . "\n<meta http-equiv=\"Content-Type\" content=\"" . get_content_type_charset() . "\">" . "\n<link rel=\"icon\" href=\"" . theme_image_src("icon-16x16.png") . "\" type=\"image/png\" />" . "\n<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"" . get_opendb_title() . " Title Search\" href=\"./searchplugins.php?type=title\">" . "\n<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"" . get_opendb_title() . " UPC Search\" href=\"./searchplugins.php?type=upc\">" . get_theme_css($pageid, $mode) . get_opendb_rss_feeds_links() . get_theme_javascript($pageid) . "</head>" . "\n<body>"; echo "<div id=\"header\">"; echo "<h1><a href=\"index.php\">" . $pageTitle . "</a></h1>"; if ($include_menu) { echo "<ul class=\"headerLinks\">"; $help_page = get_opendb_help_page($pageid); if ($help_page != NULL) { echo "<li class=\"help\"><a href=\"help.php?page=" . $help_page . "\" target=\"_new\" title=\"" . get_opendb_lang_var('help') . "\">" . theme_image("help.png") . "</a></li>"; } $printable_page_url = get_printable_page_url($pageid); if ($printable_page_url != NULL) { echo "<li><a href=\"" . $printable_page_url . "\" target=\"_new\" title=\"" . get_opendb_lang_var('printable_version') . "\">" . theme_image("printable.gif") . "</a></li>"; } if (is_exists_my_reserve_basket($user_id)) { echo "<li><a href=\"borrow.php?op=my_reserve_basket\">" . theme_image("basket.png", get_opendb_lang_var('item_reserve_list')) . "</a></li>"; } if (is_user_granted_permission(PERM_VIEW_LISTINGS, NULL, TRUE)) { echo "<li><form class=\"quickSearch\" action=\"listings.php\">" . "<input type=\"hidden\" name=\"search_list\" value=\"y\">" . "<input type=\"hidden\" name=\"title_match\" value=\"partial\">" . "<input type=\"text\" class=\"text\" name=\"title\" size=\"10\" value=\"Title Search\" onfocus=\"if(this.value=='Title Search'){this.value='';this.style.color='black';}\" onblur=\"if(this.value==''){this.value='Title Search';this.style.color='gray';}\">" . "</form></li>"; } if (is_user_granted_permission(PERM_VIEW_ADVANCED_SEARCH, NULL, TRUE)) { echo "<li><a href=\"search.php\" title=\"" . get_opendb_lang_var('advanced_search') . "\">" . get_opendb_lang_var('advanced') . "</a></li>"; } if (strlen($user_id) > 0) { echo "<li class=\"login\"><a href=\"logout.php\">" . get_opendb_lang_var('logout', 'user_id', $user_id) . "</a></li>"; } else { echo "<li class=\"login\"><a href=\"login.php?op=login\">" . get_opendb_lang_var('login') . "</a></li>"; } echo "</ul>"; } echo "</div>"; echo "<div id=\"content\" class=\"{$pageid}Content\">"; if ($include_menu) { if ($pageid == 'admin') { echo "\n<div id=\"admin-menu\" class=\"menuContainer toggleContainer\" onclick=\"return toggleVisible('admin-menu');\">\r\n <span id=\"admin-menu-toggle\" class=\"menuToggle toggleHidden\">" . get_opendb_lang_var('admin_tools') . "</span>\r\n <div id=\"admin-menu-content\" class=\"menuContent elementHidden\">\r\n <h2 class=\"menu\">Admin Tools</h2>"; $menu_options_rs = get_system_admin_tools_menu(); echo get_menu_options_list($menu_options_rs); echo "\n</div>"; echo "\n</div>"; } echo "\n<div id=\"menu\" class=\"menuContainer toggleContainer\" onclick=\"return toggleVisible('menu');\">"; echo "<span id=\"menu-toggle\" class=\"menuToggle toggleHidden\">" . get_opendb_lang_var('main_menu') . "</span>"; echo "<div id=\"menu-content\" class=\"menuContent elementHidden\">"; echo "<h2 class=\"menu\">" . get_opendb_lang_var('main_menu') . '</h2>'; echo get_menu_options_list(get_menu_options($user_id)); echo "\n</div>"; echo "\n</div>"; } }
function display_s_file_type_row($file_type_r, $row) { global $PHP_SELF; global $ADMIN_TYPE; echo "\n<tr>"; if (is_not_empty_array($file_type_r)) { echo "\n<td class=\"data\">" . get_input_field("content_type[{$row}]", NULL, NULL, "readonly", "N", $file_type_r['content_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">" . "</td>"; } else { echo "\n<td class=\"data\">" . get_input_field("content_type[{$row}]", NULL, NULL, "text(20,100)", "Y", $file_type_r['content_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"N\">" . "</td>"; } $groups = array(); $results = fetch_s_file_type_content_group_rs(); if ($results) { while ($content_group_r = db_fetch_assoc($results)) { $groups[] = $content_group_r['content_group']; } } echo "<td class=\"data\">" . custom_select("content_group[{$row}]", $groups, "%value%", 1, $file_type_r['content_group'], "value") . "</td>"; //description echo "\n<td class=\"data\">" . get_input_field("description[{$row}]", NULL, NULL, "text(20,255)", "N", $file_type_r['description'], FALSE) . "</td>"; echo "\n<td class=\"data\">" . get_input_field("extension[{$row}]", NULL, "Extension", "text(10,10)", "Y", $file_type_r['extension'], FALSE) . "</td>"; $alt_extensions = ''; if (is_not_empty_array($file_type_r)) { $alt_extensions_r = fetch_s_file_type_alt_extension_r($file_type_r['content_type']); if (is_array($alt_extensions_r)) { $alt_extensions = implode(', ', $alt_extensions_r); } } // convert array of extensiosn to a string echo "\n<td class=\"data\">" . get_input_field("alt_extensions[{$row}]", NULL, "Alternate Extensions", "text(20,255)", "N", $alt_extensions, FALSE) . "</td>"; echo "<td class=\"data\">"; // Get the theme specific source of the image. if (strlen($file_type_r['image']) > 0) { $src = theme_image_src($file_type_r['image']); } if ($src !== FALSE && strlen($src) > 0) { echo "<img src=\"{$src}\">"; } else { echo " "; } echo "</td>"; echo "\n<td class=\"data\">" . get_input_field("image[{$row}]", NULL, NULL, "url(15,*,\"gif,jpg,png\",N)", "N", $file_type_r['image'], FALSE) . "</td>"; echo "\n<td class=\"data\">" . get_input_field("thumbnail_support_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($file_type_r['thumbnail_support_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE) . "</td>"; echo "\n<td class=\"data\">"; if (is_not_empty_array($file_type_r)) { echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete&content_type=" . $file_type_r['content_type'] . "\">Delete</a>"; } else { echo " "; } echo "\n</td>"; echo "</tr>"; }
function display_s_item_type_row($item_type_r, $row) { global $PHP_SELF; global $ADMIN_TYPE; echo "\n<tr>"; $errors = NULL; if (check_item_type_structure($item_type_r['s_item_type'], $errors)) { $class = "data"; } else { $class = "error"; } // order_no echo "\n<td class=\"{$class}\">" . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "N", $item_type_r['order_no'], FALSE) . "</td>"; echo "\n<td class=\"{$class}\">" . get_input_field("s_item_type[{$row}]", NULL, "Item Type", "readonly", "Y", $item_type_r['s_item_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">" . "</td>"; //description echo "\n<td class=\"{$class}\">" . get_input_field("description[{$row}]", NULL, NULL, "text(30,30)", "N", $item_type_r['description'], FALSE) . "</td>"; echo "<td class=\"{$class}\">"; // Get the theme specific source of the image. if (strlen($item_type_r['image']) > 0) { $src = theme_image_src($item_type_r['image']); } if ($src !== FALSE && strlen($src) > 0) { echo "<img src=\"{$src}\">"; } else { echo " "; } echo "</td>"; echo "\n<td class=\"{$class}\">" . get_input_field("image[{$row}]", NULL, NULL, "url(15,*,\"gif,jpg,png\",N)", "N", $item_type_r['image'], FALSE) . "</td>"; echo "\n<td class=\"{$class}\">"; echo "\n<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=edit&s_item_type=" . $item_type_r['s_item_type'] . "\">Edit</a>" . " / <a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete_type&s_item_type=" . $item_type_r['s_item_type'] . "\">Delete</a>" . "</td>"; echo "\n<td class=\"{$class}\">"; echo "\n<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=sql&s_item_type={$item_type_r['s_item_type']}&mode=job\">SQL</a>"; echo "\n</td>"; echo "</tr>"; if (is_not_empty_array($errors)) { echo "\n<tr>"; echo "\n<td colspan=\"6\" class=\"{$class}\">"; echo format_error_block($errors); echo "\n</td>"; echo "\n<tr>"; } }
"><?php the_title(); ?> </a></li> <?php } ?> </ul> </li> <?php } ?> <li> <ul class="social-icon-links inline-list"> <li><a href="https://twitter.com/TheOpenStandard"><img src="<?php theme_image_src('icons/social-twitter.svg'); ?> "></a></li> <li><a href="https://www.facebook.com/theopenstandard"><img src="<?php theme_image_src('icons/social-facebook.svg'); ?> "></a></li> <li><a href="https://plus.google.com/101433152788587086227"><img src="<?php theme_image_src('icons/social-google-plus.svg'); ?> "></a></li> </ul> </li> </ul> </aside>
function display_edit_form($status_type_r, $HTTP_VARS = NULL) { global $_COLUMN_DESC; if (is_array($status_type_r)) { echo get_input_field("s_status_type", NULL, $_COLUMN_DESC['s_status_type'], "readonly", "Y", $status_type_r['s_status_type'], TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('s_status_type') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); } else { echo get_input_field("s_status_type", NULL, $_COLUMN_DESC['s_status_type'], "text(1,1)", "Y", $HTTP_VARS['s_status_type'], TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('s_status_type') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); } echo get_input_field("description", NULL, $_COLUMN_DESC['description'], "text(30,60)", "Y", ifempty($status_type_r['description'], $HTTP_VARS['description']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('description') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); $field = get_input_field("img", NULL, $_COLUMN_DESC['img'], "url(15,*,\"gif,jpg,png\",N)", "N", ifempty($status_type_r['img'], $HTTP_VARS['img']), FALSE); $image_src = theme_image_src(ifempty($status_type_r['img'], $HTTP_VARS['img'])); if ($image_src !== FALSE && strlen($image_src) > 0) { $field .= " <img src=\"{$image_src}\">"; } echo format_field($_COLUMN_DESC['img'], $field, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('img') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); echo get_input_field("delete_ind", NULL, $_COLUMN_DESC['delete_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['delete_ind'], $HTTP_VARS['delete_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('delete_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); echo get_input_field("change_owner_ind", NULL, $_COLUMN_DESC['change_owner_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['change_owner_ind'], ifempty($HTTP_VARS['change_owner_ind'], "N")), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('change_owner_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); echo get_input_field("borrow_ind", NULL, $_COLUMN_DESC['borrow_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['borrow_ind'], $HTTP_VARS['borrow_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('borrow_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); echo get_input_field("status_comment_ind", NULL, $_COLUMN_DESC['status_comment_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['status_comment_ind'], $HTTP_VARS['status_comment_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('status_comment_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); echo get_input_field("hidden_ind", NULL, $_COLUMN_DESC['hidden_ind'], "value_radio_grid('Y,N')", "N", ifempty($status_type_r['hidden_ind'], $HTTP_VARS['hidden_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('hidden_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); echo get_input_field("default_ind", NULL, $_COLUMN_DESC['default_ind'], "checkbox(Y,N)", "N", ifempty($status_type_r['default_ind'], $HTTP_VARS['default_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('default_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); if (is_array($status_type_r)) { echo get_input_field("closed_ind", NULL, $_COLUMN_DESC['closed_ind'], "checkbox(Y,N)", "N", ifempty($status_type_r['closed_ind'], $HTTP_VARS['closed_ind']), TRUE, "%prompt% <a class=\"smlink\" href=\"#\" onmouseover=\"" . get_edit_form_tooltip('closed_ind') . "\" onmouseout=\"return hide_tooltip();\">(?)</a>"); } }
/** Will format a complete image url. @param $src The image.ext without any path information. @param $title The tooltip to include in the image. @param $type Specifies the origin of the image. Current types being used are: s_item_type - for 's_item_type' images. borrowed_item - Borrow system status images. action - Item operation (edit, delete, etc) These are the steps it uses to work out which image to display: 1) Calls theme_image_src 2) If theme_image_src returns FALSE, then return the $src, without extension, in initcap format. */ function theme_image($src, $title = NULL, $type = NULL) { $file_r = parse_file(basename($src)); $alt = ucfirst($file_r['name']); if (($src = theme_image_src($src)) !== FALSE) { return "<img src=\"{$src}\"" . (strlen($alt) > 0 ? " alt=\"" . $alt . "\"" : "") . (strlen($title) > 0 ? " title=\"{$title}\"" : "") . (strlen($type) > 0 ? " class=\"{$type}\"" : "") . ">"; } else { if ($type == "action") { return FALSE; } else { return $alt; } } }
<?php if ($next) { $next_category = get_primary_category($next); ?> <div class="arrow-right <?php echo $next_category->slug; ?> show-for-large-up"> <a href="<?php echo post_permalink($next->ID); ?> "> <img src="<?php theme_image_src('arrow-right.svg'); ?> "> <div class="arrow-hover right"> <h3 class="<?php echo $next_category->slug; ?> "><?php echo one_of(simple_fields_fieldgroup('short_title', $next->ID), get_the_title($next->ID)); ?> </h3> </div> </a> </div> <?php }
/** Returns an array describing the image, which must then be generated, the keys will be: url width - most likely one of these only will be provided, in this case derive the other. height */ function file_cache_get_noimage_r($type) { if ($type == 'display') { $src = theme_image_src(get_opendb_config_var('item_display', 'no_image')); } else { //if($type == 'listing') $src = theme_image_src(get_opendb_config_var('listings', 'no_image')); } if (is_file($src)) { $size = @getimagesize($src); return array('url' => $src, 'width' => $size[0], 'height' => $size[1]); } else { return NULL; } }
function get_item_display_field($item_r, $item_attribute_type_r, $value = NULL, $dowrap = TRUE, $prompt_mask = NULL) { if ($item_attribute_type_r['display_type'] == 'hidden') { return ''; } else { if ($item_attribute_type_r['display_type'] == 'fileviewer') { $format_mask = ifempty($item_attribute_type_r['display_type_arg1'], '%value%'); $width = ifempty($item_attribute_type_r['display_type_arg2'], '400'); $height = ifempty($item_attribute_type_r['display_type_arg3'], '300'); $target = ifempty($item_attribute_type_r['display_type_arg4'], '_blank'); if (is_array($value)) { $values = $value; } else { $values[] = $value; } if (count($values) > 0) { $display_value_r = array(); while (list(, $value) = each($values)) { $value = trim($value); $value_format_mask = $format_mask; if (strpos($value_format_mask, '%img%') !== FALSE) { $file_type_r = fetch_file_type_r(fetch_file_type_for_extension(get_file_ext($value))); if (strlen($file_type_r['image']) > 0 && ($image_src = theme_image_src($file_type_r['image'])) !== FALSE) { $img = '<img src="' . $image_src . '" title="' . $value . '">'; } else { $img = ''; } $value_format_mask = str_replace('%img%', $img, $value_format_mask); } if (strpos($value_format_mask, '%value%') !== FALSE) { $value_format_mask = str_replace('%value%', $value, $value_format_mask); } $file_r = file_cache_get_image_r($value, 'display'); $url = $file_r['fullsize']['url']; $display_value_r[] = "<a href=\"" . $value . "\" onclick=\"fileviewer('{$url}' ,'" . ($width + 20) . "', '" . ($height + 25) . "', '" . $target . "'); return false;\" title=\"" . $item_attribute_type_r['prompt'] . "\" class=\"popuplink\">{$value_format_mask}</a>"; } $field = format_multivalue_block($display_value_r, 'fileviewer'); if ($dowrap) { return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask); } else { return $field; } } else { return ''; } } else { if ($item_attribute_type_r['display_type'] == 'datetime') { if (is_array($value)) { $values = $value; } else { $values[] = $value; } if (count($values) > 0) { $display_value_r = array(); while (list(, $value) = each($values)) { $value = trim($value); $timestamp = get_timestamp_for_datetime($value, 'YYYYMMDDHH24MISS'); if ($timestamp !== FALSE) { if (strlen($item_attribute_type_r['display_type_arg1']) == 0) { $item_attribute_type_r['display_type_arg1'] = 'DD/MM/YYYY'; } $datetime = get_localised_timestamp($item_attribute_type_r['display_type_arg1'], $timestamp); if ($datetime !== FALSE) { $display_value_r[] = $datetime; } else { $display_value_r[] = $value; } } else { $display_value_r[] = $value; } } $field = format_multivalue_block($display_value_r, 'datetime'); if ($dowrap) { return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask); } else { return $field; } } else { return ''; } } else { if ($item_attribute_type_r['display_type'] == 'format_mins') { if (is_array($value)) { $values = $value; } else { $values[] = $value; } if (count($values) > 0) { $display_value_r = array(); while (list(, $value) = each($values)) { $value = trim($value); if (is_numeric($value)) { // Ensure we have a mask to work with. $display_mask = $item_attribute_type_r['display_type_arg1']; if (strlen($display_mask) == 0) { $display_mask = '%h %H %m %M'; } $hrs = floor($value / 60); // hours $mins = $value % 60; // minutes // Process display_mask and remove any bits that are not needed because the hour/minute is zero. if ($mins == 0 && $hrs > 0) { // only get rid of minutes if $hrs is a value. $index = strpos($display_mask, '%H'); if ($index !== FALSE) { $display_mask = substr($display_mask, 0, $index + 2); } else { $index = strpos($display_mask, '%m'); if ($index != FALSE) { $display_mask = substr($display_mask, 0, $index); } //include the %H } } else { if ($hrs == 0) { $index = strpos($display_mask, '%m'); if ($index != FALSE) { $display_mask = substr($display_mask, $index); } //include the %H } } // Unfortunately we need to do $mins>0 and $hrs>0 if's twice, because otherwise once we // replace the %h and %H the test for $mins>0 would not be able to cut the display_mask, // based on the %h/%H... if ($hrs > 0) { // Now do all replacements. $display_mask = str_replace('%h', $hrs, $display_mask); if ($hrs != 1) { $display_mask = str_replace('%H', get_opendb_lang_var('hours'), $display_mask); } else { $display_mask = str_replace('%H', get_opendb_lang_var('hour'), $display_mask); } } if ($mins >= 0 || $hrs === 0 && $mins === 0) { // Now do minute replacements only. $display_mask = str_replace('%m', $mins, $display_mask); if ($mins != 1) { $display_mask = str_replace('%M', get_opendb_lang_var('minutes'), $display_mask); } else { $display_mask = str_replace('%M', get_opendb_lang_var('minute'), $display_mask); } } $display_value_r[] = $display_mask; } else { // what else can we do here?! $display_value_r[] = $value; } } $field = format_multivalue_block($display_value_r, 'format_mins'); if ($dowrap) { return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask); } else { return $field; } } else { return ''; } } else { if ($item_attribute_type_r['display_type'] == 'star_rating') { // arg[0] = rating range if (is_array($value)) { $values = $value; } else { $values[] = $value; } if (count($values) > 0) { $display_value_r = array(); while (list(, $value) = each($values)) { $value = trim($value); // no point unless numeric if (is_numeric($value)) { $total_count = $item_attribute_type_r['display_type_arg1']; if (is_numeric($total_count)) { $display_value = ''; $j = $value; for ($i = 0; $i < $total_count; ++$i) { if ($j >= 0.75) { $display_value .= theme_image('rs.gif'); } else { if ($j >= 0.25) { $display_value .= theme_image('rgs.gif'); } else { $display_value .= theme_image('gs.gif'); } } $j = $j - 1; } $ratingmask = $item_attribute_type_r['display_type_arg2']; if (strlen($ratingmask) > 0) { $ratingmask = str_replace('%value%', $value, $ratingmask); $ratingmask = str_replace('%maxrange%', $total_count, $ratingmask); $display_value = str_replace('%starrating%', $display_value, $ratingmask); } if ($item_attribute_type_r['listing_link_ind'] == 'Y') { $display_value = format_listing_link($value, $display_value, $item_attribute_type_r, NULL); } } $display_value_r[] = $display_value; } } $field = format_multivalue_block($display_value_r, 'starrating'); if ($dowrap) { return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask); } else { return $field; } } else { return ''; // nothing to do! } } else { if (!is_array($value) && $item_attribute_type_r['display_type'] == 'display' && ifempty($item_attribute_type_r['display_type_arg1'], '%value%') == '%value%') { // Support newline formatting by default. $value = nl2br(trim($value)); if ($item_attribute_type_r['listing_link_ind'] == 'Y') { $field = format_listing_links($value, $item_attribute_type_r, 'exact'); } else { $field = $value; } if ($dowrap) { return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask); } else { return $field; } } else { if ($item_attribute_type_r['display_type'] == 'list') { //list(list_type [,delimiter]) if (is_array($value)) { $values = $value; $attr_match = 'exact'; } else { $value = trim($value); if (strlen($item_attribute_type_r['display_type_arg2']) == 0) { // Use newline! $values = explode_lines($value); $attr_match = 'partial'; } else { $values = explode($item_attribute_type_r['display_type_arg2'], $value); if (strlen(trim($item_attribute_type_r['display_type_arg2'])) === 0) { $attr_match = 'word'; } else { $attr_match = 'partial'; } } } $field = format_list_from_array($values, $item_attribute_type_r, $item_attribute_type_r['listing_link_ind'] == 'Y' ? $attr_match : FALSE); if ($dowrap) { return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask); } else { return $field; } } else { if ($item_attribute_type_r['display_type'] == 'category' || $item_attribute_type_r['display_type'] == 'display') { $field = ''; if (is_array($value)) { $value_array = $value; } else { $value_array[] = $value; } $attribute_value_rs = array(); if ($item_attribute_type_r['lookup_attribute_ind'] == 'Y') { $results = fetch_value_match_attribute_type_lookup_rs($item_attribute_type_r['s_attribute_type'], $value_array, get_lookup_order_by($item_attribute_type_r['display_type_arg1']), 'asc'); if ($results) { while ($lookup_r = db_fetch_assoc($results)) { $lookup_key = array_search2($lookup_r['value'], $value_array, TRUE); if ($lookup_key !== FALSE) { // Remove the matched element array_splice($value_array, $lookup_key, 1); $attribute_value_rs[] = array(value => $lookup_r['value'], display => $lookup_r['display'], img => $lookup_r['img']); } } db_free_result($results); } } // where extra items that do not have a matching lookup value. if (is_not_empty_array($value_array)) { reset($value_array); while (list(, $value) = each($value_array)) { if (strlen(trim($value)) > 0) { // In case there are extra spaces $attribute_value_rs[] = array(value => $value, display => $value); } } } if (is_not_empty_array($attribute_value_rs)) { $field = format_lookup_display_block($item_attribute_type_r, $attribute_value_rs); if (strlen($field) > 0) { if ($dowrap) { return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask); } else { return $field; } } else { return NULL; } } } else { if ($item_attribute_type_r['display_type'] == 'review') { $total_count = fetch_attribute_type_cnt('S_RATING'); if (is_numeric($total_count)) { $value = trim($value); if (!is_numeric($value)) { $value = 0; } $field = ''; $j = $value; for ($i = 0; $i < $total_count; ++$i) { if ($j >= 0.75) { $field .= theme_image('rs.gif'); } else { if ($j >= 0.25) { $field .= theme_image('rgs.gif'); } else { $field .= theme_image('gs.gif'); } } $j = $j - 1; } // If a mask is defined, format the display value. if (strlen($item_attribute_type_r['display_type_arg1']) > 0) { $lookup_r = fetch_attribute_type_lookup_r('S_RATING', $value); if (is_not_empty_array($lookup_r)) { $field .= format_display_value($item_attribute_type_r['display_type_arg1'], $lookup_r['img'], $lookup_r['value'], $lookup_r['display']); } } return $field; // this is only used in a few places. } } } } } } } } } } //else -- no display type match. if ($dowrap) { return format_field($item_attribute_type_r['prompt'], nl2br($value), $prompt_mask); } else { return nl2br($value); } }
<div class="nav-icon-and-logo"> <div> <a class="left-off-canvas-toggle" href="#"><img src="<?php theme_image_src('icons/menu-icon.svg'); ?> "></a> </div> <div class="logo-container"> <a title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " rel="home" href="<?php echo esc_url(home_url('/')); ?> "><img src="<?php theme_image_src('tOS_logo.svg'); ?> "></a> </div> </div> <!-- OFF CANVAS MENU --> <?php include 'templates/off-canvas.php'; ?> <?php if (is_front_page()) { ?> <!-- DATE --> <div class="date-home">
function _getImageSrc($name) { if (strpos($name, '.') === FALSE) { $filename = $name . '.' . $this->getImageExtension(); $src = theme_image_src($filename); if ($src !== FALSE) { return $src; } else { $this->addError('Name source not found: ' . $filename); return FALSE; } } else { $this->addError('Name must not include extension: ' . $name); return FALSE; } }
function get_last_num_items_rs($num_of_items, $owner_id = NULL, $s_item_type = NULL, $update_on = NULL, $not_owner_id = NULL, $site_url_prefix = NULL, $title_mask_id = NULL) { if (strlen($owner_id) > 0) { $search_vars_r['owner_id'] = $owner_id; } if (strlen($s_item_type) > 0) { $search_vars_r['s_item_type'] = $s_item_type; } if (strlen($update_on) > 0) { $search_vars_r['update_on'] = $update_on; } if (strlen($not_owner_id) > 0) { $search_vars_r['not_owner_id'] = $not_owner_id; } $dummy_r = NULL; $results = fetch_item_listing_rs($search_vars_r, $dummy_r, 'update_on', 'DESC', 0, $num_of_items); if ($results) { if ($title_mask_id == 'feeds') { $title_mask_group = array('feeds', 'item_display'); } else { $title_mask_group = array('last_items_list', 'item_listing'); } $titleMaskCfg = new TitleMask($title_mask_group); $image_attribute_type_rs = NULL; while ($item_r = db_fetch_assoc($results)) { $item_r['title'] = $titleMaskCfg->expand_item_title($item_r); $item_r['update_on'] = get_localised_timestamp(get_opendb_config_var('welcome.last_items_list', 'datetime_mask'), $item_r['update_on']); $item_r['item_display_url'] = 'item_display.php?item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no']; if ($site_url_prefix != NULL) { $item_r['item_display_url'] = $site_url_prefix . $item_r['item_display_url']; } $item_type_r = fetch_item_type_r($item_r['s_item_type']); $itemtypeimagesrc = theme_image_src($item_type_r['image']); $size = @getimagesize($itemtypeimagesrc); if (is_array($size)) { $item_r['itemtypeimage']['width'] = $size[0]; $item_r['itemtypeimage']['height'] = $size[1]; } $item_r['itemtypeimage']['url'] = $itemtypeimagesrc; if ($site_url_prefix != NULL) { $item_r['itemtypeimage']['url'] = $site_url_prefix . $item_r['itemtypeimage']['url']; } $item_r['itemtypeimage']['title'] = $item_type_r['description']; $item_r['itemtypeimage']['s_item_type'] = $item_r['s_item_type']; if (get_opendb_config_var('welcome.last_items_list', 'show_item_image') !== FALSE) { if (!is_array($image_attribute_type_rs) || !is_array($image_attribute_type_rs[$item_r['s_item_type']])) { $image_attribute_type_rs[$item_r['s_item_type']] = fetch_sfieldtype_item_attribute_type_r($item_r['s_item_type'], 'IMAGE'); } // of a IMAGE s_attribute defined for this s_item_type if (is_array($image_attribute_type_rs[$item_r['s_item_type']])) { $attribute_type_r = $image_attribute_type_rs[$item_r['s_item_type']]; $imageurl = fetch_attribute_val($item_r['item_id'], NULL, $attribute_type_r['s_attribute_type']); $file_r = file_cache_get_image_r($imageurl, 'display'); $item_r['imageurl']['url'] = $file_r['thumbnail']['url']; if ($site_url_prefix != NULL) { $item_r['imageurl']['url'] = $site_url_prefix . $item_r['imageurl']['url']; } $item_r['imageurl']['width'] = $file_r['thumbnail']['width']; $item_r['imageurl']['height'] = $file_r['thumbnail']['height']; $item_r['imageurl']['title'] = $item_r['title']; } } $item_rs[] = $item_r; unset($item_r); } //while db_free_result($results); } return $item_rs; }
<div class="close-button"> <a data-modal-close href="#"><img src="<?php theme_image_src('x.svg'); ?> "></a> </div> <div class="overlay header"> <div class="row"> <div class="medium-8 medium-centered columns"> <h1 class="tab-section-title"><?php echo ucfirst($modal); ?> </h1> </div> </div> </div> <div class="row"> <div class="columns medium-8 medium-centered"> <!-- <div class="tabs"> <a class="toggle-author <?php if ($modal == 'authors') { print 'active'; } ?> " href="#authors">Authors</a> <a class="toggle-author <?php if ($modal == 'contributors') { print 'active'; }
function ajax_remove_all_interest_level() { $user_id = get_opendb_session_var('user_id'); $objResponse = new xajaxResponse(); if (db_remove_all_interest_level($user_id)) { // We update all the images $objResponse->call(doRemoveInterestAllInterestLevel, theme_image_src('interest_0.gif'), get_opendb_lang_var('interest_mark')); } return $objResponse; }
function writeRowImpl($row_column_rs) { if ($this->_toggle) { $this->rowclass = "oddRow"; } else { $this->rowclass = "evenRow"; } $this->_write("\n<tr class=\"" . $this->rowclass . "\">"); for ($i = 0; $i < count($row_column_rs); $i++) { $header_column_r = $this->_header_column_rs[$i]; $columnClass = NULL; if (strlen($header_column_r['fieldname']) > 0) { $columnClass = $header_column_r['fieldname']; } switch ($row_column_rs[$i]['column_type']) { case 'action_links': $this->_write('<td class="action_links ' . $columnClass . '">'); $this->_write(ifempty(format_action_links($row_column_rs[$i]['action_links']), get_opendb_lang_var('not_applicable'))); $this->_write('</td>'); break; case 'username': $this->_write('<td class="username ' . $columnClass . '">'); $user_id = $row_column_rs[$i]['user_id']; $fullname = $row_column_rs[$i]['fullname']; if ($user_id == get_opendb_session_var('user_id')) { $this->_write(get_opendb_lang_var('current_user', array('fullname' => $fullname, 'user_id' => $user_id))); } else { $user_name = get_opendb_lang_var('user_name', array('fullname' => $fullname, 'user_id' => $user_id)); if ($this->_include_href_links && is_user_granted_permission(PERM_VIEW_USER_PROFILE)) { $item_title = ''; // lets find the title column. for ($j = 0; $j < count($row_column_rs); $j++) { if ($row_column_rs[$j]['column_type'] == 'title') { $item_title = trim(strip_tags($row_column_rs[$j]['item_title'])); break; } } $url = "user_profile.php?uid=" . $user_id; if (is_array($row_column_rs[$i]['extra_http_vars'])) { $url .= "&" . get_url_string($row_column_rs[$i]['extra_http_vars']); } $url .= "&subject=" . urlencode(ifempty($item_title, get_opendb_lang_var('no_subject'))); $this->_write("<a href=\"{$url}\" title=\"" . htmlspecialchars(get_opendb_lang_var('user_profile')) . "\">{$user_name}</a>"); } else { $this->_write($user_name); } } $this->_write('</td>'); break; case 'interest': // opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, "_xajax=" . $_xajax===NULL?"nulles":"nonnul"); $item_id = $row_column_rs[$i]['item_id']; $instance_no = $row_column_rs[$i]['instance_no']; $level = $row_column_rs[$i]['level']; if ($level > 0) { $this->addHelpEntry(get_opendb_lang_var('interest_help'), 'interest_1.gif', 'interest'); $new_level_value = 0; $level_display .= "<img" . " id=\"interest_level_{$item_id}" . "_{$instance_no}\"" . " src=\"" . theme_image_src('interest_1.gif') . "\"" . " alt=\"" . get_opendb_lang_var('interest_remove') . "\"" . " title=\"" . get_opendb_lang_var('interest_remove') . "\"" . " onclick=\"xajax_ajax_update_interest_level('{$item_id}', '{$instance_no}', document.getElementById('new_level_value_{$item_id}\\_{$instance_no}').value);\"" . " style=\"cursor:pointer;\"" . " >"; } else { $new_level_value = 1; $level_display .= "<img" . " id=\"interest_level_{$item_id}" . "_{$instance_no}\"" . " src=\"" . theme_image_src('interest_0.gif') . "\"" . " alt=\"" . get_opendb_lang_var('interest_mark') . "\"" . " title=\"" . get_opendb_lang_var('interest_mark') . "\"" . " onclick=\"xajax_ajax_update_interest_level('{$item_id}','{$instance_no}', document.getElementById('new_level_value_{$item_id}\\_{$instance_no}').value);\"" . " style=\"cursor:pointer;\"" . " >"; } $this->_write('<td class="interest ' . $columnClass . '">'); $this->_write("<input id=\"new_level_value_{$item_id}" . "_{$instance_no}\" type=\"hidden\" value=\"{$new_level_value}\" />"); $this->_write($level_display); $this->_write('</td>'); break; case 'item_type_image': $this->_write('<td class="item_type_image ' . $columnClass . '">'); $s_item_type = $row_column_rs[$i]['s_item_type']; if (!is_array($this->_item_type_rs[$s_item_type]) || strlen($this->_item_type_rs[$s_item_type]['image']) == 0) { $this->_item_type_rs[$s_item_type] = fetch_item_type_r($s_item_type); // expand to the actual location once only. if (strlen($this->_item_type_rs[$s_item_type]['image']) > 0) { $this->_item_type_rs[$s_item_type]['image'] = theme_image_src($this->_item_type_rs[$s_item_type]['image']); } else { $this->_item_type_rs[$s_item_type]['image'] = 'none'; } if (strlen($this->_item_type_rs[$s_item_type]['description']) > 0) { $this->_item_type_rs[$s_item_type]['description'] = htmlspecialchars($this->_item_type_rs[$s_item_type]['description']); } else { $this->_item_type_rs[$s_item_type]['description'] = NULL; } } if (strlen($this->_item_type_rs[$s_item_type]['image']) > 0 && $this->_item_type_rs[$s_item_type]['image'] != 'none') { $this->_write(theme_image($this->_item_type_rs[$s_item_type]['image'], $this->_item_type_rs[$s_item_type]['description'], 's_item_type')); } else { // otherwise write the item type itself in place of the image. $this->_write($s_item_type); } $this->_write('</td>'); break; case 'theme_image': $this->_write('<td class="' . $columnClass . '">'); $this->_write(theme_image($row_column_rs[$i]['src'], htmlspecialchars($row_column_rs[$i]['title']), $row_column_rs[$i]['type'])); $this->_write('</td>'); break; case 'title': $title_href_link = $row_column_rs[$i]['title_href_link']; $is_item_reviewed = $row_column_rs[$i]['is_item_reviewed']; $is_borrowed_or_returned = $row_column_rs[$i]['is_borrowed_or_returned']; $item_title = ''; if ($this->_include_href_links && is_user_granted_permission(PERM_VIEW_ITEM_DISPLAY)) { $item_title = '<a href="' . $title_href_link . '">' . $row_column_rs[$i]['item_title'] . '</a>'; } else { $item_title = $row_column_rs[$i]['item_title']; } if ($is_item_reviewed) { // show star if rated - Add it to the actual title, so we can do a bit more with title masks $this->addHelpEntry(get_opendb_lang_var('item_reviewed'), 'rs.gif', 'item_reviewed'); $item_title .= theme_image('rs.gif', get_opendb_lang_var('item_reviewed'), 'item_reviewed'); } if ($is_borrowed_or_returned) { $this->addHelpEntry(get_opendb_lang_var('youve_borrow_or_return'), 'tick.gif', 'borrow_or_return'); $item_title .= theme_image("tick.gif", get_opendb_lang_var('youve_borrow_or_return'), 'borrow_or_return'); // show tick if previously borrowed or returned. } $this->_write('<td class="title ' . $columnClass . '">'); $this->_write($item_title); $this->_write('</td>'); break; case 'coverimage': $item_cover_image = $row_column_rs[$i]['item_cover_image']; $title_href_link = $row_column_rs[$i]['title_href_link']; $this->_write('<td class="coverimage ' . $columnId . 'Column">'); $file_r = file_cache_get_image_r($item_cover_image, 'listing'); if (is_array($file_r)) { $cover_image_tag = '<img src="' . $file_r['thumbnail']['url'] . '"'; if (is_numeric($file_r['thumbnail']['width'])) { $cover_image_tag .= ' width="' . $file_r['thumbnail']['width'] . '"'; } if (is_numeric($file_r['thumbnail']['height'])) { $cover_image_tag .= ' height="' . $file_r['thumbnail']['height'] . '"'; } $cover_image_tag .= '>'; if ($this->_mode != 'printable' && $this->_include_href_links) { $cover_image_tag = '<a href="' . $title_href_link . '">' . $cover_image_tag . '</a>'; } $this->_write($cover_image_tag); } $this->_write('</td>'); break; case 'display': $this->_write('<td class="' . $columnClass . '">'); $this->_write(get_display_field($row_column_rs[$i]['attribute_type'], $row_column_rs[$i]['prompt'], $row_column_rs[$i]['display_type'], $row_column_rs[$i]['value'], FALSE)); $this->_write('</td>'); break; case 'attribute_display': $this->_write('<td class="' . $columnClass . '">'); $this->_write(get_item_display_field($row_column_rs[$i]['item_r'], $row_column_rs[$i]['attribute_type_r'], $row_column_rs[$i]['value'], FALSE)); $this->_write('</td>'); break; case 'checkbox': $this->_write('<td class="checkbox">'); $value = $row_column_rs[$i]['value']; $this->_write('<input type="checkbox" class="checkbox" name="' . $this->_header_column_rs[$i]['fieldname'] . '[]" value="' . $value . '">'); $this->_write('</td>'); break; default: $this->_write('<td class="' . $columnClass . '">'); $this->_write($row_column_rs[$i]['value']); $this->_write('</td>'); break; } } $this->_write("\n</tr>"); }
function get_s_attribute_type_lookup_row($lookup_r, $row) { $block = "<tr>"; $block .= "<td class=\"data\">"; if (is_not_empty_array($lookup_r)) { $block .= get_input_field("delete_ind[{$row}]", NULL, NULL, "simple_checkbox()", "N", "Y", FALSE); } else { $block .= " "; } $block .= "</td>"; $block .= "<td class=\"data\">" . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "N", $lookup_r['order_no'], FALSE) . "</td>"; if (is_not_empty_array($lookup_r)) { $block .= "<td class=\"data\">" . get_input_field("value[{$row}]", NULL, "Value", "readonly", "Y", $lookup_r['value'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">" . "</td>"; } else { $block .= "<td class=\"data\">" . get_input_field("value[{$row}]", NULL, "Value", "text(10,50)", "Y", NULL, FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"N\">" . "</td>"; } $block .= "<td class=\"data\">" . get_input_field("display[{$row}]", NULL, NULL, "text(20,255)", "N", $lookup_r['display'], FALSE) . "</td>"; if ($lookup_r['img'] != 'none') { $src = theme_image_src($lookup_r['img']); } $block .= "<td class=\"data\">"; if ($src !== FALSE && strlen($src) > 0) { $block .= "<img src=\"{$src}\">"; } else { $block .= " "; } $block .= "</td>"; $block .= "<td class=\"data\">" . get_input_field("img[{$row}]", NULL, "Image", "url(15,*,\"gif,jpg,png\",N)", "N", $lookup_r['img'] != "none" ? $lookup_r['img'] : NULL, FALSE, NULL, "if(this.value.length>0){this.form['none_img[{$row}]'].checked=false;}") . "</td>"; $block .= "<td class=\"data\">" . get_input_field("none_img[{$row}]", NULL, NULL, "simple_checkbox(" . ($lookup_r['img'] == "none" ? "CHECKED" : "") . ")", "N", "Y", FALSE, NULL, "if(this.checked){this.form['img[{$row}]'].value='';}") . "</td>"; $block .= "<td class=\"data\"><input type=\"checkbox\" class=\"checkbox\" name=\"checked_ind[{$row}]\" value=\"Y\" onclick=\"toggleChecked(this, 'checked_ind')\" " . (strtoupper($lookup_r['checked_ind']) == 'Y' ? 'CHECKED' : '') . ">"; $block .= "</tr>"; return $block; }
function printJobProgressBar($arg1 = NULL) { $gsimage = theme_image_src('gs.gif'); $divContents = ' <div id="status" style="{width:300; margin: 4px}"> <div id="debug"></div> <div id="message" class="success"> <img id="progressSpinner" class="hidden" src="./images/spinner.gif"> <span id="messageText"></span> </div> <ul id="progressBar">'; for ($i = 1; $i <= 10; $i++) { $divContents .= "\n<li><img id=\"status{$i}\" src=\"{$gsimage}\"></li>"; } $divContents .= '</ul> <div id="percentage">0%</div> <form id="progressForm"> <input type="hidden" name="continue" value="true" /> <input type="button" class="button" id="startButton" value="Start" onclick="document.getElementById(\'progressSpinner\').className=\'\'; this.form[\'continue\'].value=\'true\'; xajax_' . $this->_id . '.dojob(\'' . $this->_job . '\', \'' . $arg1 . '\', \'true\', \'0\', \'0\'); this.disabled=true; return false;" /> <input type="button" class="button" id="cancelButton" value="Cancel" onclick="this.form[\'continue\'].value=\'false\'; this.disabled=true; " /> </form> </div>'; echo $divContents; }