本文整理汇总了PHP中Response::jsonSuccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::jsonSuccess方法的具体用法?PHP Response::jsonSuccess怎么用?PHP Response::jsonSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::jsonSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAction
/**
* Get object history
*/
public function listAction()
{
$object = Request::post('object', 'string', false);
if (!$object) {
Response::jsonSuccess(array());
}
$pager = Request::post('pager', 'array', array());
$filter = Request::post('filter', 'array', array());
if (!isset($filter['record_id']) || empty($filter['record_id'])) {
Response::jsonSuccess(array());
}
try {
$o = new Db_Object($object);
} catch (Exception $e) {
Response::jsonSuccess(array());
}
$filter['table_name'] = $o->getTable();
$history = Model::factory('Historylog');
$data = $history->getListVc($pager, $filter, false, array('date', 'type', 'id'), 'user_name');
if (!empty($data)) {
foreach ($data as $k => &$v) {
if (isset(Model_Historylog::$actions[$v['type']])) {
$v['type'] = Model_Historylog::$actions[$v['type']];
}
}
unset($v);
}
Response::jsonSuccess($data, array('count' => $history->getCount($filter)));
}
示例2: controllersAction
/**
* Get list of available controllers
*/
public function controllersAction()
{
$appPath = $this->_configMain['application_path'];
$folders = File::scanFiles($this->_configMain->get('frontend_controllers'), false, true, File::Dirs_Only);
$data = array();
if (!empty($folders)) {
foreach ($folders as $item) {
$name = basename($item);
if (file_exists($item . '/Controller.php')) {
$name = str_replace($appPath, '', $item . '/Controller.php');
$name = Utils::classFromPath($name);
$data[] = array('id' => $name, 'title' => $name);
}
}
}
if ($this->_configMain->get('allow_externals')) {
$config = Config::factory(Config::File_Array, $this->_configMain->get('configs') . 'externals.php');
$eExpert = new Externals_Expert($this->_configMain, $config);
$classes = $eExpert->getClasses();
$extControllers = $eExpert->getFrontendControllers();
if (!empty($extControllers)) {
$data = array_merge($data, array_values($extControllers));
}
}
Response::jsonSuccess($data);
}
示例3: 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();
}
示例4: menulistAction
/**
* Get list of accepted menu
*/
public function menulistAction()
{
$menuModel = Model::factory('menu');
$list = $menuModel->getList(false, false, array('id', 'title'));
if (!empty($list)) {
$list = array_values($list);
}
Response::jsonSuccess($list);
}
示例5: resetAction
public function resetAction()
{
$this->_checkCanDelete();
if (Backend_Cache_Manager::resetAll()) {
Response::jsonSuccess();
} else {
Response::jsonError($this->_lang->CANT_RESET_CACHE);
}
}
示例6: projectcodeAction
/**
* Get JS code for project
*/
public function projectcodeAction()
{
$project = $this->_getProject();
$projectCfg = $project->getConfig();
$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')));
Ext_Code::setRunNamespace($projectCfg['runnamespace']);
Ext_Code::setNamespace($projectCfg['namespace']);
Response::jsonSuccess($project->getCode($replaces));
}
示例7: syncFsAction
public function syncFsAction($toFile = false)
{
if ($toFile !== false) {
if ($this->_appConfig['deploy_use_console']) {
return $this->_fsmap($toFile);
} else {
return $this->_fsmapByPhp($toFile);
}
} else {
Response::jsonSuccess($this->_fsmap());
}
}
示例8: objectsAction
public function objectsAction()
{
$manager = new Db_Object_Manager();
$objects = $manager->getRegisteredObjects();
$data = array();
if (!empty($objects)) {
foreach ($objects as $name) {
$data[] = array('name' => $name, 'title' => Db_Object_Config::getInstance($name)->getTitle());
}
}
Response::jsonSuccess($data);
}
示例9: getlogfilesAction
public function getlogfilesAction()
{
//$version = $this->_configMain['development_version'];
$logPath = $this->_configMain['orm_log_path'];
//$fileName = $logPath . 'default_'.$version . '_build_log.sql';
$files = File::scanFiles($logPath, array('.sql'), false);
$data = array();
foreach ($files as $file) {
$file = basename($file, '.sql');
$data[] = array('id' => $file);
}
Response::jsonSuccess($data);
}
示例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: 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();
}
示例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: listAction
/**
* Get object properties
*/
public function listAction()
{
$id = Request::post('id', 'string', false);
if (!method_exists($this->_object, 'fieldExists')) {
Response::jsonError(get_class($this->_object) . '[' . $this->_object->getName() . '] deprecated type');
}
if (!$id || !$this->_object->fieldExists($id)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$field = $this->_object->getField($id);
$config = $field->getConfig();
$properties = $config->__toArray();
if (isset($properties['isExtended'])) {
unset($properties['isExtended']);
}
Response::jsonSuccess($properties);
}
示例14: 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();
}
示例15: changesizeAction
/**
* Change window size
*/
public function changesizeAction()
{
$object = Request::post('object', 'string', false);
$width = Request::post('width', 'integer', false);
$height = Request::post('height', 'integer', false);
if ($object === false || $width === false || $height === false) {
Response::jsonError($this->_lang->WRONG_REQUEST . 'code 1');
}
$project = $this->_getProject();
if (!$project->objectExists($object)) {
Response::jsonError($this->_lang->WRONG_REQUEST . 'code 2');
}
$object = $project->getObject($object);
$object->width = $width;
$object->height = $height;
$this->_storeProject();
Response::jsonSuccess();
}