Changeset 4628 for branches/2.2/mobile


Ignore:
Timestamp:
06/24/11 13:42:26 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #1728 - Correção para foto do contato que não está aparecendo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/mobile/inc/class.ui_mobilecc.inc.php

    r3964 r4628  
    2222                        'contact_add_edit' => true, 
    2323                        'contact_add' => true, 
    24                         'contact_edit' => true 
     24                        'contact_edit' => true, 
     25                        'getPhoto'  => true 
    2526                ); 
    2627                var $template; 
     
    504505                                default:                 
    505506 
    506                                                                 if(strpos($params['catalog'],'bo_global_ldap_catalog')==false){ 
     507                                                                if( strpos($params['catalog'],'bo_global_ldap_catalog') === false ) 
     508                                                                { 
     509                                                                        header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.init_cc'); 
     510                                                                } 
     511                                                                else 
     512                                                                { 
    507513 
    508514                                                                        $this->bo->set_catalog($params['catalog']); 
     
    510516                                                                        $fields = $this->bo->bo->get_fields(true); 
    511517                                                                        $result = $this->bo->bo->get_single_entry($params['id'], $fields); 
    512  
    513                                                                         $this->template->set_var('photo', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_photo&id='.$params["id"]); 
     518                                                                         
     519                                                                        // SessionStart 
     520                                                                        session_start(); 
     521                                                                        $_SESSION['phpgw_info']['mobile']['photoCatalog'][$params['id']] = $result['photo']; 
     522                                                                        session_write_close(); 
     523 
     524 
     525                                                                        $this->template->set_var('photo', '../index.php?menuaction=mobile.ui_mobilecc.getPhoto&id=' . $params["id"]); 
    514526 
    515527                                                                        $this->template->set_var('cc_name',$result['names_ordered'][0]); 
     
    565577                                                                        $this->template->parse("row_body","people_ldap"); 
    566578 
    567                                                                 }else{ 
    568                                                                         header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.init_cc'); 
    569579                                                                } 
    570580 
     
    572582                        } 
    573583 
    574                         if ( !empty($email_to)){ 
     584                        if ( !empty($email_to)) 
     585                        { 
    575586                                $this->template->set_var('email_to', $email_to); 
    576587                                $this->template->parse("buttom_use","buttom_use_contact"); 
     
    587598                        $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out','body')); 
    588599                } 
     600                 
     601                function getPhoto() 
     602                { 
     603                    $id = $_GET['id']; 
     604 
     605                    session_start(); 
     606 
     607                    if( isset( $_SESSION['phpgw_info']['mobile']['photoCatalog'][$id] ) ) 
     608                    { 
     609                        $photo = imagecreatefromstring($_SESSION['phpgw_info']['mobile']['photoCatalog'][$id]); 
     610 
     611                        header("Content-Type: image/jpeg"); 
     612                        $width = imagesx($photo); 
     613                        $height = imagesy($photo); 
     614                        $twidth = 70; 
     615                        $theight = 90; 
     616                        $small_photo = imagecreatetruecolor ($twidth, $theight); 
     617                        imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); 
     618                        imagejpeg($small_photo,'',100); 
     619 
     620                        unset( $_SESSION['phpgw_info']['mobile']['photoCatalog'][$id] ); 
     621                    }     
     622                    else 
     623                    { 
     624                        header('Content-type: image/png'); 
     625                        echo file_get_contents(PHPGW_INCLUDE_ROOT.'/contactcenter/templates/default/images/photo_celepar.png'); 
     626                    } 
     627 
     628                    session_write_close(); 
     629 
     630                    return; 
     631                } 
    589632 
    590633                /** 
Note: See TracChangeset for help on using the changeset viewer.