-
Notifications
You must be signed in to change notification settings - Fork 1
/
Default.php
57 lines (43 loc) · 2.22 KB
/
Default.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
<?php
class Application_Controller_Default extends Admin_Controller_Default {
protected $_current_option_value;
public function init() {
parent::init();
// Options ACL
$application_acl_option = new Application_Model_Acl_Option();
$denied_options = $application_acl_option->findAllByAppAndAdminId($this->getApplication()->getId(),$this->getAdmin()->getId());
$this->_getAcl()->denyResources($denied_options, true);
$excluded = array(
'admin_application_list',
'admin_application_new',
'admin_application_set',
'admin_application_createpost',
'front_index_noroute',
'front_index_error',
);
// Test si un id de value est passé en paramètre
if($id = $this->getRequest()->getParam('option_value_id') OR $id = $this->getRequest()->getParam('value_id')) {
// Créé et charge l'objet
$this->_current_option_value = new Application_Model_Option_Value();
$this->_current_option_value->find($id);
}
$this->getSession()->editing_app_id = $this->getApplication()->getId();
if($this->getApplication()->isSomeoneElseEditingIt()) {
$this->getSession()->addWarning($this->_("Careful, someone else is working on this application."), "two_editing_the_same_app");
}
}
public function editAction() {
if($this->getCurrentOptionValue()) {
$this->loadPartials(null, false);
$this->getLayout()->getPartial('content')->setOptionValue($this->getCurrentOptionValue());
if($this->getLayout()->getPartial('content_editor')) $this->getLayout()->getPartial('content_editor')->setOptionValue($this->getCurrentOptionValue());
$html = array('html' => mb_convert_encoding($this->getLayout()->render(), 'UTF-8', 'UTF-8'));
$path = $this->getCurrentOptionValue()->getPath(null, array(), "mobile");
$html["path"] = $path ? $path : "";
$this->getLayout()->setHtml(Zend_Json::encode($html));
}
}
public function getCurrentOptionValue() {
return $this->_current_option_value;
}
}