<commit_before><?php
/**
 * @var array $attributes
 */
if (!isset($attributes)) {
    throw new EngineBlock_Exception("Missing required parameter for view /profile/index: attributes");
}

/**
 * @var EngineBlock_Group_Provider_Aggregator $aggregator
 */
if (!isset($aggregator)) {
    throw new EngineBlock_Exception("Missing required parameter for view /profile/index: aggregator");
}

/**
 * @var EngineBlock_AttributeMetadata $metadata
 */
if (!isset($metadata)) {
    throw new EngineBlock_Exception("Missing required parameter for view /profile/index: metadata");
}

/**
 * @var array $groupOauth
 * @var array $consent
 * @var array $spAttributesList
 * @var array|null $spOauthList
 * @var array $spList
 */

/**
 * @var Zend_Layout $layout
 */
$layout = $this->layout();
$layout->setLayout('1-column-blue-grey-tabs');

// The tabs
$layout->tabs = array(
    'MyProfile' => $this->t('profile_header_my_profile'),
    'MyGroups' => $this->t('profile_header_my_groups'),
    'MyApps' => $this->t('profile_header_my_apps'),
    'Exit' => $this->t('profile_header_exit'),
);

// The current language
$lang = $this->language();

$layout->title      = $layout->title . ' - ' . $layout->subheader;
$layout->subheader  = $this->t('profile_subheader');
$layout->header     = $this->t('profile_header') . ' - ' . $layout->subheader;
$layout->footerText = $this->t('footer');

$layout->getView()->inlineScript()->appendFile(EngineBlock_View::staticUrl(). '/javascript/screen.js');
$layout->getView()->inlineScript()->appendFile(EngineBlock_View::staticUrl(). '/javascript/profile.js');
$layout->getView()->inlineScript()->appendScript("
    var profile = new Profile();
    profile.init();");

foreach ($spList as $spId => $sp) {
    foreach ($sp as $fieldName => $fieldValue) {
        $matches = array();
        if (!preg_match('|contacts:(\d+):contactType|', $fieldName, $matches)) {
            continue;
        }
        $contactNumber = $matches[1];

        if ($fieldValue !== 'support') {
            continue;
        }

        $spList[$spId]['supportContact'] = array(
            'givenName'         => $sp["contacts:$contactNumber:givenName"],
            'surName'           => $sp["contacts:$contactNumber:surName"],
            'emailAddress'      => $sp["contacts:$contactNumber:emailAddress"],
            'telephoneNumber'   => isset($sp["contacts:$contactNumber:telephoneNumber"]) ?
                                        $sp["contacts:$contactNumber:telephoneNumber"] :
                                        '',
        );
    }
}
?>
<div id="MyProfile">
    <p>
        <?php echo $this->t('profile_store_info'); ?>
    </p>
    <br />

    <table>
        <thead>
            <tr>
                <th><?php echo $this->t('attribute'); ?></th>
                <th><?php echo $this->t('value'); ?></th>
            </tr>
        </thead>
    <?php foreach ($attributes as $attributeId => $attributeValues) { ?>
        <tr>
            <td style="font-weight: bold;">
                <?=$metadata->getName($attributeId, $lang)?>
            </td>
            <td><commit_msg>Put the attribute id in the title of the table cell, for easier debugging<commit_after><?php
/**
 * @var array $attributes
 */
if (!isset($attributes)) {
    throw new EngineBlock_Exception("Missing required parameter for view /profile/index: attributes");
}

/**
 * @var EngineBlock_Group_Provider_Aggregator $aggregator
 */
if (!isset($aggregator)) {
    throw new EngineBlock_Exception("Missing required parameter for view /profile/index: aggregator");
}

/**
 * @var EngineBlock_AttributeMetadata $metadata
 */
if (!isset($metadata)) {
    throw new EngineBlock_Exception("Missing required parameter for view /profile/index: metadata");
}

/**
 * @var array $groupOauth
 * @var array $consent
 * @var array $spAttributesList
 * @var array|null $spOauthList
 * @var array $spList
 */

/**
 * @var Zend_Layout $layout
 */
$layout = $this->layout();
$layout->setLayout('1-column-blue-grey-tabs');

// The tabs
$layout->tabs = array(
    'MyProfile' => $this->t('profile_header_my_profile'),
    'MyGroups' => $this->t('profile_header_my_groups'),
    'MyApps' => $this->t('profile_header_my_apps'),
    'Exit' => $this->t('profile_header_exit'),
);

// The current language
$lang = $this->language();

$layout->title      = $layout->title . ' - ' . $layout->subheader;
$layout->subheader  = $this->t('profile_subheader');
$layout->header     = $this->t('profile_header') . ' - ' . $layout->subheader;
$layout->footerText = $this->t('footer');

$layout->getView()->inlineScript()->appendFile(EngineBlock_View::staticUrl(). '/javascript/screen.js');
$layout->getView()->inlineScript()->appendFile(EngineBlock_View::staticUrl(). '/javascript/profile.js');
$layout->getView()->inlineScript()->appendScript("
    var profile = new Profile();
    profile.init();");

foreach ($spList as $spId => $sp) {
    foreach ($sp as $fieldName => $fieldValue) {
        $matches = array();
        if (!preg_match('|contacts:(\d+):contactType|', $fieldName, $matches)) {
            continue;
        }
        $contactNumber = $matches[1];

        if ($fieldValue !== 'support') {
            continue;
        }

        $spList[$spId]['supportContact'] = array(
            'givenName'         => $sp["contacts:$contactNumber:givenName"],
            'surName'           => $sp["contacts:$contactNumber:surName"],
            'emailAddress'      => $sp["contacts:$contactNumber:emailAddress"],
            'telephoneNumber'   => isset($sp["contacts:$contactNumber:telephoneNumber"]) ?
                                        $sp["contacts:$contactNumber:telephoneNumber"] :
                                        '',
        );
    }
}
?>
<div id="MyProfile">
    <p>
        <?php echo $this->t('profile_store_info'); ?>
    </p>
    <br />

    <table>
        <thead>
            <tr>
                <th><?php echo $this->t('attribute'); ?></th>
                <th><?php echo $this->t('value'); ?></th>
            </tr>
        </thead>
    <?php foreach ($attributes as $attributeId => $attributeValues) { ?>
        <tr>
            <td style="font-weight: bold;" title="<?php echo $attributeId?>">
                <?=$metadata->getName($attributeId, $lang)?>
            </td>
            <td>
{'fraction_non_alphanumeric': 0.18521462639109698, 'fraction_numerical': 0.0006359300476947536, 'mean_word_length': 2.857142857142857, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 134, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7653572', 'n_tokens_mistral': 1875, 'n_tokens_neox': 1847, 'n_words': 355}