phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] hr index.php,1.15


From: skwashd
Subject: [Phpgroupware-cvs] hr index.php,1.15
Date: Mon, 29 Aug 2005 06:14:00 +0200

Update of hr

Modified Files:
     Branch: MAIN
            index.php lines: +67 -136

Log Message:
merge in changes from 16

====================================================
Index: hr/index.php
diff -u hr/index.php:1.14 hr/index.php:1.15
--- hr/index.php:1.14   Sun Sep 15 01:12:36 2002
+++ hr/index.php        Mon Aug 29 04:14:29 2005
@@ -29,11 +29,13 @@
   <td align="left" width="50%" valign="top">
    <table border="0" width="80%">
     <tr>
-     <td bgcolor="<?php echo $GLOBALS['phpgw_info']['theme']['th_bg'] ?>" 
align="center">Users</td>
+         <td bgcolor="<?php echo $GLOBALS['phpgw_info']['theme']['th_bg'] ?>" 
align="center">
+            <b><?php echo lang('users'); ?></b>
+         </td>
     </tr>
 <?php
        $account_info = $GLOBALS['phpgw']->accounts->get_list('accounts');
-       while(list($null,$account) = each($account_info))
+       while (list($null,$account) = each($account_info))
        {
                $GLOBALS['tr_color'] = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($GLOBALS['tr_color']);
 ?>
@@ -47,11 +49,13 @@
    <p>
    <table border="0" width="80%">
     <tr>
-     <td bgcolor="<?php echo $GLOBALS['phpgw_info']['theme']['th_bg']; ?>" 
align="center">Groups</td>
+     <td bgcolor="<?php echo $GLOBALS['phpgw_info']['theme']['th_bg']; ?>" 
align="center">
+       <b><?php echo lang('groups'); ?></b>
+     </td>
     </tr>
 <?php
        $group_info = $GLOBALS['phpgw']->accounts->get_list('groups');
-       while(list($null,$group) = each($group_info))
+       while (list($null,$group) = each($group_info))
        {
                $GLOBALS['tr_color'] = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($GLOBALS['tr_color']);
 ?>
@@ -70,8 +74,10 @@
        {
                $GLOBALS['tr_color'] = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($GLOBALS['tr_color']);
                echo '<tr>'."\n"
-                       . ' <td align="left" bgcolor="' . $GLOBALS['tr_color'] 
. '" width="50%">' . $label . '</td>'."\n"
-                       . ' <td align="right" width="50%" bgcolor="' . 
$GLOBALS['tr_color'] . '"'.$valign.'>';
+                       . ' <td align="right" bgcolor="' . $GLOBALS['tr_color'] 
. '" width="50%">'
+                       . "\t<b>$label<b>\n"
+                       . '</td>'."\n"
+                       . ' <td align="left" width="50%" bgcolor="' . 
$GLOBALS['tr_color'] . '"'.$valign.'>';

                if($link)
                {
@@ -88,68 +94,28 @@
                echo '</td>'."\n".'</tr>'."\n";
        }

-       if($groupid && !$userid)
+       //Quick fix for globals - skwashd
+       $groupid = intval($_GET['groupid']);
+       $userid  = intval($_GET['userid']);
+
+       if ($groupid && !$userid)
        {
                $account = CreateObject('phpgwapi.accounts',$groupid,'g');
                $groupdata = $account->read();
-               $membership = $account->member($groupid);
-               $contacts = CreateObject('phpgwapi.contacts');

-               $qcols = array(
-                       'n_given'  => 'n_given',
-                       'n_family' => 'n_family',
-                       'title'    => 'title',
-                       'note'     => 'note'
-               );
+               echo '<table border="0" width="80%">';
+               echo '<tr><td colspan="2" bgcolor="' . 
$phpgw_info['theme']['th_bg']    . '">&nbsp;</td></tr>';

-               $fields = 
$contacts->read(0,0,$qcols,'','tid=p,lid='.$groupdata['account_lid']);
-               echo $groupdata['account_id'];

-               if(!$fields[0]['id'])
+               if(!$groupdata['account_id'])
                {
-                       $fields[0]['tid']      = 'p';
-                       $fields[0]['lid']      = $groupdata['account_lid'];
-                       $fields[0]['n_given']  = $groupdata['firstname'];
-                       $fields[0]['n_family'] = $groupdata['lastname'];
-                       $sfields = rawurlencode(serialize($fields[0]));
-                       $contact_link   = 
$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.add');
-                       $contact_hidden = '<form 
submit=True&profile=True&entry='.$sfields;
-                       $contact_submit = 'submit';
-                       $contact_button = lang('Add');
+                       display_line(lang('error') . ':', lang('group not 
found'));
                }
                else
                {
-                       $contact_link   = $GLOBALS['phpgw']->link('/index.php',
-                               Array(
-                                       'menuaction' => 
'addressbook.uiaddressbook.view',
-                                       'ab_id'      => $fields[0]['id']
-                               )
-                       );
-                       $contact_submit = 'view';
-                       $contact_button = lang('View');
-                       $contact_num    = '#'.$fields[0]['id'];
-               }
-
-               $firstname = $fields[0]['n_given'];
-               if(!$firstname)
-               {
+                       $membership = $account->member($groupid);
                        $firstname = $groupdata['firstname'];
-               }
-
-               $lastname  = $fields[0]['n_family'];
-               if(!$lastname)
-               {
                        $lastname  = $groupdata['lastname'];
-               }
-
-               $profile_comments   = 
$GLOBALS['phpgw']->strip_html(stripslashes($fields[0]['note']));
-               if(!$profile_comments)
-               {
-                       $profile_comments = '&nbsp;';
-               }
-
-               echo '<table border="0" width="80%">';
-               echo '<tr><td colspan="2" bgcolor="' . 
$phpgw_info['theme']['th_bg'] . '">&nbsp;</td></tr>';

                if($GLOBALS['phpgw_info']['user']['apps']['admin'])
                {
@@ -164,24 +130,16 @@
                {
                        $link = '';
                }
-               display_line('Group Account 
LID:',$groupdata['account_lid'],$link);
+                       display_line(lang('group login') . 
':',$groupdata['account_lid'],$link);
+                       display_line(lang('first name') . ':',$firstname);
+                       display_line(lang('last name') . ':',$lastname);

-               $link = '<form method="POST" action="' . $contact_link . '">' . 
"\n"
-                       . '<input type="submit" name="' . $contact_submit . '" 
value="'.$contact_button.'">' . "\n"
-                       . '<input type="hidden" name="entry" 
value="'.$sfields.'">' . "\n"
-                       . '</form>' . "\n";
-               display_line('Group Profile ID:&nbsp'.$contact_num,$link,'',' 
valign="center"');
-
-               display_line('Firstname:',$firstname);
-               display_line('Lastname:',$lastname);
-               display_line('Comments:',$profile_comments);
-//             display_line('&nbsp;','<img src="' . 
$GLOBALS['phpgw']->link('/hr/view_image.php','con='.$groupdata['account_id']).'"
 width="100" height="120">');

                echo '<tr><td colspan="2">&nbsp;</td></tr>';
                echo '<tr><td colspan="2" align="left" bgcolor="' . 
$phpgw_info['theme']['th_bg']
-                       . '">Members of the following group:</td></tr>';
+                       . '"><b>' . lang('members of the group') . 
':</b></td></tr>';

-               for($i=0;$i<count($membership); $i++)
+                       for ($i=0;$i<count($membership); $i++)
                {
                        $GLOBALS['tr_color'] = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($GLOBALS['tr_color']);
                        echo '<tr bgcolor="'.$GLOBALS['tr_color'].'"><td 
colspan="2"><a href="'
@@ -190,12 +148,14 @@
                }
                echo '</table>';
        }
-       elseif(!$groupid && $userid)
+       }
+       elseif (!$groupid && $userid)
        {
                $account = CreateObject('phpgwapi.accounts',$userid,'u');
                $account_info = $account->read_repository();
                $membership = $account->membership($userid);
                $contacts = CreateObject('phpgwapi.contacts');
+               $contact_id = $contacts->is_contact($userid);

                $qcols = array(
                        'n_given'    => 'n_given',
@@ -206,95 +166,73 @@
                        'title'      => 'title',
                        'email'      => 'email',
                        'email_home' => 'email_home',
-                       'note'       => 'note'
                );

-               $fields = 
$contacts->read(0,0,$qcols,'','tid=p,lid='.$account_info['account_lid']);
+               $fields = $contacts->are_users($account_info['person_id'], 
$qcols);

-               if(!$fields[0]['id'])
+               if(!$account_info['person_id'] && 
$GLOBALS['phpgw_info']['user']['apps']['admin'])
                {
-                       $fields[0]['tid']      = 'p';
-                       $fields[0]['lid']      = $account_info['account_lid'];
-                       $fields[0]['firstname']  = $account_info['firstname'];
-                       $fields[0]['lastname'] = $account_info['lastname'];
                        $sfields = rawurlencode(serialize($fields[0]));
-                       $contact_link   = 
$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.add');
-                       $contact_hidden = '<form 
submit=True&profile=True&entry='.$sfields;
-                       $contact_submit = 'submit';
-//                     $contact_submit = 'Add';
-                       $contact_button = lang('Add');
+                       $contact_link   = $GLOBALS['phpgw']->link('/index.php',
+                               array
+                               (
+                                       'menuaction'    => 
'addressbook.uiaddressbook.add_person',
+                                       'entry'         => $fields,
+                               )
+                       );
+                       $contact_text = lang('add');
                }
                else
                {
                        $contact_link   = $GLOBALS['phpgw']->link('/index.php',
-                               Array(
-                                       'menuaction' => 
'addressbook.uiaddressbook.view',
-                                       'ab_id'      => $fields[0]['id']
+                               array
+                               (
+                                       'menuaction'    => 
'addressbook.uiaddressbook.view_person',
+                                       'ab_id'         => 
$fields[0]['person_id']
                                )
                        );
-                       $contact_submit = 'view';
-                       $contact_button = lang('View');
-                       $contact_num    = '#'.$fields[0]['id'];
+                       $contact_text = lang('view');
                }

-               $firstname = $fields[0]['n_given'];
-               if(!$firstname)
-               {
                        $firstname = $account_info['firstname'];
-               }
-
-               $lastname  = $fields[0]['n_family'];
-               if(!$lastname)
-               {
                        $lastname  = $account_info['lastname'];
-               }

-               if($phpgw_info['user']['apps']['email'])
+               if ($GLOBALS['phpgw_info']['user']['apps']['email'])
                {
-                       if($fields[0]['email'])
+                       if ($fields[0]['email'])
                        {
                                $profile_work_email = '<a 
href="'.$GLOBALS['phpgw']->link('/email/compose.php','to='.urlencode($fields[0]['email'])).'"
 target="_new">'.$fields[0]['email'].'</a>';
                        }
-                       if ($fields[0]["email_home"])
+                       if ($fields[0]['email_home'])
                        {
-                               $profile_home_email = '<a 
href="'.$GLOBALS['phpgw']->link('/email/compose.php','to='.urlencode($fields[0]['email_home'])).'"
 target="_new">'.$fields[0]['email'].'</a>';
+                               $profile_home_email = '<a 
href="'.$GLOBALS['phpgw']->link('/email/compose.php','to='.urlencode($fields[0]['email_home'])).'"
 target="_new">'.$fields[0]['email_home'].'</a>';
                        }
                }
                else
                {
-                       if($fields[0]['email'])
+                       if ($fields[0]['email'])
                        {
                                $profile_work_email='<a href="mailto:'. 
$fields[0]['email'] .'">'.$fields[0]['email'].'</a>';
                        }
-                       if($fields[0]['email_home'])
+                       if ($fields[0]['email_home'])
                        {
-                               $profile_home_email='<a href="mailto:'. 
$fields[0]['email_home'] .'">'.$fields[0]['email'].'</a>';
-                       }
+                               $profile_home_email='<a href="mailto:'. 
$fields[0]['email_home'] .'">'.$fields[0]['email_home'].'</a>';
                }
-
-               $profile_comments   = 
$GLOBALS['phpgw']->strip_html(stripslashes($fields[0]['note']));
-               if(!$profile_comments)
-               {
-                       $profile_comments = '&nbsp;';
                }

                $profile_work_phone = 
$GLOBALS['phpgw']->strip_html($fields[0]['tel_work']);
-               if(!$profile_work_phone)
+               if (!$profile_work_phone)
                {
                        $profile_work_phone = '&nbsp;';
                }

                $profile_home_phone = 
$GLOBALS['phpgw']->strip_html($fields[0]['tel_home']);
-               if(!$profile_home_phone)
+               if (!$profile_home_phone)
                {
                        $profile_home_phone = '&nbsp;';
                }

                $profile_title      = 
$GLOBALS['phpgw']->strip_html($fields[0]['title']);
-               if(!$profile_title)
-               {
-                       $profile_title = '&nbsp;';
-               }

                echo '<table border="0" width="80%">';
                echo '<tr><td colspan="2" bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['th_bg']
@@ -303,7 +241,7 @@
                if($GLOBALS['phpgw_info']['user']['apps']['admin'])
                {
                        $link = $GLOBALS['phpgw']->link('/index.php',
-                               Array(
+                               array(
                                        'menuaction' => 
'admin.uiaccounts.edit_user',
                                        'account_id' => 
$account_info['account_id']
                                )
@@ -313,29 +251,22 @@
                {
                        $link = '';
                }
-               display_line('Account LID:',$account_info['account_lid'],$link);
-
-               $link = '<form method="POST" action="' . $contact_link . '">' . 
"\n"
-                       . '<input type="submit" name="' . $contact_submit . '" 
value="'.$contact_button.'">' . "\n"
-                       . '<input type="hidden" name="entry" 
value="'.$sfields.'">' . "\n"
-                       . '</form>' . "\n";
-               display_line('Profile ID:&nbsp'.$contact_num,$link,'',' 
valign="center"');
-
-               display_line('Firstname:',$firstname);
-               display_line('Lastname:',$lastname);
-               display_line('Title:',$profile_title);
-               display_line('Work Phone:',$profile_work_phone);
-               display_line('Home Phone:',$profile_home_phone);
-               display_line('Work Email:',$profile_work_email);
-               display_line('Home Email:',$profile_home_email);
-               display_line('Comments:',$profile_comments);
+               display_line(lang('account login') . ':', 
$account_info['account_lid'], $link);
+               display_line(lang('profile') . ':',$contact_text,$contact_link);
+               display_line(lang('first name') . ':',$firstname);
+               display_line(lang('last name') .':',$lastname);
+               display_line(lang('title') . ':',$profile_title);
+               display_line(lang('work phone') . ':',$profile_work_phone);
+               display_line(lang('home phone') .':',$profile_home_phone);
+               display_line(lang('work email') . ':',$profile_work_email);
+               display_line(lang('home email') . ':',$profile_home_email);
                display_line('&nbsp;','<img src="' . 
$GLOBALS['phpgw']->link('/hr/view_image.php','con='.$account_info['account_id']).'"
 width="100" height="120">');

                echo '<tr><td colspan="2">&nbsp;</td></tr>';
                echo '<tr><td colspan="2" align="left" bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['th_bg']
-                       . '">Member of the following groups</td></tr>';
+                       . '"><b>' . lang('member of the following groups') . 
':<b></td></tr>';

-               for($i=0;$i<count($membership); $i++)
+               for ($i=0;$i<count($membership); $i++)
                {
                        $GLOBALS['tr_color'] = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($GLOBALS['tr_color']);
                        echo '<tr bgcolor="'.$GLOBALS['tr_color'].'"><td 
colspan="2">'






reply via email to

[Prev in Thread] Current Thread [Next in Thread]