Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Zend Framework i Mobile support

[es] :: PHP :: Zend Framework i Mobile support

[ Pregleda: 2269 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

nezki
Miodrag Lapcevic
Beograd

Član broj: 101503
Poruke: 438
212.200.34.*

Sajt: www.websolutions.co.rs


Profil

icon Zend Framework i Mobile support19.11.2010. u 08:54 - pre 163 meseci
Pozdrav svima
Kako da u zend framework-u proverim sledece:
1. da li je urdjaj sa kog posetilac pristupa mom sajtu mobilni ili PC?
2. kako da proverim u slucaju ako je mobilni da li ima podrsku za GPS?
3. i ako ima podrsku kako da uhvatim GPS kordinate?

Prvo stavku sam resio uz pomoc klase Zend_Http_UserAgent
Code:

        $userAgent = new Zend_Http_UserAgent();
        $device    = $userAgent->getDevice();
        
        //Get type
        $type = $device->getType();
    
        $data = "";
         if($type == 'mobile'){
            $data .= "Device type: " . $device->getType() . "<br />";
            $data .= "Model name: " . $device->getFeature('model_name') . "<br />";
            $data .= "Mobile browser: " . $device->getFeature('mobile_browser') . "<br />"; 
            $data .= "Browser name: " . $device->getFeature('browser_name') . "<br />";  
            $data .= "Browser version: " . $device->getFeature('browser_version') . "<br />";
            $data .= "Device OS: " . $device->getFeature('device_os') . "<br />"; 
            $data .= "Device OS version: " . $device->getFeature('device_os_version') . "<br />"; 
            $data .= "Resolution height: " . $device->getFeature('resolution_height') . "<br />"; 
            $data .= "Resolution width: " . $device->getFeature('resolution_width') . "<br />"; 
         }else{
             $data = "Desktop";
         }



E sad za ostale dve stavke nikako da nadjem neko resenje.
moze li neko da me uputi kako bih ovo mogao da resim ili ako ne zna u zend-u moze i samo PHP.
Trenutno nesto pokusavam sa Google Api-jem ali mi ne ide bas :(

Ps. koristim poslednju verziju Zend F-a
djLapac
 
Odgovor na temu

nezki
Miodrag Lapcevic
Beograd

Član broj: 101503
Poruke: 438
212.200.34.*

Sajt: www.websolutions.co.rs


Profil

icon Re: Zend Framework i Mobile support19.11.2010. u 11:24 - pre 163 meseci
ja evo jos guglam i ono sto sam nasao je jeste da uz pomoc java scripta mogu da se uhvate kordinata ali samo za browsere koji imaju podrsku za Geolocation API
http://www.w3.org/TR/geolocation-API/
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
if(navigator.geolocation) {  
    /* geolocation is available */  
    navigator.geolocation.getCurrentPosition(
        function(position) { // success callback  
            document.write("Coords: " + position.coords.latitude + "," + position.coords.longitude);
            //alert(position.address.city);                
        },
        function() { // failure callback
            // error handling
            document.write("error happened");
        },
        {
            // other options
            timeout:30000
        }
    );    
} else {      
    // browser does not support Geolocation API
    document.write("Browser does not support Geolocation API");

</script>
<noscript>
JAVA SCRIPT IS NOT ENABLED
</noscript>
</body>
</html>


I opet u Firefox-u mora na strani klijenta da se omoguci.
Da li neko mozda ima iskustva i preko java scripta?
djLapac
 
Odgovor na temu

strutter.poison

Član broj: 264822
Poruke: 115
*.dynamic.isp.telekom.rs.



+2 Profil

icon Re: Zend Framework i Mobile support22.11.2010. u 16:50 - pre 163 meseci
A jel radi dobro to detektovanje user agenta iz zf-a i funkcija koje uredjaj ima?
Ja sam probao sa dodatkom za FF da simuliram razlicite uredjaje/browsere ali nesto se zapucava.. Sustinski dolazim do informacija koje i bez te klase mogu da uzmem iz $_SERVER : koji je browser, os (ako je naveden) i sl.
 
Odgovor na temu

nezki
Miodrag Lapcevic
Beograd

Član broj: 101503
Poruke: 438
*.dynamic.sbb.rs.

Sajt: www.websolutions.co.rs


Profil

icon Re: Zend Framework i Mobile support22.11.2010. u 21:45 - pre 163 meseci
Da radi, sve ove informacije mozes da uhvatis:
Code:
  $data .= "Device type: " . $device->getType() . "<br />";
            $data .= "Model name: " . $device->getFeature('model_name') . "<br />";
            $data .= "Mobile browser: " . $device->getFeature('mobile_browser') . "<br />"; 
            $data .= "Browser name: " . $device->getFeature('browser_name') . "<br />";  
            $data .= "Browser version: " . $device->getFeature('browser_version') . "<br />";
            $data .= "Device OS: " . $device->getFeature('device_os') . "<br />"; 
            $data .= "Device OS version: " . $device->getFeature('device_os_version') . "<br />"; 
            $data .= "Resolution height: " . $device->getFeature('resolution_height') . "<br />"; 
            $data .= "Resolution width: " . $device->getFeature('resolution_width') . "<br />"; 

ALi jos nista nisma uspeo sa GPS-om
Mislim jesam uspeo ovo preko java scripta ali to nije dovoljno
Jel ima neko neku ideju.

djLapac
 
Odgovor na temu

strutter.poison

Član broj: 264822
Poruke: 115
*.dynamic.isp.telekom.rs.



+2 Profil

icon Re: Zend Framework i Mobile support22.11.2010. u 22:33 - pre 163 meseci
Pomogao bih ti ali sa tim nisam petljao. Onako povrsno... meni to deluje kao neki hack da dodjes do koordinata. Nije nesto sto bi po default-u trebalo da radi, bez potvrde sa client-side. Verovatno da nekako moze da se prevari browser, ali... hm..
 
Odgovor na temu

nezki
Miodrag Lapcevic
Beograd

Član broj: 101503
Poruke: 438
*.dynamic.sbb.rs.

Sajt: www.websolutions.co.rs


Profil

icon Re: Zend Framework i Mobile support22.11.2010. u 23:25 - pre 163 meseci
evo ja sam postavio sve na www.dobrodelo.org/public2/index.php
ali nece da mi radi evo ga kod
Code:

<?php

class IndexController extends Zend_Controller_Action
{
    function indexAction()
    {
        $this->view->pageTitle = "Test";
        $this->view->bodyCopy = "<p></p>";
        $this->view->content = "";
        $this->view->data = "data";
        $config['wurflapi']['wurfl_lib_dir'] = '../library/wurfl-php-1.1/'; 
        $config['wurflapi']['wurfl_config_file'] = '../application/configs/wurfl-config.php'; 
        Zend_UserAgent::setConfig($config); 
         
        $oUserAgent = Zend_UserAgent::getInstance(); 
         
        var_dump($oUserAgent->getType()); 
        var_dump($oUserAgent->device->getFeature('browser_name')); 
        var_dump($oUserAgent->device->getFeature('browser_version')); 
        var_dump($oUserAgent->device->getFeature('device_os')); 
        var_dump($oUserAgent->device->getFeature('mobile_browser')); 
        var_dump($oUserAgent->device->getFeature('model_name')); 
        var_dump($oUserAgent->device->getFeature('device_os_version')); 
        var_dump($oUserAgent->device->getFeature('resolution_height')); 
        var_dump($oUserAgent->device->getFeature('resolution_width'));
    }
}

Probao sam preko mobilnog ali nece da radi a ne vraca mi nikakvu gresku
Nemogu da verujem da nema bas niko sa nekim iskustvom

djLapac
 
Odgovor na temu

[es] :: PHP :: Zend Framework i Mobile support

[ Pregleda: 2269 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.