Hi
Ich hab leider keine Ahnung vom PHP
Ich hab dieses Code hier und moechte beide {$row->times} - {$row->title}
als Arial fett mit gelber Hintergrund haben.
Weiss Jemand wie man das macht?
Hier ist der code.
Werde fuer jede Hilfe dankbar sein.
Gruss
<?php
/**
* @version 1.0 $Id: view.html.php 958 2009-02-02 17:23:05Z julienv $
* @package Joomla
* @subpackage EventList
* @copyright (C) 2005 - 2009 Christoph Lukes
* @license GNU/GPL, see LICENSE.php
* EventList is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License 2
* as published by the Free Software Foundation.
* EventList is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with EventList; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view');
echo '<script language="javascript">';
echo 'function abc() {';
echo 'window.location.href = (window.location.href + "&print=true")';
echo '}';
echo '</script>';
/**
* HTML View class for the Day View
*
* @package Joomla
* @subpackage EventList
* @since 0.9
*/
class EventListViewDay extends JView
{
/**
* Creates the Day View
*
* @since 0.9
*/
function display( $tpl = null )
{
global $mainframe;
//initialize variables
$document = & JFactory::getDocument();
$elsettings = & ELHelper::config();
$menu = & JSite::getMenu();
$item = $menu->getActive();
$params = & $mainframe->getParams();
$user =& JFactory::getUser();
$id = $user->get('id');
//add css file
$document->addStyleSheet($this->baseurl.'/components/com_eventlist/assets/css/eventlist.css');
$document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
// get variables
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
$pop = JRequest::getBool('pop');
$pathway = & $mainframe->getPathWay();
//get data from model
$rows = & $this->get('Data');
$total = & $this->get('Total');
$day = & $this->get('Day');
$daydate = strftime( $elsettings->formatdate, strtotime( $day ));
//are events available?
if (!$rows) {
$noevents = 1;
} else {
$noevents = 0;
}
//params
$params->def( 'page_title', $item->name);
if ( $pop ) {//If printpopup set true
$params->set( 'popup', 1 );
}
$print_link = JRoute::_('index.php?view=day&tmpl=component&pop=1');
//pathway
$pathway->setItemName( 1, $item->name );
//Set Page title
if (!$item->name) {
$document->setTitle($params->get('page_title'));
$document->setMetadata( 'keywords' , $params->get('page_title') );
}
//Check if the user has access to the form
$maintainer = ELUser::ismaintainer();
$genaccess = ELUser::validate_user( $elsettings->evdelrec, $elsettings->delivereventsyes );
if ($maintainer $genaccess ) $dellink = 1;
//add alternate feed link
$link = 'index.php?option=com_eventlist&view=eventlist&format=feed';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
// Create the pagination object
$page = $total - $limit;
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
//create select lists
$lists = $this->_buildSortLists();
$this->assign('lists' , $lists);
$this->assignRef('rows' , $rows);
$this->assignRef('noevents' , $noevents);
$this->assignRef('print_link' , $print_link);
$this->assignRef('params' , $params);
$this->assignRef('dellink' , $dellink);
$this->assignRef('pageNav' , $pageNav);
$this->assignRef('page' , $page);
$this->assignRef('elsettings' , $elsettings);
$this->assignRef('lists' , $lists);
$this->assignRef('daydate' , $daydate);
parent::display($tpl);
//if((!empty($id) $id != "Null") && ($id='86'))
//{
//$pp = $this->onlinepdfgenerator();
//}
if ($_GET['print'] == "true")
{
$ss = $this->callOnlinepdfgenerator();
} // end if
}//function ListEvents end
/**
* Manipulate Data
*
* @access public
* @return object $rows
* @since 0.9
*/
function &getRows()
{
$count = count($this->rows);
if (!$count) {
return;
}
$k = 0;
foreach($this->rows as $key => $row)
{
$row->odd = $k;
$this->rows[$key] = $row;
$k = 1 - $k;
}
return $this->rows;
}
/**
* Method to build the sortlists
*
* @access private
* @return array
* @since 0.9
*/
function _buildSortLists()
{
$elsettings = & ELHelper::config();
$filter_order = JRequest::getCmd('filter_order', 'a.dates');
$filter_order_Dir = JRequest::getWord('filter_order_Dir', 'ASC');
$filter = JRequest::getString('filter');
$filter_type = JRequest::getString('filter_type');
$sortselects = array();
$sortselects[] = JHTML::_('select.option', 'title', $elsettings->titlename );
$sortselects[] = JHTML::_('select.option', 'venue', $elsettings->locationname );
$sortselects[] = JHTML::_('select.option', 'city', $elsettings->cityname );
if ($elsettings->showcat) {
$sortselects[] = JHTML::_('select.option', 'type', $elsettings->catfroname );
}
$sortselect = JHTML::_('select.genericlist', $sortselects, 'filter_type', 'size="1" class="inputbox"', 'value', 'text', $filter_type );
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
$lists['filter'] = $filter;
$lists['filter_type'] = $sortselect;
return $lists;
}
//Hanen :Start
function do_post_request($url, $data) {
$data = array("options" => base64_encode(json_encode($data)));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PORT, "80");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
return $response;
} // end do_post_request()
function force_pdf_download($stream, $filename_to_save_as = "output.pdf") {
if ($stream && (substr($stream, 0, 5) == "%PDF-")) {
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Length: ".strlen($stream));
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename=\"${filename_to_save_as}\"");
echo $stream;
} // end if
} // end force_pdf_download()
// ================================================================
// ADDED TWO NEW FUNCTIONS HERE:
// ================================================================
function strip_characters($string, $character_whitelist=array()) {
$return = "";
if ($string && is_string($string)) {
for ($x = 0; $x < strlen($string); $x++) {
$char = $string[$x];
if (is_numeric(ord($char)) && in_array(ord($char), $character_whitelist)) {
$return .= $string[$x];
} // end if
} // end for
} // end if
return $return;
} // end strip_characters()
// ================================================================
function strip_nonstandard_ascii($string) {
for ($x = 0; $x < 128; $x++) {
$whitelist[] = $x;
} // end for
return $this->strip_characters($string, $whitelist);
} // end strip_nonstandard_ascii()
// ================================================================
function onlinepdfgenerator() {
ob_clean();
$url = "http://print.onlinepdfprinter.com";
$rows = & $this->get('Data');
$data = array(); // DATA TO SEND TO PDF PRINTER
$sections = array("morgen", "vormittag", "mittag", "nachmittag", "abend");
$cats = array("aust", "besi", "bild", "brun", "char", "fami", "floh", "frei", "gart", "gesu", "kind", "kirm", "konz", "mark", "mess", "musi", "offe", "rumm", "rund", "sais", "sons", "spec", "spor", "tage");
// initialize static data
foreach ($cats as $cat) {
foreach ($sections as $section) {
$data['static_data']['${cat}_${section}'] = "";
} // end foreach
} // end foreach
foreach ($rows as $row) {
if (($row->times >= "06:00:00") && ($row->times < "09:00:00")) {
$section = "morgen";
} else if (($row->times >= "09:00:00") && ($row->times <= "12:00:00")) {
$section = "vormittag";
} else if (($row->times >= "12:00:00") && ($row->times <= "15:00:00")) {
$section = "mittag";
} else if (($row->times >= "15:00:00") && ($row->times <= "18:00:00")) {
$section = "nachmittag";
} else {
$section = "abend";
} // end if
switch ($this->strip_nonstandard_ascii($row->categories[0]->catname)) {
case $this->strip_nonstandard_ascii("Ausstellungen"):
$variable = "aust_${section}";
break;
case $this->strip_nonstandard_ascii("Besichtigungen"):
$variable = "besi_${section}";
break;
case $this->strip_nonstandard_ascii("Bildung"):
$variable = "bild_${section}";
break;
case $this->strip_nonstandard_ascii("Brunch & Breakfast"):
$variable = "brun_${section}";
break;
case $this->strip_nonstandard_ascii("Charity"):
$variable = "char_${section}";
break;
case $this->strip_nonstandard_ascii("Familienfeste"):
$variable = "fami_${section}";
break;
case $this->strip_nonstandard_ascii("Flohmärkte"):
$variable = "floh_${section}";
break;
case $this->strip_nonstandard_ascii("Freizeitparks"):
$variable = "frei_${section}";
break;
case $this->strip_nonstandard_ascii("Gartenfestivals"):
$variable = "gart_${section}";
break;
case $this->strip_nonstandard_ascii("Gesundheit"):
$variable = "gesu_${section}";
break;
case $this->strip_nonstandard_ascii("Kinderwelten"):
$variable = "kind_${section}";
break;
case $this->strip_nonstandard_ascii("Konzerte und Gesang"):
$variable = "konz_${section}";
break;
case $this->strip_nonstandard_ascii("Märkte"):
$variable = "mark_${section}";
break;
case $this->strip_nonstandard_ascii("Messen"):
$variable = "mess_${section}";
break;
case $this->strip_nonstandard_ascii("Musik & Theater"):
$variable = "musi_${section}";
break;
case $this->strip_nonstandard_ascii("Offene Türen"):
$variable = "offe_${section}";
break;
case $this->strip_nonstandard_ascii("Rummel / Kirmes"):
$variable = "rumm_${section}";
break;
case $this->strip_nonstandard_ascii("Rundfahrten"):
$variable = "rund_${section}";
break;
case $this->strip_nonstandard_ascii("Saisonales"):
$variable = "sais_${section}";
break;
case $this->strip_nonstandard_ascii("Sonstiges"):
$variable = "sons_${section}";
break;
case $this->strip_nonstandard_ascii("Special-Events"):
$variable = "spec_${section}";
break;
case $this->strip_nonstandard_ascii("Sportliches"):
$variable = "spor_${section}";
break;
case $this->strip_nonstandard_ascii("Tagestipps"):
$variable = "tage_${section}";
break;
default:
$variable = "";
break;
} // end switch
$data['static_data'][$variable] .= "{$row->times} - {$row->title} - {$row->datdescription} - {$row->venue} - {$row->street} - {$row->city} - {$row->plz} - {$row->state} - {$row->url}\n";
} // end foreach
//$data['static_data']['date_printed'] = strftime("%D %T", time());
$data['static_data']['date_printed'] = strftime("%Y-%m-%d", time());
$data['static_data']['sonntag'] = "SONNTAGS-KALENDER";
$options = array("template" => "hanen.4_page.doc",
"api_key" => "pRaDS-Iq9TS-4GUkN",
"static_data" => $data['static_data'],
"rows" => $rows, // TEMPORARY, REMOVE THIS LINE LATER
"rows_per_page" => 1,
"test_mode" => true,
);
$pdf_data = $this->do_post_request($url, $options);
$filename = "category_eventlist." . strftime("%Y-%m-%d", time()) . ".pdf";
ob_clean();
$this->force_pdf_download($pdf_data, $filename);
exit;
} // end onlinepdfgenerator()
function callOnlinepdfgenerator(){
$user =& JFactory::getUser();
$id = $user->get('id');
if($id == '86')
{
$pp = $this->onlinepdfgenerator();
}
}
//Hanen :End
}
?>
<img src="../templates/rt_versatility_ii_sienna_j15/images/pdf_button.png" border="0" onclick="abc();">