<commit_before><?php

use app\components\UrlHelper;
use app\models\db\{ConsultationUserGroup, IMotion, User};
use yii\helpers\Html;

/**
 * @var yii\web\View $this
 * @var IMotion $imotion
 * @var string $type
 */

/** @var \app\controllers\Base $controller */
$controller = $this->context;

$idBase = $type . $imotion->id;

$users = [];
$foundUsers = [];
foreach ($controller->consultation->getUsersInAnyGroup() as $user) {
    if ($user->hasPrivilege($controller->consultation, ConsultationUserGroup::PRIVILEGE_ANY)) {
        $users[]      = $user;
        $foundUsers[] = $user->id;
    }
}
usort($users, function (User $user1, User $user2): int {
    return strnatcasecmp($user1->nameFamily ?? $user1->name, $user2->nameFamily ?? $user2->name);
});

$saveUrl = UrlHelper::createUrl([
    'admin/proposed-procedure/save-responsibility',
    'type' => $type,
    'id'   => $imotion->id,
]);

$responsibilityUser = ($imotion->responsibilityId !== null ? $imotion->responsibilityUser : null);
?>
<div class="dropdown respHolder" data-save-url="<?= Html::encode($saveUrl) ?>">
    <button class="respButton dropdown-toggle btn-link" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" id="resp<?= $idBase ?>">
        <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
        <span class="sr-only"><?= Yii::t('admin', 'list_responsible_edit') ?></span>
    </button>
    <span class="responsibilityUser" data-id="<?= $imotion->responsibilityId ?>"><?php
        if ($responsibilityUser) {
            echo Html::encode($responsibilityUser->name ?? $responsibilityUser->getAuthName());
        }
        ?></span>
    <span class="responsibilityComment"><?= Html::encode($imotion->responsibilityComment) ?></span>
    <ul class="dropdown-menu" aria-labelledby="resp<?= $idBase ?>">
        <li class="respUser respUserNone <?= (!$responsibilityUser ? 'selected' : '') ?>" data-user-id="0">
            <a href="" class="setResponsibility"><?= Yii::t('admin', 'list_responsible_none') ?></a>
        </li>
        <?php
        foreach ($users as $user) {
            if ($responsibilityUser && $responsibilityUser->id === $user->id) {
                echo '<li class="respUser respUser' . $user->id . ' selected" data-user-id="' . $user->id . '">';
            } else {
                echo '<li class="respUser respUser' . $user->id . '" data-user-id="' . $user->id . '">';<commit_msg>Responsibility filter: Use full name for sorting<commit_after><?php

use app\components\UrlHelper;
use app\models\db\{ConsultationUserGroup, IMotion, User};
use yii\helpers\Html;

/**
 * @var yii\web\View $this
 * @var IMotion $imotion
 * @var string $type
 */

/** @var \app\controllers\Base $controller */
$controller = $this->context;

$idBase = $type . $imotion->id;

$users = [];
$foundUsers = [];
foreach ($controller->consultation->getUsersInAnyGroup() as $user) {
    if ($user->hasPrivilege($controller->consultation, ConsultationUserGroup::PRIVILEGE_ANY)) {
        $users[]      = $user;
        $foundUsers[] = $user->id;
    }
}
usort($users, function (User $user1, User $user2): int {
    return strnatcasecmp($user1->name ?? '', $user2->name ?? '');
});

$saveUrl = UrlHelper::createUrl([
    'admin/proposed-procedure/save-responsibility',
    'type' => $type,
    'id'   => $imotion->id,
]);

$responsibilityUser = ($imotion->responsibilityId !== null ? $imotion->responsibilityUser : null);
?>
<div class="dropdown respHolder" data-save-url="<?= Html::encode($saveUrl) ?>">
    <button class="respButton dropdown-toggle btn-link" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" id="resp<?= $idBase ?>">
        <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
        <span class="sr-only"><?= Yii::t('admin', 'list_responsible_edit') ?></span>
    </button>
    <span class="responsibilityUser" data-id="<?= $imotion->responsibilityId ?>"><?php
        if ($responsibilityUser) {
            echo Html::encode($responsibilityUser->name ?? $responsibilityUser->getAuthName());
        }
        ?></span>
    <span class="responsibilityComment"><?= Html::encode($imotion->responsibilityComment) ?></span>
    <ul class="dropdown-menu" aria-labelledby="resp<?= $idBase ?>">
        <li class="respUser respUserNone <?= (!$responsibilityUser ? 'selected' : '') ?>" data-user-id="0">
            <a href="" class="setResponsibility"><?= Yii::t('admin', 'list_responsible_none') ?></a>
        </li>
        <?php
        foreach ($users as $user) {
            if ($responsibilityUser && $responsibilityUser->id === $user->id) {
                echo '<li class="respUser respUser' . $user->id . ' selected" data-user-id="' . $user->id . '">';
            } else {
                echo '<li class="respUser respUser' . $user->id . '" data-user-id="' . $user->id . '">';
{'fraction_non_alphanumeric': 0.20230500102901833, 'fraction_numerical': 0.002469643959662482, 'mean_word_length': 3.6956521739130435, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4328045', 'n_tokens_mistral': 1552, 'n_tokens_neox': 1560, 'n_words': 294}