Пример #1
0
 /**
  * Returns the display HTML for this widget.  The optional
  * parameter determines whether or not to automatically display the widget
  * nicely, or whether to simply return the widget (for use in a template).
  * 
  * @access	public
  * @param	boolean	$generate_html
  * @return	string
  * 
  */
 function display($generate_html = 0)
 {
     $_year = new MF_Widget_select('MF_' . $this->name . '_YEAR');
     $_year->nullable = $this->nullable;
     $year_array = array();
     for ($i = $this->highest_year; $i >= $this->lowest_year; $i--) {
         $year_array[$i] = $i;
     }
     $_year->setValues($year_array);
     $_year->data_value = $this->data_value_YEAR;
     $_month = new MF_Widget_select('MF_' . $this->name . '_MONTH');
     $_month->nullable = $this->nullable;
     global $intl, $simple;
     if (is_object($intl)) {
         $_month->setValues(array('01' => $intl->get('January'), '02' => $intl->get('February'), '03' => $intl->get('March'), '04' => $intl->get('April'), '05' => $intl->get('May'), '06' => $intl->get('June'), '07' => $intl->get('July'), '08' => $intl->get('August'), '09' => $intl->get('September'), '10' => $intl->get('October'), '11' => $intl->get('November'), '12' => $intl->get('December')));
     } else {
         $_month->setValues(array('01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December'));
     }
     $_month->data_value = $this->data_value_MONTH;
     $_day = new MF_Widget_select('MF_' . $this->name . '_DAY');
     $_day->nullable = $this->nullable;
     $_day->setValues(array('01' => '1', '02' => '2', '03' => '3', '04' => '4', '05' => '5', '06' => '6', '07' => '7', '08' => '8', '09' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30', '31' => '31'));
     $_day->data_value = $this->data_value_DAY;
     if ($this->nullable || $this->addblank) {
         global $intl;
         if (is_object($intl)) {
             $_day->value[''] = $intl->get('Day');
             $_month->value[''] = $intl->get('Month');
             $_year->value[''] = $intl->get('Year');
         } else {
             $_day->value[''] = 'Day';
             $_month->value[''] = 'Month';
             $_year->value[''] = 'Year';
         }
     }
     $_year->extra = $this->extra;
     $_month->extra = $this->extra;
     $_day->extra = $this->extra;
     $_date = new MF_Widget_hidden($this->name);
     if ($generate_html) {
         $data = $_date->display(0) . "\n";
         $data .= "\t<tr>\n\t\t<td class=\"label\"><label for=\"" . $this->name . '"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . "</label></td>\n\t\t<td class=\"field\">" . $_month->display(0) . '&nbsp;' . $_day->display(0) . '&nbsp;' . $_year->display(0) . "</td>\n\t</tr>\n";
     } else {
         $data = $_date->display(0);
         $data .= $_month->display(0) . '&nbsp;' . $_day->display(0) . '&nbsp;' . $_year->display(0);
     }
     return $data;
 }
Пример #2
0
 /**
  * Returns the display HTML for this widget.  The optional
  * parameter determines whether or not to automatically display the widget
  * nicely, or whether to simply return the widget (for use in a template).
  * 
  * @access	public
  * @param	boolean	$generate_html
  * @return	string
  * 
  */
 function display($generate_html = 0)
 {
     global $intl, $simple;
     $_text = new MF_Widget_text('MF_' . $this->name . '_TEXT');
     $_text->nullable = $this->nullable;
     $_text->data_value = $this->data_value_TEXT;
     $_select = new MF_Widget_select('MF_' . $this->name . '_SELECT');
     $_select->nullable = $this->nullable;
     $_select->setValues($this->value);
     $_select->data_value = $this->data_value_SELECT;
     $_text->extra = $this->extra;
     $_select->extra = $this->extra;
     $_set = new MF_Widget_hidden($this->name);
     if ($generate_html) {
         $data = $_set->display(0) . "\n";
         $data .= "\t<tr>\n\t\t<td class=\"label\"><label for=\"" . $this->name . '"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . "</label></td>\n\t\t<td class=\"field\">" . $_text->display(0) . '&nbsp;' . $_select->display(0) . "</td>\n\t</tr>\n";
     } else {
         $data = $_set->display(0);
         $data .= $_text->display(0) . '&nbsp;' . $_select->display(0);
     }
     return $data;
 }
Пример #3
0
    /**
     * Returns the display HTML for this widget.  The optional
     * parameter determines whether or not to automatically display the widget
     * nicely, or whether to simply return the widget (for use in a template).
     * 
     * @access	public
     * @param	boolean	$generate_html
     * @return	string
     * 
     */
    function display($generate_html = 0)
    {
        $_dl = new MF_Widget_select('MF_' . $this->name . '_DIRLIST');
        $_dl->extra = $this->extra;
        $dir = new Dir($this->directory);
        if ($this->recursive == 0) {
            $list = $dir->read_all();
            $goodlist = array();
            $dir->close();
            foreach ($list as $file) {
                if (!eregi('^\\.ht', $file) && (eregi('\\.(' . join('|', $this->extensions) . ')$', $file) || count($this->extensions) == 0) && $file != '.' && $file != '..') {
                    $goodlist[$file] = $file;
                }
            }
        } else {
            $goodlist = array();
            // recurse
            $list = $dir->find('*', $this->directory, 1);
            for ($i = 0; $i < count($list); $i++) {
                if (!@is_dir($list[$i]) && !eregi('^\\.ht', $list[$i]) && (eregi('\\.(' . join('|', $this->extensions) . ')$', $list[$i]) || count($this->extensions) == 0) && $list[$i] != '.' && $list[$i] != '..') {
                    $list[$i] = preg_replace('/^' . preg_quote($this->directory . '/', '/') . '/', '', $list[$i]);
                    $goodlist[$list[$i]] = $list[$i];
                }
            }
        }
        $_dl->setValues($goodlist);
        $_dl->data_value = $this->data_value_DIRLIST;
        $_dirlist = new MF_Widget_hidden($this->name);
        $data = '';
        if ($this->show_viewbutton) {
            global $intl;
            $data .= '<script language="JavaScript">
<!--

function ' . $this->name . '_preview (name, params, formname) {
	// get src from form widget
	path = "' . $this->web_path . '/' . '" + document.forms[formname].elements[name].options[document.forms[formname].elements[name].selectedIndex].value;

	pop = window.open (\'\', name, params);
	pop.document.open ();
	pop.document.write (\'<link rel="stylesheet" type="text/css" href="css/site.css" />\');
	pop.document.write (\'<div align="center">\');
	pop.document.write (\'<img src="\' + path + \'" alt="\' + name + \'" border="0" />\');
	pop.document.write (\'<br /><br /><a href="#" onclick="window.close ()">' . $intl->get('Close Window') . '</a></div>\');
}

// -->
</script>';
            $showbutton = '&nbsp;<a href="#" onclick="' . $this->name . '_preview (\'MF_' . $this->name . '_DIRLIST\', \'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,dependent=no,fullscreen=no,width=300,height=300,top=50,left=160\', \'' . $this->formname . '\')">' . $intl->get('Preview') . '</a>';
        } else {
            $showbutton = '';
        }
        if ($generate_html) {
            $data .= $_dirlist->display(0) . "\n";
            $data .= "\t<tr>\n\t\t<td>" . '<label for="' . $this->name . '"' . $this->invalid() . '>' . $this->display_value . "</label></td>\n\t\t<td>" . $_dl->display(0) . $showbutton . "</td>\n\t</tr>\n";
        } else {
            $data .= $_dirlist->display(0);
            $data .= $_dl->display(0);
            $data .= $showbutton;
        }
        return $data;
    }
Пример #4
0
 /**
  * Returns the display HTML for this widget.  The optional
  * parameter determines whether or not to automatically display the widget
  * nicely, or whether to simply return the widget (for use in a template).
  * 
  * @access	public
  * @param	boolean	$generate_html
  * @return	string
  * 
  */
 function display($generate_html = 0)
 {
     $_hour = new MF_Widget_select('MF_' . $this->name . '_HOUR');
     $_hour->nullable = $this->nullable;
     $_hour->setValues(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12'));
     $_hour->data_value = $this->data_value_HOUR;
     $_minute = new MF_Widget_select('MF_' . $this->name . '_MINUTE');
     $_minute->nullable = $this->nullable;
     $_minute->setValues(array(':00' => ':00', ':15' => ':15', ':30' => ':30', ':45' => ':45'));
     $_minute->data_value = $this->data_value_MINUTE;
     $_ampm = new MF_Widget_select('MF_' . $this->name . '_AMPM');
     $_ampm->nullable = $this->nullable;
     $_ampm->setValues(array('am' => 'am', 'pm' => 'pm'));
     $_ampm->data_value = $this->data_value_AMPM;
     if ($this->nullable || $this->addblank) {
         global $intl;
         if (is_object($intl)) {
             $_ampm->value[''] = $intl->get('AM/PM');
             $_minute->value[''] = $intl->get('Minute');
             $_hour->value[''] = $intl->get('Hour');
         } else {
             $_ampm->value[''] = 'AM/PM';
             $_minute->value[''] = 'Minute';
             $_hour->value[''] = 'Hour';
         }
     }
     $_hour->extra = $this->extra;
     $_minute->extra = $this->extra;
     $_ampm->extra = $this->extra;
     $_time = new MF_Widget_hidden($this->name);
     if ($generate_html) {
         $data = $_time->display(0) . "\n";
         $data .= "\t<tr>\n\t\t<td class=\"label\"><label for=\"" . $this->name . '"' . $this->invalid() . '>' . $this->display_value . "</label></td>\n\t\t<td class=\"field\">" . $_hour->display(0) . '&nbsp;' . $_minute->display(0) . '&nbsp;' . $_ampm->display(0) . "</td>\n\t</tr>\n";
     } else {
         $data = $_time->display(0);
         $data .= $_hour->display(0) . '&nbsp;' . $_minute->display(0) . '&nbsp;' . $_ampm->display(0);
     }
     return $data;
 }