Пример #1
0
 protected function executeSave()
 {
     $redirect = $this->getRequestParameter('redirect');
     $id = $this->getRequestParameter();
     $m = $this->getRequestParameter('m', 'array', array());
     try {
         $ex = PartnerManager::getInstance()->getByPk($id, true);
         $ex->addField('oldImage', 'string', $ex->image);
         $ex->updateFromRequest($m);
         if (!$ex->isValid()) {
             throw new EUserMessageError("Ошибка при сохранении", $ex);
         }
         if (!$ex->save()) {
             throw new EUserMessageError("Ошибка при сохранении", $ex);
         }
         $this->setFlash('Данные успешно сохранены', self::$FLASH_SUCCESS);
         $this->setHeader('redirect', fvSite::$fvConfig->get('dir_web_root') . $this->getRequest()->getRequestParameter('module') . ($redirect ? "" : "/edit/?id=" . $ex->getPk()));
     } catch (EUserMessageError $e) {
         $this->setFlash($e->getMessage(), self::$FLASH_ERROR);
         $this->setHeader('X-JSON', json_encode($e->getValidationResult()));
     } catch (EDatabaseError $db) {
         $this->setFlash($db->getMessage(), self::$FLASH_ERROR);
     }
     return $this->getRequest()->isXmlHttpRequest() ? self::$FV_AJAX_CALL : self::$FV_OK;
 }
Пример #2
0
 function showEdit()
 {
     $id = $this->getRequestParameter();
     $ex = PartnerManager::getInstance()->getByPk($id, true);
     $this->__assign("tmpDir", fvSite::$fvConfig->get("path.upload.web_temp_image"));
     $this->__assign("ex", $ex);
     $this->__assign("wt", range(-20, 20));
     return $this->__display('edit.tpl');
 }
Пример #3
0
 function showIndex()
 {
     $List = PartnerManager::getInstance()->getAll("is_show=1", "weight asc");
     $this->__assign("List", $List);
     return $this->__display("index.tpl");
 }