<commit_before><?php
namespace SPHERE\Application\People;

use SPHERE\Application\Education\Lesson\Division\Division;
use SPHERE\Application\Education\Lesson\Term\Term;
use SPHERE\Application\IClusterInterface;
use SPHERE\Application\People\Group\Group;
use SPHERE\Application\People\Group\Service\Entity\TblGroup;
use SPHERE\Application\People\Meta\Meta;
use SPHERE\Application\People\Person\Person;
use SPHERE\Application\People\Relationship\Relationship;
use SPHERE\Application\People\Search\Search;
use SPHERE\Common\Frontend\Icon\Repository\Person as PersonIcon;
use SPHERE\Common\Frontend\Layout\Repository\Listing;
use SPHERE\Common\Frontend\Layout\Repository\Panel;
use SPHERE\Common\Frontend\Layout\Repository\PullRight;
use SPHERE\Common\Frontend\Layout\Structure\Layout;
use SPHERE\Common\Frontend\Layout\Structure\LayoutColumn;
use SPHERE\Common\Frontend\Layout\Structure\LayoutGroup;
use SPHERE\Common\Frontend\Layout\Structure\LayoutRow;
use SPHERE\Common\Frontend\Link\Repository\Backward;
use SPHERE\Common\Frontend\Link\Repository\Standard;
use SPHERE\Common\Frontend\Text\Repository\Muted;
use SPHERE\Common\Frontend\Text\Repository\Small;
use SPHERE\Common\Main;
use SPHERE\Common\Window\Navigation\Link;
use SPHERE\Common\Window\Stage;

/**
 * Class People
 *
 * @package SPHERE\Application\People
 */
class People implements IClusterInterface
{

    public static function registerCluster()
    {

        Search::registerApplication();
        Person::registerApplication();
        Group::registerApplication();
        Meta::registerApplication();
        Relationship::registerApplication();

        Main::getDisplay()->addClusterNavigation(
            new Link(new Link\Route(__NAMESPACE__), new Link\Name('Personen'), new Link\Icon(new PersonIcon()))
        );
        Main::getDispatcher()->registerRoute(Main::getDispatcher()->createRoute(
            __NAMESPACE__, __CLASS__.'::frontendDashboard'
        ));

        Main::getDispatcher()->registerWidget('Personen', array(__CLASS__, 'widgetPersonGroupList'), 4, 6);
    }

    /**
     * @return Layout
     */
    public static function widgetPersonGroupList()
    {

        $tblGroupAll = Group::useService()->getGroupAllSorted();
        $tblGroupLockedList = array();
        $tblGroupCustomList = array();
        if ($tblGroupAll) {
            /** @var TblGroup $tblGroup */
            foreach ((array)$tblGroupAll as $Index => $tblGroup) {

                if ($tblGroup->getMetaTable() == 'STUDENT') {
                    $countContent = array();
                    if (($tblYearList = Term::useService()->getYearAllFutureYears(0))) {
                        foreach ($tblYearList as $tblYear) {
                            $countContent[$tblYear->getId()] = new Muted(new Small(
                                Division::useService()->getStudentCountByYear($tblYear)
                                . ' Mitglieder im Schuljahr ' .  $tblYear->getDisplayName() . ' '));
                        }
                    }
                    $countContent = new Listing($countContent);
                } else {
                    $countContent = new Muted(new Small(Group::useService()->countMemberAllByGroup($tblGroup) . '&nbsp;Mitglieder'));
                }

                $content =
                    new Layout(new LayoutGroup(new LayoutRow(array(
                            new LayoutColumn(
                                $tblGroup->getName()
                                .new Muted(new Small('<br/>'.$tblGroup->getDescription()))
                                , 5),
                            new LayoutColumn(
                                $countContent
                                , 5, array(LayoutColumn::GRID_OPTION_HIDDEN_SM, LayoutColumn::GRID_OPTION_HIDDEN_XS)),
                            new LayoutColumn(
                                new PullRight(
                                    new Standard('', '/People/Search/Group',
                                        new \SPHERE\Common\Frontend\Icon\Repository\Group(),
                                        array('Id' => $tblGroup->getId()))
                                ), 2)
                        )
                    )));

                if ($tblGroup->isLocked()){
                    $tblGroupLockedList[] = $content;
                } else {
                    $tblGroupCustomList[] = $content;
                }
            }
        }

        return new Layout(new LayoutGroup(new LayoutRow(array(
                new LayoutColumn(
                    new Panel('Personen in festen Gruppen', $tblGroupLockedList), 6
                ),
                !empty($tblGroupCustomList) ?
                    new LayoutColumn(
                        new Panel('Personen in individuellen Gruppen', $tblGroupCustomList), 6) : null
        ))));
    }

    /**
     * @return Stage
     */
    public function frontendDashboard()
    {

        $Stage = new Stage('Dashboard', 'Personen');
        $Stage->addButton( new Backward() );

//        $Stage->setContent(Main::getDispatcher()->fetchDashboard('Personen'));
        $Stage->setContent(self::widgetPersonGroupList());

        return $Stage;
    }
}<commit_msg>fix: #SSW-1444 Anpassung Personenverwaltung Dashboard<commit_after><?php

namespace SPHERE\Application\People;

use SPHERE\Application\Education\Lesson\Division\Division;
use SPHERE\Application\Education\Lesson\Term\Term;
use SPHERE\Application\IClusterInterface;
use SPHERE\Application\People\Group\Group;
use SPHERE\Application\People\Group\Service\Entity\TblGroup;
use SPHERE\Application\People\Meta\Meta;
use SPHERE\Application\People\Person\Person;
use SPHERE\Application\People\Relationship\Relationship;
use SPHERE\Application\People\Search\Search;
use SPHERE\Common\Frontend\Icon\Repository\Person as PersonIcon;
use SPHERE\Common\Frontend\Layout\Repository\Listing;
use SPHERE\Common\Frontend\Layout\Repository\Panel;
use SPHERE\Common\Frontend\Layout\Repository\PullRight;
use SPHERE\Common\Frontend\Layout\Structure\Layout;
use SPHERE\Common\Frontend\Layout\Structure\LayoutColumn;
use SPHERE\Common\Frontend\Layout\Structure\LayoutGroup;
use SPHERE\Common\Frontend\Layout\Structure\LayoutRow;
use SPHERE\Common\Frontend\Link\Repository\Backward;
use SPHERE\Common\Frontend\Link\Repository\Standard;
use SPHERE\Common\Frontend\Text\Repository\Muted;
use SPHERE\Common\Frontend\Text\Repository\Small;
use SPHERE\Common\Main;
use SPHERE\Common\Window\Navigation\Link;
use SPHERE\Common\Window\Stage;

/**
 * Class People
 *
 * @package SPHERE\Application\People
 */
class People implements IClusterInterface
{

    public static function registerCluster()
    {

        Search::registerApplication();
        Person::registerApplication();
        Group::registerApplication();
        Meta::registerApplication();
        Relationship::registerApplication();

        Main::getDisplay()->addClusterNavigation(
            new Link(new Link\Route(__NAMESPACE__), new Link\Name('Personen'), new Link\Icon(new PersonIcon()))
        );
        Main::getDispatcher()->registerRoute(Main::getDispatcher()->createRoute(
            __NAMESPACE__, __CLASS__ . '::frontendDashboard'
        ));

        Main::getDispatcher()->registerWidget('Personen', array(__CLASS__, 'widgetPersonGroupList'), 4, 6);
    }

    /**
     * @return Layout
     */
    public static function widgetPersonGroupList()
    {

        $tblGroupAll = Group::useService()->getGroupAllSorted();
        $tblGroupLockedList = array();
        $tblGroupCustomList = array();
        if ($tblGroupAll) {
            /** @var TblGroup $tblGroup */
            foreach ((array)$tblGroupAll as $Index => $tblGroup) {

                $countContent = new Muted(new Small(Group::useService()->countMemberAllByGroup($tblGroup) . '&nbsp;Mitglieder'));
                $content =
                    new Layout(new LayoutGroup(new LayoutRow(array(
                            new LayoutColumn(
                                $tblGroup->getName()
                                . new Muted(new Small('<br/>' . $tblGroup->getDescription()))
                                , 5),
                            new LayoutColumn(
                                $countContent
                                , 5, array(LayoutColumn::GRID_OPTION_HIDDEN_SM, LayoutColumn::GRID_OPTION_HIDDEN_XS)),
                            new LayoutColumn(
                                new PullRight(
                                    new Standard('', '/People/Search/Group',
                                        new \SPHERE\Common\Frontend\Icon\Repository\Group(),
                                        array('Id' => $tblGroup->getId()))
                                ), 2)
                        )
                    )));

                if ($tblGroup->isLocked()) {
                    $tblGroupLockedList[] = $content;
                    if ($tblGroup->getMetaTable() == 'STUDENT') {
                        $countContent = array();
                        if (($tblYearList = Term::useService()->getYearAllFutureYears(0))) {
                            foreach ($tblYearList as $tblYear) {
                                $countContent[$tblYear->getId()] = new Muted(new Small(
                                    Division::useService()->getStudentCountByYear($tblYear)
                                    . ' Mitglieder im Schuljahr ' . $tblYear->getDisplayName() . ' '));
                            }
                        }
                        $countContent = new Listing($countContent);

                        $content =
                            new Layout(new LayoutGroup(new LayoutRow(array(
                                    new LayoutColumn(
                                        'Schüler / Schuljahr'
                                        . new Muted(new Small('<br/>' . 'Schüler die in Klassen zugeordnet sind'))
                                        , 5),
                                    new LayoutColumn(
                                        $countContent
                                        , 5, array(LayoutColumn::GRID_OPTION_HIDDEN_SM, LayoutColumn::GRID_OPTION_HIDDEN_XS)),
                                    new LayoutColumn(
                                        '&nbsp;'
                                        , 2)
                                )
                            )));
                        $tblGroupLockedList[] = $content;
                    }
                } else {
                    $tblGroupCustomList[] = $content;
                }
            }
        }

        return new Layout(new LayoutGroup(new LayoutRow(array(
            new LayoutColumn(
                new Panel('Personen in festen Gruppen', $tblGroupLockedList), 6
            ),
            !empty($tblGroupCustomList) ?
                new LayoutColumn(
                    new Panel('Personen in individuellen Gruppen', $tblGroupCustomList), 6) : null
        ))));
    }

    /**
     * @return Stage
     */
    public function frontendDashboard()
    {

        $Stage = new Stage('Dashboard', 'Personen');
        $Stage->addButton(new Backward());

//        $Stage->setContent(Main::getDispatcher()->fetchDashboard('Personen'));
        $Stage->setContent(self::widgetPersonGroupList());

        return $Stage;
    }
}
{'fraction_non_alphanumeric': 0.11235361451087435, 'fraction_numerical': 0.002025182706700713, 'mean_word_length': 1.77294921875, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5189931', 'n_tokens_mistral': 2940, 'n_tokens_neox': 2836, 'n_words': 469}