~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Entity/Page.php

  • Committer: Dan Garner
  • Date: 2015-09-29 15:16:59 UTC
  • mto: (454.2.11) (471.2.2)
  • mto: This revision was merged to the branch mainline in revision 468.
  • Revision ID: git-v1:ae24387a7b1397750b6ec86d0f286373da05eb16
Fixed Display Version Information Form (not showing media name)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
 
23
23
namespace Xibo\Entity;
24
 
use Xibo\Service\LogServiceInterface;
25
 
use Xibo\Storage\StorageServiceInterface;
26
24
 
27
25
/**
28
26
 * Class Page
58
56
     */
59
57
    public $asHome;
60
58
 
61
 
    /**
62
 
     * Entity constructor.
63
 
     * @param StorageServiceInterface $store
64
 
     * @param LogServiceInterface $log
65
 
     */
66
 
    public function __construct($store, $log)
67
 
    {
68
 
        $this->setCommonDependencies($store, $log);
69
 
    }
70
 
 
71
59
    public function getOwnerId()
72
60
    {
73
61
        return 1;
82
70
    {
83
71
        return $this->name;
84
72
    }
85
 
 
86
 
    /**
87
 
     * Save
88
 
     */
89
 
    public function save()
90
 
    {
91
 
        if ($this->pageId == 0)
92
 
            $this->add();
93
 
        else
94
 
            $this->update();
95
 
    }
96
 
 
97
 
    private function add()
98
 
    {
99
 
        $this->pageId = $this->getStore()->insert('
100
 
            INSERT INTO `pages` (`name`, `title`, `asHome`)
101
 
              VALUES (:name, :title, :asHome)
102
 
        ', [
103
 
            'name' => $this->name,
104
 
            'title' => $this->title,
105
 
            'asHome' => $this->asHome
106
 
        ]);
107
 
    }
108
 
 
109
 
    private function update()
110
 
    {
111
 
        $this->getStore()->update('
112
 
            UPDATE `pages` SET `name` = :name, `title` = :title, `asHome` = :asHome
113
 
             WHERE `pageId` = :pageId
114
 
        ', [
115
 
            'pageId' => $this->pageId,
116
 
            'name' => $this->name,
117
 
            'title' => $this->title,
118
 
            'asHome' => $this->asHome
119
 
        ]);
120
 
    }
121
73
}
 
 
b'\\ No newline at end of file'