public function addbookmarkpopupActi on this- _helper- layout- disable

 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
63
64
65
66
67
68
public function addbookmarkpopupAction()
{
$this->_helper->layout->disableLayout();
$form = new StuffForm;
$listModel = new Lists;
$userID = Zend_Auth::getInstance()->getIdentity()->uid;
$form->list->addMultiOptions($listModel->getShort($userID, false, - Lists::TYPE_GROUP));
$form->list->addErrorMessage('Please select a List');
if($this->_request->isPost()) {
try {
if (!array_key_exists('list', $_POST)) {
throw new Exception('Please select a List');
}
if (!$form->isValid($_POST)) {
$_messages_ready = Array();
$_messages = $form->getMessages();
foreach ($_messages as $element_name => $descr) {
if (is_array($descr)) {
foreach ($descr as $code => $err_descr) {
array_push($_messages_ready, "$err_descr");
}
}
}
if (!empty($_messages_ready)) {
$_messages_ready = implode('<br/>', $_messages_ready);
}else {
$_messages_ready = 'Unknown error. Please contact igottaList administrator.';
}
$this->getResponse()->appendBody(Zend_Json_Encoder::encode(array('isError' => true, 'error_message' => $_messages_ready)));
$this->_helper->viewRenderer->setNoRender();
return;
}
// uploading here!
list($itemID, $listID) = $this->saveStuff($form, $listModel, $is_uploaded = false);
}catch (Exception $e) {
$this->getResponse()->appendBody(Zend_Json_Encoder::encode(array('isError' => true, 'error_message' => $e->getMessage())));
$this->_helper->viewRenderer->setNoRender();
return;
}
$this->getResponse()->appendBody(Zend_Json_Encoder::encode(array('isError' => false, 'itemID' => $itemID, 'listID' => $listID)));
$this->_helper->viewRenderer->setNoRender();
return;
}
$this->view->form = $form;
}