本文整理汇总了PHP中Items::FindById方法的典型用法代码示例。如果您正苦于以下问题:PHP Items::FindById方法的具体用法?PHP Items::FindById怎么用?PHP Items::FindById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Items
的用法示例。
在下文中一共展示了Items::FindById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_page_content
function display_page_content()
{
$listname = getRequestVarAtIndex(2);
switch ($listname) {
case "portfolio":
foreach ($_POST as $ordered_objects => $order_value) {
// splits up the key to see if we are ordering a section, item or ignoring a portfolio area
$ordered_parts = explode("_", $ordered_objects);
// NOTICE: I have learned that when there are portfoli orphans, this reordering script breaks. I removed the hidden fields in the Orphans section, but check in on that if you notice reordering breaking again.
//$debug = "";
if ($ordered_parts[0] != "PortFolioAreas") {
if ($ordered_parts[0] == "SectionOrder") {
$section = Sections::FindById($ordered_parts[1]);
$section->display_order = $order_value;
$section->save();
//$debug .= $section->display_name." updated";
} else {
$section = Sections::FindById($ordered_parts[0]);
$item = Items::FindById($ordered_parts[1]);
$item->updateOrderInSection($section, $order_value);
//$debug .= $item->display_name." updated";
}
}
//setFlash( "<h3>".$debug."</h3>" );
//setFlash( "<h3>".var_export( $_POST, true )."</h3>" );
}
break;
case "areaspages":
foreach ($_POST as $ordered_objects => $order_value) {
// splits up the key to see if we are ordering a section, item or ignoring a portfolio area
$ordered_parts = explode("_", $ordered_objects);
//$debug = "";
if ($ordered_parts[0] == "AreaOrder") {
$area = Areas::FindById($ordered_parts[1]);
$area->display_order = $order_value;
$area->save();
//$debug .= "$area->display_name updated";
} else {
if ($ordered_parts[0] == "SubPage") {
$page = Pages::FindById($ordered_parts[1]);
$page->display_order = $order_value;
$page->save();
//$debug .= "$page->display_name sub page updated";
} else {
$area = Areas::FindById($ordered_parts[0]);
$page = Pages::FindById($ordered_parts[1]);
$page->updateOrderInArea($area, $order_value);
//$debug .= "$page->display_name updated in $area->display_name";
}
}
}
//setFlash( "<h3>".$debug."</h3>" );
//setFlash( "<h3>".var_export( $_POST, true )."</h3>" );
break;
}
}
示例2: get_item
function get_item()
{
// The gallery slug pattern is "portfolioGal_".$item->id."_".$item->name;
$sploded = explode('_', $this->slug);
if ($sploded[0] == 'portfolioGal') {
$item = Items::FindById($sploded[1]);
if (is_object($item)) {
return $item;
}
} else {
return false;
}
}
示例3: getRequestVaratIndex
<p><label for="taxonomy">Taxonomy (optional):</label><span class="hint">An additional means of sorting items by type.</span><br />
<select name="taxonomy" id="taxonomy">
<?php
$item_id = getRequestVaratIndex(3);
$item = Items::FindById($item_id);
$taxonomies = array();
if (!empty($taxonomies)) {
foreach ($taxonomies as $key => $value) {
$selected = $item->taxonomy == $key ? ' selected' : '';
echo "<option value=\"{$key}\"{$selected}> {$value} </option>\r\n";
}
} else {
echo "<option value=\"\">No Taxonomy Terms defined!</option>\r\n";
}
?>
</select></p>
示例4: elseif
} elseif (CALENDAR_INSTALL && $var0 == CALENDAR_STATIC_AREA) {
$page_title = "Event Calendar | " . SITE_NAME;
$bodyclass = "calendar";
if (getRequestVarAtIndex(5)) {
$event = Events::FindById(getRequestVarAtIndex(5));
$description = $event->get_excerpt(160);
$page_title = $event->get_seo_title(" | Event Calendar | " . SITE_NAME);
$bodyclass = "calendar single-event";
} elseif (getRequestVarAtIndex(4)) {
$page_title = "Event Calendar for " . date('F j, Y', mktime(0, 0, 0, $var3, getRequestVarAtIndex(4), $var2)) . " | " . SITE_NAME;
$bodyclass = "calendar events-for-day";
}
} elseif (PORTFOLIO_INSTALL && isset($area) && $area->is_portfolioarea()) {
// With Item
if (!empty($var2)) {
$item = ITEM_ID_IN_URL ? Items::FindById($var2) : Items::FindByName($var2);
$description = $item->get_excerpt(160);
$page_title = $item->get_seo_title(" | " . $page->get_title() . " | " . $area->get_title() . " | " . SITE_NAME);
$bodyclass = "portarea-{$area->id} section-{$page->id} single-item item-{$item->id}";
// No item but a port area and section
} elseif (isset($page)) {
$description = $page->content != "" ? $page->get_excerpt(160) : $area->get_excerpt(160);
$page_title = $page->get_seo_title(" | " . $area->get_title() . " | " . SITE_NAME);
$bodyclass = "portarea-{$area->id} section-landing section-{$page->id}";
} else {
$description = $area->get_excerpt(160);
$page_title = $area->get_seo_title(" | " . SITE_NAME);
$bodyclass = "portarea-{$area->id}";
}
} else {
$description = $page->get_excerpt(160);
示例5: 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 != "") {
?>
//.........这里部分代码省略.........