function numberOfPagesReferencing() { $pages = Pages::FindAll(); // this should work, but it doesn't ensure that the >>s are balanced (ie, it will also match <<image>>) $anyImagePattern = "/([>{2}<{2}]){$oldName}([>{2}<{2}])/"; foreach ($pages as $page) { $replacement = '$1' . $newName . '$2'; $page->content = updateContent($page->content, $anyImagePattern, $replacement); $page->save(); } return 0; }
function display_page_content() { $message = PORTFOLIO_INSTALL ? 'Edit or Re-order a Portfolio Area (red), an Area (blue), or Page (white)' : 'Edit or Re-order an Area (blue) or Page (white)'; ?> <script type="text/javascript"> $().ready(function() { $(".drop_item_link").click(function() { $(this).next().slideToggle(); if ($(this).text() == "[view pages]") { $(this).text("[hide pages]"); } else { $(this).text("[view pages]"); } }); $("ul.cat_drag, div.item_drag, div.sub_drag").sortable({ stop: function() { var count = 1; $("ul#listpages ul.row li input.area_order").each(function() { $(this).val(count); count++; }); var count = 1; $("ul#listpages ul.row li input.page_order").each(function() { $(this).val(count); count++; }); <?php if (SUB_PAGES) { ?> var count = 1; $("ul#listpages ul.row li input.sub_page_order").each(function() { $(this).val(count); count++; }); <?php } ?> $.post("<?php echo get_link('admin/order_parse/areaspages'); ?> ", $("form#order_item").serialize()); } }); }); </script> <div id="edit-header" class="areanav"> <div class="nav-left column"> <h1><?php echo $message; ?> </h1> </div> <div class="nav-right column"> <a class="hcd_button" href="<?php echo get_link("admin/add_page"); ?> ">Add a Page</a> <a class="hcd_button" href="<?php echo get_link("admin/edit_area/add"); ?> ">Add an Area</a> </div> <div class="clearleft"></div> </div> <form id="order_item" method="POST"> <p>1) Click name to edit. 2) “Grab” a page or area and drag it to change order. (Pages can not be dragged from one area to another. Reassign the page to another area by editing the Page and using the “Areas” tab.)</p> <div id="table-header"> <strong class="item-link">Area / Page Name</strong> <span class="item-public">Public</span> <span class="item-path">Item Path</span> </div> <?php echo "\t<ul id=\"listpages\" class=\"cat_drag clearfix\">\n"; // ! Get Portfolio Areas $areas = Areas::FindAdminListAreas(); //$area_count = 0; //$num_areas = count($areas); foreach ($areas as $area) { $thisAreaName = $area->display_name; $thisShortName = $area->name; if ($thisShortName == "") { $thisAreaName = "Global"; $thisShortName = ""; } $arealink = get_link("/admin/edit_area/" . $area->id); $areapublic = $area->public ? "<span class=\"light\">public</span>" : " <span class=\"red\">not public → <a href=\"" . get_link($area->name) . "\" target=\"_blank\">Preview</a></span>"; $isportclass = "c_group"; if ($area->is_portfolioarea()) { $arealink = get_link("/admin/portfolio_edit_area/" . $area->id); $isportclass = " c_cat"; } echo <<<EOT \t\t<ul class="row"> \t\t\t<li class="{$isportclass}"> \t\t\t\t<!-- Don't reorder these elements --> \t\t\t\t<input class="area_order" type="hidden" title="AreaOrder_{$area->id}" name="AreaOrder_{$area->id}" value="{$area->display_order}" /> \t\t\t\t<span class="item-link"><a name=\\"jump_{$thisShortName}\\"></a><a href="{$arealink}">{$thisAreaName}<small>Edit</small></a></span> \t\t\t\t<span class="item-public">{$areapublic}</span> \t\t\t\t<span class="item-path">/{$thisShortName}</span> EOT; $pages = $area->findPages(true); //$pagenum = count( $pages ); //if ( $pagenum > 8 ) { // echo "\t\t\t\t<a href=\"#jump_{$thisShortName}\" class=\"drop_item_link\">[view pages]</a>\n"; // echo "\t\t\t\t<div class=\"item_drag\" style=\"display:none\">\n"; //} else { echo "\t\t\t\t<div class=\"item_drag\">\n"; //} foreach ($pages as $page) { $pagelink = get_link("/admin/edit_page/" . $page->id); $pagepublic = $page->public ? "<span class=\"light\">public</span>" : " <span class=\"red\">not public → <a href=\"" . get_link($area->name . "/" . $page->name) . "\" target=\"_blank\">Preview</a></span>"; $inputname = $area->id . "_" . $page->id; $pageorder = $page->getOrderInArea($area); echo <<<EOT \t\t\t\t\t<ul class="row"> \t\t\t\t\t\t<li class="item_line"> \t\t\t\t\t\t\t<input class="page_order" type="hidden" title="PageOrder_{$page->id}" name="{$inputname}" value="{$pageorder}" /> \t\t\t\t\t\t\t<span class="item-link"><a href="{$pagelink}">{$page->display_name}<small>Edit</small></a></span> \t\t\t\t\t\t\t<span class="item-public">{$pagepublic}</span> \t\t\t\t\t\t\t<span class="item-path">/{$thisShortName}/{$page->name}</span> EOT; if (SUB_PAGES) { $children = $page->get_children(); if (count($children > 0)) { echo "\t\t\t\t\t<div class=\"sub_drag\">\n"; foreach ($children as $page) { $pagelink = get_link("/admin/edit_page/" . $page->id); $pagepublic = $page->public ? "" : " <span class=\"red\">not public → <a href=\"" . get_link($area->name . "/" . $page->name) . "\" target=\"_blank\">Preview</a></span>"; $inputname = "SubPage_" . $page->id; $pageorder = $page->getOrderInArea($area); echo <<<EOT \t\t\t\t\t\t<ul class="row"> \t\t\t\t\t\t\t<li class="item_line sub_page"> \t\t\t\t\t\t\t\t<span class="item-link"><a href="{$pagelink}">{$page->display_name}<small>Edit</small></a></span> \t\t\t\t\t\t\t\t<span class="item-public">{$pagepublic}</span> \t\t\t\t\t\t\t\t<span class="item-path">/{$thisShortName}/{$page->name}</span> \t\t\t\t\t\t\t\t<input class="sub_page_order" type="hidden" title="PageOrder_{$page->id}" name="{$inputname}" value="{$pageorder}" /> \t\t\t\t\t\t\t</li> \t\t\t\t\t\t</ul> EOT; } echo "\t\t\t\t\t</div>\n"; } } echo <<<EOT \t\t\t\t\t\t</li> \t\t\t\t\t</ul> EOT; } // End item_drag div echo "\t\t\t\t\t\t\t</div>\n"; // End li.c_group echo "\t\t\t\t\t\t</li>\n"; // End ul.row echo "\t\t\t\t\t</ul>\n"; } // End foreach section // End ul.row cat_drag echo "\t\t\t\t</ul>\n"; // End ul.row echo "\t\t\t</ul>\n"; // end first li echo "\t</ul>\n"; // Find Orphans $orphanlist = ""; $allpages = Pages::FindAll(); foreach ($allpages as $page) { $possiblearea = $page->getAreas(); if (!$possiblearea) { $orphanlist .= "\t<a href=\"" . get_link("/admin/edit_page/" . $page->id) . "\">{$page->display_name}</a><br />\n"; } } if ($orphanlist != "") { echo "\t<p> </p>\n\t<h3>Orphaned Pages</h3>\n"; echo $orphanlist; } ?> <p> </p> <p><strong>Extra:</strong> If a page is not Public, you can still view it by clicking the red “Preview” link. This will open a new window with the page as long as you are logged in (the content will be as recent as the most recent Save). As long as you remain logged in, you may edit the page in one window or tab and preview the content in another window or tab (click refresh after each page save to see the latest changes). </p> </form> <?php // Content Chunks $chunks = Chunks::FindAll(); if (count($chunks) > 0) { ?> <h1 id="chunks-list">Content Chunks</h1> <p class="announce">Content Chunks are small pieces of editable text that are used by templates. Typically, they do not deserve an entire page, so we put them here. Chunks can not be created or deleted, as they have been set up when templates were set up. </p> <div id="table-header" class="documents"> <strong class="item-link">Chunk Name</strong> <span class="item-filename">Description</span> </div> <ul id="listitems" class="managelist"> <?php foreach ($chunks as $chunk) { echo "\t\t<li>\n\t\t\t<span class=\"item-link\"><a href=\"" . get_link("/admin/edit_chunk/{$chunk->id}") . "\">{$chunk->slug} <small>EDIT</small></a></span>\n\t\t\t<span class=\"item-filename\" style=\"width: 50%\">{$chunk->description}</span>\n\t\t</li>\n"; } ?> </ul> <?php } $thisuser = Users::GetCurrentUser(); if ($thisuser->id == "1") { echo '<p><a class="hcd_button" href="' . get_link("admin/edit_chunk/add") . '">Create a new Chunk</a></p>'; } }
function display_page_content() { ?> <div id="edit-header" class="dashboard"> <h1>Dashboard: Definitions and Recent Activity</h1> </div> <style type="text/css"> <!-- .dropslide { background-color: transparent; } blockquote { padding: 10px 10px 0 10px; margin: 0 0 10px 0; border: 1px solid #ccc; } ul.list { list-style: disc; padding: 0 0 0 15px; margin: -8px 0 10px 0; } blockquote blockquote { border: 1px solid #ccc; padding: 5px 5px 0 5px; background-color: #eee; margin: 0 0 10px 20px; } --> </style> <ul id="dashboard" class="tabs menu"> <li><a href="#welcome" class="openclose opened">Welcome</a></li> <li><a href="#general" class="openclose">General Features</a></li> <li><a href="#navdescript" class="openclose">The Navigation</a></li> <li><a href="#glossary" class="openclose">Glossary</a></li> <li><a href="#custom" class="openclose">Custom</a></li> </ul> <div id="welcome" class="dropslide"> <h1>Welcome</h1> <p>Welcome to your content management system, the HCd>CMS. This system allows access to the text and image content of your website. Choose a tab above for a description of each concept, what it does, and how to use it. Or, choose an action below or from the navigation to the right to get started. </p> </div> <div id="general" class="dropslide" style="display:none;"> <h2>Areas and Pages</h2> <p>The core of the HCd>CMS is the management of Areas and Pages. Areas are containers for pages, and pages are independent objects that can be placed inside more than one area. A page has content, or a description, whereas an Area has only a name.</p> <p>The order in which Areas and Pages appear when viewing <a href="<?php echo get_link("admin/list_pages"); ?> ">List Pages</a> is the order in which they will appear on the site, either right to left in a horizontal navigation or top to bottom in a vertical navigation. They may be reordered by dragging a dropping them into place. </p> <h2>Email addresses</h2> <p><strong>Email addresses in Page Content do not need to be coded.</strong> When the database sees an email address (.com, .net, .org, .biz, .info, etc...) it will encode and hide the email from spam robots, but make it an active link for browsers with Javascript turned on. There is no need to manually make email addresses a link. </p> <h2 class="red">Success or Failure Feedback:</h2> <p>When a page has been successfully executed, a red message will appear above the page content. If there is a failure, error, or a required field was not filled out, a message will appear below or above the problem field. </p> <h2>Public vs. Not Public</h2> <p>Areas, pages, sections, items, blog posts and events all have the ability to be Public or non-public. Simply stated, public means that the page or item will be available to users on the front-end, while non-public is hidden from view and available only to those who have access to this admin portion of the website.</p> <p>Public-ness can be inherited, though. An Area can be not public, while all of its Pages are public. As long as those pages do not appear in any other Area, those pages will only be public once the Area is public. Same thing follows for Portfolio Areas and Sections – children of containers inherit the parent’s public property. In this way, it is possible to launch a whole new section of content at one time. </p> </div> <div id="navdescript" class="dropslide" style="display:none;"> <h2>The Navigation (to the Right):</h2> <p>The navigation is broken into three Main Areas. Here is what to expect in each:</a></p> <h2>Manage Content</h2> <p>“Content” is most of your site. In this section, you will be able to manage Pages, Calendar Content, Blog Content, or E-Newsletters. Options may vary slightly from one installation to another, and may contain custom options as well.</p> <p><strong class="red">Pages</strong> = <em>Edit Existing Pages</em> displays all the pages from the database in a table, organized by what Area they are contained within. Pages that are not in a specific area will show up in the Global area. From here you can choose a page to edit, or change the order in which they are displayed. The order is top-down – in other words, the first page listed will also be first in the navigation, wheteher your navigation is right to left or top down. <em>Add a Page, Add an Area</em> = These links to create new pages or areas and add them to the database.</p> <?php if (BLOG_INSTALL) { ?> <p><strong class="red">Blog</strong> = <em>Edit Blog Entries</em> displays a date-organized list of past blog entries. Click an entry name to edit it. You may also change the date of an older entry. <em>Add Blog Entry</em> creates a new entry in the database, which you may date as the day it was created or post-date. To edit the “name” of the Blog, you can edit the name of the Area that represents the blog in the navigation.</p> <?php } ?> <?php if (PORTFOLIO_INSTALL) { ?> <p><strong class="red">Portfolio</strong> = <em>Edit Portfolio Sections and Items</em> displays a list of all the Items, organized by Sections and Portfolio Areas. The display order is top-down, and areas, sections and items are all click-and-draggable. Click on any name to edit that entry, whether it be the name of a Portfolio Area, the Name and Description of a Section, or the Name, Description and Image Gallery for an Item. </p> <?php } ?> <?php if (CALENDAR_INSTALL) { ?> <p><strong class="red">Calendar</strong> = <em>Edit Existing Events</em> displays a calendar-formatted list of all the Events in the database. Click an event to edit it, or, use the arrows (to the right and left of the name of the month) to go forward or backward in time. <em>Add a new Event</em> creates an event in the database. <em>Edit Event Types</em> lists the current event types in the database. Click on the name to edit it. An event type is simply a way to organize events for your calendar. You can have as many event types as you like, and customize the colors that they are represented with. Click <em>Add a New Event Type</em> to create a new one.</p> <?php } ?> <h2>Manage Extras</h2> <p>“Extras” are objects that are separate from page content – by this, we mean things like Images, Documents, Products, Galleries and Videos. They can be inserted into content, but may not be accesible on their own. So we manage them here. </p> <p><strong class="red">Images</strong> = <em>Edit Existing Images</em> displays images in a grid by thumbnail and name, listed by the newest image first. Click any thumbnail to edit the image’s properties. Click <em>Upload a New Image</em> to add more to the database. </p> <blockquote> <p><strong>Insert Image tags=</strong> <em>what they look like and what they do:</em></p> <ul class="list"> <li>{{name_of_image{{ :: An image name surrounded by double curly braces. In this case, because they both point left, the image will be floated left. </li> <li>}}name_of_image}} :: Both braces point right, therefore the image will be floated right. </li> <li>{{name_of_image}} :: Braces point in opposing directions, therefore the image will be centered in the content column and text will <em>not</em> be allowed to flow around it. </li> </ul> </blockquote> <p><strong class="red">Documents</strong> = <em>Edit Existing Documents</em> lists documents by name, from newest to oldest. Click any document name to edit the document’s properties, or click “view” to download a copy of that document. Click <em>Upload a New Document</em> to add more to the database. </p> <blockquote> <p><strong>Insert Document tags=</strong> <em>what they look like and what they do:</em></p> <ul class="list"> <li>{{document:name_of_document{{ :: This is what all tags look like. What they insert ends up looking like this on the front-end= “<a href="#">name_of_document</a> (pdf)“ or whatever type the document may be. </li> </ul> </blockquote> <?php if (GALLERY_INSTALL) { ?> <p><strong class="red">Galleries</strong> = <em>Edit Existing Galleries</em> displays a list of Galleries by thumbnail and name. Click any gallery name or image to edit the name, add photos, change the order of photos, edit captions, or delete images. Click <em>Add a New Gallery</em> to add a new name to the database, and then click the name in the <em>Edit Existing</em> list to add photos to it. </p> <blockquote> <p><strong>Insert Gallery tags=</strong> <em>what they look like and what they do:</em></p> <ul class="list"> <li>{{gallery:name_of_gallery{{, }}gallery:name_of_gallery}}, {{gallery:name_of_gallery}} :: Gallery tags follow the same pattern as image tags. The thumbnail (the first image in the gallery) will be displayed either left, right, or centered above text. If a gallery is centered, it will normally appear larger on the page than if it was floating left or right. </li> <li>{{carousel:name_of_gallery{{ :: In addition, most installs of the HCd>CMS support auto-playing carousels. Try replacing the word “gallery” in the tag with “carousel” to see what happens. </li> <li>{{random-from-gallery:name_of_gallery{{ :: As the name suggests, this code will randomly select one image from a gallery of images and display it on the page. The curly braces will denote the placement or “float” of the image.</li> </ul> </blockquote> <?php } ?> <?php if (VIDEO_INSTALL) { ?> <p><strong class="red">Videos</strong> = <em>Edit Existing Videos</em> displays a list of videos available in the database. Click on any video name to edit the video’s properties, including title, unique ID, hosting service, width and height. Click <em>Add a New Video</em> to add more to the database. </p> <?php } ?> <?php if (PRODUCT_INSTALL) { ?> <p><strong class="red">Products</strong> = <em>Edit Existing Products</em> displays a list of Products in the database. Click any product name to edit the product’s properties, including price, thumbnail image, and description. Click <em>Add a New Product</em> to add more to the database. </p> <?php } ?> <h2>Admin Controls</h2> <p>“Admin” users have ultimate control over the site, and can manage the level of access that other users have as well. This section holds some of the controls that advanced users may have. </p> <?php if (PRODUCT_INSTALL) { ?> <p><strong class="red">PayPal</strong> = If your site has Products installed (Manage Extras > Products), then this is where you may edit the information for your PayPal account. Your site may have at least one account, but could have more. <em>Edit Accounts</em> is where these will be listed – click a name to edit it.</p> <?php } ?> <p><strong class="red">Users</strong> = For any site, users can be Admins (click the box marked “Admin?”) or they may be just regular users. The difference is that “Admins” have ultimate control over content – “Admins” can delete pages, areas, blog entries, etc... “Admins” can also create, edit and delete users as well as edit PayPal accounts. Regular users (“non-admins”) can only edit page, event, or blog content, and upload and edit images, documents or galleries. They can not delete content.</p> </div> <div id="glossary" class="dropslide" style="display:none;"> <h2>Glossary:</h2> <dl> <dt>Areas</dt> <dd>An Area in the HCd>CMS is a grouping of pages – it is not a page itself, but a way to organize pages into specific groups of content. </dd> <dt>Global Area</dt> <dd>When we say “Global Area”, or “Global Page”, that means that it is the first page people see before a choice is made to navigate somewhere else (a home page, or the first page of an “area”). Sometimes pages that do not have a home of their own will exist in the “Global” area. </dd> <dt>Pages</dt> <dd>A page exists in the database with specific content. Pages can get added to one or more areas, or be global. </dd> <dt>Orphans</dt> <dd>Any child element without a parent – A Page without an Area, a Section without an Area, or an Item without a Section.</dd> <?php if (PORTFOLIO_INSTALL) { ?> <dt>Portfolio Area</dt> <dd>A Portfolio Area is similar to an area, but it contains “Sections” and “Items” instead of pages. The Portfolio Area will also appear in the list of Areas and Pages, allowing you to organize it into the structure of the rest of your site however you like. The Portfolio Area may simply be called “Portfolio”, and you may only need one. A Portfolio Area can have a description if your templates need it.</dd> <dt>Portfolio Section</dt> <dd>A Portfolio Section acts just like an Area. You may not need a bunch of these to organize your portfolio, but you need at least one. Unlike an Area, though, a Section can have a description like a page might have.</dd> <dt>Portfolio Item</dt> <dd>An Item is more like a page, with a title and description, and a thumbnail and a Gallery of images attached to it. In this way, an Item is like a Page and a Gallery combined into one object.</dd> <?php } ?> <?php if (GALLERY_INSTALL) { ?> <dt>Galleries</dt> <dd>Galleries are simply a collection of images, and the order of images in a gallery can be changed at any time. Images in galleries, however, can not be easily pulled from one and added to another. The source image would need to be uploaded again, so, it is a good idea to keep a version of these images on your computer for later use. </dd> <?php } ?> <?php if (VIDEO_INSTALL) { ?> <dt>Videos</dt> <dd>Videos are managed through the CMS as well. The embed codes are managed in one place, so if they need to change, they can be changed from one location and that change will go out to where ever the video is used. Right now, the HCd>CMS supports embed codes for Vimeo and YouTube. Others can be embedded with the full share/embed code from the host service. </dd> <?php } ?> </dl> </div> <div id="custom" class="dropslide" style="display:none;"> <h2>Custom Content</h2> <p>Since the HCd>CMS is so customizable, your site may have features not explained here.</p> </div> <p> </p> <!-- Now start the dashboard --> <?php $count_dashes = 0; if (BLOG_INSTALL) { ?> <div class="dashboard-widget column"> <h1><?php echo ucwords(BLOG_STATIC_AREA); ?> Entries</h1> <p> <a class="hcdbutton" href="<?php echo get_link("admin/list_entries"); ?> ">List Entries</a> <a class="hcdbutton" href="<?php echo get_link("admin/edit_entry/add"); ?> ">Add Entry</a> <a class="hcdbutton" href="<?php echo get_link("admin/list_categories"); ?> ">List Categories</a> <a class="hcdbutton" href="<?php echo get_link("admin/add_category"); ?> ">Add Category</a> </p> <h4>Recently Added Entries:</h4> <ul> <?php $entries = MyActiveRecord::FindBySQL('Blog_Entries', "SELECT * FROM blog_entries ORDER BY date DESC LIMIT 5"); if (!empty($entries)) { foreach ($entries as $entry) { $entrypublic = $entry->public ? "" : "<span class=\"red\">(not public)</span>"; $entry_date = parseDate($entry->date, "m/d g:i A"); echo "<li>\n\t\t\t\t\t\t\t<a class=\"item-link\" href=\"" . get_link("admin/edit_entry/" . $entry->id) . "\">" . $entry->get_title() . "</a>\n\t\t\t\t\t\t\t<span class=\"item-revised\">{$entry_date}</span>\n\t\t\t\t\t\t\t<span class=\"item-public\">{$entrypublic}</span>\n\t\t\t\t\t\t</li>"; } } ?> </ul> </div> <?php $count_dashes++; } if (PORTFOLIO_INSTALL) { ?> <div class="dashboard-widget column"> <h1>Portfolio</h1> <p> <a class="hcdbutton" href="<?php echo get_link("admin/portfolio_list"); ?> ">List Items</a> <a class="hcdbutton" href="<?php echo get_link("admin/portfolio_add_item"); ?> ">Add Item</a> <a class="hcdbutton" href="<?php echo get_link("admin/portfolio_add_section"); ?> ">Add Section</a> <a class="hcdbutton" href="<?php echo get_link("admin/portfolio_add_area"); ?> ">Add Area</a> </p> <h4>Recently Added/Edited Items:</h4> <ul> <?php $items = Items::FindThisMany(7); // BROKEN when the database is missing fields (prolly date_created, date_revised) if (!empty($items)) { foreach ($items as $theitem) { $itempublic = $theitem->public ? "" : "<span class=\"red\">(not public)</span>"; $section = $theitem->theSection(); $sectionname = empty($section->name) ? "orphan_section" : $section->name; $item_revised = empty($theitem->date_revised) ? '' : formatDateTimeView($theitem->date_revised, "m/d g:i A"); echo "<li>\n\t\t\t\t\t\t\t<a class=\"item-link\" href=\"" . get_link("admin/portfolio_edit/{$sectionname}/" . $theitem->id) . "\">" . $theitem->get_title() . "</a>\n\t\t\t\t\t\t\t<span class=\"item-public\">{$itempublic}</span>\n\t\t\t\t\t\t\t<span class=\"item-revised\">{$item_revised}</span>\n\t\t\t\t\t\t</li>"; } } ?> </ul> </div> <?php $count_dashes++; } if ($count_dashes == 2) { echo "<div class=\"clearleft\"></div>\n"; } ?> <div class="dashboard-widget column"> <h1>Pages</h1> <p> <a class="hcdbutton" href="<?php echo get_link("admin/list_pages"); ?> ">List Pages</a> <a class="hcdbutton" href="<?php echo get_link("admin/add_page"); ?> ">Add Page</a> <a class="hcdbutton" href="<?php echo get_link("admin/edit_page/add"); ?> ">Add Area</a> <?php $chunks = Chunks::FindAll(); if (count($chunks) > 0) { ?> <a class="hcdbutton" href="<?php echo get_link("admin/list_pages#chunks-list"); ?> ">List Chunks</a> <?php } ?> </p> <h4>Recently Added Pages:</h4> <ul> <?php $pages = Pages::FindAll("id DESC"); if (!empty($pages)) { $counter = 0; foreach ($pages as $thepage) { if ($counter < 5) { $pagepublic = $thepage->public ? "" : "<span class=\"red\">(not public)</span>"; //$item_revised = ( empty($theitem->date_revised) ) ? '' : formatDateTimeView( $theitem->date_revised, "m/d g:i A" ); echo "<li>\n\t\t\t\t\t\t\t\t<a class=\"item-link\" href=\"" . get_link("admin/edit_page/" . $thepage->id) . "\">" . $thepage->get_title() . "</a>\n\t\t\t\t\t\t\t\t<span class=\"item-public\">{$pagepublic}</span>\n\t\t\t\t\t\t\t</li>"; $counter++; } } } ?> </ul> <h4>Quick select</h4> <?php quick_link(); ?> </div> <?php $count_dashes++; $classes = "dashboard-widget column"; if (!is_odd($count_dashes)) { $classes = "quick_buttons"; echo "<div class=\"clearleft\"></div>\n"; } ?> <div class="<?php echo $classes; ?> "> <h1>Manage Extras:</h1> <p> <?php if (CALENDAR_INSTALL) { ?> <strong>Event Calendar:</strong> <a class="hcd_button" href="<?php echo get_link("admin/list_events"); ?> ">Edit Events</a> <a class="hcd_button" href="<?php echo get_link("admin/add_event"); ?> ">Add an Event</a><br /><br /> <?php } if (GALLERY_INSTALL) { ?> <strong>Image Galleries:</strong> <a class="hcd_button" href="<?php echo get_link("admin/list_galleries"); ?> ">Edit Galleries</a> <a class="hcd_button" href="<?php echo get_link("admin/add_gallery"); ?> ">Add Gallery</a><br /><br /> <?php } if (PRODUCT_INSTALL) { ?> <strong>Products:</strong> <a class="hcd_button" href="<?php echo get_link("admin/list_products"); ?> ">Edit Products</a> <a class="hcd_button" href="<?php echo get_link("admin/add_product"); ?> ">Add a Product</a><br /><br /> <?php } if (VIDEO_INSTALL) { ?> <strong>Video:</strong> <a class="hcd_button" href="<?php echo get_link("admin/list_videos"); ?> ">Edit Videos</a> <a class="hcd_button" href="<?php echo get_link("admin/edit_video/add"); ?> ">Add a Video</a><br /><br /> <?php } if (TESTIMONIAL_INSTALL) { ?> <strong>Testimonials:</strong> <a class="hcd_button" href="<?php echo get_link("admin/list_testimonials"); ?> ">Edit Testimonials</a> <a class="hcd_button" href="<?php echo get_link("admin/edit_testimonial/add"); ?> ">Add a Testimonial</a><br /><br /> <?php } ?> <strong>Images:</strong> <a class="hcd_button" href="<?php echo get_link("admin/list_images"); ?> ">Edit Images</a> <a class="hcd_button" href="<?php echo get_link("admin/add_image"); ?> ">Upload an Image</a><br /><br /> <strong>Documents:</strong> <a class="hcd_button" href="<?php echo get_link("admin/list_documents"); ?> ">Edit Documents</a> <a class="hcd_button" href="<?php echo get_link("admin/add_document"); ?> ">Upload a Document</a> </p> </div> <div class="clearleft"></div> <!-- TO DO Break out the insert patterns into its own tab for images, documents and galleries. Explain galleries better. --> <?php include_once snippetPath("admin_tutorial_list"); }
function UpdateProductReferences($oldName, $newName) { $pages = Pages::FindAll(); $anyProductPattern = "/{{2}(product:{$oldName}+){{2}/"; foreach ($pages as $page) { $replacement = '{{product:' . $newName . '{{'; $page->content = updateContent($page->content, $anyProductPattern, $replacement); $page->save(); } }