[ Index ] |
|
Code source de phpMyVisites 2.3 |
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: FormSitePartner.class.php 76 2006-09-14 07:08:51Z 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 FormSitePartner extends Form 18 { 19 20 var $partnerName = ''; 21 var $partnerId = -1; 22 23 function FormSitePartner( &$template, $siteAdmin, $partnerId = null ) 24 { 25 parent::Form( $template ); 26 27 $this->siteAdmin = $siteAdmin; 28 29 // case modify a newsletter 30 if(!is_null($partnerId)) 31 { 32 $o_site = new Site($siteAdmin); 33 $this->partnerId = $partnerId; 34 $this->partnerName = $o_site->getPartnerNameFromId($partnerId); 35 $this->partnerUrls = $o_site->getPartnerUrlsId( $partnerId); 36 } 37 } 38 39 function process() 40 { 41 42 // general input 43 $formElements = array( 44 array('text', 'form_name', $GLOBALS['lang']['admin_name'], 'value="'.@$this->partnerName.'"'), 45 array('hidden', 'form_id', $this->partnerId ) 46 ); 47 48 $this->addElements( $formElements, $GLOBALS['lang']['generique_general'] ); 49 50 for($i = 0; $i < NB_URLS_ALIAS_AVAILABLE; $i++) 51 { 52 $formElements2[] = array('text', 53 'form_url'.$i, 54 sprintf($GLOBALS['lang']['admin_url_n'], $i), 55 'value="'. @$this->partnerUrls[$i] .'"'); 56 57 $formRules[] = $this->getRuleCheckUrl( 'form_url'.$i ); 58 } 59 60 $this->addElements( $formElements2, $GLOBALS['lang']['admin_url_aliases'] ); 61 62 $this->addRules( $formRules ); 63 // launche process 64 return parent::process( 'admin_partner_title' ); 65 66 } 67 68 function postProcess() 69 { 70 $confSite = new SiteConfigDb(); 71 72 $a_urls = array(); 73 74 for($i = 0; $i < NB_URLS_ALIAS_AVAILABLE; $i++) 75 { 76 $url = $this->getSubmitValue('form_url'.$i); 77 if(!empty($url)) $a_urls[] = $url; 78 } 79 80 // add a new nl 81 if($this->partnerId == -1) 82 { 83 $confSite->addPartner( 84 $this->getSubmitValue( 'form_name'), 85 $a_urls, 86 $this->siteAdmin 87 ); 88 } 89 // mod an existing one 90 else 91 { 92 if(!isset($a_urls) || sizeof($a_urls) == 0) 93 { 94 $a_urls = array(); 95 } 96 $confSite->setPartner( 97 $this->getSubmitValue( 'form_name'), 98 $a_urls, 99 $this->getSubmitValue( 'form_id') 100 ); 101 } 102 103 } 104 } 105 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |