本文整理汇总了PHP中Response::jsonArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::jsonArray方法的具体用法?PHP Response::jsonArray怎么用?PHP Response::jsonArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::jsonArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userlistAction
/**
* Users list action
*/
public function userlistAction()
{
$pager = Request::post('pager', 'array', array());
$filter = Request::post('filter', 'array', array());
$query = Request::post('search', 'string', false);
$model = Model::factory('User');
$count = $model->getCount($filter, $query);
$data = $model->getListVc($pager, $filter, $query, array('id', 'group_id', 'name', 'login', 'email', 'enabled', 'admin'));
/*
* Fillin group titles Its faster then using join
*/
$groups = Model::factory('Group')->getGroups();
if (!empty($data) && !empty($groups)) {
foreach ($data as $k => &$v) {
if (array_key_exists($v['group_id'], $groups)) {
$v['group_title'] = $groups[$v['group_id']];
} else {
$v['group_title'] = '';
}
}
}
unset($v);
$result = array('success' => true, 'count' => $count, 'data' => $data);
Response::jsonArray($result);
}
示例2: listAction
/**
* Get list of media library items
*/
public function listAction()
{
$pager = Request::post('pager', 'array', array());
$filter = Request::post('filter', 'array', array());
$query = Request::post('search', 'string', false);
if (isset($filter['category']) && !intval($filter['category'])) {
$filter['category'] = null;
}
$media = Model::factory('Medialib');
$data = $media->getListVc($pager, $filter, $query, '*', 'user_name');
$wwwRoot = $this->_configMain->get('wwwroot');
if (!empty($data)) {
foreach ($data as $k => &$v) {
if ($v['type'] == 'image') {
$v['srcpath'] = Model_Medialib::addWebRoot(str_replace($v['ext'], '', $v['path']));
$v['thumbnail'] = Model_Medialib::getImgPath($v['path'], $v['ext'], 'thumbnail', true);
$v['icon'] = Model_Medialib::getImgPath($v['path'], $v['ext'], 'icon', true);
} else {
$v['icon'] = $wwwRoot . 'i/unknown.png';
$v['thumbnail'] = $wwwRoot . 'i/unknown.png';
$v['srcpath'] = '';
}
$v['path'] = Model_Medialib::addWebRoot($v['path']);
}
unset($v);
}
$result = array('success' => true, 'count' => $media->getCount($filter, $query), 'data' => $data);
Response::jsonArray($result);
}
示例3: importAction
public function importAction()
{
$result = array('success' => true, 'success_records' => 123);
for ($i = 0; $i < 10; $i++) {
$result['data'][] = array('col0' => 'Data' . rand(0, 6), 'col1' => rand(1000, 9999), 'col2' => rand(1, 700), 'col3' => rand(1, 700), 'col4' => rand(1, 700), 'col5' => rand(1, 700), 'col6' => rand(1, 700));
}
Response::jsonArray($result);
}
示例4: listadaptersAction
/**
* Get list of existing form field adapters
*/
public function listadaptersAction()
{
$data = array();
$autoloaderPaths = $this->_configMain['autoloader'];
$autoloaderPaths = $autoloaderPaths['paths'];
$files = File::scanFiles($this->_config->get('components') . '/Field', array('.php'), true, File::Files_Only);
if (!empty($files)) {
foreach ($files as $item) {
$class = Utils::classFromPath(str_replace($autoloaderPaths, '', $item));
$data[] = array('id' => $class, 'title' => str_replace($this->_config->get('components') . '/', '', substr($item, 0, -4)));
}
}
Response::jsonArray($data);
}
示例5: fslistAction
/**
* Files list
*/
public function fslistAction()
{
$path = Request::post('node', 'string', '');
//$path = str_replace('.','', $path);
$dirPath = $this->_config->get('configs');
if ($path === '') {
$path = $dirPath . $path;
}
if (!is_dir($dirPath)) {
Response::jsonArray(array());
}
$files = File::scanFiles($path, array('.dat'), false, File::Files_Dirs);
$list = array();
if (!empty($files)) {
$dirs = array();
$pfiles = array();
foreach ($files as $k => $fpath) {
$text = basename($fpath);
if ($text === '.svn') {
continue;
}
if (is_dir($fpath)) {
$dirs[] = $fpath;
} else {
$pfiles[] = $fpath;
}
}
if (!empty($dirs)) {
sort($dirs);
foreach ($dirs as $k => $fpath) {
$text = basename($fpath);
$obj = new stdClass();
$obj->id = str_replace($this->_configMain->get('docroot'), './', $fpath);
$obj->text = $text;
$obj->expanded = false;
$obj->leaf = false;
$list[] = $obj;
}
}
if (!empty($pfiles)) {
sort($pfiles);
foreach ($pfiles as $k => $fpath) {
$text = basename($fpath);
$obj = new stdClass();
$obj->id = str_replace($this->_configMain->get('docroot'), './', $fpath);
$obj->text = $text;
$obj->leaf = true;
$list[] = $obj;
}
}
}
if ($path == '') {
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);
$extProjects = $eExpert->getProjects();
if (!empty($extProjects)) {
foreach ($extProjects as $item) {
$list[] = $item;
}
}
}
}
Response::jsonArray($list);
}
示例6: addSubAction
/**
* Add related object selection
*/
public function addSubAction()
{
$this->_checkCanEdit();
$this->_checkLoaded();
$baseField = Request::post('basefield', 'string', false);
$subObject = Request::post('subobject', 'string', false);
$subField = Request::post('subfield', 'string', false);
$join = Request::post('join', 'integer', 1);
if (!$baseField || !$subObject || !$subField || !$join) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$query = $this->_session->get('query');
$basePart = $query->getRootPart();
$childPart = $query->findChild($basePart->getId(), $baseField);
if ($childPart !== false) {
$query->removePart($childPart->getId());
}
$newPart = new Db_Query_Part();
$newPart->setObject($subObject);
$newPart->setParentField($baseField);
$newPart->setChildField($subField);
$newPart->setJoinType($join);
if (!$query->addPart($newPart, $basePart->getId())) {
Response::jsonArray(array('success' => false, 'msg' => $this->_lang->CANT_EXEC));
}
$basePart->setFieldCfg($baseField, 'selectSub', true);
$basePart->setFieldCfg($baseField, 'isLink', true);
$this->_session->set('query', $query);
Response::jsonSuccess();
}
示例7: treelistAction
/**
* Get Categories tree
*/
public function treelistAction()
{
$model = Model::factory('Mediacategory');
Response::jsonArray($model->getCategoriesTree());
}
示例8: imglistAction
public function imglistAction()
{
$templates = $this->_config->get('templates');
$dirPath = $this->_configMain->get('docroot');
$dir = Request::post('dir', 'string', '');
if (!is_dir($dirPath . $dir)) {
Response::jsonArray(array());
}
$files = File::scanFiles($dirPath . $dir, array('.jpg', '.png', '.gif', '.jpeg'), false, File::Files_Only);
if (empty($files)) {
Response::jsonArray(array());
}
sort($files);
$list = array();
foreach ($files as $k => $fpath) {
// ms fix
$fpath = str_replace('\\', '/', $fpath);
$text = basename($fpath);
if ($text === '.svn') {
continue;
}
$list[] = array('name' => $text, 'url' => str_replace($dirPath . '/', $this->_configMain->get('wwwroot'), $fpath), 'path' => str_replace($dirPath . '/', $templates['wwwroot'], $fpath));
}
Response::jsonSuccess($list);
}
示例9: relatedprojectlistAction
/**
* Get related project items Tree list
*/
public function relatedprojectlistAction()
{
$this->_checkLoaded();
$project = $this->_getProject();
$relatedProjects = array();
$this->getRelatedProjects($project, $relatedProjects);
if (empty($relatedProjects)) {
Response::jsonSuccess(array());
}
$result = array();
foreach ($relatedProjects as $item) {
$projectConfig = $item['project']->getConfig();
$o = new stdClass();
$o->id = $item['file'];
$o->text = $item['file'] . ' classes: ' . $projectConfig['namespace'] . ' run: ' . $projectConfig['runnamespace'];
$o->expanded = false;
$o->objClass = '';
$o->leaf = false;
$o->iconCls = '';
$o->allowDrag = false;
$o->children = $this->_fillContainers($item['project']->getTree(), 0, false);
$result[] = $o;
}
Response::jsonArray($result);
}
示例10: apitreeAction
/**
* Get API tree.Panel data
*/
public function apitreeAction()
{
Response::jsonArray($this->fileModel->getTreeList($this->versionIndex));
}
示例11: projectlistAction
public function projectlistAction()
{
$path = Request::post('node', 'string', '');
$path = str_replace('.', '', $path);
$dirPath = $this->_config->get('configs');
if (!is_dir($dirPath)) {
Response::jsonArray(array());
}
$files = File::scanFiles($dirPath . $path, array('.dat'), false, File::Files_Dirs);
if (empty($files)) {
Response::jsonArray(array());
}
$list = array();
foreach ($files as $k => $fpath) {
$text = basename($fpath);
if ($text === '.svn') {
continue;
}
$obj = new stdClass();
$obj->id = str_replace($dirPath, '', $fpath);
$obj->text = $text;
if (is_dir($fpath)) {
$obj->expanded = false;
$obj->leaf = false;
} else {
$obj->leaf = true;
}
$list[] = $obj;
}
Response::jsonArray($list);
}
示例12: viewHistoryAction
/**
* Get deploy history
*/
public function viewHistoryAction()
{
$serverId = Request::post('server_id', 'pagecode', '');
$data = array();
if (!strlen($serverId)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
if (!is_dir($this->_deployConfig->get('datadir') . $serverId)) {
Response::jsonArray($data);
}
$list = File::scanFiles($this->_deployConfig->get('datadir') . $serverId, false, false, File::Dirs_Only);
if (!empty($list)) {
foreach ($list as $k => $name) {
$name = basename($name);
$data[] = array('id' => $name, 'title' => $name);
}
}
Response::jsonSuccess($data);
}
示例13: renderersAction
/**
* Get list of available renderers
*/
public function renderersAction()
{
$data = array();
$autoloaderPaths = $this->_configMain['autoloader'];
$autoloaderPaths = $autoloaderPaths['paths'];
$files = File::scanFiles($this->_config->get('components') . '/Renderer', array('.php'), true, File::Files_Only);
$data[] = array('id' => '', 'title' => $this->_lang->NO);
/**
* This is hard fix for windows
*/
if (DIRECTORY_SEPARATOR == '\\') {
foreach ($files as &$v) {
$v = str_replace('\\', '/', $v);
$v = str_replace('//', '/', $v);
}
unset($v);
}
if (!empty($files)) {
foreach ($files as $item) {
$class = Utils::classFromPath(str_replace($autoloaderPaths, '', $item));
$data[] = array('id' => $class, 'title' => str_replace($this->_config->get('components') . '/Renderer/', '', substr($item, 0, -4)));
}
}
Response::jsonArray($data);
}
示例14: fslistAction
/**
* Files list
* @return void
*/
public function fslistAction()
{
$srcDirs = $this->_configMain['autoloader']['paths'];
$list = array();
foreach ($srcDirs as $dir) {
$list = array_merge($list, File::scanFiles($dir, array('.php'), true));
}
foreach ($list as $k => &$fpath) {
if (strpos($fpath, '/.svn')) {
unset($list[$k]);
continue;
}
}
unset($fpath);
$existingList = array();
foreach ($this->_packagesConfig->get('packages') as $v) {
$existingList = array_merge($existingList, $v['paths']);
}
$diff = array_diff($list, $existingList);
$tree = Utils::fileListToTree($diff);
$data = $this->_fillChilds($tree);
Response::jsonArray($data);
}
示例15: columnlisttreeAction
/**
* Get grid columns as tree list
*/
public function columnlisttreeAction()
{
Response::jsonArray($this->_object->getColumsList());
}