コード例 #1
0
ファイル: cf_watchman.php プロジェクト: kaantunc/MYK-BOR
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        $doc->addScript(JURI::base() . 'components/com_chronocontact/assets/timespinner/timespinner.js');
        $doc->addStylesheet(JURI::base() . 'components/com_chronocontact/assets/timespinner/timespinner.css');
        // identify and initialise the parameters used in this plugin
        $params_array = array('redirect_url' => 'index.php', 'gid' => '29', 'redirect_message_users' => '', 'open' => '', 'redirect_message_open' => '', 'close' => '', 'redirect_message_close' => '', 'days' => '1|2|3|4|5|6|0', 'redirect_message_days' => '', 'open_time' => '', 'redirect_message_open_time' => '', 'close_time' => '', 'redirect_message_close_time' => '', 'debug' => '0');
        $params = $helper->loadParams($row, $params_array);
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("cf_watchman");
        echo $pane->startPanel('General', 'general');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('General settings', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Enter the url for the page you want to redirect to if the form is not available.\n        \tDefault is `index.php`?";
        $input = $helper->createInputTD("Redirect url", 'params[redirect_url]', $params->get('redirect_url'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Plugin debug', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "If you set debug to Yes the form will display debug messages instead of re-directing.";
        $input = $helper->createYesNoTD("PlugIn debug", 'params[debug]', '', $params->get('debug'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Users', 'users');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Watch user groups', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $acl =& JFactory::getACL();
        $gtree = $acl->get_group_children_tree(null, 'USERS', false);
        $tooltip = "Select the groups who can access this form";
        $input = $helper->createSelectTD('Groups with access', 'params[gid][]', $gtree, $params->get('gid'), array('size' => '10', 'multiple' => 'multiple', 'class' => 'cf_select'), $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_users]', $params->get('redirect_message_users'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Dates and Times', 'date_time');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >

<?php 
        $input = $helper->createHeaderTD('Watch opening and closing dates', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Select the date when the form opens. Leave blank for always open";
        $config = array('showsTime' => "true");
        $input = $helper->createDateTD('Open date and time', 'params[open]', $params->get('open'), $attribs['input'], $tooltip, '', $config);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection.\n        \tIf you leave this blank,  redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_open]', $params->get('redirect_message_open'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select the date when the form closes. Leave blank for always open";
        $input = $helper->createDateTD('Close date and time', 'params[close]', $params->get('close'), $attribs['input'], $tooltip, '', $config);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_close]', $params->get('redirect_message_close'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Watch days of the week', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Select the days of the week that you want the form open.";
        $days_array = array('1' => 'MONDAY', '2' => 'TUESDAY', '3' => 'WEDNESDAY', '4' => 'THURSDAY', '5' => 'FRIDAY', '6' => 'SATURDAY', '0' => 'SUNDAY');
        foreach ($days_array as $k => $day) {
            $days_array[$k] = JHTML::_('select.option', $k, JText::_($day));
        }
        $input = $helper->createSelectTD('Open days', 'params[days][]', $days_array, $params->get('days'), array('size' => '7', 'multiple' => 'multiple', 'class' => 'cf_select'), $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_days]', $params->get('redirect_message_days'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $input = $helper->createHeaderTD('Watch opening and closing times', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Select the time of day that you want the form to open.";
        $attribs_time = array_merge($attribs['input'], array('size' => '10'));
        $input = $helper->createTimeTD('Opening time', 'params[open_time]', $params->get('open_time'), $attribs_time, $tooltip, 'open_time');
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_open_time]', $params->get('redirect_message_open_time'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select the time of day that you want the form to close.";
        $input = $helper->createTimeTD('Closing time', 'params[close_time]', $params->get('close_time'), $attribs_time, $tooltip, 'close_time');
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter a message to show after redirection. if you leave this blank, redirection will be silent.";
        $input = $helper->createInputTD("Redirect message", 'params[redirect_message_close_time]', $params->get('redirect_message_close_time'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
    </table>
 <?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Help', 'help');
        ?>
    <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Configure Watchman Plugin', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        ?>
        <tr>
            <td colspan='4' style='border:1px solid silver; padding:6px;'>
            <div>The plugin will redirect users away form your form unless the
            conditions set here are met.</div>
            <ul><li>You can select user groups; opening and closing dates (and times); days of the week;
            and daily opening and closing times. So, for example, you could set the
            form to be visible to registered users only from 08:00 on 31 Mar 09 to 19:00 on 14 Apr 2009;
            or to be visible only on Tuesdays and Thursdays between 12:00 and 15:00.</li>
            <li>The tests run in the order they are here, and the user will be redirected
            on the first 'failure'.</li>
            <li>If you leave the Redirect url blank users will redirect to the site
            home page.</li>
            <li>If you enter a Redirect message this will be displayed as a system message
            after the redirection (please check that your template shows system messages).
            If you leave the Redirect message empty the redirection will be 'invisible' as though
            the form was not there.</li>
            <li>Once this plugin is configured you must enable it in the Form 'Plugins'' tab.</li>
            </ul>
            </td>
        </tr>
    </table>
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        echo $helper->createHiddenArray($hidden_array);
        ?>
</form>
<?php 
        if ($style) {
            $doc->addStyleDeclaration($style);
        }
        if ($script) {
            $doc->addScriptDeclaration($script);
        }
    }