<commit_before><?php
/**
 * @author gareth.evans
 */

namespace Qubes\Defero\Applications\Defero\Views\Campaigns;

use Cubex\Form\Form;
use Cubex\Mapper\Database\RecordCollection;
use Qubes\Defero\Applications\Defero\Enums\TypeAheadEnum;
use Qubes\Defero\Applications\Defero\Views\Base\DeferoView;
use Qubes\Defero\Applications\Defero\Views\Base\TypeAheadSearchFormView;
use Qubes\Defero\Components\Campaign\Mappers\Campaign;

class CampaignsView extends DeferoView
{
  /**
   * @var Campaign[]
   */
  public $campaigns;

  public $sendTypeOptions;
  public $activeOptions;
  public $labelOptions;

  public $campaignsSearch;
  protected $_filterForm;

  public function __construct(RecordCollection $campaigns, $options, $postData)
  {
    $this->requireJsPackage("campaigns");
    $this->requireJs("jquery-sortable-min");
    $this->requireCss("jquery-sortable-min");

    $this->campaigns       = $campaigns;
    $this->sendTypeOptions = $options['sendTypeOptions'];
    $this->activeOptions   = $options['activeOptions'];
    $this->labelOptions    = $options['labelOptions'];
    $this->postData        = $postData;

    $this->requireJsPackage("typeahead");
    $this->campaignsSearch = new TypeAheadSearchFormView(
      TypeAheadEnum::CAMPAIGNS(), "Search Campaigns..."
    );
  }

  public function filterForm()
  {
    if($this->_filterForm == null)
    {
      $labelOptions      = ['' => 'LABEL'] + $this->labelOptions;
      $sendTypeOptions   = ['' => 'SEND TYPE'] + $this->labelOptions;
      $activeOptions     = ['' => 'ACTIVE'] + $this->labelOptions;
      $this->_filterForm = new Form('filterForm', '/campaigns/filter');
      $this->_filterForm->setDefaultElementTemplate('{{input}}');
      $this->_filterForm->addAttribute('class', 'form-search pull-right');<commit_msg>oops, wrong arrays!<commit_after><?php
/**
 * @author gareth.evans
 */

namespace Qubes\Defero\Applications\Defero\Views\Campaigns;

use Cubex\Form\Form;
use Cubex\Mapper\Database\RecordCollection;
use Qubes\Defero\Applications\Defero\Enums\TypeAheadEnum;
use Qubes\Defero\Applications\Defero\Views\Base\DeferoView;
use Qubes\Defero\Applications\Defero\Views\Base\TypeAheadSearchFormView;
use Qubes\Defero\Components\Campaign\Mappers\Campaign;

class CampaignsView extends DeferoView
{
  /**
   * @var Campaign[]
   */
  public $campaigns;

  public $sendTypeOptions;
  public $activeOptions;
  public $labelOptions;

  public $campaignsSearch;
  protected $_filterForm;

  public function __construct(RecordCollection $campaigns, $options, $postData)
  {
    $this->requireJsPackage("campaigns");
    $this->requireJs("jquery-sortable-min");
    $this->requireCss("jquery-sortable-min");

    $this->campaigns       = $campaigns;
    $this->sendTypeOptions = $options['sendTypeOptions'];
    $this->activeOptions   = $options['activeOptions'];
    $this->labelOptions    = $options['labelOptions'];
    $this->postData        = $postData;

    $this->requireJsPackage("typeahead");
    $this->campaignsSearch = new TypeAheadSearchFormView(
      TypeAheadEnum::CAMPAIGNS(), "Search Campaigns..."
    );
  }

  public function filterForm()
  {
    if($this->_filterForm == null)
    {
      $labelOptions      = ['' => 'LABEL'] + $this->labelOptions;
      $sendTypeOptions   = ['' => 'SEND TYPE'] + $this->sendTypeOptions;
      $activeOptions     = ['' => 'ACTIVE'] + $this->activeOptions;
      $this->_filterForm = new Form('filterForm', '/campaigns/filter');
      $this->_filterForm->setDefaultElementTemplate('{{input}}');
      $this->_filterForm->addAttribute('class', 'form-search pull-right');
{'fraction_non_alphanumeric': 0.15453029460811563, 'fraction_numerical': 0.0, 'mean_word_length': 4.178417266187051, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '4265359', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1120, 'n_words': 169}