function validateTech_url($value) { $valid = strlen($value) > 0; $valid = $valid && StaticPagesManager::getInstance()->getCount("tech_url = ?", array($value)) == 0; $this->setValidationResult("tech_url", $valid); return $valid; }
function showEdit() { $id = $this->getRequestParameter(); $StaticPage = StaticPagesManager::getInstance()->getByPk($id, true); $new = StaticPagesManager::getInstance()->cloneRootInstance(); /*fvDebug::debugs($new);*/ //fvDebug::debugs($StaticPage); $this->__assign(array('StaticPage' => $StaticPage)); return $this->__display('sp_edit.tpl'); }
function showOne($params) { $pageName = $params['tech_name'] or fvRequest::getInstance()->getRequestParameter("tech_name"); $Page = StaticPagesManager::getInstance()->getByTechUrl($pageName); if (count($Page) == 1 && is_object($Page = $Page[0])) { $this->__assign("sp", $Page); } else { $this->__assign("sp", new StaticPages()); } return $this->__display("one.tpl"); }
function executeDelete() { $request = fvRequest::getInstance(); if (!($StaticPage = StaticPagesManager::getInstance()->getByPk($request->getRequestParameter('id')))) { $this->setFlash("Ошибка при удалении.", self::$FLASH_ERROR); } else { $StaticPage->delete(); $this->setFlash("Данные успешно удалены", self::$FLASH_SUCCESS); } fvResponce::getInstance()->setHeader('redirect', fvSite::$fvConfig->get('dir_web_root') . $request->getRequestParameter('module') . "/"); if (fvRequest::getInstance()->isXmlHttpRequest()) { return self::$FV_NO_LAYOULT; } else { return self::$FV_OK; } }