usernameTocomplaint = false;
function compl(){
if(usernameTocomplaint) return false;
usernameTocomplaint = username; // применили уже готовое свойство в новой переменной чтобы два раза один и тот же код не писать
...
}
$group = $modx->getObject('modUserGroup', array ('id' => '5'));
$members = $group->getMany('UserGroupMembers');
foreach ($members as $member){
$user = $member->getOne('User'); // важно
// получаем имя пользователя
$name = $user->get('username');
$uid = $user->get('id');
// связь с профилем пользователя
$profile = $user->getOne('Profile');
....
}
public function validate() {
$this->load->language('account/forgotten');
$this->load->model('account/customer');
$json = array();
// Check if customer has been approved.
$customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);
if (!isset($this->request->post['email']) || empty($this->request->post['email'])) {
// $this->error['warning'] = $this->language->get('error_email');
$json['error']['warning'] = $this->language->get('error_email');
} elseif (!$this->model_account_customer->getTotalCustomersByEmail($this->request->post['email'])) {
$json['error']['warning'] = $this->language->get('error_email');
// $this->error['warning'] = $this->language->get('error_email');
}
elseif ($customer_info && !$customer_info['status']) {
$json['error']['warning'] = $this->language->get('error_approved');
// $this->error['warning'] = $this->language->get('error_approved');
}
else {
$json['error']['warning'] = 'Письмо с инструкцией по восстановлению пароля отправлено на введенную почту. Если не пришло в течение 10 минут, проверьте папку спам';
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
// return !$this->error;
}
{% set collectionname = '{{mpn}}' %}
{% set collectionname = mpn %}
input[type="file"]{display:none}
<div class="uCanUpload">Загрузить файлы и бла бла бла</div>
<div class="file-upload"><label><input type="file" name="file"><span> /*изображение скрепки вставить либо прям тут либо через css :before*/ Загрузить файлы</span></label></div>
// Перехват файла с формы
var files = '', fileName = '';
// Получим данные файлов и добавим их в переменную
$(document).on('change', 'input[type=file]', function(){
var file = this.files[0];
fileName = $(this).val();
fileName = fileName.split('\\');
fileName = fileName[fileName.length - 1];
var reader = new FileReader();
reader.onload = function (e) {
files = e.target.result
};
reader.readAsDataURL(file);
if($('.fileName').length == 0) $('.file-upload').before('<div class="fileName"></div>');
$('.fileName').html(fileName+'<span id="delFile">X</span>');
});
$(document).on('click', '#delFile', function(){
var inp = $('input[type="file"]').clone();
$('input[type="file"]').before(inp).remove();
$('.fileName').remove();
});
function base64_encode(data) {
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = '',
tmp_arr = [];
if (!data) {
return data;
}
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
} while (i < data.length);
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
}
white-space:no-wrap; overflow:hidden; text-overflow:ellipsis;max-width:200px;
/*типа запрет ротации моб устройства*/
@media only screen and (min-width: 415px) and (max-width: 1279px) {
body{display:none} html:before{content:'Переверните устройство в портретный режим или откройте сайт с компьютера.';position:fixed;top:0;left:0;right:0;bottom:0;margin:auto;background:#fff;z-index:999;text-align:center;width:80%;height:100px}
}
$res = $modx->getObject('modResource', $_POST['id']);
$id = $res->get('id');
$depth = 1;
$ids = $modx->getChildIds($id, $depth);
$docs = $modx->getCollection('modResource', array(
'id:IN' => $ids
,'alias:!=' => 'f'
));
$output = '';
foreach ($docs as $doc) {
$output .= $doc->get('pagetitle') . '<br/>';
}
return $output;