Skip to content

Instantly share code, notes, and snippets.

View MasterHans's full-sized avatar

Alexander Suvorov MasterHans

  • Russia
View GitHub Profile
@MasterHans
MasterHans / Humub acceptance - test accptnce suit
Created December 22, 2020 06:46
Humub acceptance - test accptnce suit
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
- tests\codeception\_support\WebHelper
- tests\codeception\_support\DynamicFixtureHelper
# capabilities:
# chromeOptions:
# args: ["--headless", "--disable-gpu"]
config:
@MasterHans
MasterHans / HumHub Tests basics
Last active November 30, 2020 08:59
HumHub Tests basics
run user test for module comment
cd /var/www/humhub/protected/humhub/modules/comment/tests
../../../../vendor/bin/codecept run unit CommentFollowersNotificationTest
ru queue
отправка почты:
cd /var/www/humhub/protected/
php yii queue/run
<?php
/**
* This file provides to overwrite the default HumHub / Yii configuration by your local Web environments
* @see http://www.yiiframework.com/doc-2.0/guide-concept-configurations.html
* @see http://docs.humhub.org/admin-installation-configuration.html
* @see http://docs.humhub.org/dev-environment.html
*/
return [
'modules' => [
'gii' => [
@MasterHans
MasterHans / YII2 - миграции в определённую папку
Last active January 30, 2021 09:23
YII2 - миграции в определённую папку
1. cd /var/www/humhub/protected/
1.1 create
php yii migrate/create spacesofusersgroup --migrationPath=@humhub/modules/user/migrations
2. migrate
php yii migrate --migrationPath=@humhub/modules/user/migrations
if (!$this->save()) {
throw new Exception("Could not archive content!" . print_r($this->getErrors(), 1));
};
To DB
try {
// your DB query
$test = ['a' => 1, 'b' => 2];
\yii\helpers\VarDumper::dump($test, 10, true);
return 0;
Работает из контроллеров
Yii::error();
$letter = [];
$sQuery = '';
$sQuery .= 'SELECT DISTINCT ';
$sQuery .= 'UPPER(LEFT(LTRIM(NAME), 1)) AS LETTER ';
//$sQuery .= 'UPPER(NAME) AS LETTER ';
$sQuery .= 'FROM b_iblock_element BE ';
$sQuery .= 'WHERE BE.IBLOCK_ID = '.CONTENT_BREND_IB_ID.' AND BE.ACTIVE = "Y" AND BE.WF_STATUS_ID = 1 AND BE.WF_PARENT_ELEMENT_ID IS NULL';
$sQuery .= ' ORDER BY LETTER ASC ';
$rsItems = $GLOBALS['DB']->Query($sQuery, false, __LINE__);
Имеется ID элемента. В инфоблоке несколько уровней вложенности. Как получить ID корневой папки этого элемента?
select
s.*
from b_iblock_section_element l
join b_iblock_section s
on s.ID = l.IBLOCK_SECTION_ID
where
l.IBLOCK_ELEMENT_ID = $id
А фильтровать элементы так:
$arFilter = array(
'NAME' => $sRequestLetter.'%'
);
где $sRequestLetter - это выбранная буква(ы) алфавитного индекса.
<?php
$script = <<<JS
$(function () {
$('#showModalMessage').click(function () {
$('#modalMessage').modal('show')
.find('.modalContent')
.load($(this).data('value'));
});