PHP-Code:
/**
*
* GETTING DATA
*
**/
function getDatas()
{
//
$db =& JFactory::getDBO();
// getting instance of GK_JoomlaNews
$newsClass = new GK_JoomlaNews();
// Getting list of categories
$categories = $newsClass->getSources($this->config, 0);
// Standard mode
if($this->config["mode"] == 'standard')
{
// init string for more in text
$this->more_in_text = '';
// if in database exist some needs datas
if($categories)
{
$sql_where = '';
//
$j = 0;
// getting categories ItemIDs
foreach ($categories as $item)
{
$this->more_in_text .= '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($item->ID,$item->SID)).'">'. $item->name .'</a>, ';
//
$sql_where .= ($j != 0) ? ' OR content.catid = '.$item->ID : ' content.catid = '.$item->ID;
//
$j++;
}
//
$this->more_in_text = JText::_('MORE_IN').": ".JString::substr($this->more_in_text, 0, JString::strlen($this->more_in_text)-2);
}
// getting content
$this->content = $newsClass->getNewsStandardMode($categories, $sql_where, $this->config, (($this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages']) + ($this->config['links_amount'] * $this->config['news_short_pages'])));
// getting images
$this->images = $newsClass->getImages($this->config, 'News Pro GK1');
}
else // Column mode
{
// init string for more in text
$this->more_in_text = array();
// if in database exist some needs datas
if($categories)
{
$sql_where = array();
//
$j = 0;
// getting categories ItemIDs
foreach ($categories as $item)
{
$this->more_in_text[] = '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($item->ID, $item->SID)).'">'. JText::_('SEE_ALL') .'</a>';
//
$sql_where[] = $item->ID;
//
$j++;
}
}
// getting content
$this->content = $newsClass->getNewsCategoryMode($categories, $sql_where, $this->config, (($this->config['news_column'] * $this->config['news_rows']) + ($this->config['links_amount'])));
// getting images
$this->images = $newsClass->getImages($this->config, 'News Pro GK1');
}
}
/**
*
* RENDERING LAYOUT
*
**/
function renderLayout()
{
$renderer = new GK1NewsProLayoutParts();
// tables which will be used in generated content
$news_list_tab = array();
//
$news_html_tab = array();
// Generating content
$uri =& JURI::getInstance();
if($this->config['mode'] == 'category')
{
//
for($n = 0; $n < count($this->content["ID"]); $n++)
{
$news_html_tab[$n] = array();
$news_list_tab[$n] = array();
//
$li_counter = 0;
//
for($i = 0; $i < count($this->content["ID"][$n]); $i++)
{
//
if($i < ($this->config['news_column'] * $this->config['news_rows']))
{
/*
GENERATING NEWS CONTENT
*/
// GENERATING HEADER
$news_header = $renderer->returnHeader($this->config, $this->content['ID'][$n][$i], $this->content['CID'][$n][$i], $this->content['SID'][$n][$i], $this->content['title'][$n][$i]);
// GENERATING IMAGE
$news_image = $renderer->returnImage($this->config, $this->images, $uri, $this->content['ID'][$n][$i], $this->content['IID'][$n][$i], $this->content['CID'][$n][$i], $this->content['SID'][$n][$i], $this->content['text'][$n][$i]);
// GENERATING READMORE
$news_readmore = $renderer->returnReadMore($this->config, $this->content['ID'][$n][$i], $this->content['CID'][$n][$i], $this->content['SID'][$n][$i]);
// GENERATING TEXT
$news_textt = $renderer->returnText($this->config, $this->content['ID'][$n][$i], $this->content['CID'][$n][$i], $this->content['SID'][$n][$i], $this->content['text'][$n][$i], $news_readmore);
// GENERATE NEWS INFO
$news_infoo = $renderer->returnInfo($this->config, $this->content['catname'][$n][$i], $this->content['CID'][$n][$i], $this->content['SID'][$n][$i], $this->content['author'][$n][$i], $this->content['date'][$n][$i]);
// PARSING PLUGINS
if($this->config['parse_plugins'] == TRUE)
{
//
$news_textt = $this->ParsePlugins($news_textt);
}
// GENERATE CONTENT FOR TAB
$news_generated_content = ''; // initialize variable
//
for($j = 1;$j < 5;$j++)
{
//
if($this->config['news_header_order'] == $j) $news_generated_content .= $news_header;
//
if($this->config['news_image_order'] == $j) $news_generated_content .= $news_image;
//
if($this->config['news_text_order'] == $j) $news_generated_content .= $news_textt;
//
if($this->config['news_info_order'] == $j) $news_generated_content .= $news_infoo;
}
//
if($this->config['news_content_readmore_pos'] != 4)
{
//
$news_generated_content .= $news_readmore;
}
// creating table with news content
$news_html_tab[$n][] = $news_generated_content;
}
else //
{
if($li_counter % $this->config['links_amount'] == 0) $li_counter = 0;
//
$news_list_tab[$n][] = $renderer->returnList($this->config, $this->content['ID'][$n][$i], $this->content['CID'][$n][$i], $this->content['SID'][$n][$i], $this->content['title'][$n][$i], $this->content['text'][$n][$i], $li_counter % 2);
//
$li_counter++;
}
}
}
}
else
{
//
$li_counter = 0;
//
for($i = 0; $i < count($this->content["ID"]); $i++)
{
//
if($i < ($this->config['news_column'] * $this->config['news_rows'] * $this->config['news_full_pages']))
{
/*
GENERATING NEWS CONTENT
*/
// GENERATING HEADER
$news_header = $renderer->returnHeader($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['SID'][$i], $this->content['title'][$i]);
// GENERATING IMAGE
$news_image = $renderer->returnImage($this->config, $this->images, $uri, $this->content['ID'][$i], $this->content['IID'][$i], $this->content['CID'][$i], $this->content['SID'][$i], $this->content['text'][$i]);
// GENERATING READMORE
$news_readmore = $renderer->returnReadMore($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['SID'][$i]);
// GENERATING TEXT
$news_textt = $renderer->returnText($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['SID'][$i], $this->content['text'][$i], $news_readmore);
// GENERATE NEWS INFO
$news_infoo = $renderer->returnInfo($this->config, $this->content['catname'][$i], $this->content['CID'][$i], $this->content['SID'][$i], $this->content['author'][$i], $this->content['date'][$i]);
// PARSING PLUGINS
if($this->config['parse_plugins'] == TRUE)
{
//
$news_textt = $this->ParsePlugins($news_textt);
}
// GENERATE CONTENT FOR TAB
$news_generated_content = ''; // initialize variable
//
for($j = 1;$j < 5;$j++)
{
//
if($this->config['news_header_order'] == $j) $news_generated_content .= $news_header;
//
if($this->config['news_image_order'] == $j) $news_generated_content .= $news_image;
//
if($this->config['news_text_order'] == $j) $news_generated_content .= $news_textt;
//
if($this->config['news_info_order'] == $j) $news_generated_content .= $news_infoo;
}
//
if($this->config['news_content_readmore_pos'] != 4)
{
//
$news_generated_content .= $news_readmore;
}
// creating table with news content
$news_html_tab[] = $news_generated_content;
}
else //
{
if($li_counter % $this->config['links_amount'] == 0) $li_counter = 0;
//
$news_list_tab[] = $renderer->returnList($this->config, $this->content['ID'][$i], $this->content['CID'][$i], $this->content['SID'][$i], $this->content['title'][$i], $this->content['text'][$i], $li_counter % 2);
//
$li_counter++;
}
}
}
Lesezeichen