-
Notifications
You must be signed in to change notification settings - Fork 0
/
Edit.php
62 lines (51 loc) · 1.62 KB
/
Edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* YouNet Company
*
* @category Application_Extensions
* @package Ynvideo
* @author YouNet Company
*/
class Ynvideo_Form_Edit extends Ynvideo_Form_Video {
private $_video;
public function setVideo($value)
{
$this->_video = $value;
}
protected function initValueForElements() {
$this->populate($this->_video->toArray());
/*
// prepare tags
$videoTags = $this->_video->tags()->getTagMaps();
$tagString = '';
foreach ($videoTags as $tagmap) {
if ($tagString !== '')
$tagString .= ', ';
$tagString .= $tagmap->getTag()->getTitle();
}
$this->tags->setValue($tagString);
*/
// set view authentication and comment authentication for the two dropdownlists
$authViewElement = $this->getElement('auth_view');
$authCommentElement = $this->getElement('auth_comment');
$auth = Engine_Api::_()->authorization()->context;
if ($authViewElement) {
foreach ($this->_roles as $key => $role) {
if ($auth->isAllowed($this->_video, $key, 'view')) {
$authViewElement->setValue($key);
break;
}
}
}
if ($authCommentElement) {
foreach ($this->_roles as $key => $role) {
if ($auth->isAllowed($this->_video, $key, 'comment')) {
$authCommentElement->setValue($key);
break;
}
}
}
}
protected function addAdditionalElements() {
}
}