Changeset 3456


Ignore:
Timestamp:
11/04/10 11:05:39 (13 years ago)
Author:
eduardoalex
Message:

Ticket #1204 - Adicionado data de nascimento nas preferencias do usuario

Location:
branches/2.2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoAdmin1_2/inc/class.functions.inc.php

    r3323 r3456  
    862862                                        array("text" => lang("%1 telephone number", lang("Commercial")) , "acl" => 1), 
    863863                                        array("text" => lang("%1 telephone number", lang("Mobile"))             , "acl" => 2), 
    864                                         array("text" => lang("%1 telephone number", lang("Home"))               , "acl" => 4)); 
     864                                        array("text" => lang("%1 telephone number", lang("Home"))               , "acl" => 4), 
     865                                        array("text" => lang("Birthday")                                                                , "acl" => 8)); 
    865866                        $list_personal_data = "<tr>"; 
    866867                                                 
  • branches/2.2/phpgwapi/inc/class.accounts_ldap.inc.php

    r3299 r3456  
    6363                        { 
    6464                                /* jakjr: using justthese with ldap_search */ 
    65                                 $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber","mobile","homephone"); 
     65                                $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber","mobile","homephone","datanascimento"); 
    6666                                $sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(phpgwaccounttype=u))"), $justthese); 
    6767                        } 
     
    9191                                $this->data['telephonenumber']   = $allValues[0]['telephonenumber'][0]; 
    9292                                $this->data['mobile']   = $allValues[0]['mobile'][0]; 
    93                                 $this->data['homephone']   = $allValues[0]['homephone'][0];                              
     93                                $this->data['homephone']   = $allValues[0]['homephone'][0]; 
     94                                $this->data['datanascimento']   = $allValues[0]['datanascimento'][0];                    
    9495                                /* jakjr: this is not used for expressoLivre */ 
    9596                                /* 
  • branches/2.2/preferences/changepersonaldata.php

    r3299 r3456  
    3939 
    4040        $GLOBALS['phpgw']->template->set_var('lang_commercial_telephonenumber',lang('%1 telephone number',lang('Commercial'))); 
     41        $GLOBALS['phpgw']->template->set_var('lang_birthday',lang('Birthday')); 
    4142        $GLOBALS['phpgw']->template->set_var('lang_ps_commercial_telephonenumber', 
    4243        lang('Observation') . ': ' . lang('This telephone number will apear in searches for your name, and it will be visible for all ExpressoLivre Users') . '.'); 
     
    4647        $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel')); 
    4748        $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/preferences/changepersonaldata.php')); 
    48  
     49         
    4950        /* Get telephone number from ldap or from post */ 
    5051        $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); 
    51         $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber','mobile','homephone')); 
     52        $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber','mobile','homephone','datanascimento')); 
    5253        $entrie = ldap_get_entries($ldap_conn, $result); 
    5354 
     
    5657        $disabledMobile = false; 
    5758        $disabledHomePhone = false; 
     59        $disableBirthday = false; 
    5860        if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',1)) { 
    5961                $disabledTelephoneNumber = '"disabled=true"'; 
     
    6466        if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',4)) { 
    6567                $disabledHomePhone = '"disabled=true"'; 
     68        } 
     69        if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',8)) { 
     70                $disableBirthday = '"disabled=true"'; 
    6671        } 
    6772        /* END ACL Check for Personal Data Fields.*/ 
     
    7075        $GLOBALS['phpgw']->template->set_var('mobile',($_POST['mobile'] ? $_POST['mobile'] : $entrie[0]['mobile'][0]).$disabledMobile); 
    7176        $GLOBALS['phpgw']->template->set_var('homephone',($_POST['homephone'] ? $_POST['homephone'] : $entrie[0]['homephone'][0]).$disabledHomePhone); 
    72          
     77        $GLOBALS['phpgw']->template->set_var('datanascimento',$_POST['datanascimento'] ? $_POST['datanascimento'] : $entrie[0]['datanascimento'][0] != '' ? $entrie[0]['datanascimento'][0] : ''); 
     78 
    7379 
    7480        ldap_close($ldap_conn); 
     
    8288        { 
    8389                if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'] || $_POST['mobile'] != $GLOBALS['phpgw_info']['user']['mobile'] 
    84                  || $_POST['homephone'] != $GLOBALS['phpgw_info']['user']['homephone']) 
     90                 || $_POST['homephone'] != $GLOBALS['phpgw_info']['user']['homephone'] || $_POST['datanascimento'] != $GLOBALS['phpgw_info']['user']['datanascimento']) 
    8591                { 
    8692                        $pattern = '/\([0-9]{2,3}\)[0-9]{4}-[0-9]{4}$/'; 
     
    97103                                $errors[] = lang('Format of %1 telephone number is invalid.', lang("Home")); 
    98104                        } 
     105 
     106                        if(!(checkdate(substr($_POST['datanascimento'],3,2),substr($_POST['datanascimento'],0,2),substr($_POST['datanascimento'],6,4)) == 1  
     107                                || ($_POST['datanascimento'] == ''))) 
     108                        { 
     109                                $errors[] = lang('invalid date'); 
     110                        }                                
    99111                        if(!is_array($errors)) 
    100112                        { 
     
    160172                                        unset($info['homephone']); 
    161173                                } 
     174                                if (!$disableBirthday && ($_POST['datanascimento'] != $GLOBALS['phpgw_info']['user']['datanascimento'])) { 
     175                                        if (strlen($_POST['datanascimento']) == 0) { 
     176                                                $info['datanascimento'] = $GLOBALS['phpgw_info']['user']['datanascimento']; 
     177                                                $result = @ldap_mod_del($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 
     178                                        } 
     179                                        elseif(strlen($GLOBALS['phpgw_info']['user']['datanascimento']) == 0) { 
     180                                                $info['datanascimento'] = $_POST['datanascimento']; 
     181                                                $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 
     182                                        } 
     183                                        else { 
     184                                                $info['datanascimento'] = $_POST['datanascimento']; 
     185                                                $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 
     186                                        } 
     187                                        unset($info['datanascimento']); 
     188                                } 
    162189                                ldap_close($ldap_conn);  
    163190                        } 
  • branches/2.2/preferences/templates/default/changepersonaldata.tpl

    r3299 r3456  
    3535       </td> 
    3636     </tr> 
     37         <tr> 
     38       <td>{lang_birthday}:</td> 
     39                        <td> 
     40                                <input style="text-align: center;" title="Data de Nascimento" name="datanascimento" maxlength="10" size="12" type="text" value="{datanascimento}" onkeyup="formatDate(this)";>                           
     41                        </td> 
     42        
     43       <td>        
     44     </tr> 
    3745        <tr><td colspan=2 height="20px"></td></tr> 
    3846      
Note: See TracChangeset for help on using the changeset viewer.