本文整理汇总了PHP中Users::GetCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::GetCurrentUser方法的具体用法?PHP Users::GetCurrentUser怎么用?PHP Users::GetCurrentUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::GetCurrentUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RenderChunk
function RenderChunk($slug = "", $cachelength = "")
{
if (!empty($slug)) {
// Returns a new query or a cached one
$cache_folder = SERVER_CACHE_ROOT;
// This usually points to /htdocs/cache/ on Modwest servers
if (empty($cachelength)) {
$cachelength = 60 * 60 * 3;
}
// seconds * minutes * hours = cache for 3 hours
$usecache = false;
$cachefile = $cache_folder . $slug . '.html';
$user = Users::GetCurrentUser();
// Skip using a cached file is there is a user logged in right now
if (empty($user)) {
// Check if we have this request cached recently;
if (file_exists($cachefile)) {
if (time() - filemtime($cachefile) <= $cachelength) {
// Is this file recent enough to use?
$cachecontents = file_get_contents($cachefile);
// Return the cached xml
if (!empty($cachecontents)) {
return $cachecontents;
$usecache = true;
// not neccesary, as the return statement stops execution
}
} else {
unlink($cachefile);
}
// File stale or empty, delete
}
}
if (!$usecache) {
$result = Chunks::FindBySlug($slug);
$result = image_display($result->content);
$result = email_display($result);
// Store our cache version
file_put_contents($cachefile, $result);
return $result;
}
} else {
return null;
}
}
示例2: FindPageOrIndex
function FindPageOrIndex($area, $name, $isdraft = false)
{
$draftcond = "";
if ($isdraft) {
$draftcond = "AND p.content_file = 'draft'";
}
// if the page name is index and a specific "index" page isn't found, return the first page in the area as the index
$found_pages = MyActiveRecord::FindBySql('Pages', "SELECT p.* FROM pages p INNER JOIN areas_pages ap ON ap.pages_id = p.id INNER JOIN areas a ON a.id = ap.areas_id WHERE p.name like '" . $name . "' {$draftcond} AND a.name like '" . $area->name . "' ORDER BY id ASC");
// index not found. select all pages ordered by display_order
if ($name == "index" && count($found_pages) == 0) {
$found_pages = Pages::FindByArea($area);
} else {
if (count($found_pages) == 0) {
$all_area_pages = MyActiveRecord::FindBySql('Pages', "SELECT p.* FROM pages p INNER JOIN areas_pages ap ON ap.pages_id = p.id INNER JOIN areas a ON a.id = ap.areas_id WHERE a.name like '" . $area->name . "' ORDER BY id ASC");
if (SUB_PAGES) {
foreach ($all_area_pages as $page) {
$all_children = $page->get_all_children();
foreach ($all_children as $child) {
if ($child->name == $name) {
return $child;
}
}
}
}
}
}
$page = array_shift($found_pages);
// Now that we have a page, allow users logged in to see non-public pages.
$user = Users::GetCurrentUser();
$logged_in = false;
if ($user) {
$logged_in = true;
}
// If not logged in, make sure the first page returned is not a non-public page. Could throw an error.
if (!$logged_in) {
while ($page && $page->public == false) {
$page = array_shift($found_pages);
}
}
return $page;
}
示例3: display_page_content
function display_page_content()
{
$area_id = requestIdParam();
$area = Areas::FindById($area_id);
$user = Users::GetCurrentUser();
?>
<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>Edit Portfolio Area : <a href="<?php
$area->the_url();
?>
" title="View <?php
$area->the_url();
?>
">View Area</a></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>
<input type="text" name="display_name" value="<?php
echo $area->display_name;
?>
" class="required: true" /><br />
<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 (for SEO):</label>
<?php
textField("seo_title", $area->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>
<div id="public" class="column half">
<p>
<label for="public">Public:</label> <?php
checkBoxField("public", $area->public);
?>
<br />
<span class="hint">This determines whether or not the Portfolio Area will appear in the navigation as a “Public” link. If this Portfolio Area is not public, then no sections within it – Public or not – will be visible. A nice way to create a new Portfolio Area is to make the Portfolio Area NOT Public, and all the sections within it Public, so one click can turn it all on when it is ready. </span>
</p>
</div>
<div id="template" class="column half">
<p><label for="template">Template:</label>
<select id="template" name="template">
<?php
$templates = list_available_templates();
foreach ($templates as $template) {
$text = $template;
echo "<option value=\"{$template}\"";
if ($template == $area->template) {
echo " selected=\"selected\"";
}
echo ">{$text}</option>";
}
?>
</select><br />
<span class="hint">When a Page inside this Area uses the template “inherit”, the Page will inherit this Area’s template selection. So, changing this Template may change the display of all Pages within this Area. </span>
</p>
</div>
<div class="clearleft"></div>
<p><label for="area_content">Portfolio Area Description (optional):</label>
<?php
textArea("area_content", $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="Edit Area" /> <br />
<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
</p>
//.........这里部分代码省略.........
示例4: display_page_content
function display_page_content()
{
if (requestIdParam() == "add") {
$chunk = $chunkslug = $chunkdescription = $chunkcontent = null;
$chunkhtml = 0;
} else {
$chunk_id = requestIdParam();
$chunk = Chunks::FindById($chunk_id);
$chunkslug = $chunk->slug;
$chunkdescription = $chunk->description;
$chunkhtml = $chunk->full_html;
$chunkcontent = $chunk->content;
}
$user = Users::GetCurrentUser();
?>
<script type="text/javascript">
$().ready(function() {
$("#edit_chunk").validate({
rules : {
slug: "required",
content: "required"
},
messages: {
slug: "Please enter a title for this video",
content: "Please enter some content for this chunk"
}
});
<?php
if ($chunkhtml) {
echo 'loadTinyMce("chunk_content");';
}
?>
});
</script>
<div id="edit-header" class="chunknav">
<h1>Edit Chunk</h1>
</div>
<form method="POST" id="edit_chunk">
<div class="column half">
<?php
if ($user->email == 'admin@highchairdesign.com') {
?>
<p class="display_name">
<label for="slug">Chunk Slug:</label>
<?php
textField("slug", $chunkslug, "required: true");
?>
</p>
<p>
<label for="full_html">Full Html?:</label> <?php
checkBoxField("full_html", $chunkhtml);
?>
<br>
<span class="hint">Do we need to allow full HTML capabilities on the content field? Checked for “Yes”, not checked for “No”.</span>
</p>
<p>
<label for="description">Chunk Description:</label>
<?php
textField("description", $chunkdescription);
?>
</p>
<?php
} else {
?>
<h2><?php
echo $chunkslug;
?>
</h2>
<p><strong><?php
echo $chunkdescription;
?>
</strong></p>
<?php
}
?>
<div class="clearit"></div>
</div>
<div class="column half last">
<p>
<label for="chunk_content">Content:</label>
<?php
textArea("chunk_content", $chunkcontent, 98, 18);
?>
</p>
</div>
//.........这里部分代码省略.........
示例5: display_page_content
function display_page_content()
{
$event_id = getRequestVarAtIndex(4);
$event = Events::FindById($event_id);
$event_types = EventTypes::FindAll();
$event_periods = EventPeriods::FindAll();
$year = getRequestVarAtIndex(2);
$month = getRequestVarAtIndex(3);
$recurrences = Recurrence::FindForEvent($event_id);
$days = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
$user = Users::GetCurrentUser();
?>
<script type="text/javascript">
//<![CDATA[
$().ready(function() {
setupDateFields("<?php
echo $event->eventperiod_id;
?>
");
$.datepicker.setDefaults({
showButtonPanel: true,
showOtherMonths: true,
selectOtherMonths: true
});
$( "#date_start" ).datepicker();
$( "#time_start" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
$( "#date_end" ).datepicker();
$( "#time_end" ).timepicker({timeFormat: 'hh:mm:ss tt',stepMinute: 5});
$( "#not_date" ).datepicker();
$("a#notdate_add").click(function() {
var date = $("input[name='not_date']").val();
if (date != "") {
$("input[name='not_date']").val('');
var all_dates_vis = $("span#notdates").html();
$("span#notdates").html("<label for=\"notdates[]\">"+date+" <a href=\"javascript:;\" onClick=\"$(this).parent().remove();\">X</a><input type=\"hidden\" name=\"notdates[]\" value=\""+date+"\" /></label>"+all_dates_vis);
}
});
$("#eventperiod_id").change(function() {
var selected = $(this).val();
setupDateFields(selected);
});
$("#edit_event").validate({
rules: {
title: "required",
date_start: "required",
},
messages: {
title: "Please enter a title for this event",
date_start: "Please at least a start date for this event",
}
});
});
//]]>
</script>
<div id="edit-header" class="event">
<h1>Edit Event</h1>
</div>
<div id="calendar_div"></div>
<form method="POST" id="edit_event">
<p class="display_name">
<label for="title">Title</label>
<?php
textField("title", $event->title, "required: true");
?>
</p>
<?php
if (ALLOW_EVENT_TYPES && count($event_types) > 1) {
?>
<p>
<label for="eventtype_id">Event Type</label>
<select name="eventtype_id" id="eventtype_id">
<?php
foreach ($event_types as $event_type) {
echo "<option value='{$event_type->id}' ";
if ($event_type->id == $event->eventtype_id) {
echo " selected ";
}
echo ">{$event_type->name}</option>\r\n";
}
?>
</select>
</p>
<?php
}
?>
<div id="eventdateselects" class="dropslide">
<p><label for="eventperiod_id">Event Period:</label>
<select name="eventperiod_id" id="eventperiod_id">
//.........这里部分代码省略.........
示例6: display_page_content
function display_page_content()
{
$document_id = requestIdParam();
$document = Documents::FindById($document_id);
?>
<script type="text/javascript">
$().ready(function() {
$("#edit_document").validate({
rules : {
name: "required"
},
messages: {
name: "Please enter a name for this document"
}
});
});
</script>
<div id="edit-header" class="documentnav">
<h1>Edit Document</h1>
</div>
<form method="POST" enctype="multipart/form-data" id="edit_document">
<input type="hidden" name="MAX_FILE_SIZE" value="15800000">
<p class="display_name">
<label for="name">Name:</label>
<?php
textField("name", $document->name, "required: true");
?>
<br />
<span class="hint">This is a more descriptive name for the file that will be displayed as the link when you insert it into a page. The name can start with the words “Click here to download…” in order t be most clear on the front-end display, but that is up to you.</span>
</p>
<p>
<label for="filename">File Name (uneditable):</label>
<?php
echo $document->filename;
?>
<br />
<span class="hint">This is the physical name of the file that was uploaded.</span>
</p>
<p>
<label for="file">Replace with a new document:</label>
<?php
fileField('file');
?>
</p>
<div id="edit-footer" class="documentnav clearfix">
<div class="column half">
<p>
<input type="submit" class="submitbutton" name="submit" value="Save Document" /> <br />
<input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List" />
</p>
</div>
<div class="column half last">
<?php
$user = Users::GetCurrentUser();
if ($user->has_role()) {
?>
<p><label for="delete">Delete this document?</label>
<input name="delete" class="boxes" type="checkbox" value="<?php
echo $document->id;
?>
" />
<span class="hint">Check the box and then click “Save” above to delete this document from the database</span>
</p>
<?php
}
?>
</div>
</div>
</form>
<?php
}
示例7: display_page
function display_page($params = array())
{
// canonicalize the input
$area_name = $page_name = "";
// GET /
if (count($params) == 0) {
$area_name = "index";
$page_name = "index";
}
// GET /area_name
if (count($params) == 1) {
$area_name = $params[0];
$page_name = "index";
}
// GET /area_name/page_name
if (count($params) > 1) {
$area_name = $params[0];
$page_name = $params[1];
}
if (ALIAS_INSTALL) {
// Test the MyActiveRecord connection
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'alias'")) == 1) {
// check the alias' in the database and see if there is a match
$alias = Alias::FindAll();
/* die(print_r($alias)); */
foreach ($alias as $entry) {
if ($entry->alias == $area_name || $entry->alias == "/" . $area_name) {
redirect($entry->path);
}
}
}
}
// check the routes to see if the requested page has an explicit route setup
$page_options = $GLOBALS['ROUTES'];
if (isset($page_options["/" . $area_name . "/" . $page_name])) {
$page = StaticPage::FindByAreaAndName($area_name, $page_name);
if (isset($page)) {
display_admin_with_template($page);
return true;
}
}
// check for pages that are in the "global" area and have params (ie /calendar/2008/1)
$global_area = Areas::FindByName('index');
$possible_page = Pages::FindByAreaAndName($global_area, $page_name) ? Pages::FindByAreaAndName($global_area, $area_name) : '';
if (!empty($possible_page)) {
$area = $global_area;
$page = $possible_page;
} else {
// for now, just include the first page that comes back. later we can handle multiple pages
$area = Areas::FindByName($area_name);
if (!isset($area)) {
return false;
}
if (strstr($area_name, "-portfolio")) {
if ($page_name != "index") {
$page = Sections::FindByName($page_name);
} else {
$pages = $area->getSections();
$page = array_shift($pages);
}
} else {
$page = Pages::FindPageOrIndex($area, $page_name);
}
}
if (!isset($page)) {
return false;
}
// check if the page is public or not
$is_admin = false;
$user = Users::GetCurrentUser();
if ($user) {
$logged_in = true;
}
if ($page->public || !$page->public && $logged_in) {
display_with_template($area, $page);
} else {
return false;
}
return true;
}
示例8: display_page_content
function display_page_content()
{
$gallery = Galleries::FindById(requestIdParam());
$photos = $gallery->get_photos();
$user = Users::GetCurrentUser();
?>
<script type="text/javascript">
$().ready(function() {
$("#edit_gallery").validate({
errorLabelContainer: $("#error_container"),
rules: {
name: "required"
},
messages: {
name: "Please enter a name for this gallery<br/>"
}
});
});
$().ready(function() {
$("#photo_list_order").sortable({
stop: function() {
$("#photo_list_order li input[type=hidden]").each(function(i) {
$(this).val(i+1);
});
}
});
});
</script>
<div id="edit-header" class="documentnav">
<h1>Edit Gallery</h1>
</div>
<?php
// DEBUG block. Run some tests. NOT PERFECT but should help point in the right direction.
if (HCd_debug()) {
echo '<div class="debug-block">';
// Check the folder path to see if it exists
if (is_dir(SERVER_DOCUMENTS_ROOT)) {
echo '<span class="debug-feedback passed">“' . SERVER_DOCUMENTS_ROOT . '” exists</span>';
$permmode = substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT)), -4);
if ($permmode == '0777' || $permmode == '0775') {
echo '<span class="debug-feedback passed">The folder permission is <strong>' . $permmode . '</strong></span>';
} else {
echo '<span class="debug-feedback failed">The folder permission is <strong>' . $permmode . '</strong></span>';
}
if (is_dir(SERVER_DOCUMENTS_ROOT . "gallery_photos")) {
echo '<span class="debug-feedback passed">“' . SERVER_DOCUMENTS_ROOT . 'gallery_photos” exists</span>';
$permmode2 = substr(sprintf('%o', fileperms(SERVER_DOCUMENTS_ROOT . "gallery_photos")), -4);
if ($permmode2 == '0777' || $permmode2 == '0775') {
echo '<span class="debug-feedback passed">The folder permission is <strong>' . $permmode2 . '</strong></span>';
} else {
echo '<span class="debug-feedback failed">The folder permission is <strong>' . $permmode2 . '</strong></span>';
}
} else {
echo '<span class="debug-feedback failed">“' . SERVER_DOCUMENTS_ROOT . 'gallery_photos” does NOT exist or can not be seen</span>';
}
} else {
echo '<span class="debug-feedback failed">“' . SERVER_DOCUMENTS_ROOT . '” does NOT exist</span>';
}
$test_file = SERVER_INCLUDES_ROOT . "www/lib/admin_images/hcdlogo_24.png";
if (is_file($test_file)) {
$test_imagecreatefromjpeg = @imagecreatefrompng($test_file);
if ($test_imagecreatefromjpeg !== false) {
echo '<span class="debug-feedback passed">“@imagecreatefrompng” works</span>';
} else {
echo '<span class="debug-feedback failed">“@imagecreatefrompng” returns false</span>';
}
} else {
echo '<span class="debug-feedback failed">Test file does not exist. “imagecreatefrompng” test cannot run. </span>';
echo '<span class="debug-feedback failed">Test file path: “' . $test_file . '”</span>';
}
echo '</div>';
}
?>
<form method="POST" id="edit_gallery" enctype="multipart/form-data">
<p><span class="hint">If a text box is underlined in red, it is a required field</span></p>
<a name="top"></a>
<p class="display_name">
<label for="name">Gallery Display Name:</label> <span class="hint">This is the Proper Name of the gallery.</span><br />
<?php
textField("name", $gallery->name, "required: true");
?>
</p>
<p class="announce">
<strong>Note:</strong> While the server will attempt to upload very large images and resize them, doing so may take a very long time. Please try to resize images to reasonable dimensions (about 800 pixels wide) before uploading. We recommend the Adobe Photoshop “Save for Web” feature, which makes the image file size very small (In Photoshop, under File > Save for Web. Use JPEG file type and a compression of about 60%. Click Progressive as well).<br />
<br />
The server will attempt to resize an image to a maximum dimension of: <strong><?php
echo MAX_GALLERY_IMAGE_WIDTH;
?>
pixels wide by <?php
echo MAX_GALLERY_IMAGE_HEIGHT;
?>
pixels tall</strong>. This is best for viewing images for the web. </p>
<p> </p>
//.........这里部分代码省略.........
示例9: isset
<!--[if IE 8]> <html class="no-js lt-ie9 ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<?php
// Sometimes cache-busting seems to be needed on CSS and JS.
// Use ?ver=<?php echo date("njHis")
if (!isset($page)) {
$page = null;
}
// Set the title of the page: Check the strings to do some fancy stuff...
$page_title = $description = $bodyclass = $template = "";
$blogitem = $category = null;
$template = isset($area) && isset($page) ? $page->getTemplateForArea($area) : "no-template-specified";
$current_user = Users::GetCurrentUser();
$admin_class = is_object($current_user) ? ' loggedin' : ' no-loggedin';
$admin_class = is_object(Users::GetCurrentUser()) ? ' loggedin' : '';
// CUSTOM
$var0 = getRequestVarAtIndex(0);
$var1 = getRequestVarAtIndex(1);
$var2 = getRequestVarAtIndex(2);
$var3 = getRequestVarAtIndex(3);
if (BLOG_INSTALL && $var0 == BLOG_STATIC_AREA) {
$blogarea = Areas::FindById(3);
// Might need to change this on a per project basis
$page_title = $blogarea->get_title() . " | " . SITE_NAME;
$bodyclass = "blog archive";
if ($var1 == "category") {
$category = Categories::FindByName($var2);
$description = $category->get_excerpt(160);
$page_title = $category->get_title() . " | " . $blogarea->get_title() . " | " . SITE_NAME;
$bodyclass = "blog category-archive";
示例10: display_page_content
function display_page_content()
{
$areas = Areas::FindPortAreas();
// get all Portfolio Areas, public or not
$user = Users::GetCurrentUser();
?>
<div id="edit-header" class="sectionnav">
<h1>Add Portfolio Section</h1>
</div>
<form method="POST" id="add_section">
<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");
?>
<br />
<span class="hint">This is the Proper Name of the section; how it will display in the navigation. Keep it simple, but use capitals and spaces, please.</span>
</p>
<?php
if (ALLOW_SHORT_PAGE_NAMES) {
?>
<p>
<label for="name">Name</label>
<?php
textField("name", "", "required: true");
?>
<br />
<span class="hint">This is the short name of the section for the link and the database. No spaces, commas, or quotes, please.</span>
</p>
<?php
}
?>
<?php
if ($user->email == "admin@highchairdesign.com") {
?>
<p><label for="template">Template:</label>
<select id="template" name="template">
<?php
$templates = list_available_templates();
foreach ($templates as $template) {
$text = $template;
echo "<option value=\"{$template}\">{$text}</option>";
}
?>
</select></p>
<?php
} else {
hiddenField("template", "portfolio");
}
?>
<p>
<label for="public">Public?</label><input type="checkbox" name="public" class="boxes"/><br />
<span class="hint">This determines whether or not the Section will appear in the navigation as a “Public” link. If this Section is not public, then no items within it – Public or not – will be visible. A nice way to create a new Section and make sure it works well is to make the Section NOT Public, and all the items within it Public, so one click can turn it all on when it is ready. </span>
</p>
<p>
<label for="content">Section Description:</label>
<?php
textArea("section_content", "", 98, EDIT_WINDOW_HEIGHT);
?>
</p>
<?php
require_once snippetPath("admin-insert_configs");
?>
<?php
require_once snippetPath("admin-portfolio-area");
?>
<div id="edit-footer" class="sectionnav clearfix">
<div id="error_container"></div>
<div class="column half">
<p>
<input type="submit" class="submitbutton" name="submit" value="Add New Section" /> <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 Section does not become public without any Items inside of it, a new section will automatically be set to <strong>Not Public</strong>. Add some Items and edit this Section later to make it public and visible. </p>
</div>
</div>
</form>
<script type="text/javascript">
$().ready(function() {
//.........这里部分代码省略.........
示例11: display_page_content
function display_page_content()
{
$portareas = Areas::FindPortAreas(false);
$item_id = getRequestVaratIndex(3);
$item = Items::FindById($item_id);
$next_item = $prev_item = "";
$sectionname = getRequestVaratIndex(2);
if ($sectionname != "orphan_section") {
// Problem is, there could be two sections with the same name in different Areas. So, loop through the Sections attached to this item
$item_sections = $item->getSections();
foreach ($item_sections as $thissect) {
if ($thissect->name == $sectionname) {
$a_section = Sections::FindById($thissect->id);
$thisarea = $a_section->thePortfolioArea();
$next_item = $item->findNext($a_section, "");
$prev_item = $item->findPrev($a_section, "");
break;
}
}
}
$user = Users::GetCurrentUser();
// If a gallery gets detached or this item doesn't have one, don't create an error.
$gallery = $item->getGallery();
if (is_object($gallery)) {
$photos = $gallery->get_photos();
$photocount = count($photos) == 0 ? "None" : count($photos);
// Sometimes the following statement throws errors. Check it out if this page behaves funny.
if (ITEM_VIDEOS) {
$gallery_items = $gallery->get_photos_and_videos();
$photocount = count($gallery_items) == 0 ? "None" : count($gallery_items);
$itemvideos = $item->findVideos($gallery, 'display_order DESC');
$vidcount = count($itemvideos) == 0 ? "None" : count($itemvideos);
}
} else {
$gallery = false;
$photos = $itemvideos = $gallery_items = null;
$photocount = 0;
$vidcount = "None";
}
if (ITEM_DOCUMENTS) {
$itemdocuments = $item->findDocuments('display_order DESC');
$doccount = count($itemdocuments) == 0 ? "None" : count($itemdocuments);
}
?>
<script type="text/javascript">
//<![CDATA[
$().ready(function() {
$("#edit_item").validate({
errorLabelContainer: "#error_container",
rules: {
display_name: "required",
"selected_sections[]": "required",
},
messages: {
display_name: "Please enter a name that should be displayed for this item",
"selected_sections[]": "Almost forgot! Select at least one section to include this item in",
}
});
$("#photo_list_order").sortable({
stop: function() {
$("#photo_list_order li input.displayorder").each(function(i) {
$(this).val(i+1);
});
}
});
$("#document_list").sortable({
stop: function() {
$("#document_list li input[type=hidden]").each(function(i) {
$(this).val(i+1);
});
}
});
});
//]]>
</script>
<div id="edit-header" class="itemnav threecolumnnav">
<div class="nav-left column">
<h1>Edit Item<?php
if ($sectionname != "orphan_section") {
?>
: <a href="<?php
$item->the_url($thisarea, $a_section);
?>
" title="View “<?php
$item->the_title();
?>
”">View Item</a><?php
}
?>
</h1>
</div>
<div class="nav-center column">
<?php
if ($prev_item != "") {
?>
//.........这里部分代码省略.........
示例12: display_page_content
function display_page_content()
{
// Double check that the proper columns exist
$add_testimonial = requestIdParam() == "add" ? true : false;
if ($add_testimonial) {
$testimonial = $testimonialtitle = $testimonialcontent = $testimonialatt = $testimonialfeat = null;
} else {
$testimonial_id = requestIdParam();
$testimonial = Testimonials::FindById($testimonial_id);
$testimonialtitle = $testimonial->get_title();
$testimonialcontent = $testimonial->content;
$testimonialatt = $testimonial->attribution;
$testimonialfeat = $testimonial->is_featured;
}
?>
<script type="text/javascript">
$().ready(function() {
$("#edit_testimonial").validate({
rules : {
title: "required"
},
messages: {
title: "Please enter a title for this testimonial"
}
});
});
</script>
<div id="edit-header" class="testimonialnav">
<h1><?php
if ($add_testimonial) {
echo 'Add';
} else {
echo 'Edit';
}
?>
Testimonial</h1>
</div>
<form method="POST" id="edit_testimonial">
<p class="display_name">
<label for="title">Testimonial Display Name:</label>
<?php
textField("display_name", $testimonialtitle, "required: true");
?>
<br />
<span class="hint">This name will be used in the admin only — it will not display on the front-end</span>
</p>
<p>
<label for="content">Testimonial Content:</label> <span class="hint">Quotes will get added when displayed, so please do not add quotes here.</span><br />
<?php
textArea("content", $testimonialcontent, 98, EDIT_WINDOW_HEIGHT / 2);
?>
</p>
<p>
<label for="attribution">Testimonial attribution:</label>
<?php
textField("attribution", $testimonialatt);
?>
<br />
<span class="hint">Optional. A “credit” for the testimonial quote.</span>
</p>
<p>
<label for="featured">
<input type="checkbox" name="featured" id="featured"<?php
if ($testimonialfeat) {
?>
checked="checked"<?php
}
?>
>
Feature this Testimonial
</label>
<span class="hint">Optionally show this testimonial in special places as dictated by the site design.</span>
</p>
<div id="edit-footer" class="testimonialnav clearfix">
<div class="column half">
<p>
<input type="submit" class="submitbutton" name="submit" value="Save Testimonial" /> <br />
<input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List" />
</p>
</div>
<div class="column half last">
<?php
$user = Users::GetCurrentUser();
if ($user->has_role() && requestIdParam() != "add") {
?>
<p><label for="delete">Delete this testimonial? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php
echo $testimonial->id;
?>
" /></label>
//.........这里部分代码省略.........
示例13: display_page_content
function display_page_content()
{
// Set all values to null by default
$entry = $entrytitle = $entrypublic = $entrydate = $entryimage = $entrycontent = $entryexcerpt = $entryauthor = $entrytemplate = $preventry = $nextentry = null;
// Get values from existing object if this is not the Add page
if (requestIdParam() != 'add') {
$entry_id = requestIdParam();
$entry = Blog_Entries::FindById($entry_id);
$entrytitle = $entry->title;
$entrypublic = $entry->public;
$entrydate = $entry->getDateStart();
if (BLOG_ENTRY_IMAGES) {
$possibleimage = $entry->getImage();
if (is_object($possibleimage)) {
$entryimage = $possibleimage;
}
}
$entrycontent = $entry->content;
$entryexcerpt = $entry->excerpt;
$entryauthor = $entry->author_id;
$entrytemplate = $entry->template;
}
// Get other needed objects
$the_blog = Blogs::FindById(BLOG_DEFAULT_ID);
$authors = Users::FindAll();
$categories = Categories::FindAll();
$thisuser = Users::GetCurrentUser();
// Get Previous and Next links
if (is_object($entry)) {
$preventry = $the_blog->getPrevEntry($entry->date, false);
$nextentry = $the_blog->getNextEntry($entry->date, false);
}
// Warning thrown
// Double check that the proper columns exist
$photo_entry_id = find_db_column('photos', 'entry_id');
if (!$photo_entry_id) {
echo '<h2 class="system-warning"><span>HCd>CMS says:</span> The Photos table does not have a column called "entry_id"</h2>';
}
// Language for the header
if (is_object($entry)) {
$header = 'Edit ' . ucwords(BLOG_STATIC_AREA) . ' Entry :: <a href="' . get_link(BLOG_STATIC_AREA . "/view/" . $entry->id . "/" . slug($entry->title)) . '" title="Click to View this Entry (save it first!)">View Entry</a>';
} else {
$header = 'Create new ' . ucwords(BLOG_STATIC_AREA) . ' Entry';
}
?>
<div id="edit-header" class="entrynav threecolumnnav">
<div class="nav-left column">
<h1><?php
echo $header;
?>
</h1>
</div>
<div class="nav-center column">
<?php
if (!empty($preventry)) {
?>
<a href="<?php
echo get_link("/admin/edit_entry/" . $preventry->id);
?>
" title="<?php
$preventry->the_title();
?>
">← Previous Entry</a><?php
}
?>
</div>
<div class="nav-right column">
<?php
if (!empty($nextentry)) {
?>
<a href="<?php
echo get_link("/admin/edit_entry/" . $nextentry->id);
?>
" title="<?php
$nextentry->the_title();
?>
">Next Entry →</a><?php
}
?>
</div>
<div class="clearleft"></div>
</div>
<form method="POST" id="edit_entry" enctype="multipart/form-data">
<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">Title:</label>
<span class="hint">This is the Title of the entry; how it will display in the navigation.</span><br />
<?php
textField("title", $entrytitle, "required: true");
?>
</p>
<div id="entry_date" class="column half">
<p><label for="public">Public: <input type="checkbox" name="public" id="public" <?php
//.........这里部分代码省略.........
示例14: display_page_content
function display_page_content()
{
$types = EventTypes::FindAll();
$type_id = requestIdParam();
$type = EventTypes::FindById($type_id);
$user = Users::GetCurrentUser();
?>
<script type="text/javascript">
$().ready(function() {
$("#edit_type").validate({
rules : {
name: "required"
},
messages: {
name: "Please enter an name for this event type.<br/>"
}
});
$("#color_picker table td").click(function() {
var thecolor = $(this).attr('bgcolor');
$('.colorselected').css("background-color",thecolor);
$('input.thecolor').val(thecolor);
});
});
</script>
<div id="edit-header" class="eventtype">
<h1>Edit Event Type</h1>
</div>
<form method="POST" id="edit_type">
<div class="column half">
<p class="display_name">
<label for="name">Name: </label>
<?php
textField("name", $type->name, "required: true");
?>
</p>
</div>
<div class="column half last">
<p>
<label for="colorselected">Color: </label>
<span class="colorselected" style="background-color:<?php
echo $type->color;
?>
"> </span>
</p>
</div>
<div class="clearleft"></div>
<p><label for="new_color">Select New Color:</label> <span class="hint">Click any color below to select it, then click the Save button below.</span>
<input class="thecolor" type="hidden" name="color" value="<?php
echo $type->color;
?>
" />
<?php
require_once snippetPath("color-picker");
?>
</p>
<p> </p>
<h2>Other Event Types for comparison</h2>
<div id="table-header" class="eventlist">
<strong class="item-link">Click Name to Edit</strong>
<span class="item-filename">Color Preview</span>
</div>
<ul id="listitems" class="managelist">
<?php
foreach ($types as $thetype) {
echo "\t\t\t\t\t\t<li><a class=\"item-link\" href=\"" . get_link("/admin/edit_type/{$thetype->id}") . "\">{$thetype->name}</a> <span class=\"colorpreview\" style=\"background-color: {$thetype->color}; color: {$thetype->text_color};\">{$thetype->name}</span></li>\n";
}
?>
</ul>
<div id="edit-footer" class="eventtypenav clearfix">
<div class="column half">
<p>
<input type="submit" class="submitbutton" name="submit" value="Save Type" /> <br />
<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
</p>
</div>
<div class="column half last">
<?php
if ($user->has_role() && $type->id != 1) {
?>
<p><label for="delete">Delete this Event Type?</label>
<input name="delete" class="boxes" type="checkbox" value="<?php
echo $type->id;
?>
" />
<span class="hint">Check the box and click “Save” to delete this type from the database</span></p>
<?php
}
//.........这里部分代码省略.........
示例15: display_page_content
//.........这里部分代码省略.........
<?php
textField("name", $page->name);
?>
</p>
<?php
} else {
hiddenField("name", $page->name);
?>
<p class="page-url">Page URL: <span class="page-url"><?php
echo 'http://' . SITE_URL . BASEHREF . "<mark>" . ltrim($page->get_url(), "/") . "</mark>";
?>
</span></p>
<?php
}
?>
<p>
<label for="name">Public:</label> <?php
checkBoxField("public", $page->public);
?>
<span class="hint">This determines whether or not this page will be visible to the public.</span>
</p>
<p>
<label for="page_content">Content:</label><br />
<?php
textArea("page_content", $page->content, 98, EDIT_WINDOW_HEIGHT);
?>
</p>
<?php
require_once snippetPath("admin-insert_configs");
// We decided to hide templates from everyone except ourselves
$thisuser = Users::GetCurrentUser();
if ($thisuser->id == "1") {
?>
<p>
<label for="template">Template:</label>
<select id="template" name="template">
<?php
$templates = list_available_templates();
$templates[] = "";
foreach ($templates as $template) {
$text = $template;
if ($text == "") {
$text = "(inherit)";
}
echo "<option value=\"{$template}\"";
if ($template == $page->template) {
echo " selected=\"selected\"";
}
echo ">{$text}</option>\r\n";
}
?>
</select>
</p>
<?php
} else {
hiddenField("template", $page->template);
}
?>
<div id="edit-footer" class="pagenav clearfix">
<div id="error_container"></div>