[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/components/com_contact/ -> contact.class.php (source)

   1  <?php
   2  /**
   3  * @version $Id: contact.class.php 1327 2005-12-07 03:26:07Z Jinx $
   4  * @package Joomla
   5  * @subpackage Contact
   6  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   7  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  17  
  18  include_once ( $mosConfig_absolute_path .'/includes/vcard.class.php' );
  19  
  20  /**
  21  * @package Joomla
  22  * @subpackage Contact
  23  */
  24  class mosContact extends mosDBTable {
  25      /** @var int Primary key */
  26      var $id                 = null;
  27      /** @var string */
  28      var $name                 = null;
  29      /** @var string */
  30      var $con_position         = null;
  31      /** @var string */
  32      var $address             = null;
  33      /** @var string */
  34      var $suburb             = null;
  35      /** @var string */
  36      var $state                 = null;
  37      /** @var string */
  38      var $country             = null;
  39      /** @var string */
  40      var $postcode             = null;
  41      /** @var string */
  42      var $telephone             = null;
  43      /** @var string */
  44      var $fax                 = null;
  45      /** @var string */
  46      var $misc                 = null;
  47      /** @var string */
  48      var $image                 = null;
  49      /** @var string */
  50      var $imagepos             = null;
  51      /** @var string */
  52      var $email_to             = null;
  53      /** @var int */
  54      var $default_con         = null;
  55      /** @var int */
  56      var $published             = null;
  57      /** @var int */
  58      var $checked_out         = null;
  59      /** @var datetime */
  60      var $checked_out_time     = null;
  61      /** @var int */
  62      var $ordering             = null;
  63      /** @var string */
  64      var $params             = null;
  65      /** @var int A link to a registered user */
  66      var $user_id             = null;
  67      /** @var int A link to a category */
  68      var $catid                 = null;
  69      /** @var int */
  70      var $access             = null;
  71  
  72      /**
  73      * @param database A database connector object
  74      */
  75  	function mosContact() {
  76          global $database;
  77          $this->mosDBTable( '#__contact_details', 'id', $database );
  78      }
  79  
  80  	function check() {
  81          $this->default_con = intval( $this->default_con );
  82          return true;
  83      }
  84  }
  85  
  86  /**
  87  * @package Joomla
  88  * class needed to extend vcard class and to correct minor errors
  89  */
  90  class MambovCard extends vCard {
  91  
  92      // needed to fix bug in vcard class
  93  	function setName( $family='', $first='', $additional='', $prefix='', $suffix='' ) {
  94          $this->properties["N"]     = "$family;$first;$additional;$prefix;$suffix";
  95          $this->setFormattedName( trim( "$prefix $first $additional $family $suffix" ) );
  96      }
  97  
  98      // needed to fix bug in vcard class
  99  	function setAddress( $postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL' ) {
 100          // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
 101          $separator     = ';';
 102          
 103          $key         = 'ADR';
 104          if ( $type != '' ) {
 105              $key    .= $separator . $type;
 106          }
 107          $key.= ';ENCODING=QUOTED-PRINTABLE';
 108          
 109          $return = encode( $postoffice ); 
 110          $return .= $separator . encode( $extended );
 111          $return .= $separator . encode( $street );
 112          $return .= $separator . encode( $city );
 113          $return .= $separator . encode( $region);
 114          $return .= $separator . encode( $zip );
 115          $return .= $separator . encode( $country );
 116          
 117          $this->properties[$key] = $return;
 118      }
 119  
 120      // added ability to set filename
 121  	function setFilename( $filename ) {
 122          $this->filename = $filename .'.vcf';
 123      }
 124  
 125      // added ability to set position/title
 126  	function setTitle( $title ) {
 127          $title     = trim( $title );
 128          
 129          $this->properties['TITLE']     = $title;
 130      }
 131  
 132      // added ability to set organisation/company
 133  	function setOrg( $org ) {
 134          $org     = trim( $org );
 135          
 136          $this->properties['ORG'] = $org;
 137      }
 138  
 139  	function getVCard( $sitename ) {
 140          $text     = 'BEGIN:VCARD';
 141          $text    .= "\r\n";
 142          $text     .= 'VERSION:2.1';
 143          $text    .= "\r\n";
 144  
 145          foreach( $this->properties as $key => $value ) {
 146              $text    .= "$key:$value";
 147              $text    .= "\r\n";
 148          }
 149          $text    .= 'REV:'. date( 'Y-m-d' ) .'T'. date( 'H:i:s' ). 'Z';
 150          $text    .= "\r\n";
 151          $text    .= 'MAILER: Joomla! vCard for '. $sitename;
 152          $text    .= "\r\n";
 153          $text    .= 'END:VCARD';
 154          $text    .= "\r\n";
 155  
 156          return $text;
 157      }
 158  }
 159  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics