|
From: <zy...@us...> - 2013-05-14 03:25:08
|
Revision: 11541
http://sourceforge.net/p/xoops/svn/11541
Author: zyspec
Date: 2013-05-14 03:25:04 +0000 (Tue, 14 May 2013)
Log Message:
-----------
Incomplete - task : xoopspoll including files that were not included in initial branch creation
Added Paths:
-----------
XoopsModules/xoopspoll/branches/zyspec/admin/utility.php
XoopsModules/xoopspoll/branches/zyspec/blocks/multipoll.php
XoopsModules/xoopspoll/branches/zyspec/blocks/singlepoll.php
XoopsModules/xoopspoll/branches/zyspec/class/constants.php
XoopsModules/xoopspoll/branches/zyspec/class/formdatetimepicker.php
XoopsModules/xoopspoll/branches/zyspec/class/log.php
XoopsModules/xoopspoll/branches/zyspec/class/option.php
XoopsModules/xoopspoll/branches/zyspec/class/poll.php
XoopsModules/xoopspoll/branches/zyspec/class/pollutility.php
XoopsModules/xoopspoll/branches/zyspec/class/renderer.php
XoopsModules/xoopspoll/branches/zyspec/class/request.php
XoopsModules/xoopspoll/branches/zyspec/css/datetimepicker.css
XoopsModules/xoopspoll/branches/zyspec/images/colorbars/black.gif
XoopsModules/xoopspoll/branches/zyspec/include/oninstall.inc.php
XoopsModules/xoopspoll/branches/zyspec/include/onuninstall.inc.php
XoopsModules/xoopspoll/branches/zyspec/include/search.inc.php
XoopsModules/xoopspoll/branches/zyspec/js/
XoopsModules/xoopspoll/branches/zyspec/js/index.html
XoopsModules/xoopspoll/branches/zyspec/js/jquery-ui-sliderAccess.js
XoopsModules/xoopspoll/branches/zyspec/js/jquery-ui-timepicker-addon.js
XoopsModules/xoopspoll/branches/zyspec/language/english/mail_template/index.html
XoopsModules/xoopspoll/branches/zyspec/language/english/mail_template/mail_voter.tpl
XoopsModules/xoopspoll/branches/zyspec/language/french_iso/mail_template/mail_voter.tpl
XoopsModules/xoopspoll/branches/zyspec/language/french_utf8/mail_template/mail_voter.tpl
XoopsModules/xoopspoll/branches/zyspec/language/nederlands/mail_template/index.html
XoopsModules/xoopspoll/branches/zyspec/language/nederlands/mail_template/mail_voter.tpl
XoopsModules/xoopspoll/branches/zyspec/language/persian/mail_template/index.html
XoopsModules/xoopspoll/branches/zyspec/language/persian/mail_template/mail_voter.tpl
XoopsModules/xoopspoll/branches/zyspec/language/spanish/mail_template/mail_voter.tpl
XoopsModules/xoopspoll/branches/zyspec/language/swedish/mail_template/index.html
XoopsModules/xoopspoll/branches/zyspec/language/swedish/mail_template/mail_voter.tpl
XoopsModules/xoopspoll/branches/zyspec/preloads/
XoopsModules/xoopspoll/branches/zyspec/preloads/core.php
XoopsModules/xoopspoll/branches/zyspec/preloads/index.html
XoopsModules/xoopspoll/branches/zyspec/templates/admin/
XoopsModules/xoopspoll/branches/zyspec/templates/admin/index.html
XoopsModules/xoopspoll/branches/zyspec/templates/admin/xoopspoll_index.html
XoopsModules/xoopspoll/branches/zyspec/templates/admin/xoopspoll_list.html
XoopsModules/xoopspoll/branches/zyspec/templates/admin/xoopspoll_utility.html
XoopsModules/xoopspoll/branches/zyspec/templates/blocks/xoopspoll_block_singlepoll.html
XoopsModules/xoopspoll/branches/zyspec/templates/xoopspoll_results_renderer.html
Added: XoopsModules/xoopspoll/branches/zyspec/admin/utility.php
===================================================================
--- XoopsModules/xoopspoll/branches/zyspec/admin/utility.php (rev 0)
+++ XoopsModules/xoopspoll/branches/zyspec/admin/utility.php 2013-05-14 03:25:04 UTC (rev 11541)
@@ -0,0 +1,251 @@
+<?php
+/*
+ XOOPS - PHP Content Management System
+ Copyright (c) 2000 XOOPS.org
+ <http://www.xoops.org/>
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting
+ source code which is considered copyrighted (c) material of the
+ original comment or credit authors.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+ /**
+ * Administration menu for the XoopsPoll Module
+ *
+ * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
+ * @package:: xoopspoll
+ * @subpackage:: admin
+ * @since:: 2.5.0
+ * @author:: XOOPS Module Team
+ * @version:: $Id: $
+ */
+
+require_once 'admin_header.php';
+xoops_load('request', 'xoopspoll');
+xoops_load('pollUtility', 'xoopspoll');
+
+$op = XoopspollRequest::getString('op', 'list');
+switch ($op) {
+
+case 'list':
+default:
+
+ xoops_cp_header();
+ $admin_class = new ModuleAdmin();
+
+ $GLOBALS['xoopsTpl']->assign('navigation', $admin_class->addNavigation('utility.php'));
+
+ $admin_class->addItemButton(_AM_XOOPSPOLL_IMPORT_UMFRAGE, 'utility.php' . '?op=umfrage', $icon = 'download');
+ $GLOBALS['xoopsTpl']->assign('addPollButton', $admin_class->renderButton('left'));
+
+ $GLOBALS['xoopsTpl']->assign('navigation', $admin_class->addNavigation('index.php'));
+
+ $GLOBALS['xoopsTpl']->assign('umfrageIntro', _AM_XOOPSPOLL_UMFRAGE_INTRO);
+ $GLOBALS['xoopsTpl']->display($GLOBALS['xoops']->path('modules' . DIRECTORY_SEPARATOR
+ . 'xoopspoll' . DIRECTORY_SEPARATOR
+ . 'templates' . DIRECTORY_SEPARATOR
+ . 'admin' . DIRECTORY_SEPARATOR
+ . 'xoopspoll_utility.html')
+ );
+
+ require 'admin_footer.php';
+ break;
+
+ /* Import data from umfrage */
+case 'umfrage':
+ //@todo: change zero (0) constant to use XoopspollConstants::
+ $ok = XoopspollRequest::getString('ok', 0, 'POST');
+ if ($ok) {
+ if (!$GLOBALS['xoopsSecurity']->check()) {
+ redirect_header($_SERVER['PHP_SELF'], XoopspollConstants::REDIRECT_DELAY_MEDIUM, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
+ }
+ // first check to see if umfrage module is installed and active
+ $moduleHandler =& xoops_gethandler('module');
+ $umModule =& $moduleHandler->getByDirname('umfrage');
+ try{
+ if (false !== $umModule && $umModule->isactive()) {
+ // make sure the umfrage database tables exist
+ $configHandler =& xoops_gethandler('config');
+ $umModuleConfig =& $configHandler->getConfigsByCat(0, $umModule->getVar('mid'));
+ $success = false;
+ $umTables = $umModule->getInfo('tables');
+ foreach ($umTables as $umTable) {
+ $s = XoopspollPollUtility::dbTableExists($GLOBALS['xoopsDB'], $umTable);
+ if (!$s) {
+ throw new Exception("Could not find the umfrage db table ({$umTable})");
+ }
+ // $success = $success && $s;
+ }
+
+ //setup poll objects for both umfrage and xoopspoll
+ require_once $GLOBALS['xoops']->path("modules"
+ . DIRECTORY_SEPARATOR . "umfrage"
+ . DIRECTORY_SEPARATOR . "class"
+ . DIRECTORY_SEPARATOR . "umfrage.php"
+ );
+ require_once $GLOBALS['xoops']->path("modules"
+ . DIRECTORY_SEPARATOR . "umfrage"
+ . DIRECTORY_SEPARATOR . "class"
+ . DIRECTORY_SEPARATOR . "umfrageoption.php"
+ );
+ require_once $GLOBALS['xoops']->path("modules"
+ . DIRECTORY_SEPARATOR . "umfrage"
+ . DIRECTORY_SEPARATOR . "class"
+ . DIRECTORY_SEPARATOR . "umfragelog.php"
+ );
+
+ $xpHandler =& xoops_getmodulehandler('poll', 'xoopspoll');
+ $xpOptHandler =& xoops_getmodulehandler('option', 'xoopspoll');
+ $xpLogHandler =& xoops_getmodulehandler('log', 'xoopspoll');
+
+ // maps umfrage_desc : polltype to xoopspoll_desc : visibility
+ $typeToVisMap = array(
+ 1 => XoopspollConstants::HIDE_NEVER,
+ 2 => XoopspollConstants::HIDE_ALWAYS,
+ 3 => XoopspollConstants::HIDE_VOTED,
+ );
+
+ $err = array();
+ $umContainer = new Umfrage();
+ $umOptContainer = new UmfrageOption();
+ $umLogContainer = new UmfrageLog();
+ $allUmfragePollObjs = $umContainer->getAll();
+ foreach ($allUmfragePollObjs as $umPollObj) {
+ // make sure we don't have this question already (pretty strict comparison)
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria('question', trim($umPollObj->getVar('question')), '='));
+ $criteria->setLimit(1);
+ $pollExists = $xpHandler->getCount($criteria);
+ if (0 == $pollExists) {
+ // set the visibility for the poll
+ if (array_key_exists(intval($umPollObj->getVar('polltype')), $typeToVisMap)) {
+ $visibility = $typeToVisMap[$umPollObj->getVar('polltype')];
+ } else {
+ $visibility = XoopspollConstants::HIDE_END;
+ }
+ // save the poll into Xoopspoll database
+ $xpValues = array(
+ 'question' => $umPollObj->getVar('question'),
+ 'description' => $umPollObj->getVar('description'),
+ 'user_id' => $umPollObj->getVar('user_id'),
+ 'start_time' => $umPollObj->getVar('start_time'),
+ 'end_time' => $umPollObj->getVar('end_time'),
+ 'votes' => intval($umPollObj->getVar('votes')),
+ 'voters' => intval($umPollObj->getVar('voters')),
+ 'multiple' => $umPollObj->getVar('multiple'),
+ 'multilimit' => $umPollObj->getVar('multilimit'),
+ 'display' => $umPollObj->getVar('display'),
+ 'visibility' => $visibility,
+ 'weight' => $umPollObj->getVar('weight'),
+ 'mail_status' => $umPollObj->getVar('mail_status'),
+ 'mail_voter' => $umPollObj->getVar('mail_voter')
+ );
+ $xpObj = $xpHandler->create();
+ $xpObj->setVars($xpValues);
+ $newXpId = $xpHandler->insert($xpObj);
+
+ if ($newXpId) {
+// $newXpId = $newXpObj->getVar('poll_id');
+ $optionIdMap = array();
+ /* get the options for this poll and insert them */
+ $umOptObjs = $umOptContainer->getAllByPollId($umPollObj->getVar('poll_id'));
+ if (!$umOptObjs) {
+ throw new Exception("Could not find options for the " . $umPollObj->getVar('question') . " poll.");
+ }
+ foreach($umOptObjs as $umOptObj) {
+ $optValues = array(
+ 'poll_id' => $newXpId,
+ 'option_text' => $umOptObj->getVar('option_text'),
+ 'option_count' => $umOptObj->getVar('option_count'),
+ 'option_color' => $umOptObj->getVar('option_color')
+ );
+ $xpOptObj = $xpOptHandler->create();
+ $xpOptObj->setVars($optValues);
+ $newXpOptId = $xpOptHandler->insert($xpOptObj);
+
+ if ($newXpOptId) {
+ $newOptId = $newXpOptId;
+ $oldOptId = $umOptObj->getVar('option_id');
+ $optionIdMap[$oldOptId] = $newOptId;
+ } else{
+ throw new Exception("Could not create the '" . $umOptObj->getVar('option_text') . "' option for the '" . $umPollObj->getVar('question') . "' poll.<br />" . $xpOptObj->getHtmlErrors());
+ }
+ }
+ // now update the log for this poll
+ $allUmfrageLogObjs = $umLogContainer->getAllByPollId($umPollObj->getVar('poll_id'));
+ foreach ($allUmfrageLogObjs as $umLogObj) {
+ $logValues = array(
+ 'poll_id' => $newXpId,
+ 'option_id' => $optionIdMap[$umLogObj->getVar('option_id')],
+ 'ip' => $umLogObj->getVar('ip'),
+ 'user_id' => $umLogObj->getVar('user_id'),
+ 'time' => $umLogObj->getVar('time')
+ );
+ $xpLogObj = $xpLogHandler->create();
+ $xpLogObj->setVars($logValues);
+ $newLogId = $xpLogHandler->insert($xpLogObj);
+ if (!$newLogId) {
+ throw new Exception("There was an error updating the logs for the '" . $umPollObj->getVar('question') . "' poll.<br />" . $xpLogObj->getHtmlErrors());
+ }
+ }
+ unset($optionIdMap, $umOptObjs, $allUmfrageLogObjs);
+ } else {
+ throw new Exception("Failed to create the '" . $umPollObj->getVar('question') . "' poll in the database.<br />" . $xpObj->getHtmlErrors());
+ // $err[] = "Failed to create poll in the database.";
+ }
+ } else {
+ throw new Exception("The '{$umPollObj->getVar('question')}' poll was not imported.<br />" . $umPollObj->getHtmlErrors());
+ //$err[] = "The '{$umPollObj->getVar('question')}' poll was not imported.";
+ }
+ unset($criteria, $umOptObjs);
+ }
+ redirect_header('index.php', XoopspollConstants::REDIRECT_DELAY_MEDIUM, "(" . count($allUmfragePollObjs) . ") polls successfully imported from Umfrage.");
+ } else {
+ throw new Exception('Please make sure umfrage is installed and active.');
+ // redirect_header('index.php', XoopspollConstants::REDIRECT_DELAY_MEDIUM, 'Please make sure umfrage is installed and active.');
+ }
+ } catch (Exception $e) {
+ xoops_cp_header();
+ $admin_class = new ModuleAdmin();
+ echo $admin_class->addNavigation('utility.php');
+ echo "<div class='floatcenter1'>" . xoops_error($e->getMessage(), "Import Error(s)") . "</div>\n";
+ include 'admin_footer.php';
+ exit();
+ }
+/*
+ if (empty($err)) {
+ redirect_header("index.php", XoopspollConstants::REDIRECT_DELAY_MEDIUM, count($allUmfragePollObjs) . " were successfully imported into Xoopspoll.");
+ } else {
+ xoops_cp_header();
+ $admin_class = new ModuleAdmin();
+ echo $admin_class->addNavigation('utility.php');
+ xoops_error($err, "Import Error(s)");
+ include 'admin_footer.php';
+ exit();
+ }
+*/
+ } else {
+ xoops_cp_header();
+ $admin_class = new ModuleAdmin();
+ echo $admin_class->addNavigation('utility.php');
+ xoops_confirm(array('op' => 'umfrage', 'ok' => 1), $_SERVER['PHP_SELF'], _AM_XOOPSPOLL_RUSUREUMFRAGE);
+ include 'admin_footer.php';
+// xoops_cp_footer();
+ exit();
+ }
+ break;
+}
\ No newline at end of file
Added: XoopsModules/xoopspoll/branches/zyspec/blocks/multipoll.php
===================================================================
--- XoopsModules/xoopspoll/branches/zyspec/blocks/multipoll.php (rev 0)
+++ XoopsModules/xoopspoll/branches/zyspec/blocks/multipoll.php 2013-05-14 03:25:04 UTC (rev 11541)
@@ -0,0 +1,263 @@
+<?php
+/*
+ XOOPS - PHP Content Management System
+ Copyright (c) 2000 XOOPS.org
+ <http://www.xoops.org/>
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting
+ source code which is considered copyrighted (c) material of the
+ original comment or credit authors.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+/**
+ * XoopsPoll Display Multi-poll Block
+ *
+ * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
+ * @package:: xoopspoll
+ * @subpackage:: blocks
+ * @since:: 1.0
+ * @version:: $Id: $
+ *
+ **/
+
+xoops_loadLanguage('main', 'xoopspoll');
+/*
+include_once $GLOBALS['xoops']->path( "modules"
+ . DIRECTORY_SEPARATOR . "xoopspoll"
+ . DIRECTORY_SEPARATOR . "class"
+ . DIRECTORY_SEPARATOR . "pollutility.php"
+);
+*/
+xoops_load('pollUtility', 'xoopspoll');
+xoops_load('constants', 'xoopspoll');
+//xoops_load('log', 'xoopspoll');
+
+/**
+ *
+ * Display XOOPS polls in a block
+ *
+ * @access public
+ * @global mixed $GLOBALS['xoopsUser']
+ * @uses CriteriaCompo
+ * @uses Criteria
+ * @param array $options block options array
+ * @return array block keys and values to be used by block template
+ */
+function xoopspollBlockMultiShow($options)
+{
+ $block = array();
+
+ $moduleHandler =& xoops_gethandler('module');
+ $thisModule =& $moduleHandler->getByDirName('xoopspoll');
+ $configHandler =& xoops_gethandler('config');
+ $this_module_config =& $configHandler->getConfigsByCat(0, $thisModule->getVar('mid'));
+
+ $pollHandler =& xoops_getmodulehandler('poll', 'xoopspoll');
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria('display', XoopspollConstants::DISPLAY_POLL_IN_BLOCK, '='));
+ $criteria->add(new Criteria('start_time', time(), '<='));
+ if (0 == $options[1]) {
+ $criteria->add(new Criteria('end_time', time(), '>='));
+ }
+
+ /**
+ * now check to see if we want to hide polls that were created using newbb
+ */
+ if (($thisModule instanceof XoopsModule) && $thisModule->isactive() && $this_module_config['hide_forum_polls']) {
+ $newbbModule =& $moduleHandler->getByDirname('newbb');
+ if ($newbbModule instanceof XoopsModule && $newbbModule->isactive()) {
+ $topic_handler = xoops_getmodulehandler('topic', 'newbb');
+ $tFields = array('topic_id', 'poll_id');
+ $tArray = $topic_handler->getAll(new Criteria('topic_haspoll', 0, '>'), $tFields, false);
+ if (!empty($tArray)) {
+ $tcriteria = array();
+ foreach($tArray as $t) {
+ $tcriteria[] = $t['poll_id'];
+ }
+ if (!empty($tcriteria)) {
+ $tstring = "(" . implode(',', $tcriteria) . ")";
+ $criteria->add(new Criteria('poll_id', $tstring, "NOT IN"));
+ }
+ }
+ unset($topic_handler, $tFields, $tArray);
+ }
+ unset($newbbModule);
+ }
+
+
+
+
+
+
+
+
+
+
+ $criteria->setSort('weight ASC, end_time'); // trick criteria to allow 2 sort criteria
+ $criteria->setOrder('DESC');
+ $pollObjs = $pollHandler->getAll($criteria);
+ $count = count($pollObjs);
+ if ($count) {
+ $block['langVote'] = _MD_XOOPSPOLL_VOTE;
+ $block['langResults'] = _MD_XOOPSPOLL_RESULTS;
+ $block['langExpires'] = _MB_XOOPSPOLL_WILLEXPIRE;
+ $block['langExpired'] = _MB_XOOPSPOLL_HASEXPIRED;
+ $block['langComments'] = _MB_XOOPSPOLL_COMMENTS;
+ $block['langComment'] = _MB_XOOPSPOLL_COMMENT;
+ $block['url'] = "http"
+ . ((!empty($_SERVER['HTTPS'])) ? "s" : "")
+ . "://".$_SERVER['SERVER_NAME']
+ . $_SERVER['REQUEST_URI'];
+ $block['dispVotes'] = $this_module_config['disp_vote_nums'];
+ $block['thisModuleDir'] = 'xoopspoll';
+ $block['asList'] = $options[0];
+
+ $optHandler =& xoops_getmodulehandler('option', 'xoopspoll');
+ $logHandler =& xoops_getmodulehandler('log', 'xoopspoll');
+
+ foreach($pollObjs as $pollObj) {
+ $criteria = new CriteriaCompo();
+ $pollVars = $pollObj->getValues();
+ $criteria->add(new Criteria('poll_id', $pollVars['poll_id'], '='));
+ $criteria->setSort('option_id');
+ $pollOptionObjs = $optHandler->getAll($criteria);
+ if (XoopspollConstants::MULTIPLE_SELECT_POLL == $pollVars['multiple']) {
+ $pollOptionType = 'checkbox';
+ $pollOptionName = 'option_id[]';
+ } else {
+ $pollOptionType = 'radio';
+ $pollOptionName = 'option_id';
+ }
+
+ if (isset($GLOBALS['xoopsUser']) && ($GLOBALS['xoopsUser'] instanceof XoopsUser)) {
+ $uid = $GLOBALS['xoopsUser']->getVar('uid');
+ } else {
+ $uid = 0;
+ }
+
+ $totalVotes = $pollVars['votes'];
+ $hasVoted = ($logHandler->hasVoted($pollVars['poll_id'], xoops_getenv('REMOTE_ADDR'), $uid)) ? true : false;
+ $canVote = (!$hasVoted) && ($pollObj->isAllowedToVote());
+ foreach ($pollOptionObjs as $pollOptionObj) {
+ $optionObjVars = $pollOptionObj->getValues();
+ $percent = ($totalVotes > 0) ? (100 * $optionObjVars['option_count'] / $totalVotes) : 0;
+// $percent = ($totalVotes > 0) ? intval(100 * $optionObjVars['option_count'] / $totalVotes) . '%' : '0%';
+ $pollOptionArray[] = array(
+ 'id' => $optionObjVars['option_id'],
+ 'text' => $optionObjVars['option_text'],
+ 'count' => $optionObjVars['option_count'],
+ 'percent' => sprintf(" %01.1f%%", $percent),
+ 'color' => $optionObjVars['option_color']
+ );
+ }
+ unset($pollOptionObjs, $optionObjVars);
+ $xuEndTimestamp = xoops_getUserTimestamp($pollObj->getVar('end_time'));
+ $xuEndFormattedTime = ucfirst(date(_MEDIUMDATESTRING, $xuEndTimestamp));
+
+ $isVisible = (true === $pollObj->isResultVisible()) ? true : false;
+ $multiple = ($pollVars['multiple']) ? true : false;
+ $multiLimit = intval($pollVars['multilimit']);
+ if ($multiple && ($multiLimit > 0)) {
+ $lang_multi = sprintf(_MB_XOOPSPOLL_MULTITEXT, $multiLimit);
+ } else {
+ $lang_multi = "";
+ }
+
+ $poll = array(
+ 'id' => $pollVars['poll_id'],
+ 'visible' => $isVisible,
+ 'question' => $pollVars['question'],
+ 'multiple' => $multiple,
+ 'lang_multi' => $lang_multi,
+ 'optionType' => $pollOptionType,
+ 'optionName' => $pollOptionName,
+ 'options' => $pollOptionArray,
+ 'hasExpired' => $pollObj->hasExpired(),
+ 'canVote' => $canVote,
+ 'votes' => $pollVars['votes'],
+ 'hasVoted' => $hasVoted,
+ 'totalVotes' => sprintf(_MD_XOOPSPOLL_TOTALVOTES, $totalVotes),
+ 'comments' => $pollObj->getComments($pollVars['poll_id']),
+ 'endTime' => $xuEndFormattedTime,
+ 'commentMode' => XoopspollPollUtility::commentMode()
+ );
+ $block['polls'][] = $poll;
+ unset($pollOptionArray, $poll, $pollVars);
+ }
+ }
+ return $block;
+}
+/**
+ *
+ * Display a form to edit poll block display option
+ *
+ * @access public
+ * @global mixed $GLOBALS['xoopsUser']
+ * @uses xoops_getmodulehandler() function to get class handler for this modules class(es)
+ * @param array options contains settings for block display (init in xoopsversion.php and saved in db)
+ * @return string HTML form for display by block admin
+ */
+function xoopspollBlockMultiEdit( $options )
+{
+ /**
+ * Options[]
+ * [0] 0|1 = show as option|select
+ * [1] 0|1 show expired polls in block
+ *
+ */
+
+ // find out if want to show expired polls in block
+ // (otherwise it will hide block once it expires)
+ if (0 == $options[1]) {
+ $chk0no = " checked='checked'";
+ $chk0yes = "";
+ } else {
+ $chk0no = "";
+ $chk0yes = " checked='checked'";
+ }
+ $form = "<table>\n"
+ . " <tr>\n"
+ . " <td class='width25 middle'>" . _MB_XOOPSPOLL_SHOW_EXP . ":</td>\n"
+ . " <td>\n"
+ . " <label class='middle' for='yes'>" . _YES . "</label>\n"
+ . " <input type='radio' name='options[1]' value='1'{$chk0yes} id='yes' />\n"
+ . " <label class='middle' style='margin-left: 2em;' for='no'> " . _NO . "</label>\n"
+ . " <input type='radio' name='options[1]' value='0'{$chk0no} id='no' />\n"
+ . " </td>\n"
+ . " </tr>\n";
+
+ // find out if want to show options as a lists or as a select boxes
+ if (XoopspollConstants::POLL_OPTIONS_SELECT == $options[0]) {
+ $chk0select = " checked='checked'";
+ $chk0list = "";
+ } else {
+ $chk0select = "";
+ $chk0list = " checked='checked'";
+ }
+ $form .= " <tr>\n"
+ . " <td class='width25 middle'>" . _MB_XOOPSPOLL_SHOW_OPTIONS . ":</td>\n"
+ . " <td>\n"
+ . " <label class='middle' for='list'>" . _MB_XOOPSPOLL_LIST . "</label>\n"
+ . " <input type='radio' name='options[0]' value='" . XoopspollConstants::POLL_OPTIONS_LIST . "'{$chk0list} id='list' />\n"
+ . " <label class='middle' style='margin-left: 2em;' for='select'> " . _MB_XOOPSPOLL_SELECT . "</label>\n"
+ . " <input type='radio' name='options[0]' value='" . XoopspollConstants::POLL_OPTIONS_SELECT . "'{$chk0select} id='select' />\n"
+ . " </td>\n"
+ . " </tr>\n"
+ . "</table>\n";
+ return $form;
+}
\ No newline at end of file
Added: XoopsModules/xoopspoll/branches/zyspec/blocks/singlepoll.php
===================================================================
--- XoopsModules/xoopspoll/branches/zyspec/blocks/singlepoll.php (rev 0)
+++ XoopsModules/xoopspoll/branches/zyspec/blocks/singlepoll.php 2013-05-14 03:25:04 UTC (rev 11541)
@@ -0,0 +1,321 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+ This program 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.
+ */
+
+/**
+ * XoopsPoll Single Poll Block Definition (clonable)
+ *
+ * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
+ * @package:: xoopspoll
+ * @subpackage:: blocks
+ * @since:: 1.40
+ * @version:: $Id: $
+ */
+
+xoops_loadLanguage('main', 'xoopspoll');
+xoops_load('pollUtility', 'xoopspoll');
+/*
+include_once $GLOBALS['xoops']->path( "modules"
+ . DIRECTORY_SEPARATOR . "xoopspoll"
+ . DIRECTORY_SEPARATOR . "class"
+ . DIRECTORY_SEPARATOR . "pollutility.php"
+);
+*/
+/**
+ *
+ * Display a single XOOPS Polls in a block
+ *
+ * @access public
+ * @global mixed $GLOBALS['xoopsUser']
+ * @uses CriteriaCompo
+ * @uses Criteria
+ * @uses xoops_getUserTimestamp() function to convert time to user time
+ * @uses formatTimestamp() takes timestamp and converts to human readable format
+ * @param array options contains settings for block display
+ * @return array block keys and values to be used by block template
+ */
+function xoopspollBlockSinglepollShow($options)
+{
+ $block = array();
+
+ $configHandler =& xoops_gethandler('config');
+ $pollHandler =& xoops_getmodulehandler('poll', 'xoopspoll');
+ $moduleHandler =& xoops_gethandler('module');
+ $thisModule =& $moduleHandler->getByDirname('xoopspoll');
+ $this_module_config =& $configHandler->getConfigsByCat(0, $thisModule->getVar('mid'));
+
+
+ /* if admin hasn't initialized block then we'll pick a poll for them
+ * provided that one exists in the database
+ */
+ if (0 == $options[1]) {
+ $criteria = null;
+ /**
+ * check to see if we want to include polls created with forum (newbb)
+ */
+ if (($thisModule instanceof XoopsModule) && $thisModule->isactive() && $this_module_config['hide_forum_polls']) {
+ $newbbModule =& $moduleHandler->getByDirname('newbb');
+ if ($newbbModule instanceof XoopsModule && $newbbModule->isactive()) {
+ $topic_handler = xoops_getmodulehandler('topic', 'newbb');
+ $tFields = array('topic_id', 'poll_id');
+ $tArray = $topic_handler->getAll(new Criteria('topic_haspoll', 0, '>'), $tFields, false);
+ if (!empty($tArray)) {
+ $tcriteria = array();
+ foreach($tArray as $t) {
+ $tcriteria[] = $t['poll_id'];
+ }
+ if (!empty($tcriteria)) {
+ $tstring = "(" . implode(',', $tcriteria) . ")";
+ $criteria = new Criteria('poll_id', $tstring, "NOT IN");
+ }
+ }
+ unset($topic_handler, $tFields, $tArray);
+ }
+ unset($newbbModule);
+ }
+
+ if ($pollHandler->getCount($criteria) > 0) {
+ $pollIdArray = $pollHandler->getIds();
+ $thisId = array_shift($pollIdArray);
+ $pollObj = $pollHandler->get($thisId);
+ } else {
+ return $block;
+ }
+ } else {
+ $pollObj = $pollHandler->get( (int)($options[1]));
+ }
+
+ if ($pollObj instanceof XoopspollPoll) {
+ if (((!$pollObj->hasExpired() || (1 == $options[0])))) {
+ $block['langVote'] = _MD_XOOPSPOLL_VOTE;
+ $block['langResults'] = _MD_XOOPSPOLL_RESULTS;
+ $block['langExpires'] = _MB_XOOPSPOLL_WILLEXPIRE;
+ $block['langExpired'] = _MB_XOOPSPOLL_HASEXPIRED;
+ $block['langComments'] = _MB_XOOPSPOLL_COMMENTS;
+ $block['langComment'] = _MB_XOOPSPOLL_COMMENT;
+ $block['showResultsLink'] = $options[2];
+ $block['asList'] = $options[3];
+ $block['thisModuleDir'] = 'xoopspoll';
+ $block['url'] = "http"
+ . ((!empty($_SERVER['HTTPS'])) ? "s" : "")
+ . "://"
+ . $_SERVER['SERVER_NAME']
+ . $_SERVER['REQUEST_URI'];
+ $block['dispVotes'] = $this_module_config['disp_vote_nums'];
+
+ $optHandler =& xoops_getmodulehandler('option', 'xoopspoll');
+
+ $pollVars = $pollObj->getValues();
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria('poll_id', $pollVars['poll_id'], '='));
+ $criteria->setSort('option_id');
+ $optionsObjArray = $optHandler->getAll($criteria);
+// $optionsObjArray = $optHandler->getAll($criteria, null, false);
+
+ if (XoopspollConstants::MULTIPLE_SELECT_POLL == $pollVars['multiple']) {
+ $pollOptionType = 'checkbox';
+ $pollOptionName = 'option_id[]';
+ } else {
+ $pollOptionType = 'radio';
+ $pollOptionName = 'option_id';
+ }
+
+ if (isset($GLOBALS['xoopsUser']) && ($GLOBALS['xoopsUser'] instanceof XoopsUser)) {
+ $uid = $GLOBALS['xoopsUser']->getVar('uid');
+ } else {
+ $uid = 0;
+ }
+
+ $totalVotes = $pollVars['votes'];
+ $logHandler =& xoops_getmodulehandler('log', 'xoopspoll');
+ $hasVoted = $logHandler->hasVoted($pollVars['poll_id'], xoops_getenv('REMOTE_ADDR'), $uid) ? true : false;
+ $canVote = (!$hasVoted) && ($pollObj->isAllowedToVote());
+ $pollOptionsArray = array();
+ foreach ($optionsObjArray as $optionObj) {
+ $percent = ($totalVotes > 0) ? (100 * $optionObj->getVar('option_count') / $totalVotes) : 0;
+// $percent = ($totalVotes > 0) ? ceil(100 * $optionObj->getVar('option_count') / $totalVotes) . '%' : '0%';
+ /*@TODO:: Change block templates to use Smarty html_options to support this... then comment
+ out old $pollOptionsArray assignment
+ $pollOptionsArray[] = array('options' => array($optionObj['option_id'] => $optionObj['option_text']),
+ 'count' => $optionObj['option_count'],
+ 'percent' => $percent,
+ 'color' => $optionObj['option_color']
+ ); */
+ $pollOptionsArray[] = array(
+ 'id' => $optionObj->getVar('option_id'),
+ 'text' => $optionObj->getVar('option_text'),
+ 'count' => $optionObj->getVar('option_count'),
+ 'percent' => sprintf(" %01.1f%%", $percent),
+ 'color' => $optionObj->getVar('option_color')
+ );
+ }
+
+ $xuEndTimestamp = xoops_getUserTimestamp($pollObj->getVar('end_time'));
+ $xuEndFormattedTime = ucfirst(date(_MEDIUMDATESTRING, $xuEndTimestamp));
+
+ $isVisible = (true === $pollObj->isResultVisible()) ? true : false;
+
+ $multiple = ($pollVars['multiple']) ? true : false;
+ $multiLimit = intval($pollVars['multilimit']);
+ if ($multiple && ($multiLimit > 0)) {
+ $lang_multi = sprintf(_MB_XOOPSPOLL_MULTITEXT, $multiLimit);
+ } else {
+ $lang_multi = "";
+ }
+
+ $block['id'] = $pollVars['poll_id'];
+ $block['visible'] = $isVisible;
+ $block['question'] = $pollVars['question'];
+ $block['multiple'] = $multiple;
+ $block['lang_multi'] = $lang_multi;
+ $block['optionType'] = $pollOptionType;
+ $block['optionName'] = $pollOptionName;
+ $block['options'] = $pollOptionsArray;
+ $block['hasExpired'] = $pollObj->hasExpired();
+ $block['votes'] = $pollVars['votes'];
+ $block['hasVoted'] = $hasVoted;
+ $block['canVote'] = $canVote;
+ $block['totalVotes'] = sprintf(_MD_XOOPSPOLL_TOTALVOTES, $totalVotes);
+ $block['endTime'] = $xuEndFormattedTime; // formatted output for current user
+ $block['comments'] = $pollObj->getComments($pollVars['poll_id']);
+ $block['commentMode'] = XoopspollPollUtility::commentMode();
+
+ unset($optionsObjArray, $pollOptionsArray, $pollObj, $pollVars, $timeArray);
+ }
+ }
+ return $block;
+}
+/**
+ *
+ * Display a form to edit poll block display option
+ *
+ * @access public
+ * @global mixed $GLOBALS['xoopsUser']
+ * @uses xoops_getmodulehandler() function to get class handler for this modules class(es)
+ * @param array options contains settings for block display (init in xoopsversion.php and saved in db)
+ * @return string HTML form for display by block admin
+ */
+function xoopspollBlockSinglepollEdit( $options )
+{
+ /**
+ * Options[]
+ * 0 = show expired polls in block
+ * 1 = poll id to show
+ * if hiding expired poll then the next non-expired poll
+ * will show if the selected poll is hidden
+ * 2 = show results button in block
+ * 3 = show options as list|select
+ */
+
+ // find out if want to show expired polls in block
+ // (otherwise it will hide block once it expires)
+ if (0 == $options[0]) {
+ $chk0no = " checked='checked'";
+ $chk0yes = "";
+ } else {
+ $chk0no = "";
+ $chk0yes = " checked='checked'";
+ }
+ $form = "<table><tr><td class='width25 middle'>" . _MB_XOOPSPOLL_SHOW_EXP . ":</td><td>"
+ . "<label class='middle' for='yes'>" . _YES . "</label>\n"
+ . "<input type='radio' name='options[0]' value='1'{$chk0yes} id='yes' />\n"
+ . "<label class='middle' style='margin-left: 2em;' for='no'> " . _NO . "</label>\n"
+ . "<input type='radio' name='options[0]' value='0'{$chk0no} id='no' />\n"
+ . "</td></tr>\n";
+
+ $pollHandler =& xoops_getmodulehandler('poll', 'xoopspoll');
+ $pollFields = array('poll_id', 'start_time', 'end_time', 'question', 'weight');
+ $criteria = new CriteriaCompo();
+// $criteria->add(new Criteria('end_time', time(), '>'));
+ $criteria->setOrder('ASC');
+ $criteria->setSort('weight');
+ /**
+ * Note that you can select polls that have not started yet so they will automatically show
+ * up in the block once they have started. To only allow selection of active polls uncomment
+ * the following line in the code - this could be made a module config option if desired
+ */
+ // $criteria->add(new Criteria('start_time', time(), '<='));
+ /**
+ * now check to see if we want to hide polls that were created using newbb
+ */
+ $configHandler =& xoops_gethandler('config');
+ $moduleHandler =& xoops_gethandler('module');
+ $thisModule = $moduleHandler->getByDirname('xoopspoll');
+ $this_module_config =& $configHandler->getConfigsByCat(0, $thisModule->getVar('mid'));
+
+ if (($thisModule instanceof XoopsModule) && $thisModule->isactive() && $this_module_config['hide_forum_polls']) {
+ $newbbModule =& $moduleHandler->getByDirname('newbb');
+ if ($newbbModule instanceof XoopsModule && $newbbModule->isactive()) {
+ $topic_handler = xoops_getmodulehandler('topic', 'newbb');
+ $tFields = array('topic_id', 'poll_id');
+ $tArray = $topic_handler->getAll(new Criteria('topic_haspoll', 0, '>'), $tFields, false);
+ if (!empty($tArray)) {
+ $tcriteria = array();
+ foreach($tArray as $t) {
+ $tcriteria[] = $t['poll_id'];
+ }
+ if (!empty($tcriteria)) {
+ $tstring = "(" . implode(',', $tcriteria) . ")";
+ $criteria->add(new Criteria('poll_id', $tstring, "NOT IN"));
+ }
+ }
+ unset($topic_handler, $tFields, $tArray);
+ }
+ unset($newbbModule);
+ }
+
+ $allPollsArray = $pollHandler->getAll($criteria, $pollFields, false);
+
+ // next get a list of all available polls for select box
+ $form .= "<tr><td>" . _MB_XOOPSPOLL_POLLS . ":</td><td style='text-align: left; left-margin: 1em;'>\n";
+ if (empty($allPollsArray)) {
+ $form .= "<span class='errorMsg'>" . _MB_XOOPSPOLL_NONE_ACTIVE . "</span>";
+ } else {
+ $form .= "<select name='options[1]'>\n";
+ foreach ($allPollsArray as $thisPoll) {
+ $selected = ($thisPoll['poll_id'] == $options[1]) ? " selected='selected'" : "";
+ $taggedQuestion = ($thisPoll['end_time'] < time()) ? $thisPoll['question'] . '**' : $thisPoll['question'];
+ $form .= " <option value='" . $thisPoll['poll_id'] . "'{$selected}>" . $taggedQuestion . "</option>\n";
+ }
+ $form .= "</select>\n"
+ . " ** - " . _MB_XOOPSPOLL_EXPIRED_INDICATOR . "\n";
+ }
+ if (0 == $options[2]) {
+ $chk2no = " checked='checked'";
+ $chk2yes = "";
+ } else {
+ $chk2no = "";
+ $chk2yes = " checked='checked'";
+ }
+ $form .= "</td></tr>\n"
+ . "<tr><td class='width25 middle'>" . _MB_XOOPSPOLL_SHOW_RESULT_LINK . ":</td><td>"
+ . "<label class='middle' for='yesr'>" . _YES . "</label>\n"
+ . "<input type='radio' name='options[2]' value='1'{$chk2yes} id='yesr' />\n"
+ . "<label class='middle' style='margin-left: 2em;' for='nor'> " . _NO . "</label>\n"
+ . "<input type='radio' name='options[2]' value='0'{$chk2no} id='nor' />\n"
+ . "</td></tr>\n";
+
+ /* find out if want to show options as a list or as a select box */
+ if (XoopspollConstants::POLL_OPTIONS_SELECT == $options[3]) {
+ $chk3select = " checked='checked'";
+ $chk3list = "";
+ } else {
+ $chk3select = "";
+ $chk3list = " checked='checked'";
+ }
+ $form .= "<table><tr><td class='width25 middle'>" . _MB_XOOPSPOLL_SHOW_OPTIONS . ":</td><td>"
+ . "<label class='middle' for='list'>" . _MB_XOOPSPOLL_LIST . "</label>\n"
+ . "<input type='radio' name='options[3]' value='" . XoopspollConstants::POLL_OPTIONS_LIST . "'{$chk3list} id='list' />\n"
+ . "<label class='middle' style='margin-left: 2em;' for='select'> " . _MB_XOOPSPOLL_SELECT . "</label>\n"
+ . "<input type='radio' name='options[3]' value='" . XoopspollConstants::POLL_OPTIONS_SELECT . "'{$chk3select} id='select' />\n"
+ . "</td></tr>\n"
+ . "</table>\n";
+ return $form;
+}
\ No newline at end of file
Added: XoopsModules/xoopspoll/branches/zyspec/class/constants.php
===================================================================
--- XoopsModules/xoopspoll/branches/zyspec/class/constants.php (rev 0)
+++ XoopsModules/xoopspoll/branches/zyspec/class/constants.php 2013-05-14 03:25:04 UTC (rev 11541)
@@ -0,0 +1,179 @@
+<?php
+/*
+ XOOPS - PHP Content Management System
+ Copyright (c) 2000 XOOPS.org
+ <http://www.xoops.org/>
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting
+ source code which is considered copyrighted (c) material of the
+ original comment or credit authors.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+/**
+ * XoopsPoll module
+ *
+ * Class to define XOOPS Poll constant values. These constants are
+ * used to make the code easier to read and to keep values in central
+ * location if they need to be changed. These should not normally need
+ * to be modified. If they are to be modified it is recommended to change
+ * the value(s) before module installation. Additionally the module may not
+ * work correctly if trying to upgrade if these values have been changed.
+ *
+ * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license:: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
+ * @author:: zyspec <ow...@zy...>
+ * @package:: xoopspoll
+ * @since:: 1.40
+ * @version:: $Id: $
+ **/
+
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+interface XoopspollConstants
+{
+/**#@+
+ * Constant definition
+ */
+ /**
+ * indicates a poll has not been emailed
+ */
+ const POLL_NOT_MAILED = 0;
+ /**
+ * indicates a poll has been emailed
+ */
+ const POLL_MAILED = 1;
+ /**
+ * indicates a poll should nto be emailed to voter
+ */
+ const NOT_MAIL_POLL_TO_VOTER = 0;
+ /**
+ * indicates poll should be emailed to voter
+ */
+ const MAIL_POLL_TO_VOTER = 1;
+ /**
+ * indicates admin should not be notified
+ */
+ const NOTIFICATION_DISABLED = 0;
+ /**
+ * indicates admin should be notified
+ */
+ const NOTIFICATION_ENABLED = 1;
+ /**
+ * do not reset poll results
+ */
+ const DO_NOT_RESET_RESULTS = 0;
+ /**
+ * reset poll results
+ */
+ const RESET_RESULTS = 1;
+ /**
+ * default number of elements to show on a page
+ */
+ const DEFAULT_POLL_PAGE_LIMIT = 30;
+ /**
+ * default amount of time for a poll to be active in seconds
+ */
+ const DEFAULT_POLL_DURATION = 864000;
+ /**
+ * no delay XOOPS redirect delay (in seconds)
+ */
+ const REDIRECT_DELAY_NONE = 0;
+ /**
+ * short XOOPS redirect delay (in seconds)
+ */
+ const REDIRECT_DELAY_SHORT = 1;
+ /**
+ * medium XOOPS redirect delay (in seconds)
+ */
+ const REDIRECT_DELAY_MEDIUM = 3;
+ /**
+ * long XOOPS redirect delay (in seconds)
+ */
+ const REDIRECT_DELAY_LONG = 7;
+ /**
+ * additional blank poll options to be added in form
+ */
+ const NUM_ADDTL_OPTIONS = 5;
+ /**
+ * poll results visibility option
+ * {@internal Do NOT change these after module is installed}
+ */
+ const HIDE_NEVER = 0;
+ /**
+ * poll results visibility option
+ * {@internal Do NOT change these after module is installed}
+ */
+ const HIDE_END = 1;
+ /**
+ * poll results visibility option
+ * {@internal Do NOT change these after module is installed}
+ */
+ const HIDE_VOTED = 2;
+ /**
+ * poll results visibility option
+ * {@internal Do NOT change these after module is installed}
+ */
+ const HIDE_ALWAYS = 3;
+ /**
+ * value indicates poll is displayed in block
+ */
+ const DISPLAY_POLL_IN_BLOCK = 1;
+ /**
+ * value indicates poll is NOT displayed in block
+ */
+ const DO_NOT_DISPLAY_POLL_IN_BLOCK = 0;
+ /**
+ * value indicates multiple selections are available in poll
+ */
+ const MULTIPLE_SELECT_POLL = 1;
+ /**
+ * value indicates multiple selections are not available in poll
+ */
+ const NOT_MULTIPLE_SELECT_POLL = 0;
+ /**
+ * value indicates unlimited selections allowed in multiple selection polls
+ */
+ const MULTIPLE_SELECT_LIMITLESS = 0;
+ /**
+ * value indicates poll options are shown as select box
+ */
+ const POLL_OPTIONS_SELECT = 0;
+ /**
+ * value indicates poll options are shown as list
+ */
+ const POLL_OPTIONS_LIST = 1;
+ /**
+ * anonymous voting in poll allowed
+ */
+ const ANONYMOUS_VOTING_ALLOWED = 1;
+ /**
+ * anonymous voting in poll not allowed
+ */
+ const ANONYMOUS_VOTING_DISALLOWED = 0;
+ /**
+ * default poll weight for display order
+ */
+ const DEFAULT_WEIGHT = 0;
+ /**
+ * do not look up host
+ */
+ const DO_NOT_LOOK_UP_HOST = 0;
+ /**
+ * look up host
+ */
+ const LOOK_UP_HOST = 1;
+/**#@-*/
+}
\ No newline at end of file
Added: XoopsModules/xoopspoll/branches/zyspec/class/formdatetimepicker.php
===================================================================
--- XoopsModules/xoopspoll/branches/zyspec/class/formdatetimepicker.php (rev 0)
+++ XoopsModules/xoopspoll/branches/zyspec/class/formdatetimepicker.php 2013-05-14 03:25:04 UTC (rev 11541)
@@ -0,0 +1,128 @@
+<?php
+/**
+ * Xoopspoll form timepicker
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material of the original comment or credit authors.
+ * This program 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.
+ *
+ * @copyright:: © {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license:: {@link http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL 2}
+ * @package:: xoopspoll
+ * @subpackage:: class
+ * @since:: 1.40
+ * @author:: TXMod Xoops (aka timgno) {@link http://www.txmodxoops.org/ TXMod Xoops}
+ * @author:: zyspec <ow...@zy...>
+ * @credits:: {@link http://www.trentrichardson.com Trent Richardson}
+ * @version:: $Id: $
+ */
+
+defined('XOOPS_ROOT_PATH') or die("Restricted access");
+
+/**
+ * Creates a text field with jquery ui calendar & time select popup
+ */
+class XoopspollFormDateTimePicker extends XoopsFormText
+{
+ /**
+ *
+ * Contains the maximum field size
+ */
+ const MAXSIZE = 25;
+
+ /**
+ *
+ * Constructor to build FormDateTimePicker object
+ * @param mixed $caption HTML description to display for the element
+ * @param mixed $name HTML element name (ie. name='$name')
+ * @param mixed $size size of field to display
+ * @param mixed $value timestamp of date/time to show
+ */
+ function __construct($caption, $name, $size, $value)
+ {
+ $value = (!is_numeric($value) || (0 == intval($value))) ? time($value) : intval($value);
+ $size = intval($size);
+ $size = ($size > 0 && $size <= self::MAXSIZE) ? $size : self::MAXSIZE;
+ parent::__construct($caption, $name, $size, self::MAXSIZE, $value);
+ }
+
+ /**
+ *
+ * Generate the HTML <input> to display the date/time field
+ * @return string HTML code used to display in a form
+ */
+ public function render()
+ {
+ static $included = false;
+
+ $ele_name = $this->getName();
+ $ele_value = $this->getValue(true);
+// if (is_string($ele_value)) {
+ if (!is_numeric($ele_value)) {
+ $display_value = $ele_value;
+ $ele_value = time();
+ } else {
+// $display_value = '';
+// $display_value = formatTimestamp($ele_value, 'm');
+ $display_value = ucfirst(date(_MEDIUMDATESTRING, $ele_value));
+ }
+
+ if (is_object($GLOBALS['xoTheme'])) {
+ $mod_handler =& xoops_gethandler('module');
+ $sys_module =& $mod_handler->getByDirname('system');
+ $config_handler =& xoops_gethandler('config');
+ $moduleConfig =& $config_handler->getConfigsByCat(0, $sys_module->getVar('mid'));
+ $jq_theme_dir = $moduleConfig['jquery_theme'];
+
+ $GLOBALS['xoTheme']->addStylesheet( $GLOBALS['xoops']->url("modules/system/css/ui/{$jq_theme_dir}/ui.all.css") );
+ $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
+ $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
+ $GLOBALS['xoTheme']->addScript('browse.php?modules/xoopspoll/js/jquery-ui-timepicker-addon.js');
+ $GLOBALS['xoTheme']->addScript('browse.php?modules/xoopspoll/js/jquery-ui-sliderAccess.js');
+ $GLOBALS['xoTheme']->addStylesheet( $GLOBALS['xoops']->url('modules/xoopspoll/css/datetimepicker.css'));
+
+ if (!$included) {
+ $included = true;
+ xoops_loadLanguage('admin', 'xoopspoll');
+ // setup regional date variables
+ $reg_values = "closeText: '" . _AM_XOOPSPOLL_DTP_CLOSETEXT . "',"
+ . "prevText: '" . _AM_XOOPSPOLL_DTP_PREVTEXT . "',"
+ . "nextText: '" . _AM_XOOPSPOLL_DTP_NEXTTEXT . "',"
+ . "currentText: '" . _AM_XOOPSPOLL_DTP_CURRENTTEXT . "',"
+ . "monthNames: [" . _AM_XOOPSPOLL_DTP_MONTHNAMES . "],"
+ . "monthNamesShort: [" . _AM_XOOPSPOLL_DTP_MONTHNAMESSHORT . "],"
+ . "dayNames: [" . _AM_XOOPSPOLL_DTP_DAYNAMES . "],"
+ . "dayNamesShort: [" . _AM_XOOPSPOLL_DTP_DAYNAMESSHORT . "],"
+ . "dayNamesMin: [" . _AM_XOOPSPOLL_DTP_DAYNAMESMIN . "],"
+ . "weekHeader: '" . _AM_XOOPSPOLL_DTP_WEEKHEADER . "',"
+ . "dateFormat: '" . _AM_XOOPSPOLL_DTP_DATEFORMAT . "',"
+ . "firstDay: '" . _AM_XOOPSPOLL_DTP_FIRSTDAY . "',"
+ . "isRTL: " . _AM_XOOPSPOLL_DTP_ISRTL . ","
+ . "showMonthAfterYear: " . _AM_XOOPSPOLL_DTP_SHOWMONTHAFTERYEAR . ","
+ . "yearSuffix: '" . _AM_XOOPSPOLL_DTP_YEARSUFFIX . "',";
+ // set regional time variables
+ $reg_values .= "timeOnlyTitle: '" . _AM_XOOPSPOLL_DTP_TIMEONLYTITLE . "',"
+ . "timeText: '" . _AM_XOOPSPOLL_DTP_TIMETEXT . "',"
+ . "hourText: '" . _AM_XOOPSPOLL_DTP_HOURTEXT . "',"
+ . "minuteText: '" . _AM_XOOPSPOLL_DTP_MINUTETEXT . "',"
+ . "secondText: '" . _AM_XOOPSPOLL_DTP_SECONDTEXT . "',"
+ . "millisecText: '" . _AM_XOOPSPOLL_DTP_MILLISECTEXT . "',"
+ . "timeFormat: '" . _AM_XOOPSPOLL_DTP_TIMEFORMAT . "',"
+ . "ampm: false,"
+ . "stepMinute: 5";
+
+ $GLOBALS['xoTheme']->addScript('','', '
+ $(function() {
+ $( ".datetimepicker" ).datetimepicker({
+ ' . $reg_values . '
+ });
+ });
+ ');
+ }
+ }
+ return "<input type='text' name='{$ele_name}' id='{$ele_name}' class='datetimepicker' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='{$display_value}'" . $this->getExtra() . " />";
+ }
+}
\ No newline at end of file
Added: XoopsModules/xoopspoll/branches/zyspec/class/log.php
===================================================================
--- XoopsModules/xoopspoll/branches/zyspec/class/log.php (rev 0)
+++ XoopsModules/xoopspoll/branches/zyspec/class/log.php 2013-05-14 03:25:04 UTC (rev 11541)
@@ -0,0 +1,280 @@
+<?php
+/*
+ XOOPS - PHP Content Management System
+ Copyright (c) 2000 XOOPS.org
+ <http://www.xoops.org/>
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting
+ source code which is considered copyrighted (c) material of the
+ original comment or credit authors.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+/**
+ * Log class for the XoopsPoll Module
+ *
+ * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
+ * @package:: xoopspoll
+ * @subpackage:: class
+ * @since:: 1.40
+ * @author:: {@link http://www.myweb.ne.jp/ Kazumi Ono (AKA onokazu)}
+ * @version:: $Id: $
+ **/
+
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+/**
+ *
+ * XoopspollLog() class definition for Log Objects
+ * @author:: zyspec <ow...@zy...>
+ * @uses:: xoops_getmodulehandler poll module handler for class use
+ *
+ */
+class XoopspollLog extends XoopsObject
+{
+// class XoopspollLog extends XoopsObject {
+// var $db;
+
+ /**
+ * Constructor
+ */
+ function __construct(&$id = null)
+ {
+ parent::__construct();
+ $this->initVar('log_id', XOBJ_DTYPE_INT, 0);
+ $this->initVar('poll_id', XOBJ_DTYPE_INT, null, true);
+ $this->initVar('option_id', XOBJ_DTYPE_INT, null, true);
+ $this->initVar('ip', XOBJ_DTYPE_OTHER, null);
+ $this->initVar('user_id', XOBJ_DTYPE_INT, 0);
+ $this->initVar('time', XOBJ_DTYPE_INT, null);
+ if (!empty($id) && is_array($id) ) {
+ $this->assignVars($id);
+ }
+ }
+
+ public function XoopspollLog(&$id = null)
+ {
+ $this->__construct($id);
+ }
+
+/**#@+
+ * The following method is provided for backward compatibility with cbb/xforum
+ * @deprecated since Xoopspoll 1.40, please use XoopspollLogHandler & XoopspollLog
+ */
+ static function deleteByPollId(&$pid)
+ {
+ $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . "::" . __FUNCTION__ . " is deprecated since Xoopspoll 1.40, please use XoopspollLog and XoopspollLogHandler methods instead.");
+ $slogHandler = s...
[truncated message content] |