~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Entity/Display.php

  • Committer: Dan Garner
  • Date: 2015-06-02 15:31:27 UTC
  • mto: This revision was merged to the branch mainline in revision 428.
  • Revision ID: git-v1:22e91f1ef8daa9dbdde16d1221b636ed63f9a4ac
Part way through building Display/DisplayGroup entities.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        return 1;
91
91
    }
92
92
 
 
93
    /**
 
94
     * Set the Media Status to Incomplete
 
95
     */
93
96
    public function setMediaIncomplete()
94
97
    {
95
98
        $this->mediaInventoryStatus = 3;
96
99
    }
97
100
 
 
101
    /**
 
102
     * Validate the Object as it stands
 
103
     */
98
104
    public function validate()
99
105
    {
100
106
        if (!v::string()->notEmpty()->validate($this->display))
138
144
        }
139
145
    }
140
146
 
 
147
    /**
 
148
     * Load
 
149
     */
141
150
    public function load()
142
151
    {
 
152
        // Load this displays group membership
143
153
        $this->displayGroups = DisplayGroupFactory::getByDisplayId($this->displayId);
144
154
    }
145
155
 
 
156
    /**
 
157
     * Save
 
158
     * @param bool $validate
 
159
     */
146
160
    public function save($validate = true)
147
161
    {
148
162
        if ($validate)
156
170
        Log::audit('Display', $this->displayId, 'Display Saved', $this->jsonSerialize());
157
171
    }
158
172
 
 
173
    /**
 
174
     * Delete
 
175
     * @throws \Xibo\Exception\NotFoundException
 
176
     */
159
177
    public function delete()
160
178
    {
161
179
        $this->load();
162
180
 
 
181
        // Remove our display from any groups it is assigned to
163
182
        foreach ($this->displayGroups as $displayGroup) {
164
183
            /* @var DisplayGroup $displayGroup */
165
 
            $displayGroup->unassignDisplay($this->displayId);
 
184
            $displayGroup->removeAssignments();
166
185
        }
167
186
 
168
187
        // Delete our display specific group
282
301
        return $this->setConfig();
283
302
    }
284
303
 
 
304
    /**
 
305
     * Get a particular setting
 
306
     * @param string $key
 
307
     * @param mixed $default
 
308
     * @return mixed
 
309
     */
285
310
    public function getSetting($key, $default)
286
311
    {
287
312
        $this->setConfig();
299
324
    }
300
325
 
301
326
    /**
 
327
     * Set the config array
302
328
     * @return array
303
329
     */
304
330
    private function setConfig()