本文整理汇总了PHP中Sections::FindPublicSections方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::FindPublicSections方法的具体用法?PHP Sections::FindPublicSections怎么用?PHP Sections::FindPublicSections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::FindPublicSections方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize_page
function initialize_page()
{
$item = Items::FindById(getRequestVaratIndex(3));
// get all the sections
$sections = Sections::FindPublicSections();
/* get this section
* We do this mostly for the previous and next item functions. If we dont know what section we are currently inside,
* the user may get bounced over to a different place than they started. */
$sectionname = getRequestVaratIndex(2);
if ($sectionname != "item_orphan") {
$section = Sections::FindByName($sectionname);
}
// get the associated gallery
if ($item) {
$gallery = $item->getGallery();
}
// finally, get the post action. Harder to hack if we explicitly check the value this way.
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Save Item" || $post_action == "Add Image" || $post_action == "Add Document" || $post_action == "Add or Edit Video" || $post_action == "Save and Return to List") {
/*
* Delete this item and its associated components
*/
if (isset($_POST['delete'])) {
// delete $photos and $gallery
if (is_object($gallery)) {
$gallery->delete(true);
$success .= "Gallery and Images Deleted / ";
}
/* Documents ... Why not keep them?
if ( ITEM_DOCUMENTS ) {
$itemdocuments = $item->findDocuments( 'display_order ASC' );
foreach ( $itemdocuments as $thedoc ) {
$thedoc->delete(true);
}
$success .= "Documents Deleted / ";
}*/
$item->delete(true);
$success .= "Item Deleted / ";
setFlash("<h3>" . substr($success, 0, -3) . "</h3>");
//$main_portlink = ( DISPLAY_ITEMS_AS_LIST ) ? "admin/portfolio_list/alphabetical" : "admin/portfolio_list";
//redirect( $main_portlink );
redirect("admin/portfolio_list");
} else {
$item->content = $_POST['item_content'];
$item->display_name = $_POST['display_name'];
$previous_name = $item->name;
$item->name = slug($_POST['display_name']);
$item->template = 'inherit';
$item->public = checkboxValue($_POST, 'public');
$item->date_revised = date('Y-m-d H:i:s');
// optional fields
$item->sku = ITEM_SKU ? $_POST['item_sku'] : null;
$item->taxonomy = ITEM_TAXONOMY ? $_POST['taxonomy'] : null;
$item->price = ITEM_PRICE ? $_POST['item_price'] : null;
// SAVE item... uses a MyActiveRecord method
$item->save();
$success = "Item Saved / ";
// synchronize the users section selections only if they are different
$selected_sections = array();
$previous_sections = $item->getSections();
if (isset($_POST['selected_sections'])) {
$update_sections = false;
$selected_sections = $_POST['selected_sections'];
// Problem: If we loop on only the $previous_sections, we may have fewer or more loops than $selected_sections.
// Compare one to the other.
if (count($previous_sections) != count($selected_sections)) {
// The two do not match, so there has been a change
$update_sections = true;
} else {
// In case the two match, let's make sure something is different.
foreach ($previous_sections as $sect) {
if (!in_array($sect->id, $selected_sections)) {
$update_sections = true;
}
}
}
if ($update_sections) {
$item->updateSelectedSections($selected_sections);
// update the revision dates of sections, too
$item->updateSectionRevisionDates();
}
}
/*
* Rename the gallery if the slug has changed.
* We need the name of the gallery and the name of the slug to be consistent.
* If there isn't a gallery – something broke, so – create a new one.
*/
if (is_object($gallery) && $previous_name != $item->name) {
$gallery->slug = "portfolioGal_" . $item->id . "_" . $item->name;
$gallery->save();
$success .= "Gallery name changed / ";
}
if (!is_object($gallery)) {
$gallery = MyActiveRecord::Create('Galleries');
$gallery->name = $_POST['display_name'] . " Gallery";
$gallery->slug = "portfolioGal_" . $item->id . "_" . slug($_POST['display_name']);
$gallery->save();
//.........这里部分代码省略.........
示例2: display_page_content
function display_page_content()
{
// get all the sections
$sections = Sections::FindPublicSections();
?>
<script type="text/javascript">
$().ready(function() {
$("#add_area").validate({
rules : {
display_name: "required"
},
messages: {
display_name: "Please enter a name you would like to be displayed for this area"
}
});
});
</script>
<div id="edit-header" class="portareanav">
<h1>Add Portfolio Area</h1>
</div>
<form method="POST" id="add_area">
<p><span class="hint">If a text box is underlined in red, it is a required field</span></p>
<p class="display_name">
<label for="display_name">Display Name:</label>
<?php
textField("display_name", "", "required: true");
?>
<span class="hint">This is the Proper Name of the area; how it will display in the navigation. Keep it simple, but use capitals and spaces, please. </span>
</p>
<p>
<label for="seo_title">Title:</label>
<?php
textField("seo_title");
?>
<br />
<span class="hint">This title is used in title meta tags (good for SEO). Might also show when a user hovers their mouse over a link. </span>
</p>
<p><label for="area_content">Portfolio Area Description (optional):</label>
<?php
textArea("area_content", "", 98, EDIT_WINDOW_HEIGHT);
?>
</p>
<?php
require_once snippetPath("admin-insert_configs");
?>
<div id="edit-footer" class="portareanav clearfix">
<div class="column half">
<p>
<input type="submit" class="submitbutton" name="submit" value="Add New Area" /> <br />
<input type="submit" class="submitbuttonsmall" name="submit" value="Add and Return to List" />
</p>
</div>
<div class="column half last">
<p>To ensure that a new Portfolio Area does not become public without any Sections inside of it, a new Area will automatically be set to <strong>Not Public</strong>. Add some Sections and edit this Portfolio Area later to make it public and visible. </p>
</div>
</div>
</form>
<?php
}
示例3: display_page_content
function display_page_content()
{
$isoLastModifiedSite = "";
$newLine = "\n";
$indent = " ";
$rootUrl = "http://" . SITE_URL;
$xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>{$newLine}";
$urlsetOpen = "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\"\n\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84\n\thttp://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">{$newLine}";
$urlsetValue = "";
$urlsetClose = "</urlset>";
function makeUrlString($urlString)
{
return htmlentities($urlString, ENT_QUOTES, 'UTF-8');
}
function makeIso8601TimeStamp($dateTime)
{
if (!$dateTime) {
$dateTime = date('Y-m-d H:i:s');
}
if (is_numeric(substr($dateTime, 11, 1))) {
$isoTS = substr($dateTime, 0, 10) . "T" . substr($dateTime, 11, 8) . "+00:00";
} else {
$isoTS = substr($dateTime, 0, 10);
}
return $isoTS;
}
function makeUrlTag($url, $modifiedDateTime, $changeFrequency, $priority)
{
global $newLine;
global $indent;
global $isoLastModifiedSite;
$urlOpen = "{$indent}<url>{$newLine}";
$urlValue = "";
$urlClose = "{$indent}</url>{$newLine}";
$locOpen = "{$indent}{$indent}<loc>";
$locValue = "";
$locClose = "</loc>{$newLine}";
$lastmodOpen = "{$indent}{$indent}<lastmod>";
$lastmodValue = "";
$lastmodClose = "</lastmod>{$newLine}";
$changefreqOpen = "{$indent}{$indent}<changefreq>";
$changefreqValue = "";
$changefreqClose = "</changefreq>{$newLine}";
$priorityOpen = "{$indent}{$indent}<priority>";
$priorityValue = "";
$priorityClose = "</priority>{$newLine}";
$urlTag = $urlOpen;
$urlValue = $locOpen . makeUrlString("{$url}") . $locClose;
if ($modifiedDateTime) {
$urlValue .= $lastmodOpen . makeIso8601TimeStamp($modifiedDateTime) . $lastmodClose;
if (!$isoLastModifiedSite) {
// last modification of web site
$isoLastModifiedSite = makeIso8601TimeStamp($modifiedDateTime);
}
}
if ($changeFrequency) {
$urlValue .= $changefreqOpen . $changeFrequency . $changefreqClose;
}
if ($priority) {
$urlValue .= $priorityOpen . $priority . $priorityClose;
}
$urlTag .= $urlValue;
$urlTag .= $urlClose;
return $urlTag;
}
if (BLOG_INSTALL) {
$blog_id = "1";
$the_blog = Blogs::FindById($blog_id);
}
if (PORTFOLIO_INSTALL) {
$sections = Sections::FindPublicSections();
}
$areas = Areas::FindPublicAreas();
//$pageLastModified = date('Y-m-d H:i:s');
// Today last month instead of today's date
$pageLastModified = date("Y-m-d H:i:s", mktime(date("H"), date("i"), date("s"), date("m") - 1, date("d"), date("Y")));
$pageChangeFrequency = "monthly";
$pagePriority = 0.6;
$urlsetValue .= makeUrlTag($rootUrl, $pageLastModified, $pageChangeFrequency, 1);
foreach ($areas as $area) {
if ($area->name == "site_blog" && BLOG_INSTALL) {
$urlsetValue .= makeUrlTag($rootUrl . get_link(BLOG_STATIC_AREA . "/view/"), $pageLastModified, $pageChangeFrequency, 1);
$entries = $the_blog->getEntries();
foreach ($entries as $entry) {
$urlsetValue .= makeUrlTag($rootUrl . $entry->get_url(), $entry->get_pubdate("Y-m-d H:i:s"), $pageChangeFrequency, $pagePriority);
}
} else {
if (strstr($area->name, "-portfolio") && PORTFOLIO_INSTALL) {
$first = true;
foreach ($sections as $index => $menu_section) {
if ($first) {
$pagePriority = 1;
$first = false;
} else {
$pagePriority = 0.6;
}
if ($menu_section->name != "") {
$changedate = !is_null($menu_section->date_revised) ? formatDateTimeView($menu_section->date_revised, "Y-m-d H:i:s") : $pageLastModified;
$urlsetValue .= makeUrlTag($rootUrl . $menu_section->get_url($area), $changedate, $pageChangeFrequency, $pagePriority);
$items = $menu_section->findItems();
//.........这里部分代码省略.........