Пример #1
0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,*
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once './modules/centreon-open-tickets/centreon-open-tickets.conf.php';
require_once "HTML/QuickForm.php";
require_once 'HTML/QuickForm/select2.php';
require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
/*
 * Smarty template Init
 */
$path = "./modules/centreon-open-tickets/views/logs/templates/";
$tpl = new Smarty();
$tpl = initSmartyTpl($path, $tpl);
/*
 * Form begin
 */
$form = new HTML_QuickForm('FormTicketLogs', 'get', "?p=" . $p);
$periods = array("" => "", "10800" => _("Last 3 Hours"), "21600" => _("Last 6 Hours"), "43200" => _("Last 12 Hours"), "86400" => _("Last 24 Hours"), "172800" => _("Last 2 Days"), "302400" => _("Last 4 Days"), "604800" => _("Last 7 Days"), "1209600" => _("Last 14 Days"), "2419200" => _("Last 28 Days"), "2592000" => _("Last 30 Days"), "2678400" => _("Last 31 Days"), "5184000" => _("Last 2 Months"), "10368000" => _("Last 4 Months"), "15552000" => _("Last 6 Months"), "31104000" => _("Last Year"));
$form->addElement('select', 'period', _("Log Period"), $periods);
$form->addElement('text', 'StartDate', '', array("id" => "StartDate", "class" => "datepicker", "size" => 8));
$form->addElement('text', 'StartTime', '', array("id" => "StartTime", "class" => "timepicker", "size" => 5));
$form->addElement('text', 'EndDate', '', array("id" => "EndDate", "class" => "datepicker", "size" => 8));
$form->addElement('text', 'EndTime', '', array("id" => "EndTime", "class" => "timepicker", "size" => 5));
$form->addElement('text', 'subject', _("Subject"), array("id" => "subject", "style" => "width: 203px;", "size" => 15, "value" => ''));
$form->addElement('text', 'ticket_id', _("Ticket ID"), array("id" => "ticket_id", "style" => "width: 203px;", "size" => 15, "value" => ''));
$form->addElement('submit', 'graph', _("Apply"), array("onclick" => "return applyForm();", "class" => "btc bt_success"));
$attrHosts = array('datasourceOrigin' => 'ajax', 'allowClear' => false, 'availableDatasetRoute' => './include/common/webServices/rest/internal.php?object=centreon_configuration_host&action=list', 'multiple' => true);
$attrHost1 = array_merge($attrHosts);
if (isset($cfg_syslog)) {
    $form->setDefaults($cfg_syslog);
} else {
    $form->setDefaults(array("refresh_monitoring " => '10', "refresh_filters" => '240'));
}
#End of form definition
if ($form->validate()) {
    if ($form->getSubmitValue("submitC")) {
        updateRefreshOption();
    }
}
/*
 * Smarty template Init
 */
$tpl = new Smarty();
$tpl = initSmartyTpl($syslog_mod_path . "include/administration", $tpl);
/*
 * Add buttons
 */
if ($o == "m") {
    $subC =& $form->addElement('submit', 'submitC', _("Save"));
    $res =& $form->addElement('reset', 'reset', _("Reset"));
    $redirect->setValue("f");
} else {
    if ($o == "f") {
        $form->freeze();
        $form->addElement('button', 'modify', _("Modify"), array("onClick" => "javascript:window.location.href='?p=" . $p . "&o=m'"));
    }
}
/*
 * Apply a template definition