/** 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; } }
function is_item_legal_site_type($s_item_type) { $query = "select\tsat.site_type " . "from \ts_attribute_type sat," . "\t\ts_item_attribute_type siat " . "where \tsat.s_attribute_type = siat.s_attribute_type AND " . "length(sat.site_type)>0 AND " . "siat.s_item_type = '" . $s_item_type . "'"; $result = db_query($query); if ($result && db_num_rows($result) > 0) { while ($site_type_r = db_fetch_assoc($result)) { if (is_exists_site_plugin($site_type_r['site_type'])) { db_free_result($result); return TRUE; } } db_free_result($result); } //else return FALSE; }
function is_not_exists_site_plugin($type) { return !is_exists_site_plugin($type, FALSE); }
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; }