Commit 36e3ab7c authored by jcnventura's avatar jcnventura

Profile printing is not working. Since utility is not clear, I am removing itfor now

parent 511704f9
......@@ -17,17 +17,6 @@ INSTALLATION:
Administer > Site configuration > Printer friendly (admin/settings/print)
********************************************************************
PROFILE PRINTING
To print any profile page, change any profile URL from:
http://www.example.com/profile
to
http://www.example.com/print/profile
********************************************************************
CUSTOMIZATION:
......
; $Id$
name = "Printer-friendly pages"
description = "Allows users to create printer-friendly pages for nodes and profile pages."
description = "Adds a printer-friendly version link to node pages."
......@@ -27,7 +27,7 @@ function print_menu($may_cache) {
$items[] = array(
'path' => 'admin/settings/print',
'title' => t('Printer friendly'),
'description' => t('Allows users to create printer-friendly pages for nodes and profile pages.'),
'description' => t('Adds a printer-friendly version link to node pages.'),
'callback' => 'drupal_get_form',
'callback arguments' => array('print_main_settings')
);
......@@ -271,103 +271,6 @@ function print_generate_node($title) {
include_once('print.node.tpl.php');
}
/**
* Renders a print friendly version of profile pages.
*/
function print_generate_profile() {
global $base_url;
$source_url = $base_url . substr($_GET['q'], 5);
$language = $GLOBALS['locale'];
$name = arg(2);
$value = arg(3);
$field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page, visibility FROM {profile_fields} WHERE name = '%s'", $name));
$robots_meta = _print_robots_meta_generator();
$print_settings = variable_get('print_settings', NULL);
$node->printcss = empty($print_settings['css']) ? 'misc/print.css' : $print_settings['css'];
if ($name && $field->fid) {
// Do not allow browsing of private fields by non-admins
if (!user_access('administer users') && $field->visibility == PROFILE_PRIVATE) {
drupal_access_denied();
return;
}
// Compile a list of fields to show
$fields = array();
$result = db_query('SELECT name, title, type FROM {profile_fields} WHERE fid != %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
// Determine what query to use:
switch ($field->type) {
case 'checkbox':
$query = 'v.value = 1';
break;
case 'selection':
$query = "v.value = '". db_escape_string($value) ."'";
break;
case 'list':
$query = "v.value LIKE '%%". db_escape_string($value) ."%%'";
break;
default:
drupal_not_found();
return;
}
// Extract the affected users:
$result = db_query("SELECT u.uid FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query", $field->fid);
$output = '<div id="profile">';
while ($account = db_fetch_object($result)) {
$user = user_load(array('uid' => $account->uid));
$sort[$user->profile_lastname] = $user;
}
ksort($sort);
foreach ($sort as $user) {
$output .= theme('profile_profile', $user, $fields);
}
if ($field->type == 'selection' || $field->type == 'list') {
$title = strtr($field->page, array('%value' => theme('placeholder', $value)));
}
else {
$title = $field->page;
}
$output .= '</div>';
include_once('print.profile.tpl.php');
}
else if ($name && !$field->id) {
drupal_not_found();
}
else {
// Compile a list of fields to show
$fields = array();
$result = db_query('SELECT name, title, type FROM {profile_fields} WHERE visibility = %d', PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
// Extract the affected users:
$result = pager_query("SELECT uid FROM {users} WHERE uid > 0 ORDER BY access DESC", 20, 0, NULL);
$output = '<div id="profile">';
while ($account = db_fetch_object($result)) {
$output .= theme('profile_profile', user_load(array('uid' => $account->uid)), $fields);
}
$output .= '</div>';
$output .= theme('pager', NULL, 20);
$title = t('user list');
include_once('print.profile.tpl.php');
}
}
function print_friendly_urls($url = 0, $nid) {
static $urls = array();
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language; ?>" xml:lang="<?php print $language; ?>">
<head>
<title><?php print strip_tags($title); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php print $robots_meta; ?>
<base href="<?php print $node->url ?>/" />
<style type="text/css">
@import url(<?php print $node->printcss; ?>);
</style>
</head>
<body>
<?php theme_get_setting('logo') ? print '<img src="'.theme_get_setting('logo').'" alt="logo" border="0" />' : '';?>
<div class="source_url">
<?php variable_get('site_name', 0) && print t('Published from').' '.variable_get('site_name', 0).' ('.l($base_url,'').')'; ?>
</div>
<h2 class="title"><?php print $title; ?></h2>
<div class="content"><?php print $output; ?></div>
<hr style="border:0;height:1px;color:#9E9E9E;background-color:#9E9E9E;" />
<div class="source_url">
<?php print '<strong>'.t('Source URL (retrieved on '. date(r).'):').'</strong> <a href="'.$source_url.'>">'.$source_url.'</a>'?>
</div>
<div class="date-printed">
<?php print '<strong>'.t('This page was printed on %date and is updated often.', array('%date' => format_date(time()))). '</strong>'; ?>
</div>
<div class="pfp-links">
<!-- Output printer friendly links -->
<?php $node->pfp_links ? print '<p class="links"><strong>'.t('Links:').'</strong><br />'.$node->pfp_links.'</p>' : ''; ?>
</div>
<div class="footer">
</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment