.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ========= EXT: Poll ========= :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed by: Kasper Skårhøj :Changed: 2002-11-30T01:41:18 :Email: r.fritz@colorcube.de :Info 2: :Info 3: :Info 4: .. _EXT-Poll: EXT: Poll ========= Extension Key: **tt\_poll** Copyright 2000-2002, , This document is published under the Open Content License available from http://www.opencontent.org/opl.shtml The content of this document is related to Typo3 \- a GNU/GPL CMS/Framework available from www.typo3.com .. _Table-of-Contents: Table of Contents ----------------- **EXT: Poll 1** **Introduction 1** **Configuration 2** Files 2 Description 2 Static template 2 pollLib.inc properties 2 .. _Introduction: Introduction ------------ |img-1| Please note that the poll plugin is not enabled by default in typo3. You have to include the file poll\_extTables.inc in typo3conf/localconf.php. Set in localconf.php: :: $typo_db_extTableDef_script = “extTables.php”; Add/set/uncomment in extTables.php: :: include(PATH_site.”media/scripts/poll_extTables.inc”); .. _Configuration: Configuration ------------- .. _Files: Files ^^^^^ .. ### BEGIN~OF~TABLE ### .. _pollLib-inc: pollLib.inc """"""""""" .. container:: table-row File pollLib.inc Description Main class used to display the poll abject.Call it from a USER cObject with 'userFunc = user\_poll->main\_poll' .. _poll-submit-inc: poll\_submit.inc """""""""""""""" .. container:: table-row File poll\_submit.inc Description Used with FEDATA to submit user poll values to the database.See static\_template 'plugin.tt\_poll'. .. _poll-extTables-inc: poll\_extTables.inc """"""""""""""""""" .. container:: table-row File poll\_extTables.inc Description This file extend the definition in tables.php. Look above for set up. .. ###### END~OF~TABLE ###### .. _Description: Description ^^^^^^^^^^^ The poll object consist of the two files pollLib.inc (display) and poll\_submit.inc (calculation and submission to the database). The pollLib.inc is able to display two parts which are selected through the .code option. The first part is the vote form where the user can make his vote. The second part is the result which may show some graphs. You maybe want to limit the poll to a period. You can set this limit with the tt\_poll.starttime and tt\_poll.endtime values. If the start time is in the future nothing will be shown. If the start time is in the past and the end time is in the future the poll is in progress and the vote form and the result are both displayed. If the end time is in the past the poll is finished and only the result will be displayed. If the end time is not set the poll has an open end. The polls choices/answers are stored in tt\_poll.answers in format: :: 129|coffee 45|tea 4|milk means 129 votes for coffee, 45 for tea and 4 votes for milk. During the voting a cookie will be set in poll\_submit.inc to prevent multiple votings from one user. This is not really safe, because the user can delete the cookie or he switched cookies off. If a backend user vote, no cookie will be written. This is to make it comfortable to test the poll for backend users. .. _Usage-from-tt-content-records: Usage from tt\_content.records """""""""""""""""""""""""""""" This would be the normal way to display the poll. This is used in the static\_template 'plugin.tt\_poll'. .. _Usage-from-another-object: Usage from another object """"""""""""""""""""""""" If you need a poll for another record and a link to, it should be done through TypoScript where you simply insert your poll object as a content element in a COA or whatever renders your element. Example: :: = COA 10 = LOAD_REGISTER 10.tt_whatever_uid.field = uid 20 = < plugin.tt_poll 20.pollTable = tt_whatever 20.pollTableUid.data = register : tt_whatever_uid The record field tt\_poll.linkrecord has to be set with a 'record link': :: tt_whatever_uid Example: :: tt_whatever_23 .. _Example: Example: ~~~~~~~~ See static\_template 'plugin.tt\_poll' for a working configuration. .. _Static-template: Static template ^^^^^^^^^^^^^^^ plugin.tt\_poll .. _pollLib-inc-properties: pollLib.inc properties ^^^^^^^^^^^^^^^^^^^^^^ .. ### BEGIN~OF~TABLE ### .. _pollTable: pollTable """"""""" .. container:: table-row Property pollTable Data type string Description Normally the poll has it's data already because it's the current record, so this is not needed. This is used to get a connection from another table to a poll record. Example: you created your own table user\_images which shows a photo gallery. This option allows you to link a poll The first pid from .pid\_list is used to store new created record, otherwise the current page will be used. To enable this feature, you have to set this option with the name of the table y See 'Usage from another object' Default .. _pollTableUid: pollTableUid """""""""""" .. container:: table-row Property pollTableUid Data type string / stdWrap Description This is used to get a connection from another table to a poll record. If not set cObj->currentRecord is used. See 'Usage from another object' Default Current record .. _pollTablePid: pollTablePid """""""""""" .. container:: table-row Property pollTablePid Data type string / stdWrap Description This is the pid which holds the poll record. If not set the current page is the pid. See 'Usage from another object' Default current page .. _code: code """" .. container:: table-row Property code Data type string / stdWrap Description Code to define, what the script does. Case **sensi** tive VOTEFORM : Shows a form from which to vote for the poll. RESULT : Shows the polls result (.resultObj). SUBMITTEDVOTE : Shows the just submitted vote from the user. Default .. _date-stdWrap: date\_stdWrap """"""""""""" .. container:: table-row Property date\_stdWrap Data type stdWrap Description stdWrap for tt\_poll.starttime (###STARTTIME###) andtt\_poll.endtime (###ENDTIME###) example: :: date_stdWrap.strftime= %e-%m-%y Default .. _pollOutputWidth: pollOutputWidth """"""""""""""" .. container:: table-row Property pollOutputWidth Data type integer Description If you want to create a bar this is the full (100% of votes) length.See also .resultItemObj . Default .. _wrap: wrap """" .. container:: table-row Property wrap Data type wrap Description Wraps the whole output. Default .. _voteform: voteform """""""" .. container:: table-row Property voteform Data type FORM Description There's only one form element to set up in this form: :: voteform.dataArray { 10.type = formtype_db = submit 10.value = Vote } The poll items are set up from the script. If you want to show the result on another page you have to set the voteform.redirect property. For the rest of the FORM set up, have a look at the FORM description.See also the plugin.tt\_poll TypoScript example. Default .. _resultItemObj: resultItemObj """"""""""""" .. container:: table-row Property resultItemObj Data type cObject Description Render object for every poll answer/item. Following strings will be substituted: ###ANSWER###poll item text ###ITEMVOTES###tt\_poll.votes, count of all votes ###PERCENT###percentage of the items vote from all votes Following values are usefull to create bars: ###POLLFULLWIDTH###This is the full length (100%) of a bar or something similar(= .pollOutputWidth) ###POLLWIDTH###This is the width of a bar or something similar ###POLLREMAINWIDTH###POLLFULLWIDTH – POLLWIDTH Default .. _resultObj: resultObj """"""""" .. container:: table-row Property resultObj Data type cObject Description This is the object to output the result. Have a look at the plugin.tt\_poll TypoScript example. In this object there will be done a few string substitutions. This is for output poll values. Following strings will be substituted with other objects output: ###RESULTITEMS###All items (the list) rendered with .resultItemObj ###PROGRESSMSG###If tt\_poll.starttime and/or tt\_poll.endtime is set,this marker will be substituted with.inProgressObj Or .finishedObj . ###VOTESMSG###If tt\_poll.starttime and/or tt\_poll.endtime is set,this marker will be substituted with.submittedVoteObj . Following string substitutions will be done: ###TOTALVOTES###tt\_poll.votes, count of all votes ###TITLE###tt\_poll.title ###QUESTION###tt\_poll.question – your poll question ###SUBMITTEDVOTE###The submitted vote text ###STARTTIME###tt\_poll.starttime ###ENDTIME###tt\_poll.endtime See also the plugin.tt\_poll TypoScript example. Default .. _inProgressObj: inProgressObj """"""""""""" .. container:: table-row Property inProgressObj Data type cObject Description Used if the poll is in progress and has a end date. Then it will substitute ###PROGRESSMSG###. Could display a message like: The Survey will end at ###ENDTIME### Default .. _finishedObj: finishedObj """"""""""" .. container:: table-row Property finishedObj Data type cObject Description Used if the poll is over. Then it will substitute ###PROGRESSMSG###. Could display a message like: The Survey was finished at ###ENDTIME### Default .. _submittedVoteObj: submittedVoteObj """""""""""""""" .. container:: table-row Property submittedVoteObj Data type cObject Description Used if the user just voted and .code includes SUBMITTEDVOTE. Then it will substitute ###VOTEMSG###. Could display a message like: Your vote was: “###SUBMITTEDVOTE###” Default .. ###### END~OF~TABLE ###### [tsref:(script).pollLib] |img-2| EXT: Poll **- 4** .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. :border: 0 .. :height: 387 .. :id: Grafik22 .. :name: Grafik22 .. :width: 363 .. |img-2| image:: img-2.png .. :align: left .. :border: 0 .. :height: 32 .. :id: Graphic1 .. :name: Graphic1 .. :width: 102