public function indexAction() { $this->view->form = $form = new Ynnotification_Form_Admin_Style(); $values = Engine_Api::_()->getApi('settings', 'core')->getSetting('avdnotification.customcssobj', 0); $values = Zend_JSON::decode($values); if ($values) { $form->populate($values); } if ($this->getRequest()->isPost() && $form->isValid($this->_getAllParams())) { $values = $form->getValues(); if (isset($_POST['submit'])) { // $str = $this->view->partial("_css.tpl"); $arr_keys = array_keys($values); $arr_values = array_values($values); $arr_keys = array_map(array($this, 'map'), $arr_keys); $str = str_replace($arr_keys, $arr_values, $str); Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification.customcssobj', Zend_JSON::encode($values)); Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification', $str); $form->addNotice('Your changes have been saved.'); } else { if (isset($_POST['clear'])) { Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification.customcssobj', ''); Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification', ''); $form->populate(array('mes_background' => '79B4D4', 'text_color' => '')); $form->addNotice('You have set default styles.'); } } } }
public function create($doc, $id = null) { if (!$doc instanceof CouchDocument) { if (!is_array($doc)) { $doc = Zend_JSON::decode($doc); } $data = new CouchData($doc); $doc = CouchDocument::create($this, $data); } if (!is_null($id)) { $doc->id = $id; } if (isset($doc->id)) { $request = new CouchRequest('PUT', urlencode($doc->id), $doc); } else { $request = new CouchRequest('POST', "", $doc); } $response = $this->send($request); $responseObject = $response->getObject(); $doc->id = $responseObject['id']; $doc->rev = $responseObject['rev']; return $doc; }
function getSearchFilterModel($module, $search) { return Mobile_WS_SearchFilterModel::modelWithCriterias($module, Zend_JSON::decode($search)); }