添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@204 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
# @version $Id: modules/mod_apoll/helper.php
|
||||
# @package: Apoll Vote
|
||||
# ===================================================
|
||||
# @author
|
||||
# Name: Hristo Genev
|
||||
# Email: [email protected]
|
||||
# Url: http://www.afactory.org
|
||||
# ===================================================
|
||||
# @copyright Copyright (C) 2008 aFactory.org All rights reserved.
|
||||
# @license see http://www.gnu.org/licenses/lgpl.html GNU/LGPL.
|
||||
# You can use, redistribute this file and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
class modApollHelper
|
||||
{
|
||||
|
||||
function getApollOptions($apoll_id)
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$query = "SELECT o.id, o.text, o.ordering" .
|
||||
" FROM ".$db->nameQuote('#__apoll_options') . " AS o " .
|
||||
" WHERE o.apoll_id = " . (int) $apoll_id .
|
||||
" AND o.text <> ''" .
|
||||
" ORDER BY o.ordering"
|
||||
;
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
if (!($options = $db->loadObjectList())) {
|
||||
echo "helper ".$db->stderr();
|
||||
return;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
// checks if user has voted (if cookie is set)
|
||||
function alreadyVoted($id) {
|
||||
|
||||
global $mainframe;
|
||||
|
||||
$cookieName = JUtility::getHash( $mainframe->getName() . 'apoll' . $id );
|
||||
$voted = JRequest::getVar( $cookieName, '0', 'COOKIE', 'INT');
|
||||
|
||||
return $voted;
|
||||
}
|
||||
|
||||
function userVoted($user_id, $apoll_id) {
|
||||
$db =& JFactory::getDBO();
|
||||
$query = "SELECT date FROM ".$db->nameQuote('#__apoll_votes')
|
||||
." WHERE apoll_id=".(int) $apoll_id
|
||||
." AND user_id=".(int)$user_id
|
||||
;
|
||||
$db->setQuery($query);
|
||||
|
||||
return $userVoted=($db->loadResult())?1:0;
|
||||
}
|
||||
|
||||
function ipVoted($apoll_id) {
|
||||
$db =& JFactory::getDBO();
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$query = "SELECT ip FROM ".$db->nameQuote('#__apoll_votes')
|
||||
."WHERE apoll_id=".(int) $apoll_id."
|
||||
AND ip = INET_ATON('".$ip."')"
|
||||
;
|
||||
$db->setQuery($query);
|
||||
|
||||
return $ipVoted=($db->loadResult()) ? 1:0;
|
||||
}
|
||||
|
||||
function getResults($apoll_id) {
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$query = "SELECT o.*, COUNT(v.id) AS hits,
|
||||
(SELECT COUNT(id) FROM ".$db->nameQuote('#__apoll_votes')." WHERE apoll_id=".$apoll_id.") AS votes
|
||||
FROM ".$db->nameQuote('#__apoll_options')." AS o
|
||||
LEFT JOIN ".$db->nameQuote('#__apoll_votes')." AS v
|
||||
ON (o.id = v.option_id AND v.apoll_id = ".(int)$apoll_id . ")
|
||||
WHERE o.apoll_id=".(int)$apoll_id ."
|
||||
AND o.text <> ''
|
||||
GROUP BY o.id
|
||||
ORDER BY o.ordering";
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
function getActivePolls() {
|
||||
$db =& JFactory::getDBO();
|
||||
$query = "SELECT id FROM ".$db->nameQuote('#__apoll_polls') .
|
||||
" WHERE published = 1";
|
||||
$db->setQuery($query);
|
||||
if ($ids = $db->loadResultArray()) {
|
||||
return $ids;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getItemid($apoll_id) {
|
||||
|
||||
$component =& JComponentHelper::getComponent('com_apoll');
|
||||
$menus =& JApplication::getMenu('site', array());
|
||||
$items = $menus->getItems('componentid', $component->id);
|
||||
$match = null;
|
||||
$itemid = null;
|
||||
|
||||
if (isset($items)) {
|
||||
foreach ($items as $item) {
|
||||
if ((@$item->query['view'] == 'apoll') && (@$item->query['id'] == $apoll_id)) {
|
||||
$itemid = $item->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return '&Itemid='.$itemid;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
# @file: modules/mod_apoll/mod_apoll.php
|
||||
# @package: aPoll
|
||||
# ===================================================
|
||||
# @author
|
||||
# Name: Hristo Genev
|
||||
# Email: [email protected]
|
||||
# Url: http://www.afactory.org
|
||||
# ===================================================
|
||||
# @copyright Copyright (C) 2008 aFactory.org All rights reserved.
|
||||
# @license see http://www.gnu.org/licenses/lgpl.html GNU/LGPL.
|
||||
# You can use, redistribute this file and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
$tabclass_arr = array ('sectiontableentry2', 'sectiontableentry1');
|
||||
|
||||
$menu = &JSite::getMenu();
|
||||
$items = $menu->getItems('link', 'index.php?option=com_apoll&view=apoll');
|
||||
$itemid = isset($items[0]) ? '&Itemid='.$items[0]->id : '';
|
||||
$details = "";
|
||||
|
||||
$apoll_id = $params->get( 'id', 0 );
|
||||
//if Show random poll is selected
|
||||
if (!$apoll_id) {
|
||||
$ids = modApollHelper::getActivePolls();
|
||||
|
||||
if (count($ids) > 1) {
|
||||
$apoll_id = $ids[array_rand($ids)];
|
||||
} else {
|
||||
$apoll_id = $ids[0];
|
||||
}
|
||||
}
|
||||
|
||||
$results = modApollHelper::getResults($apoll_id);
|
||||
//print_r($results); exit;
|
||||
//get the component params
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_apoll'.DS.'tables');
|
||||
$apoll =& JTable::getInstance('apoll', 'Table');
|
||||
$apoll->load( $apoll_id );
|
||||
$apollParams = new JParameter($apoll->params);
|
||||
//merge them with the module params
|
||||
$params->merge($apollParams, $params);
|
||||
|
||||
$slug = ($apoll->alias=='')? $apoll->id : $apoll->id.":".$apoll->alias;
|
||||
// check if cookie is set showing that the user has voted for this poll
|
||||
$voted = modApollHelper::alreadyVoted($apoll_id);
|
||||
// check if the registrated user has voted and if user has logged in
|
||||
$user =& JFactory::getUser();
|
||||
$userVoted = modApollHelper::userVoted($user->id, $apoll_id);
|
||||
$guest = $user->guest;
|
||||
// check if this ip has been recorder
|
||||
$ipVoted = modApollHelper::ipVoted($apoll_id);
|
||||
//reset the var display_poll
|
||||
$display_poll = 0;
|
||||
|
||||
//check the start time and the end of poll
|
||||
global $mainframe;
|
||||
$date = &JFactory::getDate();
|
||||
$date->setOffset($mainframe->getCfg('offset'));
|
||||
$now = $date->toFormat();
|
||||
|
||||
if(($now>$apoll->publish_up) && ($now<$apoll->publish_down)) {
|
||||
$display_submit = 1;
|
||||
|
||||
// if only registered users can vote
|
||||
if ($params->get('only_registered')) {
|
||||
//if the user is not a guest
|
||||
if(!$guest) {
|
||||
//if only one vote is allowed per logged user
|
||||
if($params->get('one_vote_per_user')) {
|
||||
//check if user has voted
|
||||
if($userVoted) {
|
||||
//display the poll with disabled options
|
||||
$display_submit = 0;
|
||||
$msg = "You have already voted.";
|
||||
$details = JText::_("Only one vote per user is allowed.");
|
||||
//user has not voted yet
|
||||
} else {
|
||||
//display the poll
|
||||
$display_poll = 1;
|
||||
$display_submit = 1;
|
||||
$msg = "";
|
||||
}
|
||||
// if loggedin user are allowed to vote unlimited times
|
||||
} else {
|
||||
// Check the cookie
|
||||
if($voted) {
|
||||
$display_poll = 0;
|
||||
$display_submit = 0;
|
||||
$msg = "You have already voted.";
|
||||
$details = JText::sprintf("Only one vote each %u hours is allowed.", $apoll->lag/60);
|
||||
|
||||
//hm check the ip please but only if allowed to do that
|
||||
} elseif ($params->get('ip_check')) {
|
||||
if($ipVoted) {
|
||||
//display the poll with disabled options
|
||||
$display_poll = 0;
|
||||
$display_submit = 0;
|
||||
$msg = "You have already voted.";
|
||||
$details = JText::_("Only one vote per IP is allowed.");
|
||||
//if user's ip has not been logged
|
||||
}
|
||||
//if user has not voted
|
||||
} else {
|
||||
//display the poll
|
||||
$display_poll = 1;
|
||||
$display_submit = 1;
|
||||
$msg = "";
|
||||
}
|
||||
}
|
||||
//if the user has not logged in
|
||||
} else {
|
||||
//display message please log in
|
||||
$display_poll = 1;
|
||||
$display_submit = 0;
|
||||
$msg = "Please register to vote";
|
||||
}
|
||||
// if anybody can vote
|
||||
} else {
|
||||
//if user has voted, according to the cookie check
|
||||
if($voted) {
|
||||
//display the poll with disabled options or the results
|
||||
$display_poll = ($params->get('if_voted'))? 1:0;
|
||||
$display_submit = 0;
|
||||
$msg = "You have already voted.";
|
||||
$details = JText::sprintf("Only one vote each %u hours is allowed.", $apoll->lag/60);
|
||||
//if user has not voted according to the cookie
|
||||
} else {
|
||||
//hm check the ip please but only if allowed to do that
|
||||
if ($params->get('ip_check')) {
|
||||
if($ipVoted) {
|
||||
//display the poll with disabled options
|
||||
$display_poll = ($params->get('if_voted'))? 1:0;
|
||||
$display_submit = 0;
|
||||
$msg = "You have already voted.";
|
||||
$details = JText::_("Only one vote per IP is allowed.");
|
||||
//if user's ip has not been logged
|
||||
} else {
|
||||
//display the poll
|
||||
$display_poll = 1;
|
||||
$display_submit = 1;
|
||||
$msg = "";
|
||||
}
|
||||
//if we are not allowed to do the ip check
|
||||
} else {
|
||||
//display the poll
|
||||
$display_poll = 1;
|
||||
$display_submit = 1;
|
||||
$msg = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$display_submit = 0;
|
||||
$msg = JText::_("The voting for this poll has not started yet.")." ";
|
||||
$publish_up = JFactory::getDate($apoll->publish_up);
|
||||
$details = JText::_("It will start on:")." ".$publish_up->toFormat($params->get('msg_date_format'));
|
||||
}
|
||||
//if deadline has passed change the msg
|
||||
if($now>$apoll->publish_down) {
|
||||
$display_poll = 0;
|
||||
$msg = "The voting for this poll has ended"." ";
|
||||
$publish_down = JFactory::getDate($apoll->publish_down);
|
||||
$details = JText::_("on:")." ".$publish_down->toFormat($params->get('msg_date_format'));
|
||||
}
|
||||
|
||||
$disabled = ($display_submit)? '':'disabled="disabled"';
|
||||
//if show messages is set to no, reset all messages
|
||||
//if(!$params->get('show_msg')) {$msg ='<br />';}
|
||||
|
||||
if ( $apoll && $apoll->id ) {
|
||||
$layout = JModuleHelper::getLayoutPath('mod_apoll');
|
||||
$tabcnt = 0;
|
||||
$options = modApollHelper::getApollOptions($apoll_id);
|
||||
$itemid = modApollHelper::getItemid($apoll_id);
|
||||
|
||||
require($layout);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE install SYSTEM "http://dev.joomla.org/xml/1.5/module-install.dtd">
|
||||
<install type="module" version="1.5.0">
|
||||
<name>Apoll</name>
|
||||
<author>Hristo Genev</author>
|
||||
<creationDate>October 2009</creationDate>
|
||||
<copyright>Copyright (C) 2009</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>http://www.afactory.org</authorUrl>
|
||||
<version>2.1.005</version>
|
||||
<description>Apoll module for voting</description>
|
||||
|
||||
<files>
|
||||
<filename module="mod_apoll">mod_apoll.php</filename>
|
||||
<filename module="mod_apoll">index.html</filename>
|
||||
<filename module="mod_apoll">helper.php</filename>
|
||||
<folder module="mod_apoll">tmpl</folder>
|
||||
</files>
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB.mod_apoll.ini</language>
|
||||
</languages>
|
||||
<params addpath="/administrator/components/com_apoll/elements">
|
||||
<param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
|
||||
<param type="spacer" />
|
||||
|
||||
<param name="id" type="apoll" default="" label="SELECT POLL" description="PARAMMODULEPOLL" />
|
||||
|
||||
<param name="ajax" type="radio" default="1" label="AJAX VOTE" description="AJAX VOTE DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
|
||||
<param name="show_poll_title" type="radio" default="1" label="SHOW POLL TITLE" description="SHOW POLL TITLE DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
|
||||
<param type="spacer" />
|
||||
|
||||
<param name="only_one_color" type="radio" default="1" label="ONLY ONE COLOR" description="ONLY ONE COLOR DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
|
||||
<param name="apoll_bars_color" type="text" default="cccccc" label="BARS COLOR" description="BARS COLOR DESC" size="7" />
|
||||
<param name="apoll_bars_border_color" type="text" default="cccccc" label="BARS BORDER COLOR" description="BARS BORDER COLOR DESC" size="7" />
|
||||
|
||||
<param type="spacer" />
|
||||
|
||||
<param name="show_view_details" type="radio" default="1" label="SHOW VIEW DETAILS" description="SHOW VIEW DETAILS DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
<param name="show_rel_article" type="radio" default="1" label="SHOW REL ARTICLE" description="SHOW REL ARTICLE DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
<param name="rel_article" type="text" default="http://www.afactory.org" label="RELATED ARTICLE LINK" description="RELATED ARTICLE LINK DESC" size="40" />
|
||||
<param name="rel_article_window" type="radio" default="_self" label="IN NEW WINDOW" description="ONE IN NEW WINDOW DESC">
|
||||
<option value="_blank">Yes</option>
|
||||
<option value="_self">NO</option>
|
||||
</param>
|
||||
<param type="spacer" />
|
||||
<param name="show_total" type="radio" default="1" label="SHOW TOTAL" description="SHOW TOTAL DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
<param name="show_msg" type="radio" default="1" label="SHOW MESSAGES" description="SHOW MESSAGES DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
<param name="show_detailed_msg" type="radio" default="1" label="SHOW DETAILED MESSAGES" description="SHOW DETAILED MESSAGES DESC">
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">NO</option>
|
||||
</param>
|
||||
<param name="msg_date_format" type="text" default="%Y-%m-%d" label="MSG DATE FORMAT" description="MSG DATE FORMAT DESC" size="25" />
|
||||
</params>
|
||||
<params group="advanced">
|
||||
<param name="cache" type="list" default="1" label="Caching" description="Select whether to cache the content of this module">
|
||||
<option value="1">Use global</option>
|
||||
<option value="0">No caching</option>
|
||||
</param>
|
||||
<param name="cache_time" type="text" default="900" label="Cache Time" description="The time before the module is recached" />
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
# @file: modules/mod_apoll/tmpl/default.php
|
||||
# @package: aPoll
|
||||
# ===================================================
|
||||
# @author
|
||||
# Name: Hristo Genev
|
||||
# Email: [email protected]
|
||||
# Url: http://www.afactory.org
|
||||
# ===================================================
|
||||
# @copyright Copyright (C) 2008 aFactory.org All rights reserved.
|
||||
# @license see http://www.gnu.org/licenses/lgpl.html GNU/LGPL.
|
||||
# You can use, redistribute this file and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$document =& JFactory::getDocument();
|
||||
$document->addStyleDeclaration("div#apoll_loading_".$apoll->id." {
|
||||
background: url(media/system/images/mootree_loader.gif) 0% 50% no-repeat;
|
||||
width:100%;
|
||||
height:20px;
|
||||
padding: 4px 0 0 20px;
|
||||
}
|
||||
");
|
||||
?>
|
||||
|
||||
<div class="apoll<?php echo $params->get('moduleclass_sfx'); ?>" style="width:95%; border:none; padding:1px;">
|
||||
|
||||
<?php if ($params->get('show_poll_title')) : ?>
|
||||
<h4 class="apoll_mod_title"><?php echo $apoll->title; ?></h4>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="apolldiv_<?php echo $apoll->id;?>">
|
||||
|
||||
<?php if ($display_poll) { ?>
|
||||
<form action="<?php echo JRoute::_( 'index.php' );?>" method="post" name="apoll_vote_<?php echo $apoll->id;?>" id="apoll_vote_<?php echo $apoll->id;?>">
|
||||
<?php for ($i = 0, $n = count($options); $i < $n; $i ++) { ?>
|
||||
<label for="voteid<?php echo $options[$i]->id;?>" class="<?php echo $tabclass_arr[$tabcnt].$params->get('moduleclass_sfx'); ?>" style="display:block; padding:2px;">
|
||||
<input type="radio" name="voteid" id="voteid<?php echo $options[$i]->id;?>" value="<?php echo $options[$i]->id;?>" alt="<?php echo $options[$i]->id;?>" <?php echo $disabled; ?> />
|
||||
<?php echo $options[$i]->text; ?>
|
||||
</label>
|
||||
<?php $tabcnt = 1 - $tabcnt; }
|
||||
|
||||
//show messages box
|
||||
if($params->get('show_msg')) :
|
||||
echo '<div id="mod_apoll_messages_'.$apoll->id.'" style="margin:5px;">'.JText::_($msg);
|
||||
if($params->get('show_detailed_msg')) echo " ".$details;
|
||||
echo '</div>';
|
||||
endif;
|
||||
?>
|
||||
<div style="padding:2px;" id="apoll_buttons_<?php echo $apoll->id;?>" >
|
||||
<input type="submit" id="submit_vote_<?php echo $apoll->id; ?>" name="task_button" class="button" value="<?php echo JText::_('Vote'); ?>" <?php echo $disabled; ?> />
|
||||
</div>
|
||||
<div id="apoll_loading_<?php echo $apoll->id;?>" style="display:none;"><?php echo JText::_('Processing ...'); ?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="option" value="com_apoll" />
|
||||
<input type="hidden" name="id" value="<?php echo $apoll->id;?>" />
|
||||
<?php if($params->get('ajax')) : ?>
|
||||
<input type="hidden" name="format" value="raw" />
|
||||
<input type="hidden" name="view" value="apoll" />
|
||||
<?php else : ?>
|
||||
<input type="hidden" name="task" value="vote" />
|
||||
<?php endif;
|
||||
echo "<div>".JHTML::_( 'form.token' )."</div>"; ?>
|
||||
</form>
|
||||
|
||||
<?php if($params->get('ajax')) {
|
||||
// add mootools
|
||||
JHTML::_('behavior.mootools');
|
||||
|
||||
$updateValue = '';
|
||||
|
||||
for ($i=0; $i<count($results); $i++) {
|
||||
if($params->get('only_one_color')) {
|
||||
$background_color = $params->get('apoll_bars_color');
|
||||
} else {
|
||||
$background_color = "' + options.item($i).attributes[3].nodeValue + '";
|
||||
}
|
||||
|
||||
$updateValue .= "<div style=\"width:100%\"><div style=\"padding: 3px;\">' + text.item($i).firstChild.nodeValue + ' - ' + options.item($i).attributes[1].nodeValue + '%</div><div class=\"apoll_module_bar_holder\" id=\"apoll_module_bar_holder".$i."\" style=\"width: 100%; height: 10px; padding:1px; border:1px solid #".$params->get('apoll_bars_border_color').";\"><div id=\"apoll_module_bar'+options.item($i).attributes[0].nodeValue+'\" style=\"background:#$background_color; width:' + options.item($i).attributes[1].nodeValue + '%; height:10px;\"></div></div></div>";
|
||||
}
|
||||
|
||||
if($params->get('show_total')) {
|
||||
$updateValue .= "<br /><b>".JText::_('Total votes')."</b>: ' + voters.item(0).firstChild.nodeValue + '";
|
||||
}
|
||||
$js = "
|
||||
/* <![CDATA[ */
|
||||
window.addEvent('domready', function()
|
||||
{
|
||||
$('apoll_vote_".$apoll->id."').addEvent('submit', function(e) {
|
||||
// Prevent the submit event
|
||||
new Event(e).stop();
|
||||
|
||||
var options = $('apoll_vote_".$apoll->id."').getElements('input[name=voteid]');
|
||||
|
||||
var nothing_selected = 1;
|
||||
options.each(function(item, index){
|
||||
if(item.checked==1) {nothing_selected = 0;}
|
||||
});
|
||||
if (nothing_selected) {
|
||||
alert('".JText::_('Please select an option')."');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
$('submit_vote_".$apoll->id."').disabled = 1;
|
||||
$('apoll_loading_".$apoll->id."').setStyle('display','');
|
||||
|
||||
// Update the page
|
||||
this.send({
|
||||
onComplete: function(response, responseXML)
|
||||
{
|
||||
// get the XML nodes
|
||||
var root = responseXML.documentElement;
|
||||
var options = root.getElementsByTagName('option');
|
||||
var text = root.getElementsByTagName('text');
|
||||
//var percentages = root.getElementsByTagName('percentages');
|
||||
var voters = root.getElementsByTagName('voters');
|
||||
|
||||
// prepare the XHTML
|
||||
var updateValue = '".$updateValue."';
|
||||
|
||||
// update the page element 'update'
|
||||
//$('apolldiv_".$apoll->id."').removeClass('ajax-loading');
|
||||
$('apolldiv_".$apoll->id."').empty().setHTML(updateValue);
|
||||
var apollSlide = new Fx.Slide('apoll_comp_form');
|
||||
apollSlide.slideOut();
|
||||
}});
|
||||
}
|
||||
});
|
||||
});/* ]]> */";
|
||||
|
||||
|
||||
$document->addScriptDeclaration( $js );
|
||||
|
||||
|
||||
}
|
||||
//If user has voted
|
||||
} else {
|
||||
|
||||
foreach ($results as $row) :
|
||||
$percent = ($row->votes)? round((100*$row->hits)/$row->votes, 1):0;
|
||||
$width = ($percent)? $percent:2;
|
||||
if($params->get('only_one_color'))
|
||||
$background_color = $params->get('apoll_bars_color');
|
||||
else
|
||||
$background_color = $row->color; ?>
|
||||
|
||||
<div>
|
||||
<div style="padding:3px;"><?php echo $row->text." - ".$percent; ?>%</div>
|
||||
<div style="width:100%; height:10px; padding:1px; border:1px solid #<?php echo $params->get('apoll_bars_border_color'); ?>;">
|
||||
<div style="width: <?php echo $width; ?>%; height:10px;background:#<?php echo $background_color; ?>;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;
|
||||
if($params->get('show_total'))
|
||||
echo "<br /><b>".JText::_('Total votes')."</b>: ".$row->votes;
|
||||
|
||||
if($params->get('show_msg')) :
|
||||
echo '<div id="mod_apoll_messages_'.$apoll->id.'" style="margin:5px;">'.JText::_($msg);
|
||||
if($params->get('show_detailed_msg')) {
|
||||
echo " ".$details;
|
||||
}
|
||||
echo '</div>';
|
||||
endif;
|
||||
} ?>
|
||||
|
||||
<!-- End of #apolldiv -->
|
||||
</div>
|
||||
<?php if (($params->get('show_view_details')) || ($params->get('rel_article_window'))) { ?>
|
||||
<div id="apoll_links" style="padding-top:5px; ">
|
||||
|
||||
<?php if ($params->get('show_view_details')) : ?>
|
||||
<a class="apoll_result_link" href="<?php echo JRoute::_('index.php?option=com_apoll&view=apoll&id='.$slug.$itemid); ?>"><?php echo JText::_('View details'); ?></a><br />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_rel_article')) : ?>
|
||||
<a class="apoll_result_link" target="<?php echo $params->get('rel_article_window'); ?>" href="<?php echo JRoute::_($params->get('rel_article')); ?>">
|
||||
<?php echo JText::_('read the related article >>'); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<!-- End of module .apoll -->
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 11646 2009-03-01 19:34:56Z ian $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
|
||||
|
||||
class modArchiveHelper
|
||||
{
|
||||
function getList(&$params)
|
||||
{
|
||||
//get database
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$query = 'SELECT MONTH( created ) AS created_month, created, id, sectionid, title, YEAR(created) AS created_year' .
|
||||
' FROM #__content' .
|
||||
' WHERE ( state = -1 AND checked_out = 0 AND sectionid != 0)' .
|
||||
' GROUP BY created_year DESC, created_month DESC';
|
||||
$db->setQuery($query, 0, intval($params->get('count')));
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
$menu = &JSite::getMenu();
|
||||
$item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
|
||||
$itemid = isset($item) ? '&Itemid='.$item->id : '';
|
||||
|
||||
$i = 0;
|
||||
$lists = array();
|
||||
foreach ( $rows as $row )
|
||||
{
|
||||
$date =& JFactory::getDate($row->created);
|
||||
|
||||
$created_month = $date->toFormat("%m");
|
||||
$month_name = $date->toFormat("%B");
|
||||
$created_year = $date->toFormat("%Y");
|
||||
|
||||
$lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year='.$created_year.'&month='.$created_month.$itemid);
|
||||
$lists[$i]->text = $month_name.', '.$created_year;
|
||||
$i++;
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_archive.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
$params->def('count', 10);
|
||||
$list = modArchiveHelper::getList($params);
|
||||
|
||||
require(JModuleHelper::getLayoutPath('mod_archive'));
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install type="module" version="1.5.0">
|
||||
<name>Archived Content</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>(C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5.0</version>
|
||||
<description>DESCARCHIVE</description>
|
||||
<files>
|
||||
<filename module="mod_archive">mod_archive.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="count" type="text" default="10" label="Count" description="The number of items to display (default is 10)" />
|
||||
<param name="@spacer" type="spacer" default="" label="" description="" />
|
||||
<param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
|
||||
</params>
|
||||
<params group="advanced">
|
||||
<param name="cache" type="list" default="1" label="Caching" description="Select whether to cache the content of this module">
|
||||
<option value="1">Use global</option>
|
||||
<option value="0">No caching</option>
|
||||
</param>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php // no direct access
|
||||
defined('_JEXEC') or die('Restricted access'); ?>
|
||||
<ul>
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->text; ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 10554 2008-07-15 17:15:19Z ircmaxell $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_banners'.DS.'helpers'.DS.'banner.php');
|
||||
|
||||
class modBannersHelper
|
||||
{
|
||||
function getList(&$params)
|
||||
{
|
||||
$model = modBannersHelper::getModel();
|
||||
|
||||
// Model Variables
|
||||
$vars['cid'] = (int) $params->get( 'cid' );
|
||||
$vars['catid'] = (int) $params->get( 'catid' );
|
||||
$vars['limit'] = (int) $params->get( 'count', 1 );
|
||||
$vars['ordering'] = $params->get( 'ordering' );
|
||||
|
||||
if ($params->get( 'tag_search' ))
|
||||
{
|
||||
$document =& JFactory::getDocument();
|
||||
$keywords = $document->getMetaData( 'keywords' );
|
||||
|
||||
$vars['tag_search'] = BannerHelper::getKeywords( $keywords );
|
||||
}
|
||||
|
||||
$banners = $model->getList( $vars );
|
||||
$model->impress( $banners );
|
||||
|
||||
return $banners;
|
||||
}
|
||||
|
||||
function getModel()
|
||||
{
|
||||
if (!class_exists( 'BannersModelBanner' ))
|
||||
{
|
||||
// Build the path to the model based upon a supplied base path
|
||||
$path = JPATH_SITE.DS.'components'.DS.'com_banners'.DS.'models'.DS.'banner.php';
|
||||
$false = false;
|
||||
|
||||
// If the model file exists include it and try to instantiate the object
|
||||
if (file_exists( $path )) {
|
||||
require_once( $path );
|
||||
if (!class_exists( 'BannersModelBanner' )) {
|
||||
JError::raiseWarning( 0, 'Model class BannersModelBanner not found in file.' );
|
||||
return $false;
|
||||
}
|
||||
} else {
|
||||
JError::raiseWarning( 0, 'Model BannersModelBanner not supported. File not found.' );
|
||||
return $false;
|
||||
}
|
||||
}
|
||||
|
||||
$model = new BannersModelBanner();
|
||||
return $model;
|
||||
}
|
||||
|
||||
function renderBanner($params, &$item)
|
||||
{
|
||||
$link = JRoute::_( 'index.php?option=com_banners&task=click&bid='. $item->bid );
|
||||
$baseurl = JURI::base();
|
||||
|
||||
$html = '';
|
||||
if (trim($item->custombannercode))
|
||||
{
|
||||
// template replacements
|
||||
$html = str_replace( '{CLICKURL}', $link, $item->custombannercode );
|
||||
$html = str_replace( '{NAME}', $item->name, $html );
|
||||
}
|
||||
else if (BannerHelper::isImage( $item->imageurl ))
|
||||
{
|
||||
$image = '<img src="'.$baseurl.'images/banners/'.$item->imageurl.'" alt="'.JText::_('Banner').'" />';
|
||||
if ($item->clickurl)
|
||||
{
|
||||
switch ($params->get( 'target', 1 ))
|
||||
{
|
||||
// cases are slightly different
|
||||
case 1:
|
||||
// open in a new window
|
||||
$a = '<a href="'. $link .'" target="_blank">';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// open in a popup window
|
||||
$a = "<a href=\"javascript:void window.open('". $link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">";
|
||||
break;
|
||||
|
||||
default: // formerly case 2
|
||||
// open in parent window
|
||||
$a = '<a href="'. $link .'">';
|
||||
break;
|
||||
}
|
||||
|
||||
$html = $a . $image . '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = $image;
|
||||
}
|
||||
}
|
||||
else if (BannerHelper::isFlash( $item->imageurl ))
|
||||
{
|
||||
//echo $item->params;
|
||||
$banner_params = new JParameter( $item->params );
|
||||
$width = $banner_params->get( 'width');
|
||||
$height = $banner_params->get( 'height');
|
||||
|
||||
$imageurl = $baseurl."images/banners/".$item->imageurl;
|
||||
$html = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" border=\"0\" width=\"$width\" height=\"$height\">
|
||||
<param name=\"movie\" value=\"$imageurl\"><embed src=\"$imageurl\" loop=\"false\" pluginspage=\"http://www.macromedia.com/go/get/flashplayer\" type=\"application/x-shockwave-flash\" width=\"$width\" height=\"$height\"></embed>
|
||||
</object>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_banners.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
$headerText = trim( $params->get( 'header_text' ) );
|
||||
$footerText = trim( $params->get( 'footer_text' ) );
|
||||
|
||||
$list = modBannersHelper::getList($params);
|
||||
require(JModuleHelper::getLayoutPath('mod_banners'));
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install type="module" version="1.5.0">
|
||||
<name>Banner</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5.0</version>
|
||||
<description>DESCBANNER</description>
|
||||
<files>
|
||||
<filename module="mod_banners">mod_banners.php</filename>
|
||||
</files>
|
||||
<params addpath="/administrator/components/com_banners/elements">
|
||||
<param name="target" type="list" default="1" label="Target" description="PARAMTARGET">
|
||||
<option value="0">Parent Window With Browser Navigation</option>
|
||||
<option value="1">New Window With Browser Navigation</option>
|
||||
<option value="2">New Window Without Browser Navigation</option>
|
||||
</param>
|
||||
<param name="@spacer" type="spacer" default="" label="" description="" />
|
||||
<param name="count" type="text" default="1" label="Count" description="PARAMNUMBERITEMS" />
|
||||
<param name="cid" type="bannerclient" default="" label="Banner client" description="PARAMSINGLECLIENT" />
|
||||
<param name="catid" type="category" section="com_banner" default="" label="Category" description="PARAMCATEGORY" />
|
||||
<param name="tag_search" type="radio" default="0" label="Search By Tags" description="PARAMSEARCHBYTAG">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="ordering" type="list" default="0" label="Randomise" description="PARAMRANDOMISE">
|
||||
<option value="0">Sticky,Ordering</option>
|
||||
<option value="random">Sticky,Randomise</option>
|
||||
</param>
|
||||
<param name="@spacer" type="spacer" default="" label="" description="" />
|
||||
<param name="header_text" type="textarea" rows="3" cols="40" default="" label="Header Text" description="PARAMHEADERTEXT" />
|
||||
<param name="footer_text" type="textarea" rows="3" cols="40" default="" label="Footer Text" description="PARAMFOOTERTEXT" />
|
||||
<param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
|
||||
<param name="@spacer" type="spacer" default="" label="" description="" />
|
||||
</params>
|
||||
<params group="advanced">
|
||||
<param name="cache" type="list" default="1" label="Caching" description="Select whether to cache the content of this module">
|
||||
<option value="1">Use global</option>
|
||||
<option value="0">No caching</option>
|
||||
</param>
|
||||
<param name="cache_time" type="text" default="900" label="Cache Time" description="The time before the module is recached" />
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php // no direct access
|
||||
defined('_JEXEC') or die('Restricted access'); ?>
|
||||
<div class="bannergroup<?php echo $params->get( 'moduleclass_sfx' ) ?>">
|
||||
|
||||
<?php if ($headerText) : ?>
|
||||
<div class="bannerheader"><?php echo $headerText ?></div>
|
||||
<?php endif;
|
||||
|
||||
foreach($list as $item) :
|
||||
|
||||
?><div class="banneritem<?php echo $params->get( 'moduleclass_sfx' ) ?>"><?php
|
||||
echo modBannersHelper::renderBanner($params, $item);
|
||||
?><div class="clr"></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($footerText) : ?>
|
||||
<div class="bannerfooter<?php echo $params->get( 'moduleclass_sfx' ) ?>">
|
||||
<?php echo $footerText ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
class modBreadCrumbsHelper
|
||||
{
|
||||
function getList(&$params)
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
// Get the PathWay object from the application
|
||||
$pathway =& $mainframe->getPathway();
|
||||
$items = $pathway->getPathWay();
|
||||
|
||||
$count = count($items);
|
||||
for ($i = 0; $i < $count; $i ++)
|
||||
{
|
||||
$items[$i]->name = stripslashes(htmlspecialchars($items[$i]->name));
|
||||
$items[$i]->link = JRoute::_($items[$i]->link);
|
||||
}
|
||||
|
||||
if ($params->get('showHome', 1))
|
||||
{
|
||||
$item = new stdClass();
|
||||
$item->name = $params->get('homeText', JText::_('Home'));
|
||||
$item->link = JURI::base();
|
||||
array_unshift($items, $item);
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the breadcrumbs separator for the breadcrumbs display.
|
||||
*
|
||||
* @param string $custom Custom xhtml complient string to separate the
|
||||
* items of the breadcrumbs
|
||||
* @return string Separator string
|
||||
* @since 1.5
|
||||
*/
|
||||
function setSeparator($custom = null)
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
$lang =& JFactory::getLanguage();
|
||||
|
||||
/**
|
||||
* If a custom separator has not been provided we try to load a template
|
||||
* specific one first, and if that is not present we load the default separator
|
||||
*/
|
||||
if ($custom == null) {
|
||||
if($lang->isRTL()){
|
||||
$_separator = JHTML::_('image.site', 'arrow_rtl.png');
|
||||
}
|
||||
else{
|
||||
$_separator = JHTML::_('image.site', 'arrow.png');
|
||||
}
|
||||
} else {
|
||||
$_separator = $custom;
|
||||
}
|
||||
return $_separator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_breadcrumbs.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
// Get the breadcrumbs
|
||||
$list = modBreadCrumbsHelper::getList($params);
|
||||
$count = count($list);
|
||||
|
||||
// Set the default separator
|
||||
$separator = modBreadCrumbsHelper::setSeparator( $params->get( 'separator' ));
|
||||
|
||||
require(JModuleHelper::getLayoutPath('mod_breadcrumbs'));
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install type="module" version="1.5.0">
|
||||
<name>Breadcrumbs</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5.0</version>
|
||||
<description>This module displays the breadcrumbs</description>
|
||||
<files>
|
||||
<filename module="mod_breadcrumbs">mod_breadcrumbs.php</filename>
|
||||
</files>
|
||||
<params>
|
||||
<param name="showHome" type="radio" default="1" label="Show Home" description="PARAMSHOWHOME">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="homeText" type="text" default="Home" label="Text for Home entry" description="PARAMHOMETEXT" />
|
||||
<param name="showLast" type="radio" default="1" label="Show Last" description="PARAMSHOWLAST">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="separator" type="text" default="" label="Text Separator" description="A text separator" />
|
||||
<param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
|
||||
</params>
|
||||
<params group="advanced">
|
||||
<param name="cache" type="list" default="0" label="Caching" description="Select whether to cache the content of this module">
|
||||
<option value="0">Never</option>
|
||||
</param>
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php // no direct access
|
||||
defined('_JEXEC') or die('Restricted access'); ?>
|
||||
<span class="breadcrumbs pathway">
|
||||
<?php for ($i = 0; $i < $count; $i ++) :
|
||||
|
||||
// If not the last item in the breadcrumbs add the separator
|
||||
if ($i < $count -1) {
|
||||
if(!empty($list[$i]->link)) {
|
||||
echo '<a href="'.$list[$i]->link.'" class="pathway">'.$list[$i]->name.'</a>';
|
||||
} else {
|
||||
echo $list[$i]->name;
|
||||
}
|
||||
echo ' '.$separator.' ';
|
||||
} else if ($params->get('showLast', 1)) { // when $i == $count -1 and 'showLast' is true
|
||||
echo $list[$i]->name;
|
||||
}
|
||||
endfor; ?>
|
||||
</span>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install type="module" version="1.0.0">
|
||||
<name>Custom HTML</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2004</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5.0</version>
|
||||
<description>DESCMODCUSTOM</description>
|
||||
<params>
|
||||
<param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
|
||||
</params>
|
||||
</install>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: helper.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
class modFeedHelper
|
||||
{
|
||||
function getFeed($params)
|
||||
{
|
||||
// module params
|
||||
$rssurl = $params->get('rssurl', '');
|
||||
|
||||
// get RSS parsed object
|
||||
$options = array();
|
||||
$options['rssUrl'] = $rssurl;
|
||||
if ($params->get('cache')) {
|
||||
$options['cache_time'] = $params->get('cache_time', 15) ;
|
||||
$options['cache_time'] *= 60;
|
||||
} else {
|
||||
$options['cache_time'] = null;
|
||||
}
|
||||
|
||||
$rssDoc =& JFactory::getXMLparser('RSS', $options);
|
||||
|
||||
$feed = new stdclass();
|
||||
|
||||
if ($rssDoc != false)
|
||||
{
|
||||
// channel header and link
|
||||
$feed->title = $rssDoc->get_title();
|
||||
$feed->link = $rssDoc->get_link();
|
||||
$feed->description = $rssDoc->get_description();
|
||||
|
||||
// channel image if exists
|
||||
$feed->image->url = $rssDoc->get_image_url();
|
||||
$feed->image->title = $rssDoc->get_image_title();
|
||||
|
||||
// items
|
||||
$items = $rssDoc->get_items();
|
||||
|
||||
// feed elements
|
||||
$feed->items = array_slice($items, 0, $params->get('rssitems', 5));
|
||||
} else {
|
||||
$feed = false;
|
||||
}
|
||||
|
||||
return $feed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: mod_feed.php 11371 2008-12-30 01:31:50Z ian $
|
||||
* @package Joomla
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once (dirname(__FILE__).DS.'helper.php');
|
||||
|
||||
$rssurl = $params->get('rssurl', '');
|
||||
$rssrtl = $params->get('rssrtl', 0);
|
||||
|
||||
//check if cache diretory is writable as cache files will be created for the feed
|
||||
$cacheDir = JPATH_BASE.DS.'cache';
|
||||
if (!is_writable($cacheDir))
|
||||
{
|
||||
echo '<div>';
|
||||
echo JText::_('Please make cache directory writable.');
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
//check if feed URL has been set
|
||||
if (empty ($rssurl))
|
||||
{
|
||||
echo '<div>';
|
||||
echo JText::_('No feed URL specified.');
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$feed = modFeedHelper::getFeed($params);
|
||||
require(JModuleHelper::getLayoutPath('mod_feed'));
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user