TUTOS PHP Cross Reference Groupware Applications

Source: /php/address.pinc - 772 lines - 23151 bytes - Summary - Text - Print

Description: Copyright 1999 - 2013 by Gero Kohnert This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

   1  <?php
   2  /**
   3   *  Copyright 1999 - 2013 by Gero Kohnert
   4   *
   5   *  This program is free software; you can redistribute it and/or modify it
   6   *  under the terms of the GNU General Public License as published by the
   7   *  Free Software Foundation; version 2 of the License.
   8   *
   9   *  SVN Info  $Id: address.pinc 1096 2013-07-03 06:06:47Z gokohnert $
  10   *  $Author: gokohnert $
  11   *
  12   * @modulegroup address
  13   * @module address
  14   */
  15  $tutos['files'][__FILE__] = '$Rev: 1096 $';
  16  
  17  require_once  'location.pinc';
  18  
  19  /**
  20   * a person (names and birthday)
  21   *
  22   * @package address
  23   */
  24  class Tutos_address extends Tutos_base {
  25      /**
  26       * URL to use for display this object
  27       */
  28      protected $showurl = 'address_show.php';
  29  
  30      /**
  31       * initialize
  32       */
  33      function tutos_address(tutos_db $dbconn) {
  34          global $lang,$current_user,$tutos,$table;
  35  
  36  
  37          $this->init($dbconn,Tutos_address::getType());
  38  
  39          $this->larray   = array();
  40          $this->birthday = new TUTOS_Date_Time(0);
  41          $this->location = array();
  42          $this->pic_id   = -1;
  43          $this->pic_file = null;
  44          $this->rl1      = false;
  45          $this->rl2      = false;
  46          if (isset($dbconn)) {
  47              $this->tablename = $this->dbconn->prefix . $table['address'][name];
  48          }
  49          $this->user = 0;
  50          $this->run_postinit_hook();
  51      }
  52  
  53      /**
  54       * fill the object data with a given resultset
  55       *
  56       * @param Object $r    a result set object
  57       * @param int    $pos  a index in the resultset
  58       */
  59      function read_result(result $r,$pos) {
  60          global $g_hash;
  61  
  62          if ( ! isset($pos) ) return;
  63  
  64          parent::read_result($r,$pos);
  65  
  66          $this->larray[] = 'title';
  67          $this->larray[] = 'l_name';
  68          $this->larray[] = 'f_name';
  69          $this->larray[] = 'm_name';
  70  
  71          foreach($this->larray as $f) {
  72              $this->$f = $r->get($pos, $f);
  73              if (!isset($this->$f)) {
  74                  $this->$f = '';
  75              }
  76          }
  77  
  78          $this->birthday->setDateTime($r->get($pos, 'birthday'),1);
  79  
  80          $this->pic_id = $r->get($pos, 'pic_id');
  81  
  82          $cid = $r->get($pos, 'creator');
  83          if ( isset($cid) )  {
  84              if ( $cid != $this->id )  {
  85                  $this->creator     = getObject($this->dbconn,$cid);
  86              } else {
  87                  $this->creator = $this;
  88              }
  89          }
  90          $this->read_locs();
  91      }
  92  
  93      /**
  94       * Read picture object
  95       */
  96      function read_picture () {
  97          if ( $this->pic_id < 1 ) {
  98              // no picture
  99              return;
 100          }
 101          $this->pic_file = new TUTOS_file($this->dbconn);
 102          $this->pic_file = $this->pic_file->read($this->pic_id,$this->pic_file);
 103          if (!is_object($this->pic_file)) {
 104              $this->pic_id   = -1;
 105              $this->pic_file = null;
 106          }
 107      }
 108  
 109      /**
 110       * Read all locations references
 111       */
 112      function read_locs ($force = false) {
 113          if ( ! class_exists ('location') ) {
 114              require ('location.pinc');
 115          }
 116          read_locs($this,$force);
 117      }
 118  
 119      /**
 120       * Read all locations data
 121       */
 122      function read_locs_data ($force = false) {
 123          if ( ! class_exists ('location') ) {
 124              require ('location.pinc');
 125          }
 126          read_locs_data($this,$force);
 127      }
 128  
 129      /**
 130       * search for a address
 131       * return a array of possible addresses
 132       * mode 1 fill objects
 133       * mode 0 do not fill objects
 134       */
 135      static function search_by_name(array &$arr,tutos_user $user,$name,$mode = 1) {
 136          global $table;
 137  
 138          if ( trim($name) == '' ) return 0;
 139          if (substr($name,0,1) == '!') {
 140              $name = substr($name,1);
 141              $negate = true;
 142          } else {
 143              $negate = false;
 144          }
 145  
 146          // search for a given object ID
 147          $qx = '';
 148          if (preg_match('/#([0-9]*)/',trim($name),$regs) && is_numeric($regs[1])) {
 149              $qx = ' id = '.$regs[1];
 150          } else {
 151              $qx .= $user->dbconn->Like ("f_name",$name,"m_name","l_name");
 152              $qx .= " OR ". $user->dbconn->Like ("l_name",$name,"f_name","m_name");
 153          }
 154  
 155  
 156          $q = 'SELECT '.($mode == 1 ? '*':'id').' from '. $user->dbconn->prefix .$table['address'][name].' WHERE ';
 157          $q .= $qx;
 158          $q .= " order by l_name ";
 159          check_dbacl($user->dbconn, $q, $user->id);
 160          $r = $user->dbconn->Exec($q);
 161          $n = $r->numrows();
 162          $a = 0;
 163  
 164          while ( $a < $n ) {
 165              if ($mode == 1) {
 166                  $x = new Tutos_address($user->dbconn);
 167                  $x->read_result($r,$a);
 168                  if ($negate)
 169                      $arr[-$x->id] = &$x;
 170                  else
 171                      $arr[$x->id] = &$x;
 172                  unset($x);
 173              } else {
 174                  $id = $r->get($a,'id');
 175                  if ($negate)
 176                      $arr[-$id] = $id;
 177                  else
 178                      $arr[$id] = $id;
 179              }
 180              $a++;
 181          }
 182          $r->free();
 183  
 184          return $n;
 185      }
 186  
 187      /**
 188       * a headline for CSV Export
 189       * here no linefeed at the end as locations are never (?) used alone
 190       */
 191      static function exportCSV_Header() {
 192          $r = '';
 193          $r .= txt2csv('id');
 194  
 195          $r .= txt2csv('title');
 196          $r .= txt2csv('first_name');
 197          $r .= txt2csv('middle_name');
 198          $r .= txt2csv('last_name');
 199  
 200          $r .= location::exportCSV_Header();
 201          $r .= "\r\n";
 202          return $r;
 203      }
 204  
 205      /**
 206       * Return a data  as comma seperated values string
 207       */
 208      function exportCSV() {
 209          global $lang;
 210  
 211          $this->read_locs_data();
 212          $r = '';
 213          $b = '';
 214          $b .= txt2csv($this->id);
 215          // Title
 216          $b .= txt2csv($this->title);
 217          // First Name
 218          $b .= txt2csv($this->f_name);
 219          // Middle Name
 220          $b .= txt2csv($this->m_name);
 221          // Last Name
 222          $b .= txt2csv($this->l_name);
 223  
 224          if (count($this->location) > 0) {
 225              foreach ($this->location as $l) {
 226                  $r .= $b;
 227                  $r .= $l->exportCSV();
 228                  $r .= "\r\n";
 229              }
 230          } else {
 231              $r .= $b;
 232              $r .= "\r\n";
 233          }
 234  
 235          return  $r;
 236      }
 237  
 238      /**
 239       * Return the Short Name if useful
 240       */
 241      function getShortname() {
 242          global $lang;
 243          if ( trim($this->l_name) == "" ) {
 244              return sprintf($lang['AdrFormatShort1'],$this->f_name, $this->m_name);
 245          }
 246          return sprintf($lang['AdrFormatShort2'],mb_substr($this->f_name,0,1), $this->l_name);
 247      }
 248  
 249      /**
 250       * Return the Long Name
 251       */
 252      function getFullname() {
 253          global $lang;
 254          if ( $this->m_name != '') {
 255              return sprintf($lang['AdrFormat1'],$this->f_name, $this->m_name ,$this->l_name);
 256          } else {
 257              return sprintf($lang['AdrFormat2'],$this->f_name, $this->l_name);
 258          }
 259      }
 260  
 261      /**
 262       * get the info as text
 263       */
 264      function getAsText (&$lang) {
 265          $r = "";
 266          $r .= format_asText($lang['AdrName'],$this->getFullName());
 267          $r .= format_asText($lang['AdrBirthday'],$this->birthday->getDate());
 268          return $r;
 269      }
 270  
 271      /**
 272       * Returns HTML for popup infos
 273       */
 274      function getPopInfo($layout = null) {
 275          global $lang;
 276  
 277          $fn =myentities($this->getFullName());
 278  
 279          $this->read_locs_data();
 280          $info = '';
 281          $info .= '<table class="popupinfo">';
 282          $info .= '<tr><th colspan="2">'. $fn ."</th></tr>";
 283  
 284          if ( isset($this->location) && count($this->location) ) {
 285              $phone = '';
 286              $cmp = '';
 287              $dep = '';
 288              $pre = '';
 289              $cpre = '';
 290              $dpre = '';
 291              foreach($this->location as $i => $f) {
 292                  if (is_object($f->department) && $f->department->id >0) {
 293                      $dep .= $dpre.$f->department->getFullName();
 294                      $dpre = "<br />";
 295                  } else if (is_object($f->company) && $f->company->id > 0) {
 296                      $cmp .= $cpre.$f->company->getFullName();
 297                      $dpre = "<br />";
 298                  }
 299                  if ( $f->phone_1 != "" ) {
 300                      $phone .= $pre . myentities($f->phone_1);
 301                      $pre = "<br />";
 302                  }
 303                  if ( $f->phone_2 != "" ) {
 304                      $phone .= $pre . myentities($f->phone_2);
 305                      $pre = "<br />";
 306                  }
 307              }
 308              if ($cmp != '')
 309                  $info .= '<tr><td colspan="2" valign="top">'. $cmp .'</td></tr>';
 310              if ($dep != '')
 311                  $info .= '<tr><td nowrap="nowrap" colspan="2" valign="top">'. $dep .'</td></tr>';
 312              $info .= '<tr><td valign="top">'. $lang['Phone'] .':</td><td nowrap="nowrap">';
 313              $info .= $phone;
 314              $info .= '&#160;</td></tr>';
 315          }
 316          $info .= $this->custom_popup_content($layout);
 317          $info .= '</table>';
 318          return $info;
 319      }
 320  
 321      /**
 322       * set the title
 323       */
 324      function setTitle($new) {
 325          return $this->setStrField('title',$new,'AdrTitle');
 326      }
 327  
 328      /**
 329       * set the first name
 330       */
 331      function setFName($value) {
 332          return $this->setStrField('f_name',$value,'AdrFirstName');
 333      }
 334  
 335      /**
 336       * set the last name
 337       */
 338      function setLName($value) {
 339          return $this->setStrField('l_name',$value,'AdrLastName');
 340      }
 341  
 342      /**
 343       * set the middle name
 344       */
 345      function setMName($value) {
 346          return $this->setStrField('m_name',$value,'AdrMiddleName');
 347      }
 348  
 349      /**
 350       * set the birthday date
 351       */
 352      function setBirthday(&$name) {
 353          $a = $this->birthday->getYYYYMMDD();
 354          $b = $name->getYYYYMMDD();
 355  
 356          if ( $a != $b ) {
 357              $this->modified[] = array ( 'field' => 'AdrBirthday', 'old' => $a , 'new' => $b );
 358              $this->birthday = $name;
 359          }
 360          return;
 361      }
 362  
 363      /**
 364       * save the objects data to the database
 365       */
 366      function save () {
 367          global $table,$current_user, $tutos;
 368  
 369          $msg = $this->run_presave_hook();
 370  
 371          $q = new query($this->dbconn);
 372          $q->setTable($this->tablename);
 373          $q->addFV('birthday',$this->birthday,'DATE');
 374          $q->addFV('title',$this->title,'STRING',$table['address']['title'][size]);
 375          $q->addFV('f_name',$this->f_name,'STRING',$table['address']['f_name'][size]);
 376          $q->addFV('m_name',$this->m_name,'STRING',$table['address']['m_name'][size]);
 377          $q->addFV('l_name',$this->l_name,'STRING',$table['address']['l_name'][size]);
 378          $q->addFV('pic_id',$this->pic_id,'INT');
 379          $this->save_custom_fields($q);
 380  
 381          if ( $this->id < 0 ) {
 382              $this->modified = array();
 383              if ( isset($this->newid) ) {
 384                  $this->id = $this->newid;
 385                  $q->addFV('id',$this->id,'');
 386              } else {
 387                  /* Get an new ID */
 388                  $this->id = $q->addFV('id',-1,'NEXTID');
 389                  // Defaut Access Control
 390                  $this->acl_default();
 391                  acl_raise($this, EVERYBODY, $tutos[useok]);
 392                  acl_raise($this,$this->id,$tutos[modok]);
 393  
 394                  $this->modified[] = array ( 'field' => 'created' ,
 395                                              'old' => $this->getType() ,
 396                                              'new' => $this->id,
 397                                              'obj_id' => $this->id
 398                      );
 399              }
 400              $q->addFV('creator',$this->creator,'OBJ');
 401              $q->addFV('creation',$this->creation,'DATETIME');
 402              $query = $q->getInsert();
 403          } else {
 404              $q->addWC('id',$this->id,'');
 405              $query = $q->getUpdate();
 406          }
 407  
 408  
 409          $r = $this->dbconn->Exec($query);
 410          $r->free();
 411          $msg = addLine($msg,parent::save());
 412  
 413          // The Owner can delete his picture
 414          if ( is_object($this->pic_file) && ($this->pic_file->id > 0) ) {
 415              acl_raise($this->pic_file,$this->id,$tutos[delok]);
 416              $msg = addLine($msg,acl_save($this->pic_file));
 417          }
 418  
 419          return $msg;
 420      }
 421  
 422      /**
 423       * fill mailing list
 424       * this will work recursive and add all members
 425       * and subteam members to the given mailing list
 426       */
 427      function fill_maillist(&$ml) {
 428          $ml[$this->id] = &$this;
 429          return;
 430      }
 431  
 432      /**
 433       * Read all locations data and find the email adr.
 434       */
 435      function default_email() {
 436          if ( ! $this->rl2 ) {
 437              $this->read_locs_data();
 438          };
 439          $e = '';
 440  
 441          if ( isset($this->locall) ) {
 442              foreach($this->locall as $i => $f) {
 443                  if ( $f->email_1 != '') {
 444                      $e = $f->email_1;
 445                      if ( $f->category == 2 ) {
 446                          return $e;
 447                      }
 448                  } elseif ( $f->email_2 != '' ) {
 449                      $e = $f->email_1;
 450                      if ( $f->category == 2 ) {
 451                          return $e;
 452                      }
 453                  }
 454              }
 455          }
 456          return $e;
 457      }
 458  
 459      /**
 460       * Read all locations data and find the phone number.
 461       */
 462      function default_phone() {
 463          if ( ! $this->rl2 ) {
 464              $this->read_locs_data();
 465          };
 466          $e = '';
 467  
 468          if ( isset($this->locall) ) {
 469              foreach($this->locall as $i => $f) {
 470                  if ( $f->phone_1 != '') {
 471                      $e = $f->phone_1;
 472                      if ( $f->category == 2 ) {
 473                          return $e;
 474                      }
 475                  } elseif ( $f->phone_2 != '' ) {
 476                      $e = $f->phone_2;
 477                      if ( $f->category == 2 ) {
 478                          return $e;
 479                      }
 480                  }
 481              }
 482          }
 483          return $e;
 484      }
 485  
 486      /**
 487       * Return a URL to modify this address
 488       */
 489      function getModURL() {
 490          if ( isset($this->location) &&  count($this->location) > 0 ) {
 491              @reset($this->location);
 492              list ($j,$l) = @each ($this->location);
 493              $url = 'address_new.php?id='. $this->id .'&amp;loc_id='. $l->id;
 494          } else {
 495              $url = 'address_new.php?id='. $this->id;
 496          }
 497          if (isset($_REQUEST['ss'])) {
 498              return  addUrlParameter($url,'ss='.$_REQUEST['ss']);
 499          }
 500          return $url;
 501      }
 502  
 503      /**
 504       * Return a URL to delete this address
 505       */
 506      function getDelURL() {
 507          return 'address_del.php?id='. $this->id;
 508      }
 509  
 510      /**
 511       * Return a Mail link to this address
 512       */
 513      function getMailLink($email = "" ,$text = "" ) {
 514          global $lang;
 515  
 516          if (empty($this->id)) return "";
 517  
 518          $fn = $this->getFullname();
 519  
 520          if ( $email == "" ) {
 521              $email = $this->default_email();
 522          }
 523          if ( $text == "" ) {
 524              $text = myentities($fn);
 525          }
 526  
 527          if (empty($email)) {
 528              return $this->getLink($text);
 529          } else {
 530              return asEmail($fn,$email,$fn);
 531          }
 532      }
 533  
 534      /**
 535       * Delete this address from the DB
 536       */
 537      function delete () {
 538          global $current_user;
 539  
 540          $msg = "";
 541          if ($this->gettype() == "address") {
 542              $this->read_locs_data();
 543  
 544              foreach($this->location as $f) {
 545                  $msg = addLine($msg,$f->delete());
 546              }
 547  
 548              // TODO delete ref only
 549              if ( $this->pic_id > 0 ) {
 550                  $q = "DELETE FROM ". $this->dbconn->prefix ."files WHERE id = ". $this->pic_id;
 551                  $r = $this->dbconn->Exec($q);
 552                  $r->free();
 553              }
 554  
 555              #    $msg .= tutos_file::obj_delete($current_user,$this);
 556              $msg = addLine($msg,appointment::obj_delete($current_user,$this));
 557              $msg = addLine($msg,task::obj_delete($current_user,$this));
 558              $msg = addLine($msg,product::obj_delete($current_user,$this));
 559              $msg = addLine($msg,team::obj_delete($current_user,$this));
 560          }
 561          $msg = addLine($msg,parent::delete());
 562          return $msg;
 563      }
 564  
 565      /**
 566       * Checks if this person is a user of the system
 567       */
 568      function isUser () {
 569          global $table;
 570  
 571          if ( is_object($this->user) ) {
 572              return 1;
 573          }
 574          $q = 'SELECT a.* ,p.*,p.id as u_id, p.creator as cr_a, p.creation as cr_t FROM '. $this->dbconn->prefix .$table['address'][name].' a, '. $this->dbconn->prefix .$table['people'][name].' p WHERE a.id = '. $this->id .' AND a.id = p.adr_id';
 575          $r = $this->dbconn->Exec($q);
 576          $n = $r->numrows();
 577          if ( $n > 0 ) {
 578              $this->user = new tutos_user($this->dbconn);
 579              $this->user->read_result($r,0);
 580          }
 581          $r->free();
 582          return $n;
 583      }
 584  
 585      /**
 586       * Data of XML export
 587       */
 588      function exportXML_body ($only_ids = false) {
 589          $this->read_locs_data();
 590          $r = parent::exportXML_body();
 591          if (!$only_ids) {
 592              $r .=  "<title>". htmlspecialchars($this->title) ."</title>\n";
 593              $r .=  "<firstname>". htmlspecialchars($this->f_name) ."</firstname>\n";
 594              $r .=  "<middlename>". htmlspecialchars($this->m_name) ."</middlename>\n";
 595              $r .=  "<lastname>". htmlspecialchars($this->l_name) ."</lastname>\n";
 596              if ( $this->birthday->notime != 1 ) {
 597                  $r .=  "<birthday>". $this->birthday->exportXML_body() ."</birthday>\n";
 598              }
 599              if ( isset($this->location) && (count($this->location) > 0) ) {
 600                  foreach($this->location as $i => $f) {
 601                      $r .= $f->exportXML_start();
 602                      $r .= $f->exportXML_body($only_ids);
 603                      $r .= $f->exportXML_end();
 604                  }
 605              }
 606          }
 607          return $r;
 608      }
 609  
 610      /**
 611       * parse XML import
 612       */
 613      function parseXML ($fld,$data,$attrs) {
 614          parent::parseXML($fld,$data,$attrs);
 615          if ($fld == "title") {
 616              $this->setTitle($data);
 617          } else if ($fld == "firstname") {
 618              $this->setFName($data);
 619          } else if ($fld == "middlename") {
 620              $this->setMName($data);
 621          } else if ($fld == "lastname") {
 622              $this->setLName($data);
 623          } else if ($fld == "birthday") {
 624              $d = new TUTOS_Date_Time($data);
 625              $this->setBirthday($d);
 626          }
 627          return;
 628      }
 629  
 630      /**
 631       * Return a vcard for this address
 632       */
 633      function getVcard() {
 634          $this->read_locs_data();
 635          $ical = "";
 636          $ical .= "BEGIN:VCARD\n";
 637          $ical .= "VERSION:3.0\n";
 638          $ical .= "UID:". $this->id ."\n";
 639          $ical .= "N:" . $this->l_name .";". $this->f_name ."\n";
 640          $ical .= "FN:" . $this->getFullName() ."\n";
 641          if ( isset($this->location) && (count($this->location) > 0) ) {
 642              foreach($this->location as $i => $f) {
 643                  if ( $f->email_1 != "" ) {
 644                      $ical .= "EMAIL;TYPE=INTERNET:" . $f->email_1 ."\n";
 645                  }
 646                  if ( $f->email_2 != "" ) {
 647                      $ical .= "EMAIL;TYPE=INTERNET:" . $f->email_2 ."\n";
 648                  }
 649                  if ( $f->phone_1 != "" ) {
 650                      if ( $f->category == 2 ) {
 651                          $ical .= "TEL;TYPE=WORK:" . $f->phone_1 ."\n";
 652                      } else {
 653                          $ical .= "TEL;TYPE=HOME:" . $f->phone_1 ."\n";
 654                      }
 655                  }
 656                  if ( $f->phone_2 != "" ) {
 657                      if ( $f->category == 2 ) {
 658                          $ical .= "TEL;TYPE=WORK:" . $f->phone_2 ."\n";
 659                      } else {
 660                          $ical .= "TEL;TYPE=HOME:" . $f->phone_2 ."\n";
 661                      }
 662                  }
 663                  if ( $f->fax_1 != "" ) {
 664                      if ( $f->category == 2 ) {
 665                          $ical .= "TEL;TYPE=WORK,FAX:" . $f->fax_1 ."\n";
 666                      } else {
 667                          $ical .= "TEL;TYPE=HOME,FAX:" . $f->fax_1 ."\n";
 668                      }
 669                  }
 670                  if ( ($f->company->id != -1) && ($f->company->name != "") ) {
 671                      $ical .= "ORG:" . $f->company->name ."\n";
 672                  }
 673              }
 674          }
 675          if ( $this->birthday->notime != 1 ) {
 676              $ical .= "BDAY:". $this->birthday->year ."-". $this->birthday->month ."-". $this->birthday->day ."\n";
 677          }
 678          $ical .= "END:VCARD\n";
 679          return $ical;
 680      }
 681  
 682      /**
 683       * resolve a history Tag (to be called from history_show)
 684       */
 685      function resolveHistoryTag ($f) {
 686          global $lang;
 687  
 688          $x = array();
 689          switch ($f['field']) {
 690          case 'AdrBirthday':
 691              $x = resolve_history_datetime($f,$this->dbconn);
 692              return $x;
 693              break;
 694          default:
 695              return null;
 696          }
 697      }
 698  
 699      /**
 700       * get the type of object
 701       */
 702      static function gettype () {
 703          return "address";
 704      }
 705  
 706      /**
 707       * get the type id of object
 708       */
 709      static function gettypeid () {
 710          return useaddressbook;
 711      }
 712  
 713      /**
 714       * get the type id of object
 715       */
 716      static function getHtmlIcon () {
 717          return 'addresses';
 718      }
 719  
 720      /**
 721       * return a list of possible date fields (for reminder)
 722       */
 723      function get_date_fields() {
 724          global $lang;
 725  
 726          $x = parent::get_date_fields();
 727          $x[0][REMINDER_ADR_BIRTHDAY] = array('birthday',$lang['AdrBirthday']);
 728          // possible Offsets
 729          $x[1] = array_unique($x[1] + array(-86400*7*2,-86400*7*1,-86400*2,-86400*1,-3600*2,-3600*1,0));
 730  
 731          return $x;
 732      }
 733  
 734      /* ---------------------------------------------------------------------------
 735       * The following methods are abstract factory functions for groups
 736       * which handle the membership list of an object
 737       * --------------------------------------------------------------------------- */
 738  
 739      /**
 740       * create a link to a select page
 741       */
 742      static function getSelectLink (tutos_user $user,$text = "") {
 743          global $lang,$tutos;
 744          if ( ! $user->feature_ok(useaddressbook,PERM_SEL) ) {
 745              return;
 746          }
 747          return array( url => 'address_select.php',
 748                        image => $user->layout->theme->getImage(tutos_address::getHtmlIcon(),'menu'),
 749                        text => ($text == "" ? $lang['Addresses'] : $text),
 750                        info => $lang['SearchForAdr'],
 751                        category => array('search','address',useaddressbook)
 752              );
 753      }
 754  
 755      /**
 756       * get the help index
 757       */
 758      static function getHelpIndex () {
 759          global $lang;
 760  
 761          $r = '';
 762          $r .= '<h3>'. makelink('help.php?p=glossary#address',$lang['Address'],$lang['Address']) ."</h3><ul>\n";
 763          $r .= '<li>'. makelink('help.php?p=address_new',$lang['NewEntry'].'/'. $lang['Modify'],$lang['NewEntry'].'/'. $lang['Modify']) ."</li>\n";
 764          $r .= '<li>'. makelink('help.php?p=address_show',$lang['show'],$lang['show']) ."</li>\n";
 765          $r .= '<li>'. makelink('help.php?p=address_overview',$lang['AddressOverview'],$lang['AddressOverview'])."</li>\n";
 766          $r .= "</ul>\n";
 767          return $r;
 768      }
 769  }
 770  
 771  $tutos['classes'][useaddressbook] = 'tutos_address';
 772  ?>

title

Description

title

Description

title

Description

title

title

Body