|
From: Verdon V. <ve...@us...> - 2009-02-19 20:32:13
|
Update of /cvsroot/phpwebsite-comm/modules/elections/inc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11368/inc Modified Files: runtime.php Log Message: preparing for 2.0.0 Index: runtime.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/elections/inc/runtime.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** runtime.php 28 Dec 2006 15:52:13 -0000 1.2 --- runtime.php 19 Feb 2009 20:32:01 -0000 1.3 *************** *** 1,83 **** ! <?php ! /** ! * elections ! * ! * See docs/AUTHORS and docs/COPYRIGHT for relevant info. ! * ! * 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. ! * ! * 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 ! * ! * @version $Id$ ! */ ! ! require_once(PHPWS_SOURCE_DIR.'mod/elections/class/Manager.php'); ! ! // get the settings ! $electionsSettings = ELECTIONS_Manager::getSettingsRow(); ! ! ! if ($electionsSettings['enable_sidebox']) { ! if ($electionsSettings['sidebox_homeonly'] && $GLOBALS['module'] == 'home') { ! renderElectionsBlock(); ! } elseif (!$electionsSettings['sidebox_homeonly']) { ! renderElectionsBlock(); ! } ! } ! ! function renderElectionsBlock() { ! ! $electionsSettings = ELECTIONS_Manager::getSettingsRow(); ! $tags = array(); ! if (isset($electionsSettings['sidebox_text']) && $electionsSettings['sidebox_text'] != '') ! $tags['TEXT'] = $electionsSettings['sidebox_text']; ! ! if ($electionsSettings['enable_elections'] || $_SESSION['OBJ_user']->allow_access('elections')) { ! ! $now = date("Y-m-d H:i:s"); ! $where = NULL; ! $where .= "showin_block = '1'"; ! if (!isset($_SESSION['OBJ_user']->username)) ! $where .= " AND pubview = '1'"; ! $where .= " AND closing >= '" . $now . "'"; ! ! $sql = "SELECT election_id, title FROM " . $GLOBALS['core']->tbl_prefix . "mod_elections_elections WHERE " . $where . ""; ! // echo $sql; ! $result = $GLOBALS['core']->getAllAssoc($sql); ! ! if (!$result) { ! $tags['MSG'] = $_SESSION['translate']->it('Sorry, there are no available elections.'); ! } else { ! $list = NULL; ! $ops = array(); ! foreach ($result as $element) { ! $ops['ITEM'] = '<a href="./index.php?module=elections&Man_OP=view_election&election_id='.$element['election_id'].'">' . $element['title'] . '</a>'; ! $list .= PHPWS_template::processTemplate($ops, "elections", "block_item.tpl"); ! } ! $tags['LIST'] = $list; ! } ! ! } else { ! $tags['MSG'] = $_SESSION['translate']->it('Thank you for your interest. However, all elections are currently closed.'); ! } ! ! if ($_SESSION['OBJ_user']->allow_access('elections')) ! $tags['MOD_LINK'] = '<a href="index.php?module=elections&Man_OP=list_elections">' . $_SESSION['translate']->it('Go to Elections Module') . '</a>'; ! ! $content = PHPWS_template::processTemplate($tags, "elections", "block.tpl"); ! ! $GLOBALS['CNT_elections_box']['title'] = $_SESSION['translate']->it("Elections"); ! $GLOBALS['CNT_elections_box']['content'] = $content; ! } ! ?> \ No newline at end of file --- 1,29 ---- ! <?php ! /** ! * elections - phpwebsite module ! * ! * See docs/AUTHORS and docs/COPYRIGHT for relevant info. ! * ! * 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. ! * ! * 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 ! * ! * @version $Id$ ! * @author Verdon Vaillancourt <verdonv at users dot sourceforge dot net> ! */ ! ! ! PHPWS_Core::initModClass('elections', 'ELEC_Runtime.php'); ! ELEC_Runtime::showBlock(); ! ?> \ No newline at end of file |