<commit_before><?php
/*
 * CENTREON
 *
 * Source Copyright 2005-2015 CENTREON
 *
 * Unauthorized reproduction, copy and distribution
 * are not allowed.
 *
 * For more information : <EMAIL>
 *
*/

$path = "./modules/centreon-open-tickets/views/rules/";
$tpl = new Smarty();
$tpl = initSmartyTpl($path, $tpl);
$rows = 0;
$nbRule = 0;
include("./include/common/autoNumLimit.php");

$form = new HTML_QuickForm('select_form', 'POST', "?p=".$p);

$query = "SELECT r.rule_id, r.activate, r.alias FROM mod_open_tickets_rule r";
if ($search) {
    $query .= " WHERE r.alias LIKE '%".$search."%' ";
}
$queryCount = $query;
$query .= " ORDER BY r.alias";
$query .= " LIMIT ".$num * $limit.", ".$limit;

$resCount = $db->query($queryCount);
$rows = $resCount->numRows();

$res = $db->query($query);
$elemArr = array();
$tdStyle = "list_one";
$ruleStr = "";
while ($row = $res->fetchRow()) {
    $selectedElements = $form->addElement('checkbox', "select[".$row['rule_id']."]");
	$elemArr[$row['rule_id']]['select'] = $selectedElements->toHtml();
	$elemArr[$row['rule_id']]['url_edit'] = "./main.php?p=".$p."&o=c&rule_id=".$row['rule_id'];
	$elemArr[$row['rule_id']]['name'] = $row['alias'];
	$elemArr[$row['rule_id']]['status'] = $row['activate'] ? _('Enabled') : _('Disabled');
	$elemArr[$row['rule_id']]['style'] = $tdStyle;
	$dupElements = $form->addElement('text', 'duplicateNb['.$row['rule_id'].']', NULL, array("id" => "duplicateNb[".$row['rule_id']."]", "size" => "3", "value" => "1"));
    $moptions = "";
    if ($row['activate']) {
        $moptions .= "<a href='main.php?p=".$p."&o=ds&rule_id=".$row['rule_id']."&limit=".$limit."&num=".$num."'><img src='img/icones/16x16/element_previous.gif' border='0' alt='"._("Disabled")."'></a>&nbsp;&nbsp;";
    } else {
        $moptions .= "<a href='main.php?p=".$p."&o=e&rule_id=".$row['rule_id']."&limit=".$limit."&num=".$num."'><img src='img/icones/16x16/element_next.gif' border='0' alt='"._("Enabled")."'></a>&nbsp;&nbsp;";
    }
	$elemArr[$row['rule_id']]['dup'] = $moptions . "&nbsp;" . $dupElements->toHtml();
	if ($tdStyle == "list_one") {
		$tdStyle = "list_two";
	} else {<commit_msg>fixed #6 - Use Centreon UI 2.7.x style<commit_after><?php
/*
 * CENTREON
 *
 * Source Copyright 2005-2015 CENTREON
 *
 * Unauthorized reproduction, copy and distribution
 * are not allowed.
 *
 * For more information : <EMAIL>
 *
*/

$path = "./modules/centreon-open-tickets/views/rules/";
$tpl = new Smarty();
$tpl = initSmartyTpl($path, $tpl);
$rows = 0;
$nbRule = 0;
include("./include/common/autoNumLimit.php");

$form = new HTML_QuickForm('select_form', 'POST', "?p=".$p);

$query = "SELECT r.rule_id, r.activate, r.alias FROM mod_open_tickets_rule r";
if ($search) {
    $query .= " WHERE r.alias LIKE '%".$search."%' ";
}
$queryCount = $query;
$query .= " ORDER BY r.alias";
$query .= " LIMIT ".$num * $limit.", ".$limit;

$resCount = $db->query($queryCount);
$rows = $resCount->numRows();

$res = $db->query($query);
$elemArr = array();
$tdStyle = "list_one";
$ruleStr = "";
while ($row = $res->fetchRow()) {
    $selectedElements = $form->addElement('checkbox', "select[".$row['rule_id']."]");
	$elemArr[$row['rule_id']]['select'] = $selectedElements->toHtml();
	$elemArr[$row['rule_id']]['url_edit'] = "./main.php?p=".$p."&o=c&rule_id=".$row['rule_id'];
	$elemArr[$row['rule_id']]['name'] = $row['alias'];
	$elemArr[$row['rule_id']]['status'] = $row['activate'] ? _('Enabled') : _('Disabled');
	$elemArr[$row['rule_id']]['style'] = $tdStyle;
	$dupElements = $form->addElement('text', 'duplicateNb['.$row['rule_id'].']', NULL, array("id" => "duplicateNb[".$row['rule_id']."]", "size" => "3", "value" => "1"));
    $moptions = "";
    if ($row['activate']) {
        $moptions .= "<a href='main.php?p=".$p."&o=ds&rule_id=".$row['rule_id']."&limit=".$limit."&num=".$num."'><img class='ico-14' src='img/icons/disabled.png' border='0' alt='"._("Disabled")."'></a>";
    } else {
        $moptions .= "<a href='main.php?p=".$p."&o=e&rule_id=".$row['rule_id']."&limit=".$limit."&num=".$num."'><img class='ico-14' src='img/icons/enabled.png' border='0' alt='"._("Enabled")."'></a>";
    }
	$elemArr[$row['rule_id']]['dup'] = $moptions . "&nbsp;" . $dupElements->toHtml();
	if ($tdStyle == "list_one") {
		$tdStyle = "list_two";
	} else {
{'fraction_non_alphanumeric': 0.28217126813289656, 'fraction_numerical': 0.010060832943378568, 'mean_word_length': 5.081081081081081, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 39, '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': '6126500', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1653, 'n_words': 262}