Файл: concrete5.7.5.6/concrete/controllers/dialog/user/search/customize.php
Строк: 73
<?php
namespace ConcreteControllerDialogUserSearch;
use ConcreteControllerBackendUserInterface as BackendInterfaceController;
use User;
use UserAttributeKey;
use Loader;
use UserList;
use URL;
class Customize extends BackendInterfaceController {
protected $viewPath = '/dialogs/search/customize';
protected function canAccess() {
$sh = Loader::helper('concrete/user');
return $sh->canAccessUserSearchInterface();
}
public function view() {
$selectedAKIDs = array();
$fldc = ConcreteCoreUserSearchColumnSetColumnSet::getCurrent();
$fldca = new ConcreteCoreUserSearchColumnSetAvailable();
$searchInstance = Loader::helper('text')->entities($_REQUEST['searchInstance']);
$list = UserAttributeKey::getList();
$this->set('list', $list);
$this->set('form', Loader::helper('form'));
$this->set('fldca', $fldca);
$this->set('fldc', $fldc);
$this->set('type', 'users');
}
public function submit() {
if ($this->validateAction()) {
$u = new User();
$fdc = new ConcreteCoreUserSearchColumnSetColumnSet();
$fldca = new ConcreteCoreUserSearchColumnSetAvailable();
foreach($_POST['column'] as $key) {
$fdc->addColumn($fldca->getColumnByKey($key));
}
$sortCol = $fldca->getColumnByKey($_POST['fSearchDefaultSort']);
$fdc->setDefaultSortColumn($sortCol, $_POST['fSearchDefaultSortDirection']);
$u->saveConfig('USER_LIST_DEFAULT_COLUMNS', serialize($fdc));
$userList = new UserList();
$columns = ConcreteCoreUserSearchColumnSetColumnSet::getCurrent();
$col = $columns->getDefaultSortColumn();
$userList->sanitizedSortBy($col->getColumnKey(), $col->getColumnDefaultSortDirection());
$ilr = new ConcreteCoreUserSearchResultResult($columns, $userList, URL::to('/ccm/system/search/users/submit'));
$r = new ConcreteCoreSearchResponse();
$r->setMessage(t('User search columns saved successfully.'));
$r->setSearchResult($ilr);
$r->outputJSON();
}
}
}