예제 #1
0
function customcontexts_customcontexts_configpageinit($dispnum)
{
    global $currentcomponent;
    switch ($dispnum) {
        case 'customcontexts':
            $currentcomponent->addoptlistitem('includeyn', 'yes', 'Allow');
            $currentcomponent->addoptlistitem('includeyn', 'no', 'Deny');
            $currentcomponent->addoptlistitem('includeyn', 'allowmatch', 'Allow Rules');
            $currentcomponent->addoptlistitem('includeyn', 'denymatch', 'Deny Rules');
            $timegroups = timeconditions_timegroups_list_groups();
            foreach ($timegroups as $val) {
                $currentcomponent->addoptlistitem('includeyn', $val[0], $val[1]);
            }
            $currentcomponent->setoptlistopts('includeyn', 'sort', false);
            for ($i = 0; $i <= 300; $i++) {
                $currentcomponent->addoptlistitem('includesort', $i - 50, $i);
            }
            $currentcomponent->addguifunc('customcontexts_customcontexts_configpageload');
            $currentcomponent->addprocessfunc('customcontexts_customcontexts_configprocess', 5);
            break;
    }
}
예제 #2
0
function timeconditions_timegroups_drawgroupselect($elemname, $currentvalue = '', $canbeempty = true, $onchange = '', $default_option = '')
{
    global $tabindex;
    $output = '';
    $onchange = $onchange != '' ? " onchange=\"{$onchange}\"" : '';
    $output .= "\n\t\t\t<select name=\"{$elemname}\" tabindex=\"" . ++$tabindex . "\" id=\"{$elemname}\"{$onchange}>\n";
    // include blank option if required
    if ($canbeempty) {
        $output .= '<option value="">' . ($default_option == '' ? _("--Select a Group--") : $default_option) . '</option>';
    }
    // build the options
    $valarray = timeconditions_timegroups_list_groups();
    foreach ($valarray as $item) {
        $itemvalue = isset($item['value']) ? $item['value'] : '';
        $itemtext = isset($item['text']) ? _($item['text']) : '';
        $itemselected = $currentvalue == $itemvalue ? ' selected' : '';
        $output .= "\t\t\t\t<option value=\"{$itemvalue}\"{$itemselected}>{$itemtext}</option>\n";
    }
    $output .= "\t\t\t</select>\n\t\t";
    return $output;
}
 public function doConfigPageInit($page)
 {
     $request = $_REQUEST;
     switch ($page) {
         case "timeconditions":
             isset($request['action']) ? $action = $request['action'] : ($action = '');
             isset($request['itemid']) ? $itemid = $request['itemid'] : ($itemid = '');
             isset($request['view']) ? $view = $request['view'] : ($view = '');
             $invert_hint = isset($request['invert_hint']) ? $request['invert_hint'] : '0';
             $fcc_password = isset($request['fcc_password']) ? $request['fcc_password'] : '';
             //if submitting form, update database
             switch ($action) {
                 case "add":
                     $itemid = $this->addTimeCondition($request);
                     $_REQUEST['extdisplay'] = $itemid;
                     \needreload();
                     break;
                 case "delete":
                     $this->delTimeCondition($itemid);
                     $_REQUEST['extdisplay'] = NULL;
                     \needreload();
                     break;
                 case "edit":
                     //just delete and re-add
                     $this->editTimeCondition($itemid, $request);
                     \needreload();
                     break;
             }
             break;
         case "timegroups":
             $action = isset($request['action']) ? $request['action'] : null;
             $timegroup = isset($request['extdisplay']) ? $request['extdisplay'] : null;
             $description = isset($request['description']) ? $request['description'] : null;
             $times = isset($request['times']) ? $request['times'] : null;
             switch ($action) {
                 case 'add':
                     $this->addTimeGroup($description, $times);
                     unset($_REQUEST['view']);
                     break;
                 case 'edit':
                     $this->editTimeGroup($timegroup, $description);
                     $this->editTimes($timegroup, $times);
                     unset($_REQUEST['view']);
                     break;
                 case 'del':
                     $usage = timeconditions_timegroups_list_usage($timegroup);
                     if (isset($usage) && sizeof($usage) >= 1) {
                         $this->errormsg = _("Could not delete time group as it is in use");
                         return;
                     }
                     $this->delTimeGroup($timegroup);
                     unset($_REQUEST['view']);
                     break;
                 case 'getJSON':
                     header('Content-Type: application/json');
                     switch ($request['jdata']) {
                         case 'grid':
                             $timegroupslist = timeconditions_timegroups_list_groups();
                             $rdata = array();
                             foreach ($timegroupslist as $tg) {
                                 $rdata[] = array('text' => $tg['text'], 'value' => $tg['value'], 'link' => array($tg['text'], $tg['value']));
                             }
                             echo json_encode($rdata);
                             exit;
                             break;
                         default:
                             echo json_encode(array("error" => "Unknown Request"));
                             exit;
                             break;
                     }
                     break;
             }
             break;
     }
 }
예제 #4
0
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
$dispnum = 'timegroups';
//used for switch on config.php
?>


<div class="rnav">
<?php 
$groups = timeconditions_timegroups_list_groups();
drawListMenu($groups, $skip, $type, $display, $extdisplay, _("Time Group"));
?>
</div>

<div class="rnav" style="margin:15px 10px; padding: 5px; background: #e0e0ff; border: #2E78A7 solid 1px;">
	<?php 
echo _("Server time:");
?>
 <span id="idTime">00:00:00</span>
</div>

<script>
var hour = <?php 
$l = localtime();
echo $l[2];