/** This function will return a complete table of all links valid for this item_type. This is useful because it allows the use of a site plugin for generating links only, by specifying as the default site type. */ function get_site_plugin_links($page_title, $item_r) { $pageContents = ''; $results = fetch_site_plugin_rs($item_r['s_item_type']); if ($results) { $titleMaskCfg = new TitleMask(); $pageContents = "<ul class=\"sitepluginLinks\">"; while ($site_plugin_type_r = db_fetch_assoc($results)) { if (is_exists_site_plugin($site_plugin_type_r['site_type'])) { $site_plugin_conf_rs = get_site_plugin_conf_r($site_plugin_type_r['site_type']); if (strlen($site_plugin_type_r['image']) > 0) { $link_text = theme_image("images/site/" . $site_plugin_type_r['image'], htmlspecialchars($site_plugin_type_r['title'])); } else { $link_text = $site_plugin_type_r['title']; } $results2 = fetch_site_plugin_link_rs($site_plugin_type_r['site_type'], $item_r['s_item_type']); if ($results2) { while ($site_plugin_link_r = db_fetch_assoc($results2)) { $parse_url = NULL; if (strlen($site_plugin_link_r['url']) > 0 && is_exists_site_item_attribute($site_plugin_type_r['site_type'], $item_r['item_id'], $item_r['instance_no'])) { $parse_url = $site_plugin_link_r['url']; } else { if (strlen($site_plugin_link_r['title_url']) > 0) { $parse_url = $site_plugin_link_r['title_url']; } } if ($parse_url != NULL) { $titleMaskCfg->reset(); $parse_url = trim($titleMaskCfg->expand_title($item_r, $parse_url, $site_plugin_conf_rs)); if (strlen($parse_url) > 0) { $pageContents .= "<li><a href=\"" . $parse_url . "\" target=\"_new\">{$link_text}"; $pageContents .= "<span class=\"sitePluginDescription\">" . $site_plugin_link_r['description'] . "</span>"; $pageContents .= "</a></li>"; } } } //while db_free_result($results2); } } } //while db_free_result($results); $pageContents .= "</ul>"; return $pageContents; } }
} } } } } } } } } } if ($HTTP_VARS['op'] == 'list_site_plugins') { echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=new_site_plugin\">New Site Plugin</a>]</p>"; if (is_not_empty_array($errors)) { echo format_error_block($errors); } $results = fetch_site_plugin_rs(); if ($results) { echo "\n<form name=\"s_site_plugin\" action=\"{$PHP_SELF}\" method=\"GET\">"; echo "\n<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">"; echo "\n<input type=\"hidden\" name=\"op\" value=\"new_site_plugin\">"; echo "\n<input type=\"hidden\" name=\"site_type\" value=\"\">"; echo "<table>"; echo "<tr class=\"navbar\">" . "<th>Order</th>" . "<th>Site</th>" . "<th>Title</th>" . "<th colspan=3></th>" . "</tr>"; $row = 0; while ($site_plugin_r = db_fetch_assoc($results)) { $href = "<a href=\"admin.php?type={$ADMIN_TYPE}&op=edit&site_type=" . $site_plugin_r['site_type'] . "\">"; echo "<tr>"; echo "\n<td class=\"data\">" . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "N", $site_plugin_r['order_no'], FALSE) . "</td>"; echo "<td class=\"data\">" . $site_plugin_r['site_type'] . "<input type=\"hidden\" name=\"site_type[{$row}]\" value=\"" . $site_plugin_r['site_type'] . "\"></td>"; echo "<td class=\"data\">" . $site_plugin_r['title'] . "</td>"; echo "<td class=\"data\">";
function get_site_plugin_rs($HTTP_VARS, $item_r = NULL) { $site_plugin_rs = NULL; // if $HTTP_VARS['s_item_type'] is null, all site plugins will be returned. $results = fetch_site_plugin_rs($HTTP_VARS['s_item_type']); if ($results) { $ischecked = FALSE; while ($site_plugin_r = db_fetch_assoc($results)) { if (is_exists_site_plugin($site_plugin_r['site_type'])) { $input_field_rs = get_site_type_input_fields($HTTP_VARS, $site_plugin_r, $item_r); if (is_array($input_field_rs)) { $site_plugin_r['input_fields'] = $input_field_rs; if (strlen($HTTP_VARS['s_item_type']) == 0) { $site_plugin_r['s_item_type'] = fetch_site_item_type_r($site_plugin_r['site_type']); } else { $site_plugin_r['s_item_type'][] = $HTTP_VARS['s_item_type']; } if (is_array($site_plugin_r['s_item_type'])) { if (!$ischecked) { $site_plugin_r['checked_ind'] = 'Y'; $ischecked = TRUE; } $site_plugin_rs[] = $site_plugin_r; } } } } db_free_result($results); } return $site_plugin_rs; }