Example #1
0
function ParseMLArray($array, $keys)
{
    foreach ($array as $k => $v) {
        if (is_array($v)) {
            $array[$k] = ParseMLArray($v, $keys);
        } else {
            if (!is_array($keys)) {
                $keys = array($keys);
            }
            foreach ($keys as $key) {
                if ($k == $key) {
                    $array[$k] = ParseMLField($v);
                }
            }
        }
    }
    return $array;
}
Example #2
0
function DrawRoundedRect($title, $link = '', $tabcolor = '#333366', $textcolor = '#FFFFFF', $type = '', $rollover = '')
{
    if (substr($title, 0, 1) != '<') {
        $title = preg_replace("/ /", "&nbsp;", $title);
    }
    if (!$tabcolor) {
        $tabcolor = Preferences('HEADER');
    }
    $block_table .= "<table border=0 cellspacing=0 cellpadding=0>";
    $block_table .= "  <tr style='background-color:{$tabcolor}' id=tab[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]>";
    $block_table .= "    <td height=5 width=5 valign=top><IMG SRC=assets/left_upper_corner.gif border=0></td><td rowspan=3 width=100% class=\"BoxHeading\" valign=middle>";
    if ($link) {
        if (is_array($rollover)) {
            $rollover = " onmouseover=\"document.getElementById('tab[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]').style.backgroundColor='" . $rollover['tabcolor'] . "';document.getElementById('tab_link[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]').style.color='" . $rollover['textcolor'] . "';\" onmouseout=\"document.getElementById('tab[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]').style.backgroundColor='{$tabcolor}';document.getElementById('tab_link[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]').style.color='" . $textcolor . "';\" ";
        }
        if (!isset($_REQUEST['_CENTRE_PDF'])) {
            $block_table .= "<A HREF='{$link}' class=BoxHeading style='color:{$textcolor}' {$rollover} id=tab_link[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]>" . ParseMLField($title) . "</A>";
        } else {
            $block_table .= "<font color={$textcolor} face=Verdana,Arial,sans-serif size=-2><b>" . ParseMLField($title) . "</b></font>";
        }
    } else {
        if (!isset($_REQUEST['_CENTRE_PDF'])) {
            $block_table .= "<font color={$textcolor}>" . ParseMLField($title) . "</font>";
        } else {
            $block_table .= "<font color={$textcolor} face=Verdana,Arial,sans-serif size=-2><b>" . ParseMLField($title) . "</b></font>";
        }
    }
    $block_table .= "</td><td height=5 width=5 valign=top><IMG SRC=assets/right_upper_corner.gif border=0></td>";
    $block_table .= "  </tr>";
    // MIDDLE ROW
    $block_table .= "  <tr style='background-color:{$tabcolor}' id=tab[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]>";
    $block_table .= "    <td width=5>&nbsp;</td>";
    $block_table .= "<td width=5>&nbsp;</td>";
    $block_table .= "  </tr>";
    // BOTTOM ROW
    $block_table .= "  <tr style='background-color:{$tabcolor}' id=tab[" . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . "]>";
    $block_table .= "    <td height=5 width=5 valign=bottom><IMG SRC=assets/left_lower_corner.gif border=0></td>";
    $block_table .= "<td height=5 width=5 valign=bottom><IMG SRC=assets/right_lower_corner.gif border=0></td>";
    $block_table .= "  </tr>";
    $block_table .= "</table>\n";
    return $block_table;
}
Example #3
0
function DrawTab($title, $link = '')
{
    $title = ParseMLField($title);
    if (mb_substr($title, 0, 1) != '<') {
        $title = str_replace(" ", "&nbsp;", $title);
    }
    /*	if(!$tabcolor)
    		$tabcolor = Preferences('HEADER');*/
    //modif Francois: css WPadmin
    if ($link && !isset($_REQUEST['_ROSARIO_PDF'])) {
        $block_table .= '<h3><A HREF="' . $link . '" class="BoxHeading" id="tab_link[' . preg_replace('/[^a-zA-Z0-9]/', '_', $link) . ']">' . _($title) . '</A></h3>';
    } else {
        if (!isset($_REQUEST['_ROSARIO_PDF'])) {
            $block_table .= '<h3>' . $title . '</h3>';
        } else {
            $block_table .= '<span class="size-1" style="color:' . Preferences('HIGHLIGHT') . '"><b>' . $title . '</b>&nbsp;</span>';
        }
    }
    return $block_table;
}
Example #4
0
             }
             echo SelectInput('', 'values[EXISTING][person_id]', _('Select Person'), $people_select);
         }
     } elseif ($_REQUEST['address_id'] != '0' && $_REQUEST['address_id'] != 'new' && $_REQUEST['address_id'] != 'old') {
         $categories_RET = DBGet(DBQuery("SELECT c.ID AS CATEGORY_ID,c.TITLE AS CATEGORY_TITLE,c.RESIDENCE,c.MAILING,c.BUS,f.ID,f.TITLE,f.TYPE,f.SELECT_OPTIONS,f.DEFAULT_SELECTION,f.REQUIRED FROM ADDRESS_FIELD_CATEGORIES c,ADDRESS_FIELDS f WHERE f.CATEGORY_ID=c.ID ORDER BY c.SORT_ORDER,c.TITLE,f.SORT_ORDER,f.TITLE"), array(), array('CATEGORY_ID'));
         if ($categories_RET) {
             echo '<TD style="width:10px; border:1; border-style: none dotted none none;">&nbsp;</TD><TD style="width:10px;"></TD>';
             echo '<TD class="valign-top">';
             $value = DBGet(DBQuery("SELECT * FROM ADDRESS WHERE ADDRESS_ID='{$_REQUEST['address_id']}'"));
             $value = $value[1];
             $request = 'values[ADDRESS]';
             echo '<TABLE>';
             foreach ($categories_RET as $fields_RET) {
                 if (!$fields_RET[1]['RESIDENCE'] && !$fields_RET[1]['MAILING'] && !$fields_RET[1]['BUS'] || $fields_RET[1]['RESIDENCE'] == 'Y' && $this_address['RESIDENCE'] == 'Y' || $fields_RET[1]['MAILING'] == 'Y' && $this_address['MAILING'] == 'Y' || $fields_RET[1]['BUS'] == 'Y' && ($this_address['BUS_PICKUP'] == 'Y' || $this_address['BUS_DROPOFF'] == 'Y')) {
                     echo '<TR><TD>';
                     echo '<FIELDSET><LEGEND><span style="color:gray">' . ParseMLField($fields_RET[1]['CATEGORY_TITLE']) . '</span></LEGEND>';
                     include 'modules/Students/includes/Other_Fields.inc.php';
                     echo '</FIELDSET>';
                     echo '</TD></TR>';
                 }
             }
             echo '</TABLE>';
         }
     }
     echo '</TD>';
 } else {
     echo '<TD></TD><TD></TD>';
 }
 echo '</TR>';
 echo '</TABLE>';
 $separator = '<HR>';
Example #5
0
                     $categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM STUDENT_FIELD_CATEGORIES ORDER BY SORT_ORDER,TITLE"));
                     foreach ($categories_RET as $category) {
                         $file = 'Students/Student.php&category_id=' . $category['ID'];
                         $title = ' &nbsp; &nbsp; &rsaquo; ' . ParseMLField($category['TITLE']);
                         $can_use = $exceptions_RET[$file][1]['CAN_USE'];
                         $can_edit = $exceptions_RET[$file][1]['CAN_EDIT'];
                         echo "<TR><TD></TD><TD></TD>";
                         echo "<TD align=center bgcolor=#DDDDDD><INPUT type=checkbox name=can_use[" . str_replace('.', '_', $file) . "] value=true" . ($can_use == 'Y' ? ' CHECKED' : '') . (AllowEdit() ? '' : ' DISABLED') . "></TD>";
                         echo "<TD align=center bgcolor=#DDDDDD><INPUT type=checkbox name=can_edit[" . str_replace('.', '_', $file) . "] value=true" . ($can_edit == 'Y' ? ' CHECKED' : '') . (AllowEdit() ? '' : ' DISABLED') . "></TD>";
                         echo "<TD bgcolor=#DDDDDD> &nbsp; &nbsp;{$title}</TD></TR><TR><TD></TD><TD></TD><TD colspan=3 height=1 bgcolor=#000000></TR>";
                     }
                 } elseif ($modcat == 'Users' && $file == 'Users/User.php') {
                     $categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM STAFF_FIELD_CATEGORIES ORDER BY SORT_ORDER,TITLE"));
                     foreach ($categories_RET as $category) {
                         $file = 'Users/User.php&category_id=' . $category['ID'];
                         $title = ' &nbsp; &nbsp; &rsaquo; ' . ParseMLField($category['TITLE']);
                         $can_use = $exceptions_RET[$file][1]['CAN_USE'];
                         $can_edit = $exceptions_RET[$file][1]['CAN_EDIT'];
                         echo "<TR><TD></TD><TD></TD>";
                         echo "<TD align=center bgcolor=#DDDDDD><INPUT type=checkbox name=can_use[" . str_replace('.', '_', $file) . "] value=true" . ($can_use == 'Y' ? ' CHECKED' : '') . (AllowEdit() ? '' : ' DISABLED') . "></TD>";
                         echo "<TD align=center bgcolor=#DDDDDD><INPUT type=checkbox name=can_edit[" . str_replace('.', '_', $file) . "] value=true" . ($can_edit == 'Y' ? ' CHECKED' : '') . (AllowEdit() ? '' : ' DISABLED') . "></TD>";
                         echo "<TD bgcolor=#DDDDDD> &nbsp; &nbsp;{$title}</TD></TR><TR><TD></TD><TD></TD><TD colspan=3 height=1 bgcolor=#000000></TR>";
                     }
                 }
             } else {
                 echo '<TR><TD></TD><TD></TD><TD bgcolor=#FFFFFF colspan=3 align=center><small><b>- ' . $title . ' -</b></small></TD></TR>';
             }
         }
     }
     echo '<TR><TD colspan=5 align=center height=20></TD></TR>';
 }
Example #6
0
             foreach ($calendars_RET as $calendar) {
                 $options[$calendar['CALENDAR_ID']] = $calendar['TITLE'];
             }
         }
         echo _makeSelectInput('CALENDAR_ID', $options);
         echo '</TD>';
         echo '</TR>';
     }
     echo '</TABLE>';
     echo '<BR>';
     $radio_count = count($fields_RET['radio']);
     if ($radio_count) {
         echo '<TABLE cellpadding=5>';
         echo '<TR>';
         for ($i = 1; $i <= $radio_count; $i++) {
             echo '<TD>' . _makeCheckboxInput('CUSTOM_' . $fields_RET['radio'][$i]['ID'], '<b>' . ParseMLField($fields_RET['radio'][$i]['TITLE']) . '</b>') . '</TD>';
             if ($i % 5 == 0 && $i != $radio_count) {
                 echo '</TR><TR>';
             }
         }
         echo '</TD></TR>';
         echo '</TABLE>';
     }
     echo '</TD></TR>';
     echo '</TABLE><BR>';
 } elseif ($note) {
     DrawHeader($note);
 }
 //Widgets('activity');
 //Widgets('course');
 //Widgets('absences');
							xaxis: {
								renderer: $.jqplot.CategoryAxisRenderer,
								ticks: ticks,
								tickRenderer: $.jqplot.CanvasAxisTickRenderer,
								tickOptions:{
									angle:-20
								}
							},
						},
						legend: {
							show: true,
							location: 'e',
							placement: 'outside'
						},     
						title: '<?php 
            echo ParseMLField($category_RET[1]['TITLE']) . ' ' . _('Breakdown') . $_ROSARIO['SearchTerms'];
            ?>
'
					});
				});		
			</script>
			<div id="chart" style="margin-top:20px; margin-left:20px; width:600px; height:480px;"></div>
			<script type="text/javascript" src="assets/js/colorbox/jquery.colorbox-min.js"></script>
			<link rel="stylesheet" href="assets/js/colorbox/colorbox.css" type="text/css" media="screen" />
			<script type="text/javascript" src="assets/js/jquery.jqplottocolorbox.js"></script>
<?php 
            unset($_REQUEST['_ROSARIO_PDF']);
        }
        PopTable('footer');
    }
    echo '</FORM>';
function ListOutput($result, $column_names, $singular = '.', $plural = '.', $link = false, $group = array(), $options = array())
{
    global $_ROSARIO;
    if (!isset($options['save'])) {
        $options['save'] = '1';
    }
    if (!isset($options['print'])) {
        $options['print'] = true;
    }
    if (!isset($options['search'])) {
        $options['search'] = true;
    }
    if (!isset($options['center'])) {
        $options['center'] = true;
    }
    if (!isset($options['count'])) {
        $options['count'] = true;
    }
    if (!isset($options['sort'])) {
        $options['sort'] = true;
    }
    /*if(!isset($options['cellpadding']))
    		$options['cellpadding'] = '6';*/
    if (!isset($options['header_color'])) {
        $options['header_color'] = Preferences('HEADER');
    }
    if (!$link) {
        $link = array();
    }
    if (!isset($options['add'])) {
        if (!AllowEdit() || isset($_REQUEST['_ROSARIO_PDF'])) {
            if ($link) {
                unset($link['add']);
                unset($link['remove']);
            }
        }
    }
    // PREPARE LINKS ---
    $result_count = $display_count = count($result);
    $num_displayed = 100000;
    $extra = 'page=' . (isset($_REQUEST['page']) ? $_REQUEST['page'] : '') . '&amp;LO_sort=' . (isset($_REQUEST['LO_sort']) ? $_REQUEST['LO_sort'] : '') . '&amp;LO_direction=' . (isset($_REQUEST['LO_direction']) ? $_REQUEST['LO_direction'] : '') . '&amp;LO_search=' . (isset($_REQUEST['LO_search']) ? urlencode($_REQUEST['LO_search']) : '');
    $PHP_tmp_SELF = PreparePHP_SELF($_REQUEST, array('page', 'LO_sort', 'LO_direction', 'LO_search', 'LO_save', 'remove_prompt', 'remove_name', 'PHPSESSID'));
    // END PREPARE LINKS ---
    // UN-GROUPING
    if (!is_array($group)) {
        $group_count = false;
    } else {
        $group_count = count($group);
    }
    if ($group_count && $result_count) {
        $group_result = $result;
        unset($result);
        $result[0] = '';
        foreach ($group_result as $item1) {
            $i = 0;
            foreach ($item1 as $item2) {
                if ($group_count == 1) {
                    $i++;
                    if (count($group[0]) && $i != 1) {
                        //modif Francois: fix error Warning: Invalid argument supplied for foreach()
                        //						foreach($group[0] as $column)
                        $group[0] = $column;
                        $item2[$column] = str_replace('<!-- <!--', '<!--', '<!-- ' . str_replace('-->', '--><!--', $item2[$column])) . ' -->&nbsp;';
                    }
                    $result[] = $item2;
                } else {
                    foreach ($item2 as $item3) {
                        if ($group_count == 2) {
                            $i++;
                            if (count($group[0]) && $i != 1) {
                                //modif Francois: fix error Warning: Invalid argument supplied for foreach()
                                //						foreach($group[0] as $column)
                                $group[0] = $column;
                                $item3[$column] = '<!-- ' . $item3[$column] . ' -->';
                            }
                            if (count($group[1]) && $i != 1) {
                                //modif Francois: fix error Warning: Invalid argument supplied for foreach()
                                //								foreach($group[1] as $column)
                                $group[1] = $column;
                                $item3[$column] = '<!-- ' . $item3[$column] . ' -->';
                            }
                            //$item3['row_color'] = $color;
                            $result[] = $item3;
                        } else {
                            foreach ($item3 as $item4) {
                                if ($group_count == 3) {
                                    $i++;
                                    if (count($group[2]) && $i != 1) {
                                        //modif Francois: fix error Warning: Invalid argument supplied for foreach()
                                        //										foreach($group[2] as $column)
                                        $group[2] = $column;
                                        unset($item4[$column]);
                                    }
                                    //$item4['row_color'] = $color;
                                    $result[] = $item4;
                                }
                            }
                        }
                    }
                }
            }
            $i = 0;
        }
        unset($result[0]);
        $result_count = count($result);
        unset($_REQUEST['LO_sort']);
    }
    // END UN-GROUPING
    $_LIST['output'] = true;
    // PRINT HEADINGS, PREPARE PDF, AND SORT THE LIST ---
    if ($_LIST['output'] != false) {
        if ($result_count != 0) {
            $count = 0;
            if (isset($link['remove']['variables'])) {
                $remove = count($link['remove']['variables']);
            } else {
                $remove = 0;
            }
            $cols = count($column_names);
            // HANDLE SEARCHES ---
            //modif Francois: fix bug search when only saving
            //			if($result_count && $_REQUEST['LO_search'] && $_REQUEST['LO_search']!='Search')
            if ($result_count && !empty($_REQUEST['LO_search']) && $_REQUEST['LO_search'] != _('Search')) {
                //$_REQUEST['LO_search'] = $search_term = str_replace('\\\"','"',$_REQUEST['LO_search']);
                //$_REQUEST['LO_search'] = $search_term = preg_replace('/[^a-zA-Z0-9 _"]*/','',mb_strtolower($search_term));
                $search_term = str_replace("''", "'", $_REQUEST['LO_search']);
                if (mb_substr($search_term, 0, 1) != '"' && mb_substr($search_term, -1, 1) != '"') {
                    $search_term = str_replace('"', '', $search_term);
                    while ($space_pos = mb_strpos($search_term, ' ')) {
                        $terms[mb_strtolower(mb_substr($search_term, 0, $space_pos))] = 1;
                        $search_term = mb_substr($search_term, $space_pos + 1);
                    }
                    $terms[trim($search_term)] = 1;
                } else {
                    $search_term = str_replace('"', '', $search_term);
                    $terms[trim($search_term)] = 1;
                }
                /* TRANSLATORS: List of words ignored during search operations */
                foreach (explode(',', _('of, the, a, an, in')) as $word) {
                    unset($terms[trim($word)]);
                }
                foreach ($result as $key => $value) {
                    $values[$key] = 0;
                    foreach ($value as $name => $val) {
                        //$val = preg_replace('/[^a-zA-Z0-9 _]+/','',mb_strtolower($val));
                        //if(mb_strtolower($_REQUEST['LO_search'])==$val)
                        if ($search_term == $val) {
                            $values[$key] += 25;
                        }
                        foreach ($terms as $term => $one) {
                            //modif Francois: remove ereg
                            //							if(ereg($term,$val))
                            if (mb_strpos($val, $term) !== FALSE) {
                                $values[$key] += 3;
                            }
                        }
                    }
                    if ($values[$key] == 0) {
                        unset($values[$key]);
                        unset($result[$key]);
                        $result_count--;
                        $display_count--;
                    }
                }
                if ($result_count) {
                    array_multisort($values, SORT_DESC, $result);
                    $result = _ReindexResults($result);
                    $values = _ReindexResults($values);
                    $last_value = 1;
                    $scale = 100 / $values[$last_value];
                    for ($i = $last_value; $i <= $result_count; $i++) {
                        $result[$i]['RELEVANCE'] = '<!--' . (int) ($values[$i] * $scale) . '--><div class="PortalPollBar" style="width:' . (int) ($values[$i] * $scale) . 'px; height:12px; background-color:grey;">&nbsp;</div>';
                    }
                }
                $column_names['RELEVANCE'] = _('Relevance');
                if (is_array($group) && count($group)) {
                    $options['count'] == false;
                    $display_zero = true;
                }
            }
            // END SEARCHES ---
            if (!empty($_REQUEST['LO_sort'])) {
                foreach ($result as $sort) {
                    if (mb_substr($sort[$_REQUEST['LO_sort']], 0, 4) != '<!--') {
                        $sort_array[] = $sort[$_REQUEST['LO_sort']];
                    } else {
                        $sort_array[] = mb_substr($sort[$_REQUEST['LO_sort']], 4, mb_strpos($sort[$_REQUEST['LO_sort']], '-->') - 5);
                    }
                }
                if ($_REQUEST['LO_direction'] == -1) {
                    $dir = SORT_DESC;
                } else {
                    $dir = SORT_ASC;
                }
                if ($result_count > 1) {
                    if (is_int($sort_array[1]) || is_double($sort_array[1])) {
                        array_multisort($sort_array, $dir, SORT_NUMERIC, $result);
                    } else {
                        array_multisort($sort_array, $dir, $result);
                    }
                    for ($i = $result_count - 1; $i >= 0; $i--) {
                        $result[$i + 1] = $result[$i];
                    }
                    unset($result[0]);
                }
            }
        }
        // HANDLE SAVING THE LIST ---
        if ($options['save'] && $_REQUEST['LO_save'] == $options['save']) {
            if (!$options['save_delimiter'] && Preferences('DELIMITER') == 'CSV') {
                $options['save_delimiter'] = 'comma';
            }
            switch ($options['save_delimiter']) {
                case 'comma':
                    $extension = 'csv';
                    break;
                case 'xml':
                    $extension = 'xml';
                    break;
                default:
                    $extension = 'xls';
                    break;
            }
            ob_end_clean();
            if ($options['save_delimiter'] != 'xml') {
                foreach ($column_names as $key => $value) {
                    $value = ParseMLField($value);
                    if ($options['save_delimiter'] == 'comma' && !$options['save_quotes']) {
                        $value = str_replace(',', ';', $value);
                    }
                    $output .= ($options['save_quotes'] ? '"' : '') . str_replace('&nbsp;', ' ', str_replace('<BR />', ' ', preg_replace('/<!--.*-->/', '', $value))) . ($options['save_quotes'] ? '"' : '') . ($options['save_delimiter'] == 'comma' ? ',' : "\t");
                }
                $output .= "\n";
            }
            foreach ($result as $item) {
                foreach ($column_names as $key => $value) {
                    $value = $item[$key];
                    if ($options['save_delimiter'] == 'comma' && !$options['save_quotes']) {
                        $value = str_replace(',', ';', $value);
                    }
                    $value = preg_replace('!<SELECT.*SELECTED\\>([^<]+)<.*</SELECT\\>!i', '\\1', $value);
                    $value = preg_replace('!<SELECT.*</SELECT\\>!i', '', $value);
                    $output .= ($options['save_quotes'] ? '"' : '') . ($options['save_delimiter'] == 'xml' ? '<' . str_replace(' ', '', $value) . '>' : '') . preg_replace('/<[^>]+>/', '', preg_replace("/<div onclick='[^']+'>/", '', preg_replace('/ +/', ' ', preg_replace('/&[^;]+;/', '', str_replace('<BR />&middot;', ' : ', str_replace('&nbsp;', ' ', $value)))))) . ($options['save_delimiter'] == 'xml' ? '</' . str_replace(' ', '', $value) . '>' . "\n" : '') . ($options['save_quotes'] ? '"' : '') . ($options['save_delimiter'] == 'comma' ? ',' : "\t");
                }
                $output .= "\n";
            }
            //modif Francois: accents problem
            $output = utf8_decode($output);
            header("Cache-Control: public");
            header("Pragma: ");
            header("Content-Type: application/{$extension}");
            header("Content-Disposition: inline; filename=\"" . ProgramTitle() . ".{$extension}\"\n");
            if ($options['save_eval']) {
                eval($options['save_eval']);
            }
            echo $output;
            exit;
        }
        // END SAVING THE LIST ---
        if ($result_count > $num_displayed || ($options['count'] || $display_zero) && (($result_count == 0 || $display_count == 0) && $plural || ($result_count == 0 || $display_count == 0))) {
            echo '<TABLE';
            if (isset($_REQUEST['_ROSARIO_PDF'])) {
                echo ' class="width-100p"';
            }
            if ($options['center']) {
                echo ' style="margin:0 auto;"';
            }
            echo '><TR><TD class="center">';
        }
        if ($options['count'] || $display_zero) {
            if ($result_count == 0 || $display_count == 0) {
                //modif Francois: fix bug ngettext when the plural form is not registered as this in the rosario.po file
                //                echo "<b>".sprintf(_('No %s were found.'),ngettext($singular, $plural, 0))."</b> &nbsp; &nbsp;";
                $singular_message = ngettext($singular, $plural, 0);
                if ($singular_message == $singular) {
                    $singular_message = _($singular);
                }
                echo '<b>' . sprintf(_('No %s were found.'), $singular_message) . '</b> &nbsp; &nbsp;';
            }
        }
        if ($result_count != 0 || $_REQUEST['LO_search'] && $_REQUEST['LO_search'] != _('Search')) {
            if (!isset($_REQUEST['_ROSARIO_PDF'])) {
                if (empty($_REQUEST['page'])) {
                    $_REQUEST['page'] = 1;
                }
                if (empty($_REQUEST['LO_direction'])) {
                    $_REQUEST['LO_direction'] = 1;
                }
                $start = ($_REQUEST['page'] - 1) * $num_displayed + 1;
                $stop = $start + ($num_displayed - 1);
                if ($stop > $result_count) {
                    $stop = $result_count;
                }
                if ($result_count > $num_displayed) {
                    $where_message = "" . sprintf(_('Displaying %d through %d'), $start, $stop) . "";
                    if (ceil($result_count / $num_displayed) <= 10) {
                        for ($i = 1; $i <= ceil($result_count / $num_displayed); $i++) {
                            if ($i != $_REQUEST['page']) {
                                $pages .= '<A HREF="' . $PHP_tmp_SELF . '&amp;LO_sort=' . $_REQUEST['LO_sort'] . '&amp;LO_direction=' . $_REQUEST['LO_direction'] . '&amp;LO_search=' . urlencode($_REQUEST['LO_search']) . '&amp;page=' . $i . '">' . $i . '</A>, ';
                            } else {
                                $pages .= $i . ', ';
                            }
                        }
                        $pages = mb_substr($pages, 0, -2) . "<BR />";
                    } else {
                        for ($i = 1; $i <= 7; $i++) {
                            if ($i != $_REQUEST['page']) {
                                $pages .= '<A HREF="' . $PHP_tmp_SELF . '&amp;LO_sort=' . $_REQUEST['LO_sort'] . '&amp;LO_direction=' . $_REQUEST['LO_direction'] . '&amp;LO_search=' . urlencode($_REQUEST['LO_search']) . '&amp;page=' . $i . '">' . $i . '</A>, ';
                            } else {
                                $pages .= $i . ', ';
                            }
                        }
                        $pages = mb_substr($pages, 0, -2) . " ... ";
                        for ($i = ceil($result_count / $num_displayed) - 2; $i <= ceil($result_count / $num_displayed); $i++) {
                            if ($i != $_REQUEST['page']) {
                                $pages .= '<A HREF="' . $PHP_tmp_SELF . '&amp;LO_sort=' . $_REQUEST['LO_sort'] . '&amp;LO_direction=' . $_REQUEST['LO_direction'] . '&amp;LO_search=' . urlencode($_REQUEST['LO_search']) . '&amp;page=' . $i . '">' . $i . '</A>, ';
                            } else {
                                $pages .= $i . ', ';
                            }
                        }
                        $pages = mb_substr($pages, 0, -2) . ' &nbsp;<A HREF="' . $PHP_tmp_SELF . '&amp;LO_sort=' . $_REQUEST['LO_sort'] . '&amp;LO_direction=' . $_REQUEST['LO_direction'] . '&amp;LO_search=' . urlencode($_REQUEST['LO_search']) . '&amp;page=' . ($_REQUEST['page'] + 1) . '">' . _('Next Page') . '</A><BR />';
                    }
                    echo sprintf(_('Go to Page %s'), $pages);
                    echo '</TD></TR></TABLE>';
                    echo '<BR />';
                }
            } else {
                $start = 1;
                $stop = $result_count;
                if ($cols > 8 || $_REQUEST['expanded_view']) {
                    //modif Francois: wkhtmltopdf
                    $_SESSION['orientation'] = 'landscape';
                    //$repeat_headers = 17;
                    $repeat_headers = 16;
                } else {
                    //$repeat_headers = 28;
                    //modif Francois: wkhtmltopdf
                    //modif Francois: PrintClassLists with all contacts
                    if (isset($_ROSARIO['makeParents']) && empty($_ROSARIO['makeParents'])) {
                        if ($cols < 5) {
                            $repeat_headers = 28;
                        } else {
                            $repeat_headers = 17;
                        }
                    } else {
                        if ($cols < 5) {
                            $repeat_headers = 48;
                        } else {
                            $repeat_headers = 28;
                        }
                    }
                }
                if ($options['print']) {
                    //modif Francois: bug PDF
                    /*					$html = explode('<div style="page-break-after: always;"></div>',mb_strtolower(ob_get_contents()));
                    					$html = $html[count($html)-1];
                    					echo '</TD></TR></TABLE>';
                    					$br = (mb_substr_count($html,'<BR />')) + (mb_substr_count($html,'</p>')) + (mb_substr_count($html,'</tr>')) + (mb_substr_count($html,'</h1>')) + (mb_substr_count($html,'</h2>')) + (mb_substr_count($html,'</h3>')) + (mb_substr_count($html,'</h4>')) + (mb_substr_count($html,'</h5>'));
                    					if($br%2!=0)
                    					{
                    						$br++;
                    						echo '<BR />';
                    					}*/
                } else {
                    echo '</TD></TR></TABLE>';
                }
            }
            // END MISC ---
            // WIDTH = 100%
            echo '<TABLE class="width-100p cellspacing-0 cellpadding-0">';
            // SEARCH BOX & MORE HEADERS
            if (!empty($where_message) || $singular != '.' && $plural != '.' || !isset($_REQUEST['_ROSARIO_PDF']) && $options['search']) {
                echo '<TR><TD class="width-100p">';
                echo '<TABLE class="width-100p cellpadding-1">';
                echo '<TR><TD style="text-align:left;">';
                if ($singular != '.' && $plural != '.' && $options['count']) {
                    if ($display_count > 0) {
                        //modif Francois: fix bug ngettext when the plural form is not registered as this in the rosario.po file
                        //						echo "<b>".sprintf(ngettext('%d %s was found.','%d %s were found.', $display_count), $display_count, ngettext($singular, $plural, $display_count))."</b> &nbsp; &nbsp;";
                        $plural_message = ngettext($singular, $plural, $display_count);
                        if (($plural_message == $plural || $plural_message == _($singular) && $display_count != 1) && _($plural) != $plural) {
                            $plural_message = _($plural);
                            if ($display_count == 1) {
                                $plural_message = _($singular);
                            }
                        }
                        echo '<b>&nbsp;&nbsp;' . sprintf(ngettext('%d %s was found.', '%d %s were found.', $display_count), $display_count, $plural_message) . '</b>&nbsp; &nbsp;';
                    }
                    if (!empty($where_message)) {
                        echo '<BR />' . $where_message;
                    }
                }
                if ($options['save'] && !isset($_REQUEST['_ROSARIO_PDF']) && $result_count > 0) {
                    echo '<A HREF="' . $PHP_tmp_SELF . '&amp;' . $extra . '&amp;LO_save=' . $options['save'] . '&amp;_ROSARIO_PDF=true"><IMG SRC="assets/download.png" class="alignImg" title="' . _('Export list') . '" /></A>';
                }
                echo '</TD>';
                $colspan = 1;
                if (!isset($_REQUEST['_ROSARIO_PDF']) && $options['search']) {
                    echo '<TD style="text-align:right">';
                    echo '<INPUT type="text" id="LO_search" name="LO_search" value="' . str_replace("''", "'", $_REQUEST['LO_search']) . '" placeholder="' . _('Search') . '" onkeypress="if(event.keyCode==13 && this.value!=\'\'){document.location.href=\'' . PreparePHP_SELF($_REQUEST, array('LO_search', 'page')) . '&amp;LO_search=\'+this.value; return false;}" /><INPUT type="button" value="' . _('Go') . '" onclick="if(document.getElementById(\'LO_search\').value!=\'\'){document.location.href=\'' . PreparePHP_SELF($_REQUEST, array('LO_search', 'page')) . '&amp;LO_search=\'+document.getElementById(\'LO_search\').value;}" /></TD>';
                    $colspan++;
                }
                echo '</TR>';
                //modif Francois: remove LOx
                echo '</TABLE>';
            } else {
                echo '<TR style="height:0;"><TD class="width-100p" style="height:0; text-align:right;">&nbsp;';
            }
            // END SEARCH BOX ----
            echo '</TD></TR>';
            if (!empty($options['header'])) {
                echo '</TABLE><TABLE class="postbox width-100p cellspacing-0 cellpadding-0"><TR><TD class="center">' . $options['header'] . '</TD></TR>';
            }
            echo '<TR><TD style="padding: 8px;">';
            echo '<TABLE class="widefat width-100p cellspacing-0">';
            if (!isset($_REQUEST['_ROSARIO_PDF']) && $stop - $start > 10) {
                echo '<THEAD>';
            }
            if (!isset($_REQUEST['_ROSARIO_PDF'])) {
                echo '<TR>';
            }
            $i = 1;
            if ($remove && !isset($_REQUEST['_ROSARIO_PDF']) && $result_count != 0) {
                echo '<TH>&nbsp;</TH>';
                $i++;
            }
            if ($result_count != 0 && $cols && !isset($_REQUEST['_ROSARIO_PDF'])) {
                foreach ($column_names as $key => $value) {
                    if (isset($_REQUEST['LO_sort']) && $_REQUEST['LO_sort'] == $key) {
                        $direction = -1 * $_REQUEST['LO_direction'];
                    } else {
                        $direction = 1;
                    }
                    echo '<TH>';
                    echo '<A ';
                    if ($options['sort']) {
                        echo 'HREF="' . $PHP_tmp_SELF . '&amp;page=' . $_REQUEST['page'] . '&amp;LO_sort=' . $key . '&amp;LO_direction=' . $direction . '&amp;LO_search=' . urlencode(isset($_REQUEST['LO_search']) ? $_REQUEST['LO_search'] : '');
                    }
                    echo '">' . ParseMLField($value) . '</A>';
                    //modif Francois: remove LOy
                    echo '</TH>';
                    $i++;
                }
                echo '</TR>';
            }
            if (!isset($_REQUEST['_ROSARIO_PDF']) && $stop - $start > 10) {
                echo '</THEAD><TBODY>';
            }
            // mab - enable add link as first or last
            if ($result_count != 0 && isset($link['add']['first']) && $stop - $start + 1 >= $link['add']['first']) {
                if ($link['add']['link'] && !isset($_REQUEST['_ROSARIO_PDF'])) {
                    echo '<TR><TD colspan="' . ($remove ? $cols + 1 : $cols) . '" style="text-align:left;">' . button('add', $link['add']['title'], $link['add']['link']) . '</TD></TR>';
                } elseif ($link['add']['span'] && !isset($_REQUEST['_ROSARIO_PDF'])) {
                    echo '<TR><TD colspan="' . ($remove ? $cols + 1 : $cols) . '" style="text-align:left;">' . button('add') . $link['add']['span'] . '</TD></TR>';
                } elseif ($link['add']['html'] && $cols) {
                    echo '<TR>';
                    if ($remove && !isset($_REQUEST['_ROSARIO_PDF']) && $link['add']['html']['remove']) {
                        echo '<TD>' . $link['add']['html']['remove'] . '</TD>';
                    } elseif ($remove && !isset($_REQUEST['_ROSARIO_PDF'])) {
                        echo '<TD>' . button('add') . '</TD>';
                    }
                    foreach ($column_names as $key => $value) {
                        echo '<TD>' . $link['add']['html'][$key] . '</TD>';
                    }
                    echo '</TR>';
                    $count++;
                }
            }
            for ($i = $start; $i <= $stop; $i++) {
                $item = $result[$i];
                if (isset($_REQUEST['_ROSARIO_PDF']) && $options['print'] && count($item)) {
                    foreach ($item as $key => $value) {
                        $value = preg_replace('!<SELECT.*SELECTED\\>([^<]+)<.*</SELECT\\>!i', '\\1', $value);
                        $value = preg_replace('!<SELECT.*</SELECT\\>!i', '', $value);
                        $item[$key] = preg_replace("/<div onclick=[^']+'>/", '', $value);
                    }
                }
                if (!empty($item['row_color'])) {
                    $color = $item['row_color'];
                } else {
                    $color = '';
                }
                if (isset($_REQUEST['_ROSARIO_PDF']) && $count % $repeat_headers == 0) {
                    if ($count != 0) {
                        //modif Francois: wkhtmltopdf New page
                        echo '</TABLE><div style="page-break-after: always;"></div><TABLE class="widefat width-100p cellspacing-0">';
                        echo '<div style="page-break-after: always;"></div>';
                    }
                    echo '<TR>';
                    if ($cols) {
                        foreach ($column_names as $key => $value) {
                            echo '<TD style="background-color:' . $options['header_color'] . '"><span style="color:#FFFFFF" class="size-1"><b>' . ParseMLField($value) . '</b></span></TD>';
                        }
                    }
                    echo '</TR>';
                }
                echo '<TR>';
                $count++;
                if ($remove && !isset($_REQUEST['_ROSARIO_PDF'])) {
                    $button_title = $link['remove']['title'];
                    $button_link = $link['remove']['link'];
                    if (count($link['remove']['variables'])) {
                        foreach ($link['remove']['variables'] as $var => $val) {
                            $button_link .= "&{$var}=" . urlencode($item[$val]);
                        }
                    }
                    echo '<TD>' . button('remove', $button_title, '"' . $button_link . '"') . '</TD>';
                }
                if ($cols) {
                    foreach ($column_names as $key => $value) {
                        if (!empty($link[$key]) && $item[$key] !== false && !isset($_REQUEST['_ROSARIO_PDF'])) {
                            if ($color == Preferences('HIGHLIGHT')) {
                                echo '<TD class="highlight">';
                            } else {
                                echo '<TD>';
                            }
                            if (!empty($link[$key]['js'])) {
                                echo "<A HREF=\"#\" onclick='window.open(\"{$link[$key][link]}";
                                if (count($link[$key]['variables'])) {
                                    foreach ($link[$key]['variables'] as $var => $val) {
                                        echo "&{$var}=" . urlencode($item[$val]);
                                    }
                                }
                                echo "\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'";
                                if ($link[$key]['extra']) {
                                    echo ' ' . $link[$key]['extra'];
                                }
                                echo ">";
                            } else {
                                echo '<A HREF="' . $link[$key]['link'];
                                if (count($link[$key]['variables'])) {
                                    foreach ($link[$key]['variables'] as $var => $val) {
                                        echo '&' . $var . '=' . urlencode($item[$val]);
                                    }
                                }
                                echo '"';
                                if (!empty($link[$key]['extra'])) {
                                    echo ' ' . $link[$key]['extra'];
                                }
                                echo '>';
                            }
                            echo $item[$key];
                            if (!$item[$key]) {
                                echo '***';
                            }
                            echo '</A>';
                            echo '</TD>';
                        } else {
                            if ($color == Preferences('HIGHLIGHT')) {
                                echo '<TD class="highlight">';
                            } else {
                                echo '<TD>';
                            }
                            echo $item[$key];
                            if (!$item[$key]) {
                                echo '&nbsp;';
                            }
                            echo '</TD>';
                        }
                    }
                }
                echo '</TR>';
            }
            if ($result_count != 0 && (!isset($link['add']['first']) || $stop - $start + 1 < $link['add']['first'])) {
                //if($remove && !isset($_REQUEST['_ROSARIO_PDF']))
                //	$cols++;
                if (isset($link['add']['link']) && !isset($_REQUEST['_ROSARIO_PDF'])) {
                    echo '<TR><TD colspan="' . ($remove ? $cols + 1 : $cols) . '" style="text-align:left;">' . button('add', $link['add']['title'], $link['add']['link']) . '</TD></TR>';
                } elseif (isset($link['add']['span']) && !isset($_REQUEST['_ROSARIO_PDF'])) {
                    echo '<TR><TD colspan="' . ($remove ? $cols + 1 : $cols) . '" style="text-align:left;">' . button('add') . $link['add']['span'] . '</TD></TR>';
                } elseif (isset($link['add']['html']) && $cols) {
                    echo '<TR>';
                    if ($remove && !isset($_REQUEST['_ROSARIO_PDF']) && $link['add']['html']['remove']) {
                        echo '<TD>' . $link['add']['html']['remove'] . '</TD>';
                    } elseif ($remove && !isset($_REQUEST['_ROSARIO_PDF'])) {
                        echo '<TD>' . button('add') . '</TD>';
                    }
                    foreach ($column_names as $key => $value) {
                        echo '<TD>' . $link['add']['html'][$key] . '</TD>';
                    }
                    echo '</TR>';
                }
            }
            if ($result_count != 0) {
                if (!isset($_REQUEST['_ROSARIO_PDF']) && $stop - $start > 10) {
                    echo '</TBODY>';
                }
                echo '</TABLE>';
                echo '</TD></TR></TABLE>';
            }
            // END PRINT THE LIST ---
        }
        if ($result_count == 0) {
            // mab - problem with table closing if not opened above - do same conditional?
            if ($result_count > $num_displayed || ($options['count'] || $display_zero) && (($result_count == 0 || $display_count == 0) && $plural || ($result_count == 0 || $display_count == 0))) {
                echo '</TD></TR></TABLE>';
            }
            if ($options['header']) {
                echo '<TABLE class="postbox width-100p cellspacing-0 cellpadding-0"><TR><TD class="center">' . $options['header'] . '</TD></TR><TR><TD style="padding: 8px;">';
            }
            if ($link['add']['link'] && !isset($_REQUEST['_ROSARIO_PDF'])) {
                echo '<span class="center">' . button('add', $link['add']['title'], $link['add']['link']) . '</span></TD></TR></TABLE>';
            } elseif (($link['add']['html'] || $link['add']['span']) && count($column_names) && !isset($_REQUEST['_ROSARIO_PDF'])) {
                //$color = $side_color;
                // WIDTH=100%
                //modif Francois: css WPadmin
                if ($link['add']['html']) {
                    echo '<TABLE class="widefat width-100p cellspacing-0"';
                    if ($options['center']) {
                        echo ' style="margin:0 auto;"';
                    }
                    echo '><TR><TH>&nbsp;</TH>';
                    foreach ($column_names as $key => $value) {
                        echo '<TH>' . str_replace(' ', '&nbsp;', $value) . '</TH>';
                    }
                    echo '</TR>';
                    echo '<TR>';
                    if ($link['add']['html']['remove']) {
                        echo '<TD>' . $link['add']['html']['remove'] . '</TD>';
                    } else {
                        echo '<TD>' . button('add') . '</TD>';
                    }
                    foreach ($column_names as $key => $value) {
                        echo '<TD>' . $link['add']['html'][$key] . '</TD>';
                    }
                    echo '</TR>';
                    echo '</TABLE>';
                } elseif ($link['add']['span'] && !isset($_REQUEST['_ROSARIO_PDF'])) {
                    echo '<TABLE class="postbox"';
                    if ($options['center']) {
                        echo ' style="margin:0 auto;"';
                    }
                    echo '><TR><TD style="text-align:left;">' . button('add') . $link['add']['span'] . '</TD></TR></TABLE>';
                }
            }
            if ($options['header']) {
                echo '</TD></TR></TABLE>';
            }
        }
        if ($result_count != 0) {
            //modif Francois: remove LO
            /*			if($options['yscroll'])
            			{
            				echo '<div id="LOy_layer" style="position: absolute; top: 0; left: 0; visibility:hidden;">';
            				echo "<TABLE cellpadding=$options[cellpadding] id=LOy_table>";
            				$i = 1;
            
            				if($cols && !isset($_REQUEST['_ROSARIO_PDF']))
            				{
            					$color = $side_color;
            					foreach($result as $item)
            					{
            						echo "<TR><TD bgcolor=$color id=LO_row$i>";
            						if($color==Preferences('HIGHLIGHT'))
            							echo '<span style="color:white>';
            						echo $item['FULL_NAME'];
            						if(!$item['FULL_NAME'])
            							echo '&nbsp;';
            						if($color==Preferences('HIGHLIGHT'))
            							echo '</span>';
            						echo '</TD></TR>';
            						$i++;
            
            						if($item['row_color'])
            							$color = $item['row_color'];
            						elseif($color=='#ececec')
            							$color = $side_color;
            						else
            							$color = '#ececec';
            					}
            				}
            				echo '</TABLE>';
            				echo '</div>';
            			}
            */
            //modif Francois: remove LO
            /*echo '<div id="LOx_layer" style="position: absolute; top: 0; left: 0; visibility:hidden;">';
            			echo "<TABLE cellpadding=$options[cellpadding] id=LOx_table><TR>";
            			$i = 1;
            			if($remove && !isset($_REQUEST['_ROSARIO_PDF']) && $result_count!=0)
            			{
            				echo "<TD bgcolor=$options[header_color] id=LO_col$i></TD>";
            				$i++;
            			}
            
            			if($cols && !isset($_REQUEST['_ROSARIO_PDF']))
            			{
            				foreach($column_names as $key=>$value)
            				{
            					echo "<TD bgcolor=".($options['header_colors'][$key]?$options['header_colors'][$key]:$options['header_color'])." id=LO_col$i><A class=column_heading><b>".str_replace('controller','',$value).'</b></A></TD>';
            					$i++;
            				}
            			}
            			echo '</TR></TABLE>';
            			echo '</div>';*/
        }
    }
}
Example #9
0
    $handle = PDFStart();
    echo '<TABLE><TR><TD><IMG SRC="assets/themes/' . Preferences('THEME') . '/logo.png" /></TD><TD><h1>' . sprintf(_('%s Handbook'), $title) . '<BR />' . sprintf(_('version %s'), '1.0') . '</h1></TD></TR></TABLE><HR>';
    foreach ($help as $program => $value) {
        if (mb_strpos($program, '/')) {
            $modcat = str_replace('_', ' ', mb_substr($program, 0, mb_strpos($program, '/')));
            if (!$RosarioModules[str_replace(' ', '_', $modcat)]) {
                //module not activated
                break;
            }
            if ($modcat != $old_modcat) {
                echo '<div style="page-break-after: always;"></div><TABLE><TR><TD><IMG SRC="assets/icons/' . str_replace(' ', '_', $modcat) . '.png" class="headerIcon" /></TD><TD><h2>' . $modcat . '</h2></TD></TR></TABLE><HR>';
            }
            $old_modcat = $modcat;
        }
        $_REQUEST['modname'] = $program;
        echo '<h3>';
        if ($program == 'default') {
            echo ParseMLField(Config('TITLE')) . ' - ' . sprintf(_('%s Handbook'), $title) . '<BR />' . sprintf(_('version %s'), '1.0');
        } else {
            echo ProgramTitle() == 'RosarioSIS' ? str_replace(' ', '_', $program) : ProgramTitle();
        }
        echo '</h3>';
        echo '<TABLE class="width-100p cellpadding-5"><TR><TD class="header2">';
        if ($student == true) {
            $value = str_replace('your child', 'yourself', str_replace('your child\'s', 'your', $value));
        }
        echo $value;
        echo '</TD></TR></TABLE><BR />';
    }
    PDFStop($handle);
}
}
if (empty($_REQUEST['modfunc'])) {
    if (!empty($note)) {
        echo ErrorMessage($note, 'note');
    }
    if (!empty($error)) {
        echo ErrorMessage($error, 'error');
    }
    echo '<FORM ACTION="Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=update" METHOD="POST">';
    if (AllowEdit()) {
        DrawHeader('', SubmitButton(_('Save')));
    }
    echo '<BR />';
    PopTable('header', SchoolInfo('TITLE'));
    $program_config = DBGet(DBQuery("SELECT * FROM PROGRAM_CONFIG WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'"), array(), array('TITLE'));
    echo '<FIELDSET><legend><b>' . ParseMLField(Config('TITLE')) . '</b></legend><TABLE>';
    echo '<TR style="text-align:left;"><TD>' . MLTextInput(Config('TITLE'), 'values[CONFIG][TITLE]', _('Program Title'), 'required') . '</TD></TR>';
    echo '</TABLE></FIELDSET>';
    echo '<BR /><FIELDSET><legend><b>' . _('School') . '</b></legend><TABLE>';
    //modif Francois: school year over one/two calendar years format
    echo '<TR style="text-align:left;"><TD>' . CheckboxInput(Config('SCHOOL_SYEAR_OVER_2_YEARS'), 'values[CONFIG][SCHOOL_SYEAR_OVER_2_YEARS]', _('School year over two calendar years'), '', false, '<img src="assets/check.png" height="15" />&nbsp;', '<img src="assets/x.png" height="15" />&nbsp;') . '</TD></TR>';
    echo '</TABLE></FIELDSET>';
    echo '<BR /><FIELDSET><legend><b>' . _('Students') . '</b></legend><TABLE>';
    echo '<TR style="text-align:left;"><TD>' . CheckboxInput(Config('STUDENTS_USE_MAILING'), 'values[CONFIG][STUDENTS_USE_MAILING]', _('Display Mailing Address'), '', false, '<img src="assets/check.png" height="15" />&nbsp;', '<img src="assets/x.png" height="15" />&nbsp;') . '</TD></TR>';
    echo '<TR style="text-align:left;"><TD>' . CheckboxInput($program_config['STUDENTS_USE_BUS'][1]['VALUE'], 'values[PROGRAM_CONFIG][STUDENTS_USE_BUS]', _('Check Bus Pickup / Dropoff by default'), '', false, '<img src="assets/check.png" height="15" />&nbsp;', '<img src="assets/x.png" height="15" />&nbsp;') . '</TD></TR>';
    echo '<TR style="text-align:left;"><TD>' . CheckboxInput($program_config['STUDENTS_USE_CONTACT'][1]['VALUE'], 'values[PROGRAM_CONFIG][STUDENTS_USE_CONTACT]', _('Enable Legacy Contact Information'), '', false, '<img src="assets/check.png" height="15" />&nbsp;', '<img src="assets/x.png" height="15" />&nbsp;') . '</TD></TR>';
    echo '<TR style="text-align:left;"><TD>' . CheckboxInput($program_config['STUDENTS_SEMESTER_COMMENTS'][1]['VALUE'], 'values[PROGRAM_CONFIG][STUDENTS_SEMESTER_COMMENTS]', _('Use Semester Comments instead of Quarter Comments'), '', false, '<img src="assets/check.png" height="15" />&nbsp;', '<img src="assets/x.png" height="15" />&nbsp;') . '</TD></TR>';
    echo '</TABLE></FIELDSET>';
    echo '<BR /><FIELDSET><legend><b>' . _('Grades') . '</b></legend><TABLE>';
    $options = array('-1' => _('Use letter grades only'), '0' => _('Use letter and percent grades'), '1' => _('Use percent grades only'));
    echo '<TR style="text-align:left;"><TD>' . SelectInput($program_config['GRADES_DOES_LETTER_PERCENT'][1]['VALUE'], 'values[PROGRAM_CONFIG][GRADES_DOES_LETTER_PERCENT]', _('Grades'), $options, false) . '</TD></TR>';
function printCustom(&$categories, &$values)
{
    echo '<TR><TD colspan="3"><b>' . ParseMLField($categories[1]['CATEGORY_TITLE']) . '<b></TD></TR>';
    foreach ($categories as $field) {
        echo '<TR><TD>&nbsp;</TD>';
        echo '<TD>' . ($field['REQUIRED'] && $values['CUSTOM_' . $field['ID']] == '' ? '<span style="color:red">' : '') . ParseMLField($field['TITLE']) . ($field['REQUIRED'] && $values['CUSTOM_' . $field['ID']] == '' ? '</span>' : '') . '</TD>';
        if ($field['TYPE'] == 'select') {
            echo '<TD>' . ($field['SELECT_OPTIONS'][$values['CUSTOM_' . $field['ID']]] != '' ? '' : '<span style="color:red">') . $values['CUSTOM_' . $field['ID']] . ($field['SELECT_OPTIONS'][$values['CUSTOM_' . $field['ID']]] != '' ? '' : '</span>') . '</TD>';
        } elseif ($field['TYPE'] == 'codeds') {
            echo '<TD>' . ($field['SELECT_OPTIONS'][$values['CUSTOM_' . $field['ID']]] != '' ? $field['SELECT_OPTIONS'][$values['CUSTOM_' . $field['ID']]] : '<span style="color:red">' . $values['CUSTOM_' . $field['ID']] . '</span>') . '</TD>';
        } else {
            echo '<TD>' . $values['CUSTOM_' . $field['ID']] . '</TD>';
        }
        echo '</TR>';
    }
}
 // If $test email is set then this script will only 'go through the motions' and email the results to the $test_email address instead of parents
 $test_email = $_REQUEST['test_email'];
 // Set the from and cc emails here - the emails can be comma separated list of emails.
 if (!empty($test_email)) {
     $from = $test_email;
 } elseif (User('EMAIL')) {
     $from = $cc = User('EMAIL');
 } else {
     ErrorMessage(array(_('You must set the <b>test mode email</b> or have a user email address to use this script.')), 'fatal');
 }
 $headers = "From:" . $from . "\r\nCc:" . (isset($cc) ? $cc . ',' : '') . $RosarioNotifyAddress . "\r\n";
 //modif Francois: add email headers
 $headers .= 'Return-Path:' . $from . "\r\n";
 $headers .= 'Reply-To:' . $from . "\r\n" . 'X-Mailer:PHP/' . phpversion();
 $params = '-f ' . $from;
 $subject = ParseMLField(Config('TITLE')) . ' - ' . _('New Parent Account');
 //modif Francois: add Template
 $template_update = DBGet(DBQuery("SELECT 1 FROM TEMPLATES WHERE MODNAME = 'Custom/NotifyParents.php' AND STAFF_ID = '" . User('STAFF_ID') . "'"));
 if (!$template_update) {
     DBQuery("INSERT INTO TEMPLATES (MODNAME, STAFF_ID, TEMPLATE) VALUES ('Custom/NotifyParents.php', '" . User('STAFF_ID') . "', '" . $_REQUEST['inputnotifyparentstext'] . "')");
 } else {
     DBQuery("UPDATE TEMPLATES SET TEMPLATE = '" . $_REQUEST['inputnotifyparentstext'] . "' WHERE MODNAME = 'Custom/NotifyParents.php' AND STAFF_ID = '" . User('STAFF_ID') . "'");
 }
 $message = $_REQUEST['inputnotifyparentstext'];
 if (count($_REQUEST['staff'])) {
     $st_list = '\'' . implode('\',\'', $_REQUEST['staff']) . '\'';
     $extra['SELECT'] = ",s.FIRST_NAME||' '||s.LAST_NAME AS NAME,s.USERNAME,s.PASSWORD,s.EMAIL";
     $extra['WHERE'] = " AND s.STAFF_ID IN ({$st_list})";
     $RET = GetStaffList($extra);
     //echo '<pre>'; var_dump($RET); echo '</pre>';
     $RESULT = array(0 => array());
Example #13
0
     $extra['extra_header_left'] = '<TABLE>';
     Widgets('mailing_labels');
     $extra['extra_header_left'] .= $extra['search'];
     $extra['search'] = '';
     $extra['extra_header_left'] .= '</TABLE>';
     if (User('PROFILE_ID')) {
         $can_use_RET = DBGet(DBQuery("SELECT MODNAME FROM PROFILE_EXCEPTIONS WHERE PROFILE_ID='" . User('PROFILE_ID') . "' AND CAN_USE='Y'"), array(), array('MODNAME'));
     } else {
         $can_use_RET = DBGet(DBQuery("SELECT MODNAME FROM STAFF_EXCEPTIONS WHERE USER_ID='" . User('STAFF_ID') . "' AND CAN_USE='Y'"), array(), array('MODNAME'));
     }
     $categories_RET = DBGet(DBQuery("SELECT ID,TITLE,INCLUDE FROM STUDENT_FIELD_CATEGORIES ORDER BY SORT_ORDER,TITLE"));
     $extra['extra_header_right'] = '<TABLE>';
     foreach ($categories_RET as $category) {
         if ($can_use_RET['Students/Student.php&category_id=' . $category['ID']]) {
             $extra['extra_header_right'] .= '<TR><TD><INPUT type=checkbox name=category[' . $category['ID'] . '] value=Y checked></TD>';
             $extra['extra_header_right'] .= '<TD>' . ParseMLField($category['TITLE']) . '</TD></TR>';
         }
     }
     $extra['extra_header_right'] .= '</TABLE>';
 }
 $extra['link'] = array('FULL_NAME' => false);
 $extra['SELECT'] = ",s.STUDENT_ID AS CHECKBOX";
 $extra['functions'] = array('CHECKBOX' => '_makeChooseCheckbox');
 $extra['columns_before'] = array('CHECKBOX' => '</A><INPUT type=checkbox value=Y name=controller checked onclick="checkAll(this.form,this.form.controller.checked,\'st_arr\');"><A>');
 $extra['options']['search'] = false;
 $extra['new'] = true;
 //Widgets('course');
 //Widgets('request');
 //Widgets('activity');
 //Widgets('absences');
 //Widgets('gpa');
 if (!empty($test_email)) {
     $from = $test_email;
 } elseif (User('EMAIL')) {
     $from = $cc = User('EMAIL');
 } else {
     ErrorMessage(array(_('You must set the <b>test mode email</b> or have a user email address to use this script.')), 'fatal');
 }
 $headers = "From:" . $from . "\r\nCc:" . (isset($cc) ? $cc . ',' : '') . $RosarioNotifyAddress . "\r\n";
 //modif Francois: add email headers
 $headers .= 'Return-Path:' . $from . "\r\n";
 $headers .= 'Reply-To:' . $from . "\r\n" . 'X-Mailer:PHP/' . phpversion();
 $params = '-f ' . $from;
 // new for when parent account was created new
 // old for when parent account was existing
 $subject['new'] = ParseMLField(Config('TITLE')) . ' ' . _('New Parent Account');
 $subject['old'] = ParseMLField(Config('TITLE')) . ' ' . _('Updated Parent Account');
 //modif Francois: add Template
 $createparentstext = $_REQUEST['inputcreateparentstext_new'] . '__BLOCK2__' . $_REQUEST['inputcreateparentstext_old'];
 $template_update = DBGet(DBQuery("SELECT 1 FROM TEMPLATES WHERE MODNAME = 'Custom/CreateParents.php' AND STAFF_ID = '" . User('STAFF_ID') . "'"));
 if (!$template_update) {
     DBQuery("INSERT INTO TEMPLATES (MODNAME, STAFF_ID, TEMPLATE) VALUES ('Custom/CreateParents.php', '" . User('STAFF_ID') . "', '" . $createparentstext . "')");
 } else {
     DBQuery("UPDATE TEMPLATES SET TEMPLATE = '" . $createparentstext . "' WHERE MODNAME = 'Custom/CreateParents.php' AND STAFF_ID = '" . User('STAFF_ID') . "'");
 }
 $message['new'] = $_REQUEST['inputcreateparentstext_new'];
 $message['old'] = $_REQUEST['inputcreateparentstext_old'];
 if (count($_REQUEST['student'])) {
     $st_list = '\'' . implode('\',\'', $_REQUEST['student']) . '\'';
     $extra['SELECT'] = ",lower({$email_column}) AS EMAIL";
     $extra['SELECT'] .= ",(SELECT STAFF_ID FROM STAFF WHERE lower(EMAIL)=lower({$email_column}) AND PROFILE='parent' AND SYEAR=ssm.SYEAR) AS STAFF_ID";
     $extra['WHERE'] = " AND s.STUDENT_ID IN ({$st_list})";
Example #15
0
            }
        }
    }
    if ($_REQUEST['values']['STUDENTS']) {
        $sql = "UPDATE STUDENTS SET ";
        foreach ($_REQUEST['values']['STUDENTS'] as $column_name => $value) {
            $sql .= "{$column_name}='" . $value . "',";
        }
        $sql = mb_substr($sql, 0, -1) . " WHERE STUDENT_ID='" . UserStudentID() . "'";
        DBQuery($sql);
    }
    $student = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME FROM STUDENTS WHERE STUDENT_ID='" . UserStudentID() . "'"));
    mail('*****@*****.**', sprintf(_('New Registration %s %s (%d) has been registered by %s.'), $student[1]['FIRST_NAME'], $student[1]['LAST_NAME'], UserStudentID(), User('NAME')));
    unset($_SESSION['_REQUEST_vars']['values']);
}
echo '<H4>Welcome, ' . User('NAME') . ', to the ' . ParseMLField(Config('TITLE')) . '</H4>';
$addresses = DBGet(DBQuery("SELECT COUNT(*) AS COUNT FROM STUDENTS_JOIN_ADDRESS WHERE STUDENT_ID='" . UserStudentID() . "'"));
echo '' . _('We would appreciate it if you would enter just a little bit of information about you and your child to help us out this school year. Thanks!') . '';
if ($addresses[1]['COUNT'] != 0) {
    echo '<BR /><BR /><IMG SRC="assets/check.png" class="alignImg"><b>' . _('Your child has been registered.') . '</b>';
}
echo '<BR /><BR /><TABLE><TR><TD class="valign-top">';
echo '<B>' . Localize('colon', _('Information about you')) . '</B><BR /><BR />';
echo '<TABLE class="cellpadding-3"><TR><TD>';
echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST" onsubmit=\'for(i=0;i<document.forms[0].elements.length;i++){if(document.forms[0].elements[i].style.color=="rgb(187, 187, 187)" || document.forms[0].elements[i].style.color=="#bbbbbb") document.forms[0].elements[i].value="";}\'>';
echo _makeInput('values[PEOPLE][1][FIRST_NAME]', _('First Name'));
echo _makeInput('values[PEOPLE][1][LAST_NAME]', _('Last Name'));
echo '<BR />' . _makeInput('values[PEOPLE][1][extra][Cell]', _('Cell Phone'), '', 'size=30');
echo '<BR />' . _makeInput('values[PEOPLE][1][extra][Workplace]', _('Workplace'), '', 'size=30');
echo '</TD></TR></TABLE>';
echo '</TD><TD>';
Example #16
0
 $QI = DBQuery($sql);
 $categories_RET = DBGet($QI);
 if (AllowEdit() && $_REQUEST['id'] != 'new' && $_REQUEST['category_id'] != 'new' && ($_REQUEST['id'] || $_REQUEST['category_id'] > 2)) {
     $delete_button = '<INPUT type="button" value="' . _('Delete') . '" onClick="javascript:window.location=\'Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=delete&category_id=' . $_REQUEST['category_id'] . '&id=' . $_REQUEST['id'] . '\'" />';
 }
 // ADDING & EDITING FORM
 if ($_REQUEST['id'] && $_REQUEST['id'] != 'new') {
     $sql = "SELECT CATEGORY_ID,TITLE,TYPE,SELECT_OPTIONS,DEFAULT_SELECTION,SORT_ORDER,REQUIRED,REQUIRED,(SELECT TITLE FROM STAFF_FIELD_CATEGORIES WHERE ID=CATEGORY_ID) AS CATEGORY_TITLE FROM STAFF_FIELDS WHERE ID='{$_REQUEST['id']}'";
     $RET = DBGet(DBQuery($sql));
     $RET = $RET[1];
     $title = ParseMLField($RET['CATEGORY_TITLE']) . ' - ' . ParseMLField($RET['TITLE']);
 } elseif ($_REQUEST['category_id'] && $_REQUEST['category_id'] != 'new' && $_REQUEST['id'] != 'new') {
     $sql = "SELECT TITLE,ADMIN,TEACHER,PARENT,NONE,SORT_ORDER,INCLUDE,COLUMNS\n\t\t\t\tFROM STAFF_FIELD_CATEGORIES\n\t\t\t\tWHERE ID='{$_REQUEST['category_id']}'";
     $RET = DBGet(DBQuery($sql));
     $RET = $RET[1];
     $title = ParseMLField($RET['TITLE']);
 } elseif ($_REQUEST['id'] == 'new') {
     $title = _('New User Field');
 } elseif ($_REQUEST['category_id'] == 'new') {
     $title = _('New User Field Category');
 }
 if ($_REQUEST['id']) {
     echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&category_id=' . $_REQUEST['category_id'];
     if ($_REQUEST['id'] != 'new') {
         echo '&id=' . $_REQUEST['id'];
     }
     echo '&table=STAFF_FIELDS" method="POST">';
     DrawHeader($title, $delete_button . SubmitButton(_('Save')));
     $header .= '<TABLE class="width-100p cellpadding-3">';
     $header .= '<TR>';
     //modif Francois: field name required
Example #17
0
function db_show_error($sql, $failnote, $additional = '')
{
    global $RosarioVersion, $RosarioNotifyAddress;
    echo '<BR />';
    PopTable('header', _('We have a problem, please contact technical support ...'));
    // TRANSLATION: do NOT translate these since error messages need to stay in English for technical support
    echo '
		<TABLE style="border-collapse:separate; border-spacing:10px;">
		<TR>
			<TD style="text-align:right"><b>Date:</b></TD>
			<TD><pre>' . date("m/d/Y h:i:s") . '</pre></TD>
		</TR><TR>
			<TD style="text-align:right"><b>Failure Notice:</b></TD>
			<TD><pre> ' . $failnote . ' </pre></TD>
		</TR><TR>
			<TD style="text-align:right"><b>Additional Information:</b></TD>
			<TD>' . $additional . '</TD>
		</TR>
		</TABLE>';
    //Something you have asked the system to do has thrown a database error.  A system administrator has been notified, and the problem will be fixed as soon as possible.  It might be that changing the input parameters sent to this program will cause it to run properly.  Thanks for your patience.
    PopTable('footer');
    echo "<!-- SQL STATEMENT: \n\n {$sql} \n\n -->";
    if ($RosarioNotifyAddress) {
        $message = "System: " . ParseMLField(Config('TITLE')) . " \n";
        $message .= "Date: " . date("m/d/Y h:i:s") . "\n";
        $message .= "Page: " . $_SERVER['PHP_SELF'] . ' ' . ProgramTitle() . " \n\n";
        $message .= "Failure Notice:  {$failnote} \n";
        $message .= "Additional Info: {$additional} \n";
        $message .= "\n {$sql} \n";
        $message .= "Request Array: \n" . print_r($_REQUEST, true);
        $message .= "\n\nSession Array: \n" . print_r($_SESSION, true);
        //modif Francois: add email headers
        $headers = 'From:' . $RosarioNotifyAddress . "\r\n";
        $headers .= 'Return-Path:' . $RosarioNotifyAddress . "\r\n";
        $headers .= 'Reply-To:' . $RosarioNotifyAddress . "\r\n" . 'X-Mailer: PHP/' . phpversion();
        $params = '-f ' . $RosarioNotifyAddress;
        mail($RosarioNotifyAddress, 'Rosario Database Error', utf8_decode($message), $headers, $params);
    }
    die;
}
Example #18
0
// DebugBreak();
if (!UserSyear()) {
    $_SESSION['UserSyear'] = Config('SYEAR');
}
$_ROSARIO['HeaderIcon'] = 'rosario.png';
//modif Francois: icones Educons
//DrawHeader(ParseMLField(Config('TITLE')),'RosarioSIS v.'.$RosarioVersion);
DrawHeader(ParseMLField(Config('TITLE')));
DrawHeader('<script type="text/javascript">
var currentTime = new Date();
var hours = currentTime.getHours();
if (hours < 12) document.write("' . sprintf(_('Good Morning, %s.'), User('NAME')) . '");
else if (hours < 18) document.write("' . sprintf(_('Good Afternoon, %s.'), User('NAME')) . '");
else document.write("' . sprintf(_('Good Evening, %s.'), User('NAME')) . '");</script>');
$welcome = sprintf(_('Welcome to %s!'), ParseMLField(Config('TITLE')));
if ($_SESSION['LAST_LOGIN']) {
    $welcome .= '<BR />&nbsp;' . sprintf(_('Your last login was <b>%s</b>.'), ProperDate(mb_substr($_SESSION['LAST_LOGIN'], 0, 10)) . mb_substr($_SESSION['LAST_LOGIN'], 10));
}
if ($_REQUEST['failed_login']) {
    //modif Francois: css WPadmin add class error for all Warning! of this file
    //	$welcome .= '<BR />&nbsp;<span style="color:red"><b>'._('Warning!').'</b></span>&nbsp;'.sprintf(_('There have been <b>%d</b> failed login attempts since your last successful login.'),$_REQUEST['failed_login']);
    $welcome .= '<BR /><div class="error"><p><IMG SRC="assets/x.png" class="alignImg">&nbsp;<span style="color:red"><b>' . _('Warning!') . '</b></span>&nbsp;' . sprintf(_('There have been <b>%d</b> failed login attempts since your last successful login.'), $_REQUEST['failed_login']) . '</p></div>';
}
switch (User('PROFILE')) {
    case 'admin':
        //DrawHeader($welcome.'<BR />&nbsp;'._('You are an <b>Administrator</b> on the system.<BR />').PHPCheck().versionCheck());
        DrawHeader($welcome . '<BR />&nbsp;' . _('You are an <b>Administrator</b> on the system.') . '<BR />' . PHPCheck());
        //modif Francois: Discipline new referrals alert
        if (AllowUse('Discipline/Referrals.php') && User('LAST_LOGIN')) {
            $extra = array();
Example #19
0
?>
" <?php 
echo mb_substr($locale, 0, 2) == 'he' || mb_substr($locale, 0, 2) == 'ar' ? ' dir="RTL"' : '';
?>
>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="assets/themes/<?php 
echo Preferences('THEME');
?>
/stylesheet.css" />
<?php 
echo $addJavascripts;
?>
<title><?php 
echo ParseMLField(Config('TITLE'));
?>
</title>
</head>
<BODY <?php 
echo $_REQUEST['modcat'] ? 'onload="openMenu(\'' . $_REQUEST['modcat'] . '\');" ' : '';
?>
class="bgcolor">
<div id="adminmenushadow"></div>
<?php 
// User Information
echo '<TABLE class="width-100p cellspacing-0 cellpadding-0"><TR><TD>';
echo '<A HREF="index.php" target="_top"><img src="assets/themes/' . Preferences('THEME') . '/logo.png" id="SideLogo" /></A>';
echo '</TD></TR><TR>';
//modif Francois: strftime for locale date date('l F j, Y')
echo '<TD class="width-100p valign-top">
Example #20
0
             }
             echo SelectInput('', 'values[EXISTING][person_id]', _('Select Person'), $people_select);
         }
     } elseif ($_REQUEST['address_id'] != '0' && $_REQUEST['address_id'] != 'new' && $_REQUEST['address_id'] != 'old') {
         $categories_RET = DBGet(DBQuery("SELECT c.ID AS CATEGORY_ID,c.TITLE AS CATEGORY_TITLE,c.RESIDENCE,c.MAILING,c.BUS,f.ID,f.TITLE,f.TYPE,f.SELECT_OPTIONS,f.DEFAULT_SELECTION,f.REQUIRED FROM ADDRESS_FIELD_CATEGORIES c,ADDRESS_FIELDS f WHERE f.CATEGORY_ID=c.ID ORDER BY c.SORT_ORDER,c.TITLE,f.SORT_ORDER,f.TITLE"), array(), array('CATEGORY_ID'));
         if ($categories_RET) {
             echo '<TD width=10 style="border:1; border-style: none dotted none none;">&nbsp;</TD><TD width=10></TD>';
             echo '<TD valign=top>';
             $value = DBGet(DBQuery("SELECT * FROM ADDRESS WHERE ADDRESS_ID='{$_REQUEST['address_id']}'"));
             $value = $value[1];
             $request = 'values[ADDRESS]';
             echo '<TABLE>';
             foreach ($categories_RET as $fields_RET) {
                 if (!$fields_RET[1]['RESIDENCE'] && !$fields_RET[1]['MAILING'] && !$fields_RET[1]['BUS'] || $fields_RET[1]['RESIDENCE'] == 'Y' && $this_address['RESIDENCE'] == 'Y' || $fields_RET[1]['MAILING'] == 'Y' && $this_address['MAILING'] == 'Y' || $fields_RET[1]['BUS'] == 'Y' && ($this_address['BUS_PICKUP'] == 'Y' || $this_address['BUS_DROPOFF'] == 'Y')) {
                     echo '<TR><TD>';
                     echo '<FIELDSET><LEGEND><FONT color=gray>' . ParseMLField($fields_RET[1]['CATEGORY_TITLE']) . '</FONT></LEGEND>';
                     include 'modules/Students/includes/Other_Fields.inc.php';
                     echo '</FIELDSET>';
                     echo '</TD></TR>';
                 }
             }
             echo '</TABLE>';
         }
     }
     echo '</TD>';
 } else {
     echo '<TD></TD><TD></TD>';
 }
 echo '</TR>';
 echo '</TABLE>';
 $separator = '<HR>';
 $attendance_RET = DBGet(DBQuery("SELECT trim(leading '0' from to_char(ap.SCHOOL_DATE,'MM')) AS MON,trim(leading '0' from to_char(ap.SCHOOL_DATE,'DD')) AS DAY,ac.STATE_CODE,ac.SHORT_NAME FROM ATTENDANCE_PERIOD ap,ATTENDANCE_CODES ac,SCHOOL_PERIODS sp WHERE ap.STUDENT_ID='" . $student['STUDENT_ID'] . "' AND ap.PERIOD_ID=sp.PERIOD_ID AND sp.SCHOOL_ID='" . UserSchool() . "' AND sp.SYEAR='" . UserSyear() . "' AND ac.ID=ap.ATTENDANCE_CODE AND sp.ATTENDANCE='Y'"), array(), array('MON', 'DAY'));
 //echo '<pre>'; var_dump($calendar_RET); echo '</pre>';
 echo '<TABLE class="width-100p">';
 echo '<TR><TD class="width-100p center">';
 echo '<TABLE style="width:96%">';
 echo '<TR><TD class="width-100p center">';
 echo '<span class="sizep2"><B>' . $student['FULL_NAME'] . '</B></span>';
 echo '</TD><TR>';
 echo '</TABLE>';
 echo '<TABLE style="width:96%; border: solid 1px">';
 echo '<TR class="center"><TD><B>' . _('Student Name') . '</B></TD><TD><B>ID#</B></TD><TD><B>' . _('School') . ' / ' . _('Year') . '</B></TD></TR>';
 //modif Francois: school year over one/two calendar years format
 echo '<TR><TD class="center">' . $student['FULL_NAME'] . '</TD><TD class="center">' . $student['STUDENT_ID'] . '</TD><TD class="center">' . $school_RET[1]['TITLE'] . ' / ' . FormatSyear(UserSyear(), Config('SCHOOL_SYEAR_OVER_2_YEARS')) . '</TD></TR>';
 echo '<TR><TD colspan="3"><span class="sizep1"><B>' . _('Demographics') . '</B></span><TABLE style="width:98%; margin:0 auto;" class="cellpadding-0 cellspacing-0">';
 echo '<TR><TD style="text-align:right">' . ParseMLField($custom_RET[200000000][1]['TITLE']) . ':&nbsp;</TD><TD>' . $student['CUSTOM_200000000'] . '</TD><TD style="text-align:right">' . _('Status') . ':&nbsp;</TD><TD>' . _($student['STATUS']) . '</TD></TR>';
 echo '<TR><TD style="text-align:right">' . ParseMLField($custom_RET[200000003][1]['TITLE']) . ':&nbsp;</TD><TD>' . $student['CUSTOM_200000003'] . '</TD><TD style="text-align:right">' . _('Grade Level') . ':&nbsp;</TD><TD>' . $student['GRADE_ID'] . '</TD></TR>';
 echo '</TABLE></TD></TR>';
 echo '<TR><TD colspan="3"><span class="sizep1"><B>' . _('Attendance') . '</B></span><TABLE style="width:98%; border:solid 1px; margin:0 auto;" class="cellpadding-0 cellspacing-0">';
 echo '<TR class="center"><TD colspan="32"></TD><TD colspan="3"><B>' . _('MTD') . '</B></TD></TR>';
 /* TRANSLATORS: Abreviation for month */
 echo '<TR class="center"><TD><B>' . mb_substr(_('Month'), 0, 3) . '</B></TD>';
 for ($day = 1; $day <= 31; $day++) {
     echo '<TD><B>' . ($day < 10 ? '&nbsp;' : '') . $day . '</B></TD>';
 }
 /* TRANSLATORS: Abreviations for Absences, Tardy and Position */
 echo '<TD><B>' . _('Abs') . '</B><TD><B>' . _('Tdy') . '</B><TD><B>' . _('Pos') . '</B></TD></TR>';
 $abs_tot = $tdy_tot = $pos_tot = 0;
 $FY_dates = DBGet(DBQuery("SELECT START_DATE,END_DATE FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
 $first_month = explode('-', $FY_dates[1]['START_DATE']);
 $first_month = (int) $first_month[1];
 $last_month = explode('-', $FY_dates[1]['END_DATE']);
    $text = '<input type="text" name="textcell_id" size="20" placeholder="' . _('Title') . '" required />';
    $calculations_RET = DBGet(DBQuery("SELECT ID,TITLE\n\t\tFROM SAVED_CALCULATIONS\n\t\tORDER BY TITLE"));
    $calculations_options = array();
    foreach ((array) $calculations_RET as $calculation) {
        $calculations_options[$calculation['ID']] = $calculation['TITLE'];
    }
    $calculation_select = SelectInput('', 'calculationcell_id', '', $calculations_options, dgettext('Reports', 'Calculation'), 'required style="width:' . ($width - 7) . ';"');
    $birthdate_RET = DBGet(DBQuery("SELECT 1\n\t\tFROM CUSTOM_FIELDS\n\t\tWHERE TYPE='date'\n\t\tAND ID='200000004'"));
    $fields_RET = DBGet(DBQuery("SELECT ID,TITLE\n\t\tFROM CUSTOM_FIELDS\n\t\tWHERE TYPE='select'\n\t\tORDER BY TITLE"));
    $breakdown_options = array('school' => _('School'), 'grade' => _('Grade Level'), 'stuid' => sprintf(_('%s ID'), Config('NAME')));
    // Check Birthdate original field exists and is DATE.
    if ($birthdate_RET) {
        $breakdown_options['age'] = _('Age');
    }
    foreach ((array) $fields_RET as $field) {
        $breakdown_options['CUSTOM_' . $field['ID']] = ParseMLField($field['TITLE'], $locale);
    }
    $breakdown = SelectInput('', 'breakdowncell_id', '', $breakdown_options, dgettext('Reports', 'Breakdown'), 'style="max-width:150px;"');
    $graph = CheckboxInput('', 'graphcell_id', dgettext('Reports', 'Graph Results'), '', true);
    echo '<form action="Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=run" method="GET">';
    DrawHeader('', SubmitButton(_('Go')));
    echo '<div id="main_div" style="position: relative; height: 1000px;">';
    echo '<div id="add_col" style="position:absolute;top:' . ($top_offset + 15) . 'px;left:' . ($left_offset + 15 + $width) . 'px;">' . button('add', dgettext('Reports', 'Add Column'), '# onclick="addCol();"') . '</div>';
    echo '<div id="add_row" style="position:absolute;top:' . ($top_offset + 15 + $height) . 'px;left:' . ($left_offset + 15) . 'px;">' . button('add', dgettext('Reports', 'Add Row'), '# onclick="addRow();"') . '</div>';
    echo '</div></form>';
    echo '<div id="new_cell" style="position:absolute;display:none;">
		<div div_id="cellcell_id" style="position:absolute;width:' . $width . 'px;height:' . $height . 'px;top:9876px;left:6789px;padding:5px;border-style:solid solid solid solid;border-width:1px;background-color:#fff;">' . $text . '<br />' . $calculation_select . '<br />' . $breakdown . '<br />' . $graph . '</div>';
    echo '<script>addCell(1,1);</script>';
}
/**
 * Run Calculation
                echo '</TR>';
            } else {
                echo '<TD style="width:50px;"></TD>';
            }
            $i++;
            break;
    }
}
if (($i - 1) % $per_row != 0) {
    echo '</TR>';
}
echo '</TABLE><BR />';
echo '<TABLE class="cellpadding-5">';
$i = 1;
foreach ($fields_RET as $field) {
    $field['TITLE'] = ParseMLField($field['TITLE']);
    if ($field['TYPE'] == 'textarea') {
        if (($i - 1) % 2 == 0) {
            echo '<TR>';
        }
        echo '<TD>';
        echo _makeTextareaInput('CUSTOM_' . $field['ID'], $field['TITLE'], 'staff');
        echo '</TD>';
        if ($i % 2 == 0) {
            echo '</TR>';
        } else {
            echo '<TD style="width:50px;"></TD>';
        }
        $i++;
    }
}
Example #24
0
 $students_RET = GetStuList($extra);
 $LO_columns += array('FULL_NAME' => _('Student'), 'STUDENT_ID' => _('RosarioSIS ID'), 'GRADE_ID' => _('Grade Level'));
 $LO_columns += array('CUSTOM_200000000' => _('Gender'), 'CUSTOM_200000001' => _('Ethnicity'));
 //modif Francois: disable mailing address display
 if (Config('STUDENTS_USE_MAILING')) {
     $LO_columns += array('ADDRESS' => _('Street'), 'CITY' => _('City'), 'STATE' => _('State'), 'ZIPCODE' => _('Zipcode'), 'PHONE' => _('Phone'), 'MAIL_ADDRESS' => _('Mailing Street'), 'MAIL_CITY' => _('Mailing City'), 'MAIL_STATE' => _('Mailing State'), 'MAIL_ZIPCODE' => _('Mailing Zipcode'));
 } else {
     $LO_columns += array('ADDRESS' => _('Street'), 'CITY' => _('City'), 'STATE' => _('State'), 'ZIPCODE' => _('Zipcode'), 'PHONE' => _('Phone'));
 }
 foreach ($address_fields_RET as $field) {
     //modif Francois: add translation
     $LO_columns += array('ADDRESS_' . $field['ID'] => ParseMLField($field['TITLE']));
 }
 $LO_columns += array('PERSON_NAME' => _('Person Name'));
 foreach ($people_fields_RET as $field) {
     $LO_columns += array('PEOPLE_' . $field['ID'] => ParseMLField($field['TITLE']));
 }
 for ($i = 1; $i <= $maxTV; $i++) {
     $LO_columns += array('TITLE_' . $i => _('Title') . ' ' . $i, 'VALUE_' . $i => _('Value') . ' ' . $i);
 }
 DrawHeader($header_left);
 DrawHeader(str_replace('<BR />', '<BR /> &nbsp;', mb_substr($_ROSARIO['SearchTerms'], 0, -6)));
 if (!$_REQUEST['LO_save']) {
     $_SESSION['List_PHP_SELF'] = PreparePHP_SELF($_SESSION['_REQUEST_vars'], array('bottom_back'));
     if ($_SESSION['Back_PHP_SELF'] != 'student') {
         $_SESSION['Back_PHP_SELF'] = 'student';
         unset($_SESSION['Search_PHP_SELF']);
     }
     echo '<script type="text/javascript">parent.help.location.reload();</script>';
 }
 ListOutput($students_RET, $LO_columns, 'Student', 'Students', false, $LO_group);
}
$date_note = $date != DBDate() ? ' <span style="color:red">' . _('The selected date is not today') . '</span> |' : '';
$date_note .= AllowEdit() ? ' <span style="color:green">' . _('You can edit this attendance') . '</span>' : ' <span style="color:red">' . _('You cannot edit this attendance') . '</span>';
$completed_RET = DBGet(DBQuery("SELECT 'Y' as COMPLETED FROM ATTENDANCE_COMPLETED WHERE STAFF_ID='" . User('STAFF_ID') . "' AND SCHOOL_DATE='{$date}' AND PERIOD_ID='" . UserPeriod() . "' AND TABLE_NAME='" . $_REQUEST['table'] . "'"));
if (count($completed_RET)) {
    $note = ErrorMessage(array('<IMG SRC="assets/check.png" class="alignImg" />&nbsp;' . _('You already have taken attendance today for this period.')), 'note');
}
echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&table=' . $_REQUEST['table'] . '" method="POST">';
DrawHeader(PrepareDate($date, '_date', false, array('submit' => true)) . $date_note, SubmitButton(_('Save')));
//DrawHeader($note);
echo $note;
$LO_columns = array('FULL_NAME' => _('Student'), 'STUDENT_ID' => _('RosarioSIS ID'), 'GRADE_ID' => _('Grade Level')) + $columns;
//$tabs[] = array('title'=>'Attendance','link'=>"Modules.php?modname=$_REQUEST[modname]&table=0&month_date=$_REQUEST[month_date]&day_date=$_REQUEST[day_date]&year_date=$_REQUEST[year_date]");
//$categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'"));
foreach ($categories_RET as $category) {
    $tabs[] = array('title' => ParseMLField($category['TITLE']), 'link' => "Modules.php?modname={$_REQUEST['modname']}&table={$category['ID']}&month_date={$_REQUEST['month_date']}&day_date={$_REQUEST['day_date']}&year_date={$_REQUEST['year_date']}");
}
echo '<BR />';
if (count($categories_RET)) {
    $LO_options = array('download' => false, 'search' => false, 'header' => WrapTabs($tabs, "Modules.php?modname={$_REQUEST['modname']}&table={$_REQUEST['table']}&month_date={$_REQUEST['month_date']}&day_date={$_REQUEST['day_date']}&year_date={$_REQUEST['year_date']}"));
} else {
    $LO_options = array();
}
ListOutput($stu_RET, $LO_columns, 'Student', 'Students', false, array(), $LO_options);
echo '<span class="center">' . SubmitButton(_('Save')) . '</span>';
echo '</FORM>';
function _makeRadio($value, $title)
{
    global $THIS_RET, $current_RET;
    $colors = array('P' => '#00FF00', 'A' => '#FF0000', 'H' => '#FFCC00', 'T' => '#0000FF');
    if ($current_RET[$THIS_RET['STUDENT_ID']][1]['ATTENDANCE_TEACHER_CODE'] == mb_substr($title, 5)) {
Example #26
0
function MLSelectInput($value, $name, $title = '', $options, $allow_na = 'N/A', $extra = '', $div = true)
{
    global $CentreLocales, $locale;
    if (sizeof($CentreLocales) < 2) {
        return SelectInput($value, $name, $title, $options, $div);
    }
    if (Preferences('HIDDEN') != 'Y') {
        $div = false;
    }
    // mab - support array style $option values
    // mab - append current val to select list if not in list
    if ($value != '' && $options[$value] == '') {
        $options[$value] = array($value, '<FONT color=red>' . $value . '</FONT>');
    }
    if (AllowEdit() && !$_REQUEST['_CENTRE_PDF']) {
        if ($value != '' && $div) {
            $return = "<DIV id='div{$name}'><div onclick='javascript:addHTML(\"";
            $extra = str_replace('"', '\\"', $extra);
        }
        $return .= "<SELECT name={$name} {$extra}>";
        if ($allow_na !== false) {
            if ($value != '' && $div) {
                $return .= '<OPTION value=\\"\\">' . $allow_na;
            } else {
                $return .= '<OPTION value="">' . $allow_na;
            }
        }
        if (count($options)) {
            foreach ($options as $key => $val) {
                $key .= '';
                if ($value != '' && $div) {
                    $return .= '<OPTION value=\\"' . str_replace(array("'", '"'), array('&#39;', '&rdquo;'), $key) . '\\"' . ($value == $key && (!($value == false && $value !== $key) || $value === 0 && $key === '0') ? ' SELECTED' : '') . '>' . str_replace(array("'", '"'), array('&#39;', '\\"'), is_array($val) ? ParseMLField($val[0], $locale) : ParseMLField($val, $locale));
                } else {
                    $return .= '<OPTION value="' . $key . '"' . ($value == $key && (!($value == false && $value !== $key) || $value === 0 && $key === '0') ? ' SELECTED' : '') . '>' . (is_array($val) ? ParseMLField($val[0], $locale) : ParseMLField($val, $locale));
                }
            }
        }
        $return .= "</SELECT>";
        if ($title != '') {
            $return .= '<BR><small>' . (strpos(strtolower($title), '<font ') === false ? '<FONT color=' . Preferences('TITLES') . '>' : '') . str_replace(array("'", '"'), array('&#39;', '\\"'), $title) . (strpos(strtolower($title), '<font ') === false ? '<FONT>' : '') . '</small>';
        }
        if ($value != '' && $div) {
            $return .= "\",\"div{$name}\",true)'><span style='border-bottom-style:dotted;border-bottom-width:1;border-bottom-color:" . Preferences('TITLES') . ";'>" . ParseMLField(is_array($options[$value]) ? $options[$value][1] : $options[$value], $locale) . '</span>' . ($title != '' ? '<BR><small>' . (strpos(strtolower($title), '<font ') === false ? '<FONT color=' . Preferences('TITLES') . '>' : '') . $title . (strpos(strtolower($title), '<font ') === false ? '</FONT>' : '') . '</small>' : '') . '</div></DIV>';
        }
    } else {
        $return = ParseMLField((is_array($options[$value]) ? $options[$value][1] : $options[$value]) != '' ? is_array($options[$value]) ? $options[$value][1] : $options[$value] : ($allow_na !== false ? $allow_na ? $allow_na : '-' : '-'), $locale) . ($title != '' ? '<BR><small>' . (strpos(strtolower($title), '<font ') === false ? '<FONT color=' . Preferences('TITLES') . '>' : '') . $title . (strpos(strtolower($title), '<font ') === false ? '</FONT>' : '') . '</small>' : '');
    }
    return $return;
}
Example #27
0
    function Warehouse($mode)
    {
        global $_ROSARIO, $locale;
        switch ($mode) {
            case 'header':
                //modif Francois: fix bug Internet Explorer Quirks Mode, add DOCTYPE
                ?>
<!DOCTYPE html>
<HTML lang="<?php 
                echo mb_substr($locale, 0, 2);
                ?>
" <?php 
                echo mb_substr($locale, 0, 2) == 'he' || mb_substr($locale, 0, 2) == 'ar' ? ' dir="RTL"' : '';
                ?>
>
<HEAD><TITLE><?php 
                echo ParseMLField(Config('TITLE'));
                ?>
</TITLE>
<meta charset="UTF-8" />
<?php 
                if (basename($_SERVER['PHP_SELF']) != 'index.php') {
                    ?>
<noscript><META http-equiv="REFRESH" content="0; url=index.php?modfunc=logout&amp;reason=javascript" /></noscript>
<script type="text/javascript" src="assets/js/tipmessage/main15.js"></script>
<?php 
                }
                if (basename($_SERVER['PHP_SELF']) == 'index.php') {
                }
                ?>
<link rel="stylesheet" type="text/css" href="assets/themes/<?php 
                echo Preferences('THEME');
                ?>
/stylesheet.css" />
<?php 
                break;
            case "footer":
                //modif Francois: Javascript load optimization
                ?>
<BR />
<script type="text/javascript" src="assets/js/warehouse.js" defer></script>
<?php 
                //modif Francois: load calendar Javascript only if required
                if (isset($_ROSARIO['PrepareDate'])) {
                    ?>
<link rel="stylesheet" type="text/css" media="all" href="assets/js/jscalendar/calendar-blue.css" />
<script type="text/javascript" src="assets/js/jscalendar/calendar.js"></script>
<script type="text/javascript" src="assets/js/jscalendar/lang/calendar-<?php 
                    echo mb_substr($locale, 0, 2);
                    ?>
.js"></script>
<script type="text/javascript" src="assets/js/jscalendar/calendar-setup.js"></script>
<?php 
                    for ($i = 1; $i <= $_ROSARIO['PrepareDate']; $i++) {
                        ?>
<script type="text/javascript">
	Calendar.setup({
		monthField     :    "monthSelect<?php 
                        echo $i;
                        ?>
",
		dayField       :    "daySelect<?php 
                        echo $i;
                        ?>
",
		yearField      :    "yearSelect<?php 
                        echo $i;
                        ?>
",
		ifFormat       :    "%d-%b-%y",
		button         :    "trigger<?php 
                        echo $i;
                        ?>
",
		align          :    "Tl",
		singleClick    :    true
	});
</script>
<?php 
                    }
                }
                echo '</BODY></HTML>';
                break;
        }
    }
Example #28
0
     echo '<TD><label><INPUT type="checkbox" id="residence" value="Y" />&nbsp;' . _('Residence') . '</label></TD>';
     //modif Francois: disable mailing address display
     if (Config('STUDENTS_USE_MAILING')) {
         echo '<TD><label><INPUT type="checkbox" id="mailing" value="Y" />&nbsp;' . _('Mailing') . '</label></TD>';
     } else {
         echo '<TD>&nbsp;</TD>';
     }
     echo '</TR><TR>';
     echo '<TD><label><INPUT type="checkbox" id="bus_pickup" value="Y" />&nbsp;' . _('Bus Pickup') . '</label></TD>';
     echo '<TD><label><INPUT type="checkbox" id="bus_dropoff" value="Y" />&nbsp;' . _('Bus Dropoff') . '</label></TD>';
     echo '</TR><TR>';
 }
 foreach ($fields as $field => $title) {
     $i++;
     echo '<TD><label><INPUT type="checkbox" onclick=\'addHTML("' . str_replace('"', '\\"', '<LI>' . ParseMLField($title) . '</LI>') . '","names_div",false);addHTML("' . str_replace('"', '\\"', '<INPUT type="hidden" name="fields[' . $field . ']" value="Y" />') . '","fields_div",false);this.disabled=true\' />&nbsp;' . ParseMLField($title) . '</label>';
     if (ParseMLField($category, 'default') == 'Address' && $field == 'PARENTS') {
         $relations_RET = DBGet(DBQuery("SELECT DISTINCT STUDENT_RELATION FROM STUDENTS_JOIN_PEOPLE ORDER BY STUDENT_RELATION"));
         $select = '<SELECT id="relation"><OPTION value="">' . _('N/A');
         foreach ($relations_RET as $relation) {
             if ($relation['STUDENT_RELATION'] != '') {
                 $select .= '<OPTION value="' . $relation['STUDENT_RELATION'] . '">' . $relation['STUDENT_RELATION'];
             } else {
                 $select .= '<OPTION value="!">' . _('No Value');
             }
         }
         $select .= '</SELECT>';
         echo '&nbsp;-&nbsp;' . _('Relation') . ':&nbsp;' . $select;
     }
     echo '</TD>';
     if ($i % 2 == 0) {
         echo '</TR><TR>';
             $_ROSARIO['allow_edit'] = false;
             $_ROSARIO['AllowEdit'][$modname] = array();
             $type_options = array('select' => _('Pull-Down'), 'autos' => _('Auto Pull-Down'), 'edits' => _('Edit Pull-Down'), 'text' => _('Text'), 'radio' => _('Checkbox'), 'codeds' => _('Coded Pull-Down'), 'exports' => _('Export Pull-Down'), 'numeric' => _('Number'), 'multiple' => _('Select Multiple from Options'), 'date' => _('Date'), 'textarea' => _('Long Text'));
         } else {
             $type_options = array('select' => _('Pull-Down'), 'autos' => _('Auto Pull-Down'), 'edits' => _('Edit Pull-Down'), 'exports' => _('Export Pull-Down'), 'text' => _('Text'));
         }
     } else {
         $type_options = array('select' => _('Pull-Down'), 'autos' => _('Auto Pull-Down'), 'edits' => _('Edit Pull-Down'), 'text' => _('Text'), 'radio' => _('Checkbox'), 'codeds' => _('Coded Pull-Down'), 'exports' => _('Export Pull-Down'), 'numeric' => _('Number'), 'multiple' => _('Select Multiple from Options'), 'date' => _('Date'), 'textarea' => _('Long Text'));
     }
     $header .= '<TD>' . SelectInput($RET['TYPE'], 'tables[' . $_REQUEST['id'] . '][TYPE]', _('Data Type'), $type_options, false) . '</TD>';
     if ($_REQUEST['id'] != 'new' && $RET['TYPE'] != 'select' && $RET['TYPE'] != 'autos' && $RET['TYPE'] != 'edits' && $RET['TYPE'] != 'text' && $RET['TYPE'] != 'exports') {
         $_ROSARIO['allow_edit'] = $allow_edit;
         $_ROSARIO['AllowEdit'][$modname] = $AllowEdit;
     }
     foreach ($categories_RET as $type) {
         $categories_options[$type['ID']] = ParseMLField($type['TITLE']);
     }
     $header .= '<TD>' . MLSelectInput($RET['CATEGORY_ID'] ? $RET['CATEGORY_ID'] : $_REQUEST['category_id'], 'tables[' . $_REQUEST['id'] . '][CATEGORY_ID]', _('Student Field Category'), $categories_options, false) . '</TD>';
     $header .= '<TD>' . TextInput($RET['SORT_ORDER'], 'tables[' . $_REQUEST['id'] . '][SORT_ORDER]', _('Sort Order'), 'size=5') . '</TD>';
     $header .= '</TR><TR>';
     $colspan = 2;
     if ($RET['TYPE'] == 'autos' || $RET['TYPE'] == 'edits' || $RET['TYPE'] == 'select' || $RET['TYPE'] == 'codeds' || $RET['TYPE'] == 'multiple' || $RET['TYPE'] == 'exports' || $_REQUEST['id'] == 'new') {
         $header .= '<TD colspan="2">' . TextAreaInput($RET['SELECT_OPTIONS'], 'tables[' . $_REQUEST['id'] . '][SELECT_OPTIONS]', _('Pull-Down') . '/' . _('Auto Pull-Down') . '/' . _('Coded Pull-Down') . '/' . _('Select Multiple from Options') . '<BR />' . _('* one per line'), 'rows=7 cols=40') . '</TD>';
         $colspan = 1;
     }
     $header .= '<TD style="vertical-align:bottom;" colspan="' . $colspan . '">' . TextInput($RET['DEFAULT_SELECTION'], 'tables[' . $_REQUEST['id'] . '][DEFAULT_SELECTION]', _('Default')) . '<BR />' . _('* for dates: YYYY-MM-DD') . ',<BR />&nbsp;' . _('for checkboxes: Y') . '</TD>';
     $new = $_REQUEST['id'] == 'new';
     $header .= '<TD>' . CheckboxInput($RET['REQUIRED'], 'tables[' . $_REQUEST['id'] . '][REQUIRED]', _('Required'), '', $new) . '</TD>';
     $header .= '</TR>';
     $header .= '</TABLE>';
 } elseif ($_REQUEST['category_id']) {
Example #30
0
function MLSelectInput($value, $name, $title = '', $options, $allow_na = 'N/A', $extra = '', $div = true)
{
    global $RosarioLocales, $locale;
    if (sizeof($RosarioLocales) < 2) {
        return SelectInput($value, $name, $title, $options, $div);
    }
    if (Preferences('HIDDEN') != 'Y') {
        $div = false;
    }
    // mab - support array style $option values
    // mab - append current val to select list if not in list
    if ($value != '' && $options[$value] == '') {
        $options[$value] = array($value, '<span style="color:red">' . $value . '</span>');
    }
    if (AllowEdit() && !isset($_REQUEST['_ROSARIO_PDF'])) {
        if ($value != '' && $div) {
            $return = '<DIV id="div' . $name . '"><div class="onclick" onclick=\'javascript:addHTML(html' . str_replace(array('[', ']', '-'), '', $name);
        }
        $select = '<SELECT name="' . $name . '" id="' . $name . '" ' . $extra . '>';
        if ($allow_na !== false) {
            $select .= '<OPTION value="">' . str_replace("'", '&#39;', $allow_na == 'N/A' ? _('N/A') : $allow_na) . '</OPTION>';
        }
        if (count($options)) {
            foreach ($options as $key => $val) {
                $key .= '';
                $select .= '<OPTION value="' . str_replace("'", '&#39;', htmlspecialchars($key)) . '"' . ($value == $key && (!($value == false && $value !== $key) || $value === 0 && $key === '0') ? ' SELECTED="SELECTED"' : '') . '>' . str_replace("'", '&#39;', is_array($val) ? ParseMLField($val[0], $locale) : ParseMLField($val, $locale)) . '</OPTION>';
            }
        }
        $select .= '</SELECT>';
        $select .= '<BR />' . (mb_strpos(mb_strtolower($title), '<span ') === false ? '<span class="legend-gray">' : '') . '<label for="' . $name . '">' . $title . '</label>' . (mb_strpos(mb_strtolower($title), '<span ') === false ? '</span>' : '') . '';
        if ($value != '' && $div) {
            $return = '<script type="text/javascript">var html' . str_replace(array('[', ']', '-'), '', $name) . '=\'' . $select . '\';</script>' . $return;
            $return .= ',"div' . $name . '",true)\'><span class="underline-dots">' . ParseMLField(is_array($options[$value]) ? $options[$value][1] : $options[$value], $locale) . '</span>' . ($title != '' ? '<BR />' . (mb_strpos(mb_strtolower($title), '<span ') === false ? '<span class="legend-gray">' : '') . str_replace("'", '&#39;', $title) . (mb_strpos(mb_strtolower($title), '<span ') === false ? '</span>' : '') . '' : '') . '</div></DIV>';
        } else {
            $return = $select;
        }
    } else {
        $return = ParseMLField((is_array($options[$value]) ? $options[$value][1] : $options[$value]) != '' ? is_array($options[$value]) ? $options[$value][1] : $options[$value] : ($allow_na !== false ? $allow_na ? $allow_na : '-' : '-'), $locale) . ($title != '' ? '<BR />' . (mb_strpos(mb_strtolower($title), '<span ') === false ? '<span class="legend-gray">' : '') . $title . (mb_strpos(mb_strtolower($title), '<span ') === false ? '</span>' : '') . '' : '');
    }
    return $return;
}