]> dev.renevier.net Git - syj.git/blob - application/models/Path.php
28e5c9021b2d614d4fc2dcd9ed187a7bd09590ee
[syj.git] / application / models / Path.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 class Syj_Model_Path extends Syj_Model_Generic
6 {
7     protected $_id;
8     protected $_geom;
9     protected $_creator;
10     protected $_title;
11     protected $_urlcomp;
12     protected $_creator_ip;
13
14     public function setId($id) {
15         $this->_id = (int) $id;
16         return $this;
17     }
18
19     public function getId() {
20         return $this->_id;
21     }
22
23     public function setGeom(gisconverter\Geometry $geom) {
24         $this->_geom = $geom;
25         return $this;
26     }
27
28     public function getGeom() {
29         return $this->_geom;
30     }
31
32     public function setCreator(Syj_Model_User $creator = null) {
33         $this->_creator = $creator;
34         return $this;
35     }
36
37     public function getCreator() {
38         return $this->_creator;
39     }
40
41     public function isCreator(Syj_Model_User $creator = null) {
42         if (!$creator or !$this->creator) {
43             return false;
44         }
45         return ($creator->id == $this->creator->id);
46     }
47
48     public function setTitle($title) {
49         $this->_title = (string) $title;
50         return $this;
51     }
52
53     public function getTitle() {
54         return $this->_title;
55     }
56
57     public function getDisplayTitle() {
58         if ($this->_title) {
59             return $this->_title;
60         } else if ($this->_id) {
61             $title = $this->getTranslator()->translate("route number %d");
62             return str_replace('%d', (string)$this->id, $title);
63         } else {
64             return "";
65         }
66     }
67
68     public function setUrlComp($_urlcomp) {
69         $this->_urlcomp = (string) $_urlcomp;
70         return $this;
71     }
72
73     public function getUrlComp() {
74         return $this->_urlcomp;
75     }
76
77     public function setCreatorIp($_creator_ip) {
78         $this->_creator_ip = (string) $_creator_ip;
79         return $this;
80     }
81
82     public function getCreatorIp() {
83         return $this->_creator_ip;
84     }
85
86 }