<commit_before><?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Services_Tracker_CalendarController
{
	function setUp()
	{
		Services_Exception_Disabled::check('calendar_fullcalendar');
	}

	function action_list($input)
	{
		$unifiedsearchlib = TikiLib::lib('unifiedsearch');
		$index = $unifiedsearchlib->getIndex();
		$dataSource = $unifiedsearchlib->getDataSource();

		$start = 'tracker_field_' . $input->beginField->word();
		$end = 'tracker_field_' . $input->endField->word();

		if ($resource = $input->resourceField->word()) {
			$resource = 'tracker_field_' . $resource;
		}

		if ($coloring = $input->coloringField->word()) {
			$coloring = 'tracker_field_' . $coloring;
		}

		$query = $unifiedsearchlib->buildQuery(array());
		$query->filterRange($input->start->int(), $input->end->int(), array($start, $end));

		if ($body = $input->filters->none()) {
			$builder = new Search_Query_WikiBuilder($query);
			$builder->apply(WikiParser_PluginMatcher::match($body));
		}

		$result = $query->search($index);

		$result = $dataSource->getInformation($result, array('title', $start, $end));

		$response = array();

		$smarty = TikiLib::lib('smarty');
		$smarty->loadPlugin('smarty_modifier_sefurl');
		foreach ($result as $row) {
			$item = Tracker_Item::fromId($row['object_id']);
			$response[] = array(
				'id' => $row['object_id'],
				'trackerId' => isset($row['tracker_id']) ? $row['tracker_id'] : null,
				'title' => $row['title'],
				'description' => '',
				'url' => smarty_modifier_sefurl($row['object_id'], $row['object_type']),
				'allDay' => false,
				'start' => (int) $row[$start],
				'end' => (int) $row[$end],
				'editable' => $item->canModify(),
				'color' => $this->getColor(isset($row[$coloring]) ? $row[$coloring] : ''),
				'textcolor' => '#000',
				'resource' => ($resource && isset($row[$resource])) ? $row[$resource] : '',
			);
		}

		return $response;
	}

	private function getColor($value)
	{<commit_msg>[FIX] Typo, wrong property name - setting text color to black<commit_after><?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Services_Tracker_CalendarController
{
	function setUp()
	{
		Services_Exception_Disabled::check('calendar_fullcalendar');
	}

	function action_list($input)
	{
		$unifiedsearchlib = TikiLib::lib('unifiedsearch');
		$index = $unifiedsearchlib->getIndex();
		$dataSource = $unifiedsearchlib->getDataSource();

		$start = 'tracker_field_' . $input->beginField->word();
		$end = 'tracker_field_' . $input->endField->word();

		if ($resource = $input->resourceField->word()) {
			$resource = 'tracker_field_' . $resource;
		}

		if ($coloring = $input->coloringField->word()) {
			$coloring = 'tracker_field_' . $coloring;
		}

		$query = $unifiedsearchlib->buildQuery(array());
		$query->filterRange($input->start->int(), $input->end->int(), array($start, $end));

		if ($body = $input->filters->none()) {
			$builder = new Search_Query_WikiBuilder($query);
			$builder->apply(WikiParser_PluginMatcher::match($body));
		}

		$result = $query->search($index);

		$result = $dataSource->getInformation($result, array('title', $start, $end));

		$response = array();

		$smarty = TikiLib::lib('smarty');
		$smarty->loadPlugin('smarty_modifier_sefurl');
		foreach ($result as $row) {
			$item = Tracker_Item::fromId($row['object_id']);
			$response[] = array(
				'id' => $row['object_id'],
				'trackerId' => isset($row['tracker_id']) ? $row['tracker_id'] : null,
				'title' => $row['title'],
				'description' => '',
				'url' => smarty_modifier_sefurl($row['object_id'], $row['object_type']),
				'allDay' => false,
				'start' => (int) $row[$start],
				'end' => (int) $row[$end],
				'editable' => $item->canModify(),
				'color' => $this->getColor(isset($row[$coloring]) ? $row[$coloring] : ''),
				'textColor' => '#000',
				'resource' => ($resource && isset($row[$resource])) ? $row[$resource] : '',
			);
		}

		return $response;
	}

	private function getColor($value)
	{
{'fraction_non_alphanumeric': 0.20018198362147407, 'fraction_numerical': 0.005004549590536852, 'mean_word_length': 4.666237113402062, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 75, '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': '6195090', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1477, 'n_words': 287}