本文整理匯總了PHP中Documents::FindAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Documents::FindAll方法的具體用法?PHP Documents::FindAll怎麽用?PHP Documents::FindAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Documents
的用法示例。
在下文中一共展示了Documents::FindAll方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: display_page_content
function display_page_content()
{
if (!requestIdParam()) {
$documents = Documents::FindAll("DESC");
} else {
$documents = Documents::FindByFiletype(requestIdParam());
}
?>
<div id="edit-header" class="documentnav">
<div class="nav-left column">
<h1>Choose a Document to Edit</h1>
</div>
<div class="nav-right column">
<a href="<?php
echo get_link("admin/add_document");
?>
" class="hcd_button">Add a New Document</a>
</div>
<div class="clearleft"></div>
</div>
<p class="announce">Documents are defined as downloadable files or forms. PDFs, DOCs, and the like are acceptable. You may use this feature to make high resolution images downloadable as well. If the image is too large to upload, and you get an error, you may want to compress the image with StuffIt (.sit), WinZip (.zip), or ZipIt (.zip).</p>
<?php
if (count($documents) > 0) {
?>
<div id="table-header" class="documents">
<strong class="item-link">Document Name</strong>
<span class="item-filename">Filename</span>
<span class="item-viewlink">View file in new window</span>
</div>
<?php
//$filetypes = Documents::FindUniqueFiletypes();
if (isset($filetypes) && count($filetypes) > 1) {
echo "<ul class=\"menu tabs\">\n\t\t<li>Show Only: </li>\n";
foreach ($filetypes as $type) {
echo "\t\t<li><a href=\"" . get_link("admin/list_documents/" . $type->file_type) . "\">{$type->file_type}</a></li>\n";
}
echo "\t\t<li><a class=\"hcd_button\" href=\"" . get_link("admin/list_documents/") . "\">Show All</a></li>\n\t</ul>\n ";
}
?>
<ul id="listitems" class="managelist">
<?php
foreach ($documents as $document) {
echo "\t\t<li>\n\t\t\t<span class=\"item-link\"><a href=\"" . get_link("/admin/edit_document/{$document->id}") . "\">{$document->name} <small>EDIT</small></a></span>\n\t\t\t<span class=\"item-filename\">{$document->filename}</span>\n\t\t\t<span class=\"item-viewlink\"><a href=\"" . $document->getPublicUrl() . "\" target=\"_blank\">View file</a></span>\n\t\t</li>\n";
}
?>
</ul>
<?php
} else {
echo "\t\t<h3 class=\"empty-list\">There are no documents to edit. <a class=\"short\" href=\"" . get_link("admin/add_document") . "\">Add one if you like</a>.</h3>";
}
}
示例2: __construct
function __construct()
{
// Deconstruct connection string
$params = @parse_url(MYACTIVERECORD_CONNECTION_STR);
$host = $params['host'];
if (isset($params['query'])) {
$host .= ":{$params['query']}";
}
// Open connection
$link = mysql_connect($host, $params['user'], $params['pass']);
if (!$link) {
die('Could not connect: ' . mysql_error());
} else {
// select database
mysql_select_db(str_replace('/', '', $params['path']), $link);
echo "<span style='color:blue'>Connected successfully</span><br />";
}
// 1. Create an Alias table if it does not exist
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'alias'")) == TRUE) {
echo "1) <span style='color:green'>alias table already exists</span><br />";
} else {
$query1 = "CREATE TABLE `alias` (\n `id` int(11) NOT NULL auto_increment,\n `alias` varchar(255) NOT NULL default '',\n `path` varchar(255) NOT NULL default '', \n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
if (mysql_query($query1)) {
echo "1) <span style='color:blue'>Alias Table Created</span><br />";
} else {
echo "<span style='color:red'>Error with query 1</span><br />";
}
}
// 2. Create a Blogs table if it does not exist
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'blogs'")) == TRUE) {
echo "2) <span style='color:green'>blogs table already exists</span><br />";
} else {
$query2 = "CREATE TABLE `blogs` (\n\t\t\t\t`id` int(11) NOT NULL auto_increment,\n\t\t\t\t`name` varchar(512) NOT NULL,\n\t\t\t\t`slug` varchar(512) NOT NULL,\n\t\t\t\t`user_id` int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;";
if (mysql_query($query2)) {
mysql_query("insert into `blogs` values('1','Your Blog','your_blog','1');");
echo "2) <span style='color:blue'>Blogs Table Created</span><br />";
} else {
echo "<span style='color:red'>Error with query 2</span><br />";
}
}
// 3. Create a Blog_Entries table if it does not exist
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'blog_entries'")) == TRUE) {
echo "3) <span style='color:green'>Blog Entries table already exists</span><br />";
} else {
$query3 = "CREATE TABLE `blog_entries` (\n\t\t\t\t`id` int(11) NOT NULL auto_increment,\n\t\t\t\t`title` varchar(512) NOT NULL,\n\t\t\t\t`slug` varchar(512) NOT NULL,\n\t\t\t\t`content` blob NOT NULL,\n\t\t\t\t`date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n\t\t\t\t`template` varchar(255) default null,\n\t\t\t\t`blog_id` int(11) NOT NULL,\n\t\t\t\t`public` tinyint(11) NOT NULL default '0',\n\t\t\t\t`author_id` tinyint(11) NOT NULL default '1',\n\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;";
if (mysql_query($query3)) {
echo "3) <span style='color:blue'>Blog Entries Table Created</span><br />";
} else {
echo "<span style='color:red'>Error with query 3</span><br />";
}
}
// 4. Check the pages table and add in the parent_page_id column, use for the newer drafts feature
if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `pages` LIKE 'parent_page_id'")) == TRUE) {
echo "4) <span style='color:green'>Pages > parent_page_id column already exists</span><br />";
} else {
$query4 = "ALTER TABLE pages ADD `parent_page_id` int(11) default NULL;";
if (mysql_query($query4)) {
echo "4) <span style='color:blue'>Page Parent ID column added to Pages table</span><br />";
} else {
echo "<span style='color:red'>Error with query 4</span><br />";
}
}
// 5. Check the PayPalconfig table and make sure the fields are the new names:
if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `paypal_config` LIKE 'success_url'")) == TRUE) {
echo "5) <span style='color:green'>Paypal_config > success_url column did not need to be renamed</span><br />";
} else {
$query5 = "ALTER TABLE `paypal_config` CHANGE `return` `success_url` text(0);";
if (mysql_query($query5)) {
echo "5) <span style='color:blue'>PayPal column name RETURN changed to SUCCESS_URL</span><br />";
} else {
echo "<span style='color:red'>Error with query 5</span><br />";
}
}
// 6. Check the PayPalconfig table and make sure the fields are the new names:
if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `paypal_config` LIKE 'cancel_url'")) == TRUE) {
echo "6) <span style='color:green'>Paypal_config > cancel_url column did not need to be renamed</span><br />";
} else {
$query6 = "ALTER TABLE `paypal_config` CHANGE `cancel_return` `cancel_url` text(0);";
if (mysql_query($query6)) {
echo "6) <span style='color:blue'>PayPal column name CANCEL_RETURN changed to CANCEL_URL</span><br />";
} else {
echo "<span style='color:red'>Error with query 6</span><br />";
}
}
// 7. Add a new column to the Documents table to allow sorting by type
if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `documents` LIKE 'file_type'")) == TRUE) {
echo "7) <span style='color:green'>Documents > file_type column already exists</span><br />";
} else {
$query7 = "ALTER TABLE documents ADD `file_type` varchar(6) default NULL;";
if (mysql_query($query7)) {
echo "7) <span style='color:blue'>Added the “file_type” column to Documents</span><br />";
} else {
echo "<span style='color:red'>Error with query 7</span><br />";
}
// Now, loop through the documents and add in data to the new column
$documents = Documents::FindAll();
$count = 0;
foreach ($documents as $doc) {
$doc->file_type = $doc->get_filetype();
$doc->save();
//.........這裏部分代碼省略.........
示例3: snippetPath
}
?>
<a href="#hide_all" class="openclose droplink">Close</a>
</p>
<?php
if (in_array(getRequestVarAtIndex(1), $pages)) {
echo "\t<div id=\"areachild\" class=\"dropslide\"";
if (getRequestVarAtIndex(1) == "add_page") {
echo ">\n";
} else {
echo " style=\"display: none;\">\n";
}
SUB_PAGES ? require_once snippetPath("admin-area_child") : (require_once snippetPath("admin-area"));
echo "\t</div>\n";
}
$documents = Documents::FindAll();
require_once snippetPath("admin-insertDoc");
$images = Images::FindAll();
require_once snippetPath("admin-insertImage");
if (GALLERY_INSTALL && !in_array(getRequestVarAtIndex(1), $portfolio)) {
$galleries = Galleries::FindAll("DESC");
require_once snippetPath("admin-insertGallery");
}
if (PORTFOLIO_INSTALL && (ITEM_GALLERY_INSERT && !in_array(getRequestVarAtIndex(1), $portfolio))) {
//$galleries = Galleries::FindAll();
require_once snippetPath("admin-insertItemGallery");
}
if (VIDEO_INSTALL) {
require_once snippetPath("admin-insertVideo");
}
if (TESTIMONIAL_INSTALL) {