© 2010 Sourcefabric O.P.S., maintained and distributed under the GNU GPL
'; return $str; } // fn camp_html_article_link /** * Create a link to an article. * * @param Article $p_articleObj * The article we want to display. * * @param int $p_interfaceLanguageId * The language ID for the interface language. * * @param string $p_targetFileName * Which file in the "articles" directory to call. * * @param string $p_backLink * A URL to get back to the previous page the user was on. * * @param string $p_extraParams */ function camp_html_article_url($p_articleObj, $p_interfaceLanguageId, $p_targetFileName = "", $p_backLink = "", $p_extraParams = null) { global $ADMIN; $str = "/$ADMIN/articles/".$p_targetFileName ."?Pub=".$p_articleObj->getPublicationId() ."&Issue=".$p_articleObj->getIssueId() ."&Section=".$p_articleObj->getSectionId() ."&Article=".$p_articleObj->getArticleId() ."&Language=".$p_interfaceLanguageId ."&sLanguage=".$p_articleObj->getLanguageId(); if ($p_backLink != "") { $str .="&Back=".urlencode($p_backLink); } if (!is_null($p_extraParams)) { $str .= $p_extraParams; } return $str; } // fn camp_html_article_url /** * Redirect to the error page and show the given error message. * You can also give a back link for the user to go back to when they * click OK on that screen. * * @param mixed $p_errorStr * This can be a string or an array. An array is for the case when the * error string requires arguments. * * @param string $p_backLink * * @return void */ function camp_html_display_error($p_errorStr, $p_backLink = null, $popup = false) { global $ADMIN; $script = $popup ? 'ad_popup.php' : 'ad.php'; $location = "/$ADMIN/$script?ADReason=".urlencode($p_errorStr); if (!is_null($p_backLink)) { $location .= '&Back='.urlencode($p_backLink); } header("Location: $location"); exit; } // fn camp_html_display_error /** * Common header for all content screens. * * @param string $p_title * The title of the page. This should have a translation in the language files. * * @param array $p_objArray * This represents your current location in the content tree. This * can have the following index values, each containing the appropriate object: * 'Pub', 'Issue', 'Section', 'Article' * * @param boolean $p_includeLinks * Whether to include the links underneath the title or not. Default TRUE. * * @param boolean $p_fValidate * Whether to include the fValidate javascript files in the HTML header. Default FALSE. * * @param array $p_extraBreadcrumbs * An array in the form 'text' => 'link' for more breadcrumbs. * * @return void */ function camp_html_content_top($p_title, $p_objArray, $p_includeLinks = true, $p_fValidate = false, $p_extraBreadcrumbs = null) { global $Campsite; global $ADMIN; $publicationObj = camp_array_get_value($p_objArray, 'Pub', null); $issueObj = camp_array_get_value($p_objArray, 'Issue', null); $sectionObj = camp_array_get_value($p_objArray, 'Section', null); $articleObj = camp_array_get_value($p_objArray, 'Article', null); $breadcrumbs = array(); if (!is_null($publicationObj)) { $prompt = getGS("Publication").":"; //$strCrumbs .= camp_html_breadcrumb($prompt, "/$ADMIN/pub/", ) $name = htmlspecialchars($publicationObj->getName()); $breadcrumbs[] = array($prompt, "/$ADMIN/pub/", false); $breadcrumbs[] = array($name, "/$ADMIN/pub/edit.php?Pub=".$publicationObj->getPublicationId()); } if (!is_null($issueObj)) { $prompt = getGS("Issue").":"; $breadcrumbs[] = array($prompt, "/$ADMIN/issues/" ."?Pub=".$issueObj->getPublicationId() ."&Issue=".$issueObj->getIssueId() ."&Language=".$issueObj->getLanguageId(), false); $name = htmlspecialchars($issueObj->getName())." (".htmlspecialchars($issueObj->getLanguageName()).")"; $breadcrumbs[] = array($name, "/$ADMIN/issues/edit.php" ."?Pub=".$issueObj->getPublicationId() ."&Issue=".$issueObj->getIssueId() ."&Language=".$issueObj->getLanguageId()); } if (!is_null($sectionObj)) { $prompt = getGS("Section").":"; $breadcrumbs[] = array($prompt, "/$ADMIN/sections/" ."?Pub=".$sectionObj->getPublicationId() ."&Issue=".$sectionObj->getIssueId() ."&Language=".$sectionObj->getLanguageId() ."&Section=".$sectionObj->getSectionId(), false); $name = htmlspecialchars($sectionObj->getName()); $breadcrumbs[] = array($name, "/$ADMIN/sections/edit.php" ."?Pub=".$sectionObj->getPublicationId() ."&Issue=".$sectionObj->getIssueId() ."&Language=".$sectionObj->getLanguageId() ."&Section=".$sectionObj->getSectionId()); } if (!is_null($articleObj)) { $prompt = getGS("Article").":"; $breadcrumbs[] = array($prompt, "/$ADMIN/articles/index.php" ."?Pub=" . $articleObj->getPublicationId() ."&Issue=".$articleObj->getIssueId() ."&Language=".$articleObj->getLanguageId() ."&Section=".$articleObj->getSectionId() ."&Article=".$articleObj->getArticleId() ."&sLanguage=".$sectionObj->getLanguageId(), false); $name = htmlspecialchars($articleObj->getName())." (".htmlspecialchars($articleObj->getLanguageName()).")"; $breadcrumbs[] = array($name, "/$ADMIN/articles/edit.php" ."?Pub=" . $articleObj->getPublicationId() ."&Issue=".$articleObj->getIssueId() ."&Language=".$articleObj->getLanguageId() ."&Section=".$articleObj->getSectionId() ."&Article=".$articleObj->getArticleId() ."&sLanguage=".$sectionObj->getLanguageId()); } if (is_array($p_extraBreadcrumbs)) { //print_r($p_extraBreadcrumbs); foreach ($p_extraBreadcrumbs as $text => $link) { $breadcrumbs[] = array($text, $link); } } $breadcrumbs[] = array($p_title, ""); //echo "
";
	//print_r($breadcrumbs);
	//echo "
"; ?> <?php p($p_title); ?> 'link' for breadcrumbs. * Farthest-away link comes first, increasing in specificity. * * @return string */ function camp_html_breadcrumbs($p_crumbs) { $lastCrumb = array_pop($p_crumbs); $str = ''; $str .= '
'; //$str .= ''; $str .= "".getGS("You are here:").""; $tmpCrumbs = array(); foreach ($p_crumbs as $crumb) { if (count($crumb) == 2) { $str .= camp_html_breadcrumb($crumb[0], $crumb[1]); } else { $str .= camp_html_breadcrumb($crumb[0], $crumb[1], $crumb[2]); } } // $numCrumbs = count($p_crumbs); // for ($i = 0; i < ($numCrumbs - 1); $i++) { // $str .= camp_html_breadcrumb($text, $link) . ""; // } //print_r($lastCrumb); $str .= camp_html_breadcrumb($lastCrumb[0], $lastCrumb[1], false, true); //$str .= ''; //$str .= '
'; $str .= '
'; return $str; } // fn camp_html_breadcrumbs /** * Create one breadcrumb. * * @param string $p_text * @param mixed $p_link * @param boolean $p_active * @param boolean $p_separator * @return string */ function camp_html_breadcrumb($p_text, $p_link, $p_separator = true, $p_active = false) { $tmpStr = ''; if ($p_active) { $class = "breadcrumb_active"; } else { $class = "breadcrumb"; } if ($p_separator) { $tmpStr .= ""; } else { $tmpStr .= ""; } if ($p_link != "") { $tmpStr .= "$p_text"; } else { $tmpStr .= "$p_text"; } $tmpStr .=""; if ($p_separator) { $tmpStr .= " "; } else { $tmpStr .= " "; } return $tmpStr; } // fn camp_html_breadcrumb ?>