本文整理汇总了PHP中Response::jsonError方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::jsonError方法的具体用法?PHP Response::jsonError怎么用?PHP Response::jsonError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::jsonError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importdbfieldsAction
/**
* Import DB fields into the form object
*/
public function importdbfieldsAction()
{
$connection = Request::post('connection', 'string', false);
$table = Request::post('table', 'string', false);
$conType = Request::post('type', 'integer', false);
$importFields = Request::post('importfields', 'array', array());
if ($connection === false || !$table || empty($importFields) || $conType === false) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$conManager = new Backend_Orm_Connections_Manager($this->_configMain->get('db_configs'));
$cfg = $conManager->getConnection($conType, $connection);
if (!$cfg) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$cfg = $cfg->__toArray();
$tableFields = Backend_Designer_Import::getTableFields($cfg, $table);
if ($tableFields === false) {
Response::jsonError($this->_lang->CANT_CONNECT);
}
foreach ($importFields as $name) {
if (isset($tableFields[$name]) && !empty($tableFields[$name])) {
$this->_importDbField($name, $tableFields[$name]);
}
}
$this->_storeProject();
Response::jsonSuccess();
}
示例2: updateAction
public function updateAction()
{
$this->_checkCanEdit();
$data = Request::post('data', 'raw', false);
if ($data === false) {
Response::jsonError($this->_lang->INVALID_VALUE);
}
$data = json_decode($data, true);
if (!isset($data[0])) {
$data = array($data);
}
$manager = new Backend_Fmodules_Manager();
$manager->removeAll();
if (!empty($data)) {
foreach ($data as $v) {
if (empty($v)) {
continue;
}
$name = $v['name'];
unset($v['name']);
$manager->addModule($name, $v);
}
}
if ($manager->save()) {
Response::jsonSuccess();
} else {
Response::jsonError($this->_lang->CANT_WRITE_FS);
}
}
示例3: _getEvent
protected function _getEvent()
{
$event = Request::post('event', 'string', false);
if (!strlen($event) || $event === false) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
return $event;
}
示例4: getModule
public function getModule()
{
$dataObject = Request::post('d_object', 'string', false);
if (!$dataObject || !Db_Object_Config::configExists($dataObject)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
return ucfirst($dataObject);
}
示例5: _errorResponse
/**
* Send JSON error message
*
* @return string
*/
protected function _errorResponse($msg)
{
if (Request::isAjax()) {
Response::jsonError($msg);
} else {
Response::redirect(Request::url(array('index'), true));
}
}
示例6: _getObject
/**
* Check requested object
* Get requested object from project
* @return Ext_Object
*/
protected function _getObject()
{
$name = Request::post('object', 'string', '');
$project = $this->_getProject();
if (!strlen($name) || !$project->objectExists($name)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
return $project->getObject($name);
}
示例7: resetAction
public function resetAction()
{
$this->_checkCanDelete();
if (Backend_Cache_Manager::resetAll()) {
Response::jsonSuccess();
} else {
Response::jsonError($this->_lang->CANT_RESET_CACHE);
}
}
示例8: updateObject
/**
* Update object
* @param Db_Object $object
* @return void
*/
public function updateObject(Db_Object $object)
{
$changeVal = Request::post('changeVal', 'bool', false);
if ($changeVal) {
$object->set('hash', Utils::hash($object->get('hash')));
}
if (!$object->save()) {
Response::jsonError($this->_lang->CANT_EXEC);
}
Response::jsonSuccess(array('id' => $object->getId()));
}
示例9: actionsAction
public function actionsAction()
{
$controller = Request::post('controller', 'string', '');
if (!strlen($controller)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
if (strpos($controller, '.php') !== false) {
$controller = Utils::classFromPath($controller);
}
$actions = Backend_Designer_Code::getPossibleActions($controller);
Response::jsonSuccess($actions);
}
示例10: savepermissionsAction
/**
* Save permissions action
*/
public function savepermissionsAction()
{
$this->_checkCanEdit();
$data = Request::post('data', 'raw', false);
$groupId = Request::post('group_id', 'int', false);
$data = json_decode($data, true);
if (empty($data) || !$groupId) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
if (Model::factory('acl_simple')->updateGroupPermissions($groupId, $data)) {
Response::jsonSuccess();
} else {
Response::jsonError($this->_lang->CANT_EXEC);
}
}
示例11: objectcodeAction
/**
* Get JS code for object
*/
public function objectcodeAction()
{
$object = Request::post('object', 'string', '');
$project = $this->_getProject();
if (!$project->objectExists($object)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$projectCfg = $project->getConfig();
Ext_Code::setRunNamespace($projectCfg['runnamespace']);
Ext_Code::setNamespace($projectCfg['namespace']);
$templates = $this->_config->get('templates');
$replaces = array(array('tpl' => $templates['wwwroot'], 'value' => $this->_configMain->get('wwwroot')), array('tpl' => $templates['adminpath'], 'value' => $this->_configMain->get('adminPath')), array('tpl' => $templates['urldelimiter'], 'value' => $this->_configMain->get('urlDelimiter')));
$code = $project->getObjectCode($object, $replaces);
Response::jsonSuccess($code);
}
示例12: saveAction
/**
* Save ActionJs code
*/
public function saveAction()
{
$code = Request::post('code', 'raw', false);
if ($code === false) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$project = $this->_getProject();
$actionjs = str_replace('../', '', $project->actionjs);
if ($actionjs[0] !== '.') {
$actionjs = '.' . $actionjs;
}
if (!@file_put_contents($actionjs, $code)) {
Response::jsonError($this->_lang->CANT_WRITE_FS . ' ' . $actionjs);
}
Response::jsonSuccess();
}
示例13: setpropertyAction
/**
* Set object property
*/
public function setpropertyAction()
{
$id = Request::post('id', 'string', false);
$property = Request::post('name', 'string', false);
$value = Request::post('value', 'raw', false);
if (!$id || !$this->_object->getFiltersFeature()->filterExists($id)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$object = $this->_object->getFiltersFeature()->getFilter($id);
if (!$object->isValidProperty($property)) {
Response::jsonError();
}
$object->{$property} = $value;
$this->_storeProject();
Response::jsonSuccess();
}
示例14: setpropertyAction
/**
* Set object property
*/
public function setpropertyAction()
{
$this->_checkColumn();
$action = Request::post('id', 'string', false);
if ($action === false || !$this->_column->actionExists($action)) {
Response::jsonError($this->_lang->WRONG_REQUEST . ' invalid action');
}
$action = $this->_column->getAction($action);
$property = Request::post('name', 'string', false);
$value = Request::post('value', 'raw', false);
if (!$action->isValidProperty($property)) {
Response::jsonError();
}
$action->{$property} = $value;
$this->_storeProject();
Response::jsonSuccess();
}
示例15: importfieldsAction
/**
* Import fields into the form object
*/
public function importfieldsAction()
{
$importObject = Request::post('importobject', 'string', false);
$importFields = Request::post('importfields', 'array', array());
if (!$importObject || empty($importFields) || !Db_Object_Config::configExists($importObject)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$importObjectConfig = Db_Object_Config::getInstance($importObject);
foreach ($importFields as $name) {
if ($importObjectConfig->fieldExists($name)) {
$this->_importOrmField($name, $importObjectConfig);
}
}
$this->_object->objectName = $importObject;
$this->_storeProject();
Response::jsonSuccess();
}