List locks.

@return JsonResponse
@Route("/list", name="locks_list")
13069
public function listAction()
    {
        $lockManager = $this->get('phlexible_element.element_lock_manager');
        $userManager = $this->get('phlexible_user.user_manager');

        $locks = $lockManager->findAll();

        $data = [];
        foreach ($locks as $lock) {
            /* @var $lock ElementLock */
            $username = '(unknown user)';
            $user = $userManager->find($lock->getUserId());
            if ($user) {
                $username = $user->getDisplayName();
            }

            $data[] = [
                'id' => $lock->getId(),
                'uid' => $lock->getUserId(),
                'user' => $username,
                'ts' => $lock->getLockedAt()->format('Y-m-d H:i:s'),
                'eid' => $lock->getElement()->getEid(),
                'lock_type' => $lock->getType(),
            ];
        }

        return new JsonResponse(['locks' => $data]);
    }
1344151
public function getList()
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		// 1) getting params
		$page = (int) $this->params()->fromQuery("page", 1);
		$category = $this->params()->fromQuery("category", "usato");
		$purpose = $this->params()->fromQuery("purpose", "compravendita");
		$location = $this->params()->fromQuery("location", "italia");
		$limit = 30;
		$offset = ($page * $limit) - $limit;
		$returnSelect = true;
		
		// 2) Discard useless params and prepare them to be passed to the model
		$params = $this->requestToSearchParams($this->params()->fromQuery());
		$params = is_array($params) ? $params + compact('returnSelect', 'offset', 'limit') : array();
		
		if(empty($params)) {
            return new JsonModel(array());
		}
		
		// 3) get only for current user?
		$onlyCurrentUser = (bool) $this->params()->fromQuery("current", false);
		$k = 0;
		foreach($params['field'] as $f) {
			if('current' == $f || 'user' == $f) {
				unset($params['field'][$k]);
				unset($params['value'][$k]);
			}
			$k++;
		}
		if($onlyCurrentUser) {
			if($this->zfcUserAuthentication()->hasIdentity()) {
				$identity = $this->zfcUserAuthentication()->getIdentity();
// 				$params['field'][] = 'user';
// 				$params['value'][] = sha1('neo' . $identity->getUserId() . 'bazaar');
				$params['field'][] = 'account';
				$params['value'][] = sha1('neo' . $identity->getUserId() . 'bazaar');
			} else {
				// Questo è necessario per non far restituire la lista completa se l'utente non è connesso
				$params['field'][] = 'account';
				$params['value'][] = sha1('usernotconnected');
			}
		}
		
		// 4) all classifieds? This should be requested only by the admin, will not use sphinx
		if((bool) $this->params()->fromQuery("full", false)) {
			if($this->zfcUserAuthentication()->hasIdentity()) {
			    $params = $this->params()->fromQuery();
				$identity = $this->zfcUserAuthentication()->getIdentity();
				$userModel = $this->getServiceLocator()->get('user.model.user');
				$userModel->init($identity, $this->getServiceLocator());
				if(!$userModel->getIsAdmin()) {
				    return new JsonModel(array());
				}
				
				$paginator = $this->getServiceLocator()->get('document.paginator.classifiedFull');
				$paginator->build($params);

				$data = array();
				foreach($paginator as $post) {
            		$file = $this->getServiceLocator()->get('document.model.classifiedAdminListing');
				    $data[] = $file->init($post);
				}

				$routeName = 'DocumentAdminClassified/page';
				$routeParams = array('page' => $this->params()->fromQuery("page", 1));
				$queryParams = array('full' => 1, 'user' => $this->params()->fromQuery("user"));
				$data = $this->getModel()->getPaginationData($this->getServiceLocator(), $paginator, $data, $routeName, $routeParams, $queryParams);

				return new JsonModel($data);
			}
		}
		
		// 5) Pass param to the model and get the data
		$data = $this->getModel()->getList($params, $this->getServiceLocator());
		
		return new JsonModel($data);
	}
520795
public static function get_lock_summaries() {
        $locks = array();
        $instance = cache_config::instance();
        $stores = $instance->get_all_stores();
        foreach ($instance->get_locks() as $lock) {
            $default = !empty($lock['default']);
            if ($default) {
                $name = new lang_string($lock['name'], 'cache');
            } else {
                $name = $lock['name'];
            }
            $uses = 0;
            foreach ($stores as $store) {
                if (!empty($store['lock']) && $store['lock'] === $lock['name']) {
                    $uses++;
                }
            }
            $lockdata = array(
                'name' => $name,
                'default' => $default,
                'uses' => $uses,
                'type' => get_string('pluginname', $lock['type'])
            );
            $locks[$lock['name']] = $lockdata;
        }
        return $locks;
    }
449040
public function modelList()
    {
        $this->action = self::API_ACTION_LIST;
        $code = 200;
        list($return, $total, $pages) = $this->getList();
        $message = null;
        if(!$total) {
            $message = t('No se han encontrado elementos para la búsqueda');
        }

        return $this->json(new JsonResponse($return, $code === 200, $total, $pages, $message), $code);
    }
1267927
public function getList() {
        $context=$this->getSearchContext();
        $params=$this->getRequest()->requestVar('q');
        
        if(is_array($params)) {
            if(array_key_exists('Created', $params) && is_array($params['Created'])) {
                $params['Created']=implode(' ', $params['Created']);
            }
            
            $params=array_map('trim', $params);
        }
        
        $list=$context->getResults($params);
        
        $this->extend('updateList', $list);
        
        return $list;
    }
933566
public function getList()
    {
        $routeMatch = $this->getEvent()->getRouteMatch();
        $mode = $routeMatch->getParam('mode', false);
        $annee = $routeMatch->getParam('annee', 0);
        $processStateHandler = $this->getProcessStateHandler();
        $processes = $processStateHandler->getRunningProcessList($mode, $annee);
        $response = $this->getResponse();
        $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
        $serializer = $this->getSerializer();
        $processJson = $serializer->serialize($processes, 'json');
        $response->setContent($processJson);
        return $response;
    }
256997
protected function getSessionLocks() {
    if ($this->session->exist(self::SESSION_VARNAME)) {
      return $this->session->get(self::SESSION_VARNAME);
    }
    return [];
  }
790865
public function listAction()
    {
        $response = $this->getResponse();
        $response->setStatusCode(200);
        $headers = $response->getHeaders();
        $headers->addHeaderLine('Cache-Control', 'public, max-age=86400');
        $headers->addHeaderLine('Expires', date(DATE_RFC822, strtotime("1 day")));


        $key = strtolower($this->getEvent()->getRouteMatch()->getParam('key'));
        $locale = $this->getEvent()->getRouteMatch()->getParam('locale');

        if (strlen($key)<=2) {
            $response->setContent(json_encode(array('status' => 1, 'message' => "The key length should be greater than 3!")));
        
            return $response;
        }

        $translatesSelected = array();
        if (empty($locale)) {
            $locale = 'en_UK';
        }
        $translatesSelected = array();
        $translates = $this->getTranslateService()->readLanguageFile($locale);
        if ($translates) {
            foreach ($translates as $translateKey => $translateValue) {
                $pattern = "/^".$key."/";
                if (preg_match($pattern, strtolower($translateKey))) {
                    $translatesSelected[$translateKey] = $translateValue;
                }
            }
        }

        $return['status'] = 0;
        $return['translates'] = $translatesSelected;

        $response->setContent(json_encode($return));
        
        return $response;
    }
718485
public function getSeatUserList(Request $request)
    {

        return response()->json([
            'results' => DB::table('users')
                ->select('id', 'name as text')
                ->where('name', 'like', '%' . $request->q . '%')
                ->orderBy('name', 'asc')
                ->get(),
        ]);
    }
416921
public function listActionCustom(Request $request = null)
    {
        $this->admin->checkAccess('list');

        $preResponse = $this->preList($request);
        if (null !== $preResponse) {
            return $preResponse;
        }

        if ($listMode = $request->get('_list_mode')) {
            $this->admin->setListMode($listMode);
        }

        $datagrid = $this->admin->getDatagrid();
        $formView = $datagrid->getForm()->createView();

        return $this->renderWithExtraParams($this->admin->getTemplate('list'), [
            'action' => 'list',
            'form' => $formView,
            'batch_action_forms' => $this->getBatchActionFormViews(),

            'datagrid' => $datagrid,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
            'export_formats' => $this->admin->getExportFormats(),
        ], null);
    }
397578
public function list()
    {
        $response = $this->client->fetch(
            $this->uri,
            []
        );

        return json_encode($response->getContent(), JSON_FORCE_OBJECT);
    }
390959
public function listAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse('AnimeDbCatalogBundle:Storage');
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        /* @var $rep StorageRepository */
        $rep = $this->getDoctrine()->getRepository('AnimeDbCatalogBundle:Storage');

        return $this->render('AnimeDbCatalogBundle:Storage:list.html.twig', [
            'storages' => $rep->getList(),
        ], $response);
    }
327234
public function listAction()
    {
        $request = $this->getRequest();

        $this->admin->checkAccess('list');

        $preResponse = $this->preList($request);
        if (null !== $preResponse) {
            return $preResponse;
        }

        if ($listMode = $request->get('_list_mode')) {
            $this->admin->setListMode($listMode);
        }

        $datagrid = $this->admin->getDatagrid();
        $formView = $datagrid->getForm()->createView();

        // set the theme for the current Admin Form
        $this->setFormTheme($formView, $this->admin->getFilterTheme());

        // NEXT_MAJOR: Remove this line and use commented line below it instead
        $template = $this->admin->getTemplate('list');
        // $template = $this->templateRegistry->getTemplate('list');

        return $this->renderWithExtraParams($template, [
            'action' => 'list',
            'form' => $formView,
            'datagrid' => $datagrid,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
            'export_formats' => $this->has('sonata.admin.admin_exporter') ?
                $this->get('sonata.admin.admin_exporter')->getAvailableFormats($this->admin) :
                $this->admin->getExportFormats(),
        ], null);
    }
699540
public function jsonTasksList() {    
        $controller = new JsonController();
        $controller
            ->restrictAccess(Auth::isAdmin());
    
        // Generate an AJAX/JSON response for datatables to load a block of rows
        $search = Filter::postArray('search');
        if($search) $search = $search['value'];
        $start  = Filter::postInteger('start');
        $length = Filter::postInteger('length');
        $order  = Filter::postArray('order');
    
		$order_by_name = false;
        foreach($order as $key => &$value) {
            switch($value['column']) {
                case 3:
					$order_by_name = true;
                    unset($order[$key]);
                    break;
                case 4;
					$value['column'] = 'majat_last_run';
					break;
				case 4;
					$value['column'] = 'majat_last_result';
					break;
                default:
                    unset($order[$key]);
            }
        }
    
        $list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
		if($order_by_name) {
			usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); });
		}
        $recordsFiltered = count($list);
        $recordsTotal = $this->provider->getTasksCount();
    
        $data = array();
        foreach($list as $task) {    
            $datum = array();
			
            $datum[0] = '
                <div class="btn-group">
                    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                        <i class="fa fa-pencil"></i><span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                       <li>
                            <a href="#" onclick="return set_admintask_status(\''. $task->getName().'\', '.($task->isEnabled() ? 'false' : 'true').');">
                                <i class="fa fa-fw '.($task->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
                            </a>
                       </li>
                        <li>
                            <a href="module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='. $task->getName().'">
                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
                            </a>
                       </li>
                    </ul>
                </div>';
            $datum[1] = $task->getName();
            $datum[2] = $task->isEnabled() ? 
				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
            $datum[3] = $task->getTitle();
            $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
			$datum[4] = $task->getLastUpdated()->format($date_format);
            $datum[5] = $task->isLastRunSuccess() ? 
				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
            $dtF = new \DateTime('@0');
            $dtT = new \DateTime('@' . ($task->getFrequency() * 60));            
            $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
			$datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited');
			$datum[8] = $task->isRunning() ? 
				'<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : 
				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>';
			if($task->isEnabled() && !$task->isRunning()) {
			    $datum[9] = '
    			    <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')">
    			         <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
    			    </button>';
			}
			else {
			    $datum[9] = '';
			}			    
						
            $data[] = $datum;
        }
    
        $controller->pageHeader();
    
        $controller->encode(array(
            'draw'            => Filter::getInteger('draw'),
            'recordsTotal'    => $recordsTotal,
            'recordsFiltered' => $recordsFiltered,
            'data'            => $data
        ));
    
    }
663269
public function listJsonAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var \AdminBundle\Services\DataTables\JsonList $jsonList */
        $jsonList = $this->get('json_list');
        $jsonList->setRepository($em->getRepository('CoreBundle:Page'));
        $jsonList->setLocale($request->getLocale());
        $response = $jsonList->get();
        

        return new JsonResponse($response);
    }
819458
public function getList() {
		$dt = $this->getDataTable();
		
		if (! $dt)
			return $this->createResponse($this->getNameManager()->getTableNames(), 401, "Tabels");
		
		$es = $dt->fetchAll();
		$data = [];
		foreach ( $es as $e ) {
			$data[] = [
				$this->getNameManager()->primary => $e->{$this->getNameManager()->primary}];
		}
		return $this->createResponse($data, 0, "{$this->getNameManager()->modelName} List");
	}
786714
public function listAction()
    {
        $repository = $this->get('phlexible_media_template.template_manager');

        $allTemplates = $repository->findAll();

        $templates = [];
        foreach ($allTemplates as $template) {
            if (substr($template->getKey(), 0, 4) === '_mm_') {
                continue;
            }

            $templates[] = [
                'key' => $template->getKey(),
                'type' => $template->getType(),
            ];
        }

        return new JsonResponse(['templates' => $templates]);
    }