Skip to content

Instantly share code, notes, and snippets.

@touol
touol / date.tpl
Last active February 3, 2023 01:48
user_migxdb_tab
<input id="tv{$tv->id}" type="hidden" class="datefield"
value="{$tv->value}" name="tv{$tv->id}"
onblur="MODx.fireResourceFormChange();"/>
<script>
// <![CDATA[
{literal}
Ext.onReady(function() {
var fld = MODx.load({
{/literal}
<?php
/**
* The base class for mSearch2.
*
* @package msearch2
*/
class mSearch2 {
/** @var modX $modx */
public $modx;
<?php
/**
* Return array with filters
*
* @param array|string $ids
* @param boolean $build
*
* @return array|boolean
*/
@touol
touol / msearch2.class.php
Created August 17, 2021 09:37
Исправление кеширования mfilter2
<?php
/**
* The base class for mSearch2.
*
* @package msearch2
*/
class mSearch2 {
/** @var modX $modx */
public $modx;
@touol
touol / UserTest.php
Last active August 26, 2020 10:29
UserTest
<?php
/** @var modX $modx */
/** @var array $scriptProperties */
/** @var UserTest $UserTest */
$tplError = $modx->getOption('tplError', $scriptProperties, 'tpl.UserTest.error');
$AjaxMode = $modx->getOption('AjaxMode', $scriptProperties, '1');
$frontend_js = $modx->getOption('frontend_js', $scriptProperties, 'components/usertest/js/web/default.js');
$frontend_css = $modx->getOption('frontend_css', $scriptProperties, 'components/usertest/css/web/default.css');
$pdoFetch = $modx->getService('pdoFetch');
<div id="testuser-main" class="row">
<script>
{if !$check_ajax}
var _init = [];
{/if}
</script>
<div class="col-md-2">
{if $block_q_number}
{foreach $block_q_number as $q}
<a href="#" class="step-box__item {if $q.curStepCheck}current{/if} {if $q.ansCheck}check{/if}"
@touol
touol / UserTest.php
Last active April 14, 2020 19:48
UserTest
<?php
/** @var modX $modx */
/** @var array $scriptProperties */
/** @var UserTest $UserTest */
$tplError = $modx->getOption('tplError', $scriptProperties, 'tpl.UserTest.error');
$AjaxMode = $modx->getOption('AjaxMode', $scriptProperties, '1');
$frontend_js = $modx->getOption('frontend_js', $scriptProperties, 'components/usertest/js/web/default.js');
$frontend_css = $modx->getOption('frontend_css', $scriptProperties, 'components/usertest/css/web/default.css');
$pdoFetch = $modx->getService('pdoFetch');
<?php
/** @var modX $modx */
switch ($modx->event->name) {
case 'OnDocFormSave':
/** @var Ticket $resource */
if ($resource->class_key == "Ticket") {
//$modx->log(1, "TicketsResGroup ".print_r($resource->toArray(),1));
if(!empty($resource->res_groups)){
$resGroups = $resource->getMany('ResourceGroupResources');
<select name="res_groups[]" class="form-control bootstrap-multiple" multiple="multiple">
{foreach $res_groups as $res_group}
<option value="{$res_group.id}" {$res_group.selected}>{$res_group.name}</option>
{/foreach}
</select>
<?php
/** @var pdoFetch $pdoFetch */
$pdoFetch = $modx->getService('pdoFetch');
$pdoFetch->setConfig($scriptProperties);
$pdoFetch->addTime('pdoTools loaded');
$allow_res_groups = $modx->getOption("allow_res_groups");
$all = false;
$where = [];