Subversion Repositories starrating

[/] [modules/] [starrating/] [collect.php] - Blame information for rev 1

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 zabbie
<?php
2
include_once ('kernel/common/template.php');
3
include_once ('kernel/common/eztemplatedesignresource.php');
4
include_once ('extension/starrating/classes/starrating.php');
5
 
6
$Module = $Params['Module'];
7
 
8
$http = eZHTTPTool::instance();
9
$ini = eZINI::instance();
10
 
11
$contentobject_attribute_id = false;
12
$version = false;
13
$rating = false;
14
 
15
if (isset($Params['ContentObjectAttributeID']) and is_numeric($Params['ContentObjectAttributeID']))
16
  $contentobject_attribute_id = $Params['ContentObjectAttributeID'];
17
 
18
if (isset($Params['version']) and is_numeric($Params['version']))
19
  $version = $Params['version'];
20
 
21
if (isset($Params['rating']) and is_numeric($Params['rating']))
22
  $rate = $Params['rating'];
23
 
24
if ($contentobject_attribute_id and
25
    $version and
26
    $rate)
27
{
28
  // Check to see if this person has voted before
29
  $votedBefore = starrating::fetchBySessionKey($contentobject_attribute_id);
30
  if (! $votedBefore)
31
  {
32
      $rating = starrating::rate($contentobject_attribute_id,$version,$rate);
33
  }
34
  else
35
  {
36
    eZDebug::writeDebug( "User has previously voted", "starrating" );
37
  }
38
}
39
 
40
// redircet back to where we just were
41
$RedirectURI = '/';
42
if ( $http->hasSessionVariable( "LastAccessesURI" ) )
43
  $RedirectURI = $http->sessionVariable( "LastAccessesURI" );
44
return $Module->redirectTo($RedirectURI);
45
?>