function print_item_pdf($id) { global $tp, $pref, $content_shortcodes; global $CONTENT_PRINT_IMAGES, $row, $content_image_path, $content_pref, $mainparent; //in this section you decide what to needs to be output to the pdf file $con = new convert(); require_once e_PLUGIN . "content/content_shortcodes.php"; require_once e_PLUGIN . "content/handlers/content_class.php"; $aa = new content(); if (!is_object($sql)) { $sql = new db(); } $sql->db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_image, content_author, content_parent, content_datestamp, content_class, content_pref", "content_id='" . intval($id) . "' "); $row = $sql->db_Fetch(); if (!check_class($row['content_class'])) { header("location:" . e_PLUGIN . "content/content.php"); exit; } $authordetails = $aa->getAuthor($row['content_author']); $row['content_datestamp'] = $con->convert_date($row['content_datestamp'], "long"); $img = $tp->parseTemplate('{CONTENT_PRINT_IMAGES}', FALSE, $content_shortcodes); $mainparent = $aa->getMainParent(intval($id)); $content_pref = $aa->getContentPref($mainparent); $content_icon_path = $tp->replaceConstants($content_pref["content_icon_path"]); $content_image_path = $tp->replaceConstants($content_pref["content_image_path"]); $img = $tp->parseTemplate('{CONTENT_PDF_IMAGES}', FALSE, $content_shortcodes); //add custom and preset tags if present $custom = e107::unserialize($row['content_pref']); //$custom = $eArrayStorage->ReadxxxArray($row['content_pref']); $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = ""; if (!empty($custom)) { foreach ($custom as $k => $v) { if ($k == "content_custom_presettags") { if (isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]) { foreach ($v as $ck => $cv) { if (is_array($cv)) { //date if (!($cv['day'] == "" && $cv['month'] == "" && $cv['year'] == "")) { $vv = $cv['day'] . " " . $months[$cv['month'] - 1] . " " . $cv['year']; } } else { $vv = $cv; } if (isset($ck) && $ck != "" && isset($vv) && $vv != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />"; } } } } else { if (isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]) { $key = substr($k, 15); if (isset($key) && $key != "" && isset($v) && $v != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />"; } } } } } $text = "\n\t<b>" . $row['content_heading'] . "</b><br />\n\t" . $row['content_subheading'] . "<br />\n\t" . $authordetails[1] . ", " . $row['content_datestamp'] . "<br />\n\t<br />\n\t" . $row['content_text'] . "<br />\n\t" . ($CONTENT_CONTENT_TABLE_CUSTOM_TAGS ? $CONTENT_CONTENT_TABLE_CUSTOM_TAGS : "") . "\n\t<div style='float:left; padding-left:10px;'>" . $img . "</div>\n\t"; //the following defines are processed in the document properties of the pdf file //Do NOT add parser function to the variables, leave them as raw data ! //as the pdf methods will handle this ! $text = $text; //define text $creator = SITENAME; //define creator $author = $authordetails[1]; //define author $title = $row['content_heading']; //define title $subject = $row['content_subheading']; //define subject $keywords = ""; //define keywords //define url to use in the header of the pdf file $url = SITEURLBASE . e_PLUGIN_ABS . "content/content.php?content." . $row['content_id']; //always return an array with the following data: return array($text, $creator, $author, $title, $subject, $keywords, $url); }
if (array_key_exists($rowi['content_parent'], $array)) { $newarr = $array[$rowi['content_parent']]; $newarr = array_reverse($newarr); $CATEGORY = "<a href='" . e_PLUGIN_ABS . "content/content.php?cat." . $newarr[1] . "'>" . $newarr[0] . "</a>"; } } $DATE = $arr[5] ? $this->getListDate($rowi['content_datestamp'], $mode) : ""; //$ICON = $this -> getBullet($arr[6], $mode); $image_link_append = "<a href='" . e_PLUGIN_ABS . "content/content.php?content." . $rowi['content_id'] . "'>"; if ($rowi['content_icon'] && file_exists(e_PLUGIN . "content/images/icon/" . $rowi['content_icon'])) { $ICON = $image_link_append . "<img src='" . e_PLUGIN_ABS . "content/images/icon/" . $rowi['content_icon'] . "' style='width:50px; border:1px solid #000;' alt='' /></a>"; } else { $ICON = ""; } //get author details if ($arr[3]) { $authordetails = $aa->getAuthor($rowi['content_author']); if (USER && is_numeric($authordetails[0]) && $authordetails[0] != "0") { $AUTHOR = "<a href='" . e_HTTP . "user.php?id." . $authordetails[0] . "' >" . $authordetails[1] . "</a>"; } else { $AUTHOR = $authordetails[1]; } } else { $AUTHOR = ""; } $INFO = ""; $LIST_DATA[$mode][] = array($ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO); } } } }
} //##### ------------------------------------------------------------------------------------ //##### create rss data, return as array $eplug_rss_data ----------------------------------- $mainparent = $aa->getMainParent($this->topicid); $content_pref = $aa->getContentPref($mainparent); $array = $aa->getCategoryTree("", $mainparent, TRUE); $datequery = " AND content_datestamp < " . time() . " AND (content_enddate=0 || content_enddate>" . time() . ") "; $qry = " content_refer !='sa' " . $datequery . " AND content_class REGEXP '" . e_CLASS_REGEXP . "' AND content_parent = '" . $this->topicid . "' ORDER BY content_datestamp DESC LIMIT 0," . $this->limit; $rss = array(); $sqlrss = new db(); if ($items = $sqlrss->db_Select('pcontent', "*", $qry)) { $i = 0; while ($rowrss = $sqlrss->db_Fetch()) { //$author = array($author_id, $author_name, $author_email, $content_author); $rowrss['url_content_id'] = $rowrss['content_parent']; $author = $aa->getAuthor($rowrss['content_author']); $rss[$i]['author'] = $author[1]; $rss[$i]['author_email'] = $author[2]; $rss[$i]['link'] = $e107->base_path . $PLUGINS_DIRECTORY . "content/content.php?content." . $rowrss['content_id']; $rss[$i]['linkid'] = $rowrss['content_id']; $rss[$i]['title'] = $rowrss['content_heading']; $rss[$i]['description'] = $rowrss['content_subheading']; $rss[$i]['category_name'] = $array[$rowrss['content_parent']][count($array[$rowrss['content_parent']]) - 1]; //$rss[$i]['category_link'] = $e107->base_path.$PLUGINS_DIRECTORY."content/content.php?cat.".$rowrss['content_parent']; $rss[$i]['category_link'] = e107::url("content", "cat", $rowrss, "full"); $rss[$i]['datestamp'] = $rowrss['content_datestamp']; $rss[$i]['enc_url'] = ""; $rss[$i]['enc_leng'] = ""; $rss[$i]['enc_type'] = ""; $i++; }