<commit_before><?php
/**
 * @file      _available.php
 * @date      9/10/2015
 * @time      1:54 AM
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2015 WritesDown
 * @license   http://www.writesdown.com/license/
 */

use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $availableWidget [] */
/* @var $widgetSpace [] */
?>

<?php $index = 0;
foreach ($availableWidget as $dir => $widget) {
    if ($index % 2 === 0) {
        echo Html::tag('div', '', ['class' => 'clearfix']);
    } ?>

    <div class="col-sm-12 col-md-6">
        <div id="available-widget-<?= $widget['widget_dir'] ?>" class="available-widget box box-solid collapsed-box">
            <div class="box-header">
                <h3 class="box-title"><?= $widget['widget_title'] ?></h3>

                <div class="box-tools pull-right">
                    <button class="btn btn-box-tool" data-widget="collapse">
                        <i class="fa fa-plus"></i>
                    </button>

                    <?= Html::a('<i class="fa fa-times"></i>', ['delete-widget', 'id' => $widget['widget_dir']], [
                        'class' => 'btn btn-box-tool',
                        'data'  => [
                            'method'  => 'post',
                            'confirm' => Yii::t('writesdown', 'Are you sure you want to delete this widget?')
                        ]
                    ]); ?>

                </div>
            </div>

            <?php if (isset($widget['widget_description'])) {
                echo Html::tag('div', $widget['widget_description'], [
                    'class' => 'box-body',
                ]);
            } ?>

            <?php $form = ActiveForm::begin([
                'action'  => Url::to(['/site/forbidden']),
                'options' => [
                    'data-url' => Url::to(['ajax-activate', 'id' => $widget['widget_dir']]),
                    'class'    => 'widget-activation-form box-footer'
                ]
            ]) ?>

            <div class="input-group">

                <?= Html::dropDownList('Widget[widget_location]', null, ArrayHelper::map($widgetSpace, 'location', 'title'), [
                    'class' => 'input-sm form-control widget-widget_location'
                ]); ?>

                <div class="input-group-btn">
                    <button type="submit" class="btn btn-flat btn-sm btn-default">
                        <?= Yii::t('writesdown', 'Activate'); ?>
                    </button>
                </div>
            </div>

            <?php ActiveForm::end() ?>

        </div>
    </div>

    <?php $index++;
}<commit_msg>divide available widgets to 2 column<commit_after><?php
/**
 * @file      _available.php
 * @date      9/10/2015
 * @time      1:54 AM
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2015 WritesDown
 * @license   http://www.writesdown.com/license/
 */

use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $availableWidget [] */
/* @var $widgetSpace [] */
?>

<?php
$index = 0;
$sizeofAvailable = sizeof($availableWidget);
$divideAvailable = round($sizeofAvailable / 2);
foreach ($availableWidget as $dir => $widget) {
    if ($index == 0 || $index == $divideAvailable) {
        echo Html::beginTag('div', ['class' => 'col-sm-12 col-md-6']);
    } ?>

    <div id="available-widget-<?= $widget['widget_dir'] ?>" class="available-widget box box-solid collapsed-box">
        <div class="box-header">
            <h3 class="box-title"><?= $widget['widget_title'] ?></h3>

            <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse">
                    <i class="fa fa-plus"></i>
                </button>

                <?= Html::a('<i class="fa fa-times"></i>', ['delete-widget', 'id' => $widget['widget_dir']], [
                    'class' => 'btn btn-box-tool',
                    'data'  => [
                        'method'  => 'post',
                        'confirm' => Yii::t('writesdown', 'Are you sure you want to delete this widget?')
                    ]
                ]); ?>

            </div>
        </div>

        <?php if (isset($widget['widget_description'])) {
            echo Html::tag('div', $widget['widget_description'], [
                'class' => 'box-body',
            ]);
        } ?>

        <?php $form = ActiveForm::begin([
            'action'  => Url::to(['/site/forbidden']),
            'options' => [
                'data-url' => Url::to(['ajax-activate', 'id' => $widget['widget_dir']]),
                'class'    => 'widget-activation-form box-footer'
            ]
        ]) ?>

        <div class="input-group">

            <?= Html::dropDownList('Widget[widget_location]', null, ArrayHelper::map($widgetSpace, 'location', 'title'), [
                'class' => 'input-sm form-control widget-widget_location'
            ]); ?>

            <div class="input-group-btn">
                <button type="submit" class="btn btn-flat btn-sm btn-default">
                    <?= Yii::t('writesdown', 'Activate'); ?>
                </button>
            </div>
        </div>

        <?php ActiveForm::end() ?>

    </div>

    <?php
    if ($index == $divideAvailable - 1 || $index == $sizeofAvailable - 1) {
        echo Html::endTag('div');
    }
    $index++;
}
{'fraction_non_alphanumeric': 0.1893911775428363, 'fraction_numerical': 0.008567262121764492, 'mean_word_length': 1.7435, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3934029', 'n_tokens_mistral': 1689, 'n_tokens_neox': 1605, 'n_words': 321}