Ejemplo n.º 1
0
if (!($mainparents = $sqlm->db_Select("pcontent", "*", "content_class REGEXP '" . e_CLASS_REGEXP . "' AND content_parent = '0' " . $datequery . " " . $headingquery . " ORDER BY content_heading"))) {
    $LIST_DATA = "no valid content category";
    return;
}
while ($rowm = $sqlm->db_Fetch()) {
    $ICON = "";
    $HEADING = "";
    $AUTHOR = "";
    $CATEGORY = "";
    $DATE = "";
    $INFO = "";
    $LIST_CAPTION = $rowm['content_heading'];
    //global var for this main parent
    $mainparent = $rowm['content_id'];
    //get path variables
    $content_recent_pref = $aa->getContentPref($mainparent);
    $content_recent_pref["content_icon_path"] = $content_recent_pref["content_icon_path"] ? $content_recent_pref["content_icon_path"] : "{e_PLUGIN_ABS}content/images/icon/";
    $content_icon_path = $tp->replaceConstants($content_recent_pref["content_icon_path"]);
    //prepare query string
    $array = $aa->getCategoryTree("", $mainparent, TRUE);
    $validparent = implode(",", array_keys($array));
    $qry = " content_refer !='sa' AND content_parent REGEXP '" . $aa->CONTENTREGEXP($validparent) . "' AND content_class REGEXP '" . e_CLASS_REGEXP . "' ";
    //check so only the preferences from the correct content_type (article, content, review etc) are used and rendered
    if (substr($contentmode, 8) == $rowm['content_id']) {
        if ($mode == "new_page" || $mode == "new_menu") {
            $lvisit = $this->getlvisit();
            $qry = $qry . " AND content_datestamp>" . $lvisit;
        } else {
            $qry = $qry . " " . $datequery;
        }
        $qry .= " ORDER BY content_datestamp DESC LIMIT 0," . intval($arr[7]);
Ejemplo n.º 2
0
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);
}