]> dev.renevier.net Git - syj.git/blob - application/controllers/helpers/SyjAltiService.php
routes profile
[syj.git] / application / controllers / helpers / SyjAltiService.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
3     and is published under the AGPL license. */
4
5
6 class Syj_Controller_Action_Helper_SyjAltiService extends Zend_Controller_Action_Helper_Abstract
7 {
8     protected static $_service = null;
9
10     public function service() {
11         if (is_null (self::$_service)) {
12             $params = Zend_Controller_Front::getInstance()->getParam('altiphp');
13             if ($params['source'] == 'srtmtiles' and isset($params['cache'])) {
14                 $cachedir = $params['cache'];
15                 if (!is_dir($cachedir)) {
16                     if (@mkdir($cachedir, 0755, true) === false) {
17                         throw new Zend_Exception();
18                     }
19                 }
20             }
21             self::$_service = new alti\Alti($params);
22         }
23         return self::$_service;
24     }
25 }