]> dev.renevier.net Git - syj.git/blob - application/models/Path.php
allow anonymous routes creation
[syj.git] / application / models / Path.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010 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             return "journey number " . (string)$this->_id;
62         } else {
63             return "";
64         }
65     }
66
67     public function setUrlComp($_urlcomp) {
68         $this->_urlcomp = (string) $_urlcomp;
69         return $this;
70     }
71
72     public function getUrlComp() {
73         return $this->_urlcomp;
74     }
75
76     public function setCreatorIp($_creator_ip) {
77         $this->_creator_ip = (string) $_creator_ip;
78         return $this;
79     }
80
81     public function getCreatorIp() {
82         return $this->_creator_ip;
83     }
84
85 }