[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/addressbook/inc/ -> hook_home.inc.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare - Addressbook                                                 *
   4    * http://www.egroupware.org                                                *
   5    * --------------------------------------------                             *
   6    *  This program is free software; you can redistribute it and/or modify it *
   7    *  under the terms of the GNU General Public License as published by the   *
   8    *  Free Software Foundation; either version 2 of the License, or(at your   *
   9    *  option) any later version.                                              *
  10    \**************************************************************************/
  11  
  12      /* $Id: hook_home.inc.php 20295 2006-02-15 12:31:25Z  $ */
  13      
  14      $d1 = strtolower(substr(EGW_APP_INC,0,3));
  15      if($d1 == 'htt' || $d1 == 'ftp' )
  16      {
  17          echo "Failed attempt to break in via an old Security Hole!<br>\n";
  18          $GLOBALS['egw']->common->phpgw_exit();
  19      }
  20      unset($d1);
  21  
  22      if($GLOBALS['egw_info']['user']['apps']['addressbook']
  23          && $GLOBALS['egw_info']['user']['preferences']['addressbook']['mainscreen_showbirthdays'])
  24      {
  25          echo "\n<!-- Birthday info -->\n";
  26  
  27          $c = CreateObject('phpgwapi.contacts');
  28          $qfields = array(
  29              'n_given'  => 'n_given',
  30              'n_family' => 'n_family',
  31              'bday'     => 'bday'
  32          );
  33          $now = time() - ((60 * 60) * (int)$GLOBALS['egw_info']['user']['preferences']['common']['tz_offset']);
  34          $today = $GLOBALS['egw']->common->show_date($now,'n/d/');
  35          
  36          $bdays = $c->read(0,15,$qfields,$today,'tid=n','','',$GLOBALS['egw_info']['user']['account_id']);
  37          
  38          $title = '<center><font color="#FFFFFF">'.lang('Birthdays').'</font></center>';
  39  
  40          $portalbox = CreateObject('phpgwapi.listbox',
  41              Array(
  42                  'title'     => $title,
  43                  'primary'   => $GLOBALS['egw_info']['theme']['navbar_bg'],
  44                  'secondary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
  45                  'tertiary'  => $GLOBALS['egw_info']['theme']['navbar_bg'],
  46                  'width'     => '100%',
  47                  'outerborderwidth' => '0',
  48                  'header_background_image' => $GLOBALS['egw']->common->image($GLOBALS['egw']->common->get_tpl_dir('phpgwapi'),'bg_filler')
  49              )
  50          );
  51          $app_id = $GLOBALS['egw']->applications->name2id('addressbook');
  52          $GLOBALS['portal_order'][] = $app_id;
  53          $var = Array(
  54              'up'       => Array('url' => '/set_box.php', 'app' => $app_id),
  55              'down'     => Array('url' => '/set_box.php', 'app' => $app_id),
  56              'close'    => Array('url' => '/set_box.php', 'app' => $app_id),
  57              'question' => Array('url' => '/set_box.php', 'app' => $app_id),
  58              'edit'     => Array('url' => '/set_box.php', 'app' => $app_id)
  59          );
  60  
  61          while(list($key,$value) = each($var))
  62          {
  63              $portalbox->set_controls($key,$value);
  64          }
  65  
  66          $portalbox->data = Array();
  67  
  68          while(list($key,$val) = @each($bdays))
  69          {
  70              if(substr($val['bday'],0,strlen($today)) == $today)
  71              {
  72                  $portalbox->data[] = array(
  73                      'text' => lang("Today is %1's birthday!", $val['n_given'] . ' ' . $val['n_family']),
  74                      'link' => $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $val['id'])
  75                  );
  76              }
  77  //            $tmp = '<a href="'
  78  //                . $GLOBALS['egw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
  79  //                . $val['n_given'] . ' ' . $val['n_family'] . '</a>';
  80  //            echo '<tr><td align="left">' . lang("Today is %1's birthday!", $tmp) . '</td></tr>' . "\n";
  81          }
  82  
  83          $tomorrow = $GLOBALS['egw']->common->show_date($now + 86400,'n/d/');
  84  
  85          $bdays = $c->read(0,15,$qfields,$tomorrow,'tid=n','','',$GLOBALS['egw_info']['user']['account_id']);
  86  
  87          while(list($key,$val) = @each($bdays))
  88          {
  89              if(substr($val['bday'],0,strlen($tomorrow)) == $tomorrow)
  90              {
  91                  $portalbox->data[] = array(
  92                      'text' => lang("Tomorrow is %1's birthday.",$val['n_given'] . ' ' . $val['n_family']),
  93                      'link' => $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id='.$val['id'])
  94                  );
  95              }
  96  //            $tmp = '<a href="'
  97  //                . $GLOBALS['egw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
  98  //                . $val['n_given'] . ' ' . $val["n_family"] . '</a>';
  99  //            echo '<tr><td align="left">' . lang("Tomorrow is %1's birthday.", $tmp) . '</td></tr>' . "\n";
 100          }
 101          if(count($portalbox->data))
 102          {
 103              echo $portalbox->draw();
 104          }
 105          unset($portalbox);
 106          echo "\n<!-- Birthday info -->\n";
 107      }
 108  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7