[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/forms/ -> FormSiteNewsletter.class.php (source)

   1  <?php
   2  /* 
   3   * phpMyVisites : website statistics and audience measurements
   4   * Copyright (C) 2002 - 2006
   5   * http://www.phpmyvisites.net/ 
   6   * phpMyVisites is free software (license GNU/GPL)
   7   * Authors : phpMyVisites team
   8  */
   9  
  10  // $Id: FormSiteNewsletter.class.php 29 2006-08-18 07:35:21Z matthieu_ $
  11  
  12  
  13  
  14  require_once  INCLUDE_PATH . "/core/forms/Form.class.php";
  15  require_once  INCLUDE_PATH . "/core/include/SiteConfigDb.class.php";
  16  
  17  class FormSiteNewsletter extends Form
  18  {
  19      
  20      var $newsletterName = '';
  21      var $newsletterId = -1;
  22      
  23  	function FormSiteNewsletter( &$template, $siteAdmin, $newsletterId = null )
  24      {
  25          parent::Form( $template );
  26          
  27          $this->siteAdmin = $siteAdmin;
  28          
  29          // case modify a newsletter        
  30          if(!is_null($newsletterId))
  31          {
  32              $o_site = new Site($siteAdmin);
  33              $this->newsletterId = $newsletterId;
  34              $this->newsletterName = $o_site->getNewsletterName($newsletterId);
  35          }
  36      }
  37      
  38  	function process()
  39      {            
  40          // general input
  41          $formElements = array(
  42              array('text', 'form_name', $GLOBALS['lang']['admin_name'], 'value="'.$this->newsletterName.'"'),
  43              array('hidden', 'form_id', $this->newsletterId )
  44          );
  45          
  46          $this->addElements( $formElements );
  47  
  48          // launche process
  49          return parent::process('admin_newsletter_title');
  50          
  51      }
  52      
  53  	function postProcess()
  54      {
  55          $confSite = new SiteConfigDb();
  56          
  57          // add a new nl
  58          if($this->newsletterId == -1)
  59          {
  60              $confSite->addNewsletter( 
  61                                          $this->getSubmitValue( 'form_name'),
  62                                          $this->siteAdmin 
  63                                  );
  64          }
  65          // mod an existing one
  66          else
  67          {
  68              $confSite->setNewsletterName(     
  69                                          $this->getSubmitValue( 'form_name'), 
  70                                          $this->getSubmitValue( 'form_id') 
  71                                      );
  72          }
  73          
  74      }
  75  }
  76  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics