Example #1
0
 function display($arrParam)
 {
     print '<div id="div' . $this->name . '">';
     print '<table cellspacing="0">';
     $i = 0;
     foreach (array('year' => array(_('Year: '), 4), 'month' => array(_('Month: '), 2), 'day' => array(_('Day: '), 2), 'hour' => array(_('Hour: '), 2), 'min' => array(_('Min.: '), 2), 'sec' => array(_('Sec.: '), 2)) as $elem => $a_params) {
         $e = new InputTpl($this->name . '_' . $elem);
         //, array('value'=>$arrParam[$elem]));
         $e->setSize($a_params[1]);
         print $a_params[0];
         $e->display(array('value' => $arrParam[$elem], 'onchange' => '
             var elem = document.getElementById("' . $this->name . '");
             var date = elem.value;
             var part = ' . $i . ';
             var value = document.getElementById("' . $this->name . '_' . $elem . '").value;
             var newdate = changePartDate(date, part, value);
             elem.value = newdate;
         '));
         $i += 1;
     }
     print '<input name="' . $this->name . '" id="' . $this->name . '" type="hidden" value="0000/00/00/00/00/00"/>';
     print '</table>';
     print '</div>';
     print '<script type="text/javascript">
             function changePartDate(date, part, value) {
                 var re = new RegExp("/", "g");
                 var adate = date.split(re);
                 adate[part] = value;
                 return adate.join("/");
             }
            </script>';
 }
Example #2
0
 function display($arrParam)
 {
     print '<div id="div' . $this->name . '">';
     //print '<table cellspacing="0">';
     $i = 0;
     foreach (array('days' => array(_T('Days: '), 4), 'hours' => array(_T('Hours: '), 2), 'minutes' => array(_T('Minutes: '), 2), 'seconds' => array(_T('Seconds: '), 2)) as $elem => $a_params) {
         $e = new InputTpl($this->name . '_' . $elem, '/^\\d*$/');
         $e->setSize($a_params[1]);
         print $a_params[0];
         print "&nbsp;";
         $e->display(array('value' => $arrParam["value"][$elem], 'onchange' => '
             var elem = document.getElementById("' . $this->name . '");
             var date = elem.value;
             var part = ' . $i . ';
             var value = document.getElementById("' . $this->name . '_' . $elem . '").value;
             var newdate = changePartDate(date, part, value);
             elem.value = newdate;
         '));
         print "&nbsp;";
         $i += 1;
     }
     print '<input name="' . $this->name . '" id="' . $this->name . '" type="hidden" value="' . $this->stringValue($arrParam["value"]) . '"/>';
     //print '</table>';
     print '</div>';
     print '<script type="text/javascript">
             function changePartDate(date, part, value) {
                 var re = new RegExp("/", "g");
                 var adate = date.split(re);
                 adate[part] = value;
                 return adate.join("/");
             }
            </script>';
 }
Example #3
0
File: loc.php Project: neoclust/mmc
    function display($arrParam){
        print '<div id="div'.$this->name.'">';

        //print '<table cellspacing="0">';

        $e = new InputTpl($this->name.'_value', $this->regexp); //, array('value'=>$arrParam[$elem]));
        $e->setSize($this->size);
	$e->display(array('value'=>floatval($arrParam["value"]["value"]) != 0 ? floatval($arrParam["value"]["value"]) : "", 
			  'onchange'=>'
                var elem = document.getElementById("'.$this->name.'");
                var data = elem.value;
                var value = document.getElementById("'.$this->name .'_value").value;
                var newdata = changePart(data,0,value);
                elem.value = newdata;'));
        
        $onchange = 'onchange = \'
		var elem = document.getElementById("'.$this->name.'");
                var data = elem.value;
                var elems = document.getElementsByName("'.$this->name.'_unit");
                
                var len = elems.length;
                var value="";
                for (i = 0; i <len; i++) {
            	    if (elems[i].checked) {
            		value = elems[i].value;
            		break;            		
            	    }
            	}
                var newdata = changePart(data, 1, value);
                elem.value = newdata;
        	
                \'';
                
	foreach ($this->units as $k => $v){
	    $checked = ($k === $arrParam["value"]["unit"]) ? "checked" : "";
	    print '<input type=radio name="' . $this->name . '_unit"  value="' . $k . '" '. $checked . ' ' . $onchange .'>' . $v;

	}	    

        print '<input name="'.$this->name.'" id="'.$this->name.'" type="hidden" value="' . $this->stringValue($arrParam["value"]) . '"/>';

        print '</div>';


        print '<script type="text/javascript">
                function changePart(data, part, value) {
                    var re = new RegExp("/", "g");
                    var adata = data.split(re);
                    adata[part] = value;
                    return adata.join("/");
                }
               </script>';
    }