Example #1
0
function _makeColorInput($value, $name)
{
    global $THIS_RET, $color_select;
    if ($THIS_RET['ASSIGNMENT_TYPE_ID']) {
        $id = $THIS_RET['ASSIGNMENT_TYPE_ID'];
    } else {
        $id = 'new';
    }
    if (!$color_select) {
        $colors = array('#330099', '#3366FF', '#003333', '#FF3300', '#660000', '#666666', '#333366', '#336633', 'purple', 'teal', 'firebrick', 'tan');
        foreach ($colors as $color) {
            $color_select[$color] = array('<TABLE cellpadding=0 cellspacing=0 width=100% bgcolor=' . $color . '><TR><TD>&nbsp;</TD></TR></TABLE>', "<TABLE cellpadding=1 cellspacing=0 width=30><TR><TD bgcolor={$color}>&nbsp;</TD></TR></TABLE>");
        }
    }
    return RadioInput($value, "values[{$id}][COLOR]", '', $color_select);
}
/**
 * Make Search Input
 *
 * @param  string $field text|numeric|select|date|radio|grade|school|timespan|test_no|other.
 *
 * @return string Search Input HTML
 */
function _makeSearchInput($field)
{
    $div = false;
    $value = $_REQUEST['bottom_back'] == 'true' && isset($_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']]) ? $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']] : '';
    switch ($field['TYPE']) {
        case 'text':
            /*return "<INPUT type=text name=cust[{$field[COLUMN_NAME]}] size=30".(($_REQUEST['bottom_back']=='true' && $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']])?' value="'.$_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']].'"':'').">";*/
            return TextInput($value, 'cust[' . $field['COLUMN_NAME'] . ']', 'size="20"', $div);
            break;
        case 'numeric':
            /*return "<small>Between</small> <INPUT type=text name=cust_begin[{$field[COLUMN_NAME]}] size=3 maxlength=11".(($_REQUEST['bottom_back']=='true' && $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']])?' value="'.$_SESSION['_REQUEST_vars']['cust_begin'][$field['COLUMN_NAME']].'"':'')."> <small>&amp;</small> <INPUT type=text name=cust_end[{$field[COLUMN_NAME]}] size=3 maxlength=11".(($_REQUEST['bottom_back']=='true' && $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']])?' value="'.$_SESSION['_REQUEST_vars']['cust_end'][$field['COLUMN_NAME']].'"':'').">";*/
            return '<small>' . _('Between') . '</small> ' . TextInput($_REQUEST['bottom_back'] == 'true' && isset($_SESSION['_REQUEST_vars']['cust_begin'][$field['COLUMN_NAME']]) ? $_SESSION['_REQUEST_vars']['cust_begin'][$field['COLUMN_NAME']] : '', 'cust_begin[' . $field['COLUMN_NAME'] . ']', '', 'size="3" maxlength="11"', $div) . '<small>&amp;</small>' . TextInput($_REQUEST['bottom_back'] == 'true' && isset($_SESSION['_REQUEST_vars']['cust_end'][$field['COLUMN_NAME']]) ? $_SESSION['_REQUEST_vars']['cust_end'][$field['COLUMN_NAME']] : '', 'cust_end[' . $field['COLUMN_NAME'] . ']', '', 'size="3" maxlength="11"', $div);
            break;
        case 'select':
            $options = explode("\r", str_replace(array("\r\n", "\n"), "\r", $field['SELECT_OPTIONS']));
            /*if($_REQUEST['bottom_back']=='true' && $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']])
            				$bb_option = $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']];
            			else
            				$bb_option = '';
            			$return = "<SELECT name=cust[{$field[COLUMN_NAME]}] style='max-width:250;'><OPTION value=''>N/A</OPTION><OPTION value='!'".($bb_option=='!'?' SELECTED':'').">No Value</OPTION>";
            
            			foreach ( (array) $options as $option )
            			{
            				//$return .= "<OPTION value=\"$option\"".(($field['COLUMN_NAME']=='CUSTOM_44' && $field['TITLE']=='District' && $option==$_SESSION['district'])?' SELECTED':'').($bb_option==$option?' SELECTED':'').">$option</OPTION>";
            				$return .= '<option value="' . $option . '"' . ( $bb_option == $option ? ' selected' : '' ) . '>' .
            					$option . '</option>';
            			}
            
            			$return .= '</SELECT>';*/
            foreach ((array) $options as $option) {
                $options_with_keys[$option] = $option;
            }
            return SelectInput($value, 'cust[' . $field['COLUMN_NAME'] . ']', '', array('!' => _('No Value')) + $options_with_keys, 'N/A', 'style="max-width:250px;"', $div);
            break;
        case 'date':
            return '<small>' . _('Between') . '</small> ' . PrepareDate($value, '_cust_begin[' . $field['COLUMN_NAME'] . ']', true, array('short' => true, 'C' => false)) . ' <small>&amp;</small> ' . PrepareDate('', '_cust_end[' . $field['COLUMN_NAME'] . ']', true, array('short' => true, 'C' => false));
            break;
        case 'radio':
            /*return "<table clsss=cellpadding=0 cellspacing=0><tr><td width=30 align=center>
            		<input name='cust[{$field[COLUMN_NAME]}]' type='radio' value='Y'".(($_REQUEST['bottom_back']=='true' && $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']]=='Y')?' CHECKED':'')." /> Yes
            		</td><td width=25 align=center>
            		<input name='cust[{$field[COLUMN_NAME]}]' type='radio' value='N'".(($_REQUEST['bottom_back']=='true' && $_SESSION['_REQUEST_vars']['cust'][$field['COLUMN_NAME']])?' CHECKED':'')." /> No
            		</td></tr></table>";*/
            return RadioInput($value, 'cust[' . $field['COLUMN_NAME'] . ']', $title = '', array('Y' => _('Yes'), 'N' => _('No')), false, '', $div);
            break;
        case 'grade':
            $grades_RET = DBGet(DBQuery("SELECT DISTINCT TITLE,ID,SORT_ORDER\n\t\t\t\tFROM SCHOOL_GRADELEVELS\n\t\t\t\tWHERE SCHOOL_ID='" . UserSchool() . "'\n\t\t\t\tORDER BY SORT_ORDER"));
            /*$return = '<SELECT name="grade"><OPTION value=""></OPTION>';
            		foreach ($grades_RET as $grade)
            			$return .= "<OPTION value=" . $grade['ID'] . ">".$grade['TITLE'].'</OPTION>';
            		$return .= '</SELECT>';*/
            $grade_options = array();
            foreach ((array) $grades_RET as $grade) {
                $grade_options[$grade['ID']] = $grade['TITLE'];
            }
            return SelectInput('', 'grade', '', $grade_options, 'N/A', '', $div);
            break;
        case 'schools':
            return CheckboxInput('', '_search_all_schools', _('Search All Schools'), '', true);
            break;
        case 'timespan':
            $start_date = '01-' . mb_strtoupper(date('M-y'));
            $end_date = DBDate();
            return '<small>' . _('Between') . '</small> ' . PrepareDate($start_date, '_start', true, array('short' => true, 'C' => false)) . ' <small>&amp;</small> ' . PrepareDate($end_date, '_end', true, array('short' => true, 'C' => false));
            break;
            /*case 'test_no':
            
            			$select = SelectInput(
            				'',
            				'test_no[]',
            				'',
            				array(
            					'1' => 1,
            					'2' => 2,
            					'3' => 3,
            					'4' => 4,
            					'5' => 5,
            					'6' => 6,
            					'7' => 7,
            					'8' => 8,
            					'9' => 9,
            					'10' => 10,
            					'0' => _( 'Final' ),
            				),
            				'N/A',
            				'',
            				$div
            			);
            
            			$select = "<select name='test_no[]'>";
            			$vals = array('1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7,'8'=>8,'9'=>9,'10'=>10,'0'=>'Final');
            			$select .= '<OPTION value="">N/A</OPTION>';
            			foreach ($vals as $i=>$val)
            				$select .= "<OPTION value=$i>".$val.'</OPTION>';
            			$select .= '</SELECT>';
            
            			return '<small>' . _( 'Test Number' ) . '</small> ' . $select;
            
            		break;*/
        /*case 'test_no':
        
        			$select = SelectInput(
        				'',
        				'test_no[]',
        				'',
        				array(
        					'1' => 1,
        					'2' => 2,
        					'3' => 3,
        					'4' => 4,
        					'5' => 5,
        					'6' => 6,
        					'7' => 7,
        					'8' => 8,
        					'9' => 9,
        					'10' => 10,
        					'0' => _( 'Final' ),
        				),
        				'N/A',
        				'',
        				$div
        			);
        
        			$select = "<select name='test_no[]'>";
        			$vals = array('1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7,'8'=>8,'9'=>9,'10'=>10,'0'=>'Final');
        			$select .= '<OPTION value="">N/A</OPTION>';
        			foreach ($vals as $i=>$val)
        				$select .= "<OPTION value=$i>".$val.'</OPTION>';
        			$select .= '</SELECT>';
        
        			return '<small>' . _( 'Test Number' ) . '</small> ' . $select;
        
        		break;*/
        case 'other':
            return '<input type="text" name="' . $field['COLUMN_NAME'] . '" size="20" />';
            break;
    }
}
Example #3
0
     }
     echo " method=POST>";
     DrawHeader($title, $delete_button . '<INPUT type=submit value="' . _('Save') . '">');
     $header .= '<TABLE cellpadding=3 width=100%>';
     $header .= '<TR>';
     $header .= '<TD>' . TextInput($RET['TITLE'], 'tables[' . $_REQUEST['assignment_type_id'] . '][TITLE]', _('Title')) . '</TD>';
     if (Preferences('WEIGHT', 'Gradebook') == 'Y') {
         $header .= '<TD>' . TextInput($RET['FINAL_GRADE_PERCENT'], 'tables[' . $_REQUEST['assignment_type_id'] . '][FINAL_GRADE_PERCENT]', ($RET['FINAL_GRADE_PERCENT'] != 0 ? '' : '<FONT color=red>') . _('Percent of Final Grade') . ($RET['FINAL_GRADE_PERCENT'] != 0 ? '' : '</FONT>')) . '</TD>';
         $header .= '<TD>' . NoInput($RET['TOTAL_PERCENT'] == 1 ? '100%' : '<FONT COLOR=red>' . 100 * $RET['TOTAL_PERCENT'] . '%</FONT>', _('Percent Total')) . '</TD>';
     }
     $header .= '<TD>' . TextInput($RET['SORT_ORDER'], 'tables[' . $_REQUEST['assignment_type_id'] . '][SORT_ORDER]', _('Sort Order')) . '</TD>';
     $colors = array('#330099', '#3366FF', '#003333', '#FF3300', '#660000', '#666666', '#333366', '#336633', 'purple', 'teal', 'firebrick', 'tan');
     foreach ($colors as $color) {
         $color_select[$color] = array('<TABLE cellpadding=0 cellspacing=0 width=100% bgcolor=' . $color . '><TR><TD>&nbsp;</TD></TR></TABLE>', "<TABLE cellpadding=1 cellspacing=0 width=30><TR><TD bgcolor={$color}>&nbsp;</TD></TR></TABLE>");
     }
     $header .= '<TD>' . RadioInput($RET['COLOR'], 'tables[' . $_REQUEST['assignment_type_id'] . '][COLOR]', 'Color', $color_select) . '</TD>';
     $header .= '</TR>';
     $header .= '</TABLE>';
 } else {
     $header = false;
 }
 if ($header) {
     DrawHeader($header);
     echo '</FORM>';
 }
 // DISPLAY THE MENU
 $LO_options = array('save' => false, 'search' => false, 'add' => true);
 echo '<TABLE><TR>';
 if (count($types_RET)) {
     if ($_REQUEST['assignment_type_id']) {
         foreach ($types_RET as $key => $value) {
function makeColorInput($value, $name)
{
    global $THIS_RET;
    if ($THIS_RET['ID']) {
        $id = $THIS_RET['ID'];
    } else {
        $id = 'new';
    }
    $colors = array('#330099', '#3366FF', '#003333', '#FF3300', '#660000', '#666666', '#333366', '#336633', 'purple', 'teal', 'firebrick', 'tan');
    foreach ($colors as $color) {
        $color_select[$color] = array('<TABLE class="cellpadding-0 cellspacing-0"><TR><TD style="width:100%; background-color:' . $color . '">&nbsp;</TD></TR></TABLE>', '<TABLE class="cellpadding-0 cellspacing-0"><TR><TD style="background-color:' . $color . '; width:30px">&nbsp;</TD></TR></TABLE>');
    }
    return RadioInput($value, "values[{$id}][{$name}]", '', $color_select);
}