示例#1
0
/**
 * Prints a user's mainpage
 */
function display_mainpage()
{
    display_menu();
    print "<div class=\"container2\">";
    display_content();
    print "</div>";
    display_copyright();
    display_footer();
}
function contact_page_controller()
{
    global $cssFilePaths;
    global $javascriptFilePaths;
    $scripts = array($javascriptFilePaths["variableInputWidth"], $javascriptFilePaths["main"], $javascriptFilePaths["uploadResume"], $javascriptFilePaths["contact"]);
    display_header("Contact", array($cssFilePaths["contact"]), 5);
    contact_page_view();
    display_footer($scripts);
}
示例#3
0
function error($message, $type, $custom_message = "")
{
    $msg = "UNSPECIFIED ERROR OCCURED";
    if ($custom_message != "") {
        $msg = $custom_message;
    }
    //append_message($msg,$type);
    // TODO : DEGAGER LE PRINT ET FOUTRE CA DANS UN FIC. DE LOG
    echo htmlentities($message);
    if ($type == "SECURITY") {
        exit(1);
    }
    if ($type == "CRITICAL") {
        display_header();
        display_footer();
        exit(1);
    }
}
示例#4
0
function xhtml_output($mode)
{
    global $cfg, $lang, $style_num, $style, $cd, $begin_time_str, $admin, $footer_content, $dtd, $page_title, $content_type, $alternate_link_rss, $subtitle, $contents_top, $contents, $admin_sess_menu, $content_menu, $search_form, $menu_middle, $archive_by_date, $category_menu, $file_type_menu, $recent_entries, $recent_comments, $recent_trackbacks, $css_switch, $rss_button, $rss2_button, $menu_bottom, $request_uri, $p_blog_path, $plugin;
    include_plugin($mode);
    xhtml_header();
    xhtml_menu($mode);
    // Contents Top
    if ($request_uri == 'http://' . $_SERVER['HTTP_HOST'] . $cfg['root_path'] . 'index.php') {
        if (file_exists($cd . '/include/user_include/contents_top.inc.php')) {
            include_once $cd . '/include/user_include/contents_top.inc.php';
        } else {
            $contents_top = '';
        }
    } else {
        $contents_top = '';
    }
    // Choose Footer
    if ($cfg['footer_type'] == 1) {
        $footer_content = display_footer($cd);
    } elseif ($cfg['footer_type'] == 2) {
        $footer_content = display_valid_footer($style_num, $style, $cd);
    } elseif ($cfg['footer_type'] == 3) {
        $footer_content = display_w3c_valid_footer($style_num, $style, $cd);
    } else {
        $footer_content = display_user_footer($admin = FALSE);
    }
    // Load Template
    require_once $cd . '/include/user_include/base_xhtml.inc.php';
    /*
    if ($request_uri == $p_blog_path . 'var/vars-sample/index.php') {
        require_once $cd . '/include/user_include/vars_xhtml.inc.php';
    } else {
        require_once $cd . '/include/user_include/base_xhtml.inc.php';
    }
    */
}
示例#5
0
function changecr($title)
{
    /* checks the user login and  
     * redirecting user to login page */
    if (!check_login()) {
        header('location:login.php');
    } else {
        include 'config/globals.php';
        /* taking the query string by using the regular expression */
        $p = $_SERVER['QUERY_STRING'];
        $reg = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
        $reg1 = "/^all\$/";
        if (preg_match($reg, $p) or preg_match($reg1, $p)) {
            /* including the necessary configuration php files */
            include 'config/db.php';
            include 'config/settings.php';
            /* defining the table names  */
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_CRs';
            $table1 = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            //$branch = $row['Branch']; its not required
            $class = substr($p, -1);
            /* Getting the users details from joining the two tables */
            if ($p == 'all') {
                $q = "select {$table}.Name as Name, {$table}.Gender as Gender, {$table}.Id as Id,PhoneNo, `{$table1}`.`Class` as `Class` from {$table},{$table1} where `{$table}`.`Id` = `{$table1}`.`Id` order by `{$table1}`.`Class` Desc;";
            } else {
                $q = "select {$table}.Name as Name, {$table}.Gender as Gender, {$table}.Id as Id,PhoneNo from {$table},{$table1} where `{$table}`.`Id` = `{$table1}`.`Id` and `{$table}`.`Class` = '{$class}';";
            }
            $res = mysql_query($q) or die(mysql_error());
            echo "<!DOCTYPE html>\n<html>\n";
            /* including the header java scripts and css files  */
            display_headers($title);
            echo "\n<body>";
            /* displayin the header menu */
            menu();
            $br = $p == 'all' ? $globalbranch : $p;
            $cls1 = $p == 'all' ? '<th style="text-align:center;" class="span1"> Class </th>' : "";
            echo <<<a
\t\t<div class='container'>
\t\t\t<div id="error" style="display:none;"></div>
\t\t\t<div class='row'>
\t\t\t<div class='span9'>
\t\t\t\t<div class="well well-large" style="background:#FFF;">
\t\t\t\t<h5 class='text-info'>CRs @ {$br}  </h5>
\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing all CRs in {$br}  </h6><br>
\t\t\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t\t<thead>
\t\t\t\t\t<tr> <th class="span1" style="text-align:center;" > Id </th><th style="text-align:center;" class="span3"> Name   </th> {$cls1}
\t\t\t\t\t<th style="text-align:center;" class="span1"> Gender  </th>  <th class="span1" style="text-align:center;"> Contact No </th> </tr>
\t\t\t\t</thead>
\t\t\t\t<tbody>
a;
            while ($row = mysql_fetch_array($res)) {
                $gender = $row['Gender'];
                $d = $dict[$gender . '1'];
                $id = $row['Id'];
                $contact = $row['PhoneNo'];
                $cls = $p == 'all' ? '<td style="text-align:center;">' . $globalbranch . " " . $row['Class'] . '</td>' : "";
                $name = ucwords(strtolower($row['Name']));
                echo <<<a
\t\t\t\t\t
\t\t\t<tr >  
\t\t\t<td style="text-align:center;" > {$id} </td> 
\t\t\t<td > {$name} </td>
\t\t\t{$cls}
\t\t\t<td style="text-align:center;"> {$d}  </td> 
\t\t\t<td style="text-align:center;" class="text-success"><b> {$contact} </b> </td>  
\t\t\t</tr>
a;
            }
            echo <<<a
\t\t\t\t</tbody>
\t\t\t   </table>
\t\t\t</div>\t
\t\t\t</div>
\t\t\t<div class='span3'>
a;
            go_home();
            echo '<ul class="nav nav nav-tabs nav-stacked"> <li><a href=\'?all\'>All CRs &nbsp; <i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li></ul>';
            cr_classes($classno, $globalbranch);
            echo "</div></div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
示例#6
0
}
function is_accept($stackTrace)
{
    if ($stackTrace[0]->className == "com.caucho.vfs.JniServerSocketImpl" && $stackTrace[0]->methodName == "nativeAccept") {
        return true;
    } else {
        if ($stackTrace[0]->className == "java.net.PlainSocketImpl" && $stackTrace[0]->methodName == "socketAccept") {
            return true;
        } else {
            if ($stackTrace[0]->className == "java.net.PlainSocketImpl" && $stackTrace[0]->methodName == "accept") {
                return true;
            }
        }
    }
    return false;
}
function is_keepalive($stackTrace)
{
    for ($i = 0; $i < sizeof($stackTrace); $i++) {
        if ($stackTrace[$i]->className != "com.caucho.server.port.TcpConnection" || $stackTrace[$i]->methodName != "run") {
            continue;
        } else {
            if ($stackTrace[$i - 1]->className == "com.caucho.server.port.TcpConnection" && $stackTrace[$i - 1]->methodName == "waitForKeepalive") {
                return true;
            }
        }
    }
    return false;
}
display_footer("profile.php");
示例#7
0
function generate_attendance($title)
{
    if (!check('CR')) {
        header('location:./?sub');
    } else {
        if (!check_day()) {
            $p = $_SERVER['QUERY_STRING'];
            $reg = '/^P[1-4]$/';
            if (preg_match($reg, $p)) {
                include 'config/db.php';
                include 'config/settings.php';
                include 'config/globals.php';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $userid = $_SESSION['UserId'];
                $q = "select Branch,Class from {$table} where Id = '{$userid}'";
                $res = mysql_query($q) or die(mysql_error());
                $row = mysql_fetch_array($res);
                $branch = $row['Branch'];
                $class = $row['Class'];
                echo "<!DOCTYPE html>\n<html>\n";
                display_headers($title);
                echo "\n<body>";
                menu();
                echo <<<a
\t\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t\t
a;
                $dbname = $branchyear . '_Attendance';
                $table = $branch . $class . '_Attendance';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $class_total = mysql_num_rows(mysql_query("select `Id` from {$table}"));
                $sample = mt_rand(1, $class_total);
                $da = date('d-m-Y');
                $date = date('d-m-Y');
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select Date from {$table} where Date = '{$da}'") or die(mysql_error());
                if (mysql_num_rows($q) == 0) {
                    $q = mysql_query("insert into {$table}(Date) values('{$da}')") or die(mysql_error());
                    $dbname = $branchyear . '_Cache';
                    $table = $branch . $class . '_Cache';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    for ($j = 1; $j <= 4; $j++) {
                        $q = mysql_query("alter table {$table} add `" . $da . "_P" . $j . "` varchar(2);") or die(mysql_error());
                    }
                    insert_log($_SESSION['UserId'] . " added {$date} Cache columns to {$table}");
                    $dbname = $branchyear . '_Attendance';
                    $table = $branch . $class . '_Attendance';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $q = mysql_query("alter table {$table} add `" . $da . "` varchar(30) default '';") or die(mysql_error());
                    insert_log($_SESSION['UserId'] . "added {$date} to Attendance columns to {$table}");
                }
                echo <<<a
\t\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t\t
\t\t<div class="row">
\t\t\t\t<div class='span9'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select {$p},`" . $p . "_Con` from {$table} where Date = '{$da}';") or die(mysql_error());
                $row = mysql_fetch_array($q);
                $a = $da . '_' . $p;
                if (isset($_POST['Generate'])) {
                    if ($row[$p] == 'ok') {
                        echo "<script>show_error('{$p} Attendance has been already uploaded ');</script>";
                    } else {
                        $key2 = addslashes($_POST['Skey']);
                        $table = $branchyear . '_CRs';
                        $q = "select `Id`,`Key` from {$table} where `Id` = '{$userid}'";
                        $res = mysql_query($q) or die(mysql_error());
                        $row = mysql_fetch_array($res);
                        $key1 = $row['Key'];
                        if ($key1 != $key2) {
                            echo "<script>show_error('<b>Error </b> : CR Security Key does not matched.  Please try again.. ');</script>";
                        } else {
                            $dbname = $branchyear . '_Cache';
                            $table = $branch . $class . '_Cache';
                            //if(!mysql_select_db($dbname))die(mysql_error());
                            $less = addslashes($_POST['Less']);
                            $rnos = addslashes($_POST['RNos']);
                            $lastone = $rnos[strlen($rnos) - 1];
                            $rollno[$less] = $lastone != ',' ? explode(',', $rnos) : explode(',', $rnos, -1);
                            if ($less == "Absents") {
                                for ($i = 1, $c = 0; $i <= $class_total; $i++) {
                                    if (!in_array($i, $rollno["Absents"])) {
                                        $rollno["Presents"][$c++] = $i;
                                    }
                                }
                            } else {
                                for ($i = 1, $c = 0; $i <= $class_total; $i++) {
                                    if (!in_array($i, $rollno["Presents"])) {
                                        $rollno["Absents"][$c++] = $i;
                                    }
                                }
                            }
                            if (array_key_exists('Absents', $rollno)) {
                                foreach ($rollno['Absents'] as $val) {
                                    $insert = mysql_query("UPDATE " . $table . " SET `{$a}` = 'A' WHERE RNo ='{$val}';") or die(mysql_error());
                                }
                            }
                            if (array_key_exists('Presents', $rollno)) {
                                foreach ($rollno['Presents'] as $val) {
                                    $insert = mysql_query("UPDATE " . $table . " SET `{$a}` = 'P' WHERE RNo ='{$val}';") or die(mysql_error());
                                }
                            }
                            $dbname = $branchyear . '_Dates';
                            $table = $branch . $class . '_Dates';
                            //if(!mysql_select_db($dbname)) die(mysql_error());
                            $in = mysql_query("UPDATE " . $table . " SET `{$p}` = 'ok' WHERE Date ='{$da}';") or die(mysql_error());
                            echo "<script>show_success('{$p} Attendance has been uploaded ');</script>";
                        }
                    }
                }
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname))  die(mysql_error());
                $remaining = array();
                $j = 0;
                $remaining1 = array();
                $j1 = 0;
                $confired = array();
                $j2 = 0;
                $confired1 = array();
                $j3 = 0;
                for ($i = 1; $i <= 4; $i++) {
                    $tmp = "P" . $i;
                    $tmp1 = "P" . $i . "_Con";
                    $q = mysql_query("select ISNUll(`{$tmp}`) as `P{$i}`,ISNUll(`{$tmp1}`) as `P" . $i . "_C` from {$table} where Date = '{$da}' ") or die(mysql_error());
                    $res = mysql_fetch_array($q);
                    if ($res["P" . $i]) {
                        $remaining[$j] = "P" . $i;
                        $j++;
                    } else {
                        $remaining1[$j1] = "P" . $i;
                        $j1++;
                    }
                    if ($res["P" . $i . "_C"]) {
                        $confired[$j2] = "P" . $i;
                        $j2++;
                    } else {
                        $confired1[$j3] = "P" . $i;
                        $j3++;
                    }
                }
                $dates1 = getdate(strtotime($da));
                $day = substr($dates1["weekday"], 0, 3);
                $dbname = $branchyear . '_TimeTable';
                $table = $branch . $class . '_TimeTable';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $ti = mysql_query("SELECT DayPeriod,{$day} from {$table};") or die(mysql_error());
                $subjects = array();
                while ($da = mysql_fetch_array($ti)) {
                    $subjects[$da[0]] = $da[1];
                }
                $sub = $subjects[$p];
                if (in_array($p, $remaining1)) {
                    echo "<h5 style='text-align:center;'> Attendance Submission Details - {$branch}&nbsp;{$class}</h5><br>";
                    //$p="P".$m;
                    if (in_array($p, $confired1)) {
                        $period = $p;
                        $dbname = $branchyear . '_Attendance';
                        $table = $branch . $class . '_Attendance';
                        //if(!mysql_select_db($dbname)) die(mysql_error());
                        $q = mysql_query("select RNo,Id,`{$date}` from {$table};") or die(mysql_error());
                        $Rnos = array("Absents" => array(), "Presents" => array());
                        $aindex = 0;
                        $pindex = 0;
                        $uid = array();
                        while ($res = mysql_fetch_array($q)) {
                            $uid[$res['RNo']] = $res['Id'];
                            $z = explode(",", $res[$date]);
                            for ($m = 0; $m < count($z); $m++) {
                                $y = explode("_", $z[$m]);
                                if ($y[0] == $period) {
                                    if ($y[1] == "A") {
                                        $Rnos['Absents'][$aindex] = $res[0];
                                        $aindex++;
                                    } else {
                                        $Rnos['Presents'][$pindex] = $res[0];
                                        $pindex++;
                                    }
                                }
                            }
                        }
                    } else {
                        $da = date('d-m-Y');
                        $a = $da . '_' . $p;
                        $dbname = $branchyear . '_Cache';
                        $table = $branch . $class . '_Cache';
                        //if(!mysql_select_db($dbname)) die(mysql_error());
                        $q3 = mysql_query("SELECT RNo, `" . $a . "` FROM {$table}") or die(mysql_error());
                        $Rnos = array("Absents" => array(), "Presents" => array());
                        $aindex = 0;
                        $pindex = 0;
                        while ($individual = mysql_fetch_array($q3)) {
                            if ($individual[$a] == "A") {
                                $Rnos["Absents"][$aindex] = $individual["RNo"];
                                $aindex++;
                            }
                            if ($individual[$a] == "P") {
                                $Rnos["Presents"][$pindex] = $individual["RNo"];
                                $pindex++;
                            }
                        }
                    }
                    $pc = count($Rnos["Presents"]);
                    $ac = count($Rnos["Absents"]);
                    $tot = $pc + $ac;
                    //print_r($Rnos);
                    //print_r($uid);
                    echo <<<tab
\t\t\t\t
\t\t\t\t<div class="row">
\t\t\t\t\t<div class="span8">
\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t<tr> <td class="span2" style="text-align:center"> Date </td> <th class="text-warning span2" style="text-align:center"> {$date}</th> 
\t\t\t\t\t\t\t<td class="span2" style="text-align:center"> Subject </td> <th class="text-success span2" style="text-align:center"> {$sub}</th> </tr>
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>
\t\t\t\t\t</div>
\t\t\t\t</div>
                     <div class="row">
                    \t<div class="span8">
                        <table class="table  table-hover table-bordered" >
                            <thead>
                                <tr> <th class="span2"  style="text-align:center"> Period # </th> <th class="span3"> Presents  </th> <th class="span3"> Absents  </th> </tr>
                            </thead>
                            <tbody>
                            <tr><td style="text-align:center;" >{$p}</td><td>
tab;
                    for ($i = 0; $i < $pc; $i++) {
                        if ($i % 8 == 0 && $i != 0) {
                            echo "<br>";
                        }
                        if ($i == $pc - 1) {
                            echo $Rnos["Presents"][$i];
                        } else {
                            echo $Rnos["Presents"][$i] . ",";
                        }
                    }
                    echo "</td><td>";
                    for ($i = 0; $i < $ac; $i++) {
                        if ($i % 8 == 0 && $i != 0) {
                            echo "<br>";
                        }
                        if ($i == $ac - 1) {
                            echo $Rnos["Absents"][$i];
                        } else {
                            echo $Rnos["Absents"][$i] . ",";
                        }
                    }
                    echo <<<tab
\t\t\t\t\t\t</td></tr>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td style="text-align:center;" >Total  (<b>{$class_total}</b>) </td>
\t\t\t\t\t\t\t<td style="text-align:center;" class='text-success'> {$pc}</td>
\t\t\t\t\t\t\t<td style="text-align:center;" class='text-error'>{$ac}</td>
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>
\t\t\t\t\t</div>
\t\t\t\t</div>
                            
tab;
                } else {
                    display_generate_form($p, $class_total, $sub, $branch . $class);
                }
                echo <<<a
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<div class='span3'>
a;
                go_home();
                echo '<ul class="nav nav-tabs nav-stacked">';
                for ($i = 1; $i <= 4; $i++) {
                    echo "<li><a href=\"?P{$i}\">P{$i}";
                    $period = "P" . $i;
                    if (!in_array($period, $remaining)) {
                        echo "<i class='icon-ok pull-right text-success' style=\"padding-top:5px;\"></i>";
                    } else {
                        echo "<i class='icon-remove pull-right text-error' style='padding-top:5px;'></i>";
                    }
                    echo '<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>';
                }
                echo "</ul></div>";
                echo "</div> </div> ";
                display_footer();
                echo "\n</body>\n</html>";
                @mysql_close($con);
            } else {
                echo "<script type='text/javascript'>document.location.href='404.php';</script>";
            }
        } else {
            noservice();
        }
    }
}
示例#8
0
function homepage($title)
{
    if (!check_login()) {
        header('location:login.php');
    } else {
        echo "<!DOCTYPE html>\n<html>\n\t<SCRIPT LANGUAGE=\"Javascript\" SRC=\"assets/charts/FusionCharts.js\"></SCRIPT>";
        display_headers($title);
        echo "\n<body>";
        menu();
        echo <<<a
\t<div class='container'>
\t\t<div id='error'></div>
\t\t<div class='row'>
a;
        echo '<div class="span9"><div class="well well-large" style="background:#FFF;">';
        /* Pattern Matching */
        $reg1 = "/^N[0-9]{6}\$/";
        $reg2 = "/^p|(sub)\$/";
        $qs = $_SERVER["QUERY_STRING"];
        $va = explode("/", $qs);
        $qs1 = $va[0];
        $qs2 = $va[1];
        if (preg_match($reg1, $qs1) and preg_match($reg2, $qs2)) {
            /* Fetching Details */
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SERVER["QUERY_STRING"];
            $resultant = explode("/", $userid);
            $id = $resultant[0];
            $mode = $resultant[1];
            $q = "select Name,Gender,Position, Branch, Class ,RNo from {$table} where Id = '{$id}'";
            $res = mysql_query($q) or die(mysql_error());
            if (mysql_num_rows($res) == 0) {
                echo "<script>document.location.href='404.php';</script>";
            }
            $row = mysql_fetch_array($res);
            $username = ucwords(strtolower($row['Name']));
            $gender = $row['Gender'];
            $RNo = $row["RNo"];
            $type = $row['Position'];
            $class = $row['Class'];
            $branch = $row['Branch'];
            $colors = array('F6BD0F', '8BBA00', 'FF8E46', '8E468E', '588526', '008ED6', '9D080D', 'D64646', 'B3AA00', 'A186BE', 'AFD8F8');
            shuffle($colors);
            /* Deatils Fetched */
            echo <<<a
\t\t<div id="step1" class="span6">     
\t\t<a ><h5>Student Attendance Report for {$id} </h5></a>
\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Lising Attendance details submitted from CR @ {$branch} {$class}</h6><br>
\t\t</div>
\t\t<table class="table table-hover table-bordered">
\t\t<tbody>
\t\t<tr><th>Name </th> <td>{$username}</td> <th>Gender </th> <td>{$gender}</td> </tr>
\t\t<tr><th>RNo </th> <td>{$RNo}</td>  <th>Class </th> <td>{$branch} {$class} </td></tr>
\t\t</tbody>
\t\t</table>
\t<div id="step1" class="span4">     
\t\t<h5>Chart Based Representaiton </h5>
\t</div>
\t<div id="side1" class="span4" >
\t\t<h6 class='text-right'><a href='?{$id}/sub' ><i class='icon-book'></i>&nbsp; Subjects</a> &emsp; <a href='?{$id}/p'><i class='icon-qrcode'></i>&nbsp; Periods</a></h6>
\t</div>
a;
            if (strtolower($mode) == "p") {
                //mysql_select_db($branchyear."_Dates") or die(mysql_error());
                $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok' ;") or die(mysql_error());
                $nofd = mysql_num_rows($query);
                if ($nofd != 0) {
                    $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0);
                    $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0);
                    $strXML = "<graph caption='Period Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>";
                    $datasetp = '';
                    while ($dates = mysql_fetch_array($query)) {
                        //mysql_select_db($branchyear."_Attendance") or die(mysql_error());
                        $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $RNo . "';");
                        while ($res = mysql_fetch_array($q)) {
                            $values = explode(",", $res[0]);
                            for ($i = 0; $i < count($values) - 1; $i++) {
                                if (substr($values[$i], -1) == "P") {
                                    $stats["Presents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                if (substr($values[$i], -1) == "A") {
                                    $stats["Absents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                $p[$values[$i]] += 1;
                            }
                        }
                    }
                    $tr = '';
                    for ($i = 1; $i <= 4; $i++) {
                        $st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success";
                        $tr .= '<tr>  
				<td style="text-align:center;">' . $i . '</td>
				<td style="text-align:center;"> P' . $i . ' </td> 
				<td style="text-align:center;"><b> ' . $nofd . '</b> </td> 
				<td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td>  
				<td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> 
				<td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-' . $st . '"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </b></td>   
			</tr>';
                        $datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>";
                    }
                    $strXML .= $datasetp . "</graph>";
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5> Period Wise Attendance Representation </h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Period </th> 
                                <th  style="text-align:center;"  > Days </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > P/Day </th>  <th  style="text-align:center;"  > Absents </th> 
                                <th  style="text-align:center;" > A/Day </th><th  style="text-align:center;" > Performance </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Period Wise Attendance*/
            /* SUbjects Wise Attendance */
            if (strtolower($mode) == "sub") {
                //mysql_select_db($branchyear."_Subjects") or die(mysql_error());
                $query = mysql_query("Select * from " . $branch . $class . "_Subjects where RNo='{$RNo}';") or die(mysql_error());
                $subjectwise = mysql_fetch_array($query) or die(mysql_error());
                $tr = '';
                $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>";
                $datasetp = '';
                $nc_cls = 0;
                for ($i = 0; $i < count($allowed_subjects); $i++) {
                    $tnoc = $subjectwise[$allowed_subjects[$i] . "_P"] + $subjectwise[$allowed_subjects[$i] . "_A"];
                    if ($tnoc == 0) {
                        $nc_cls++;
                        $performance = "N/A  ";
                        $st = "error";
                        $remarks = "CNYS";
                    } else {
                        $performance = $subjectwise[$allowed_subjects[$i] . "_P"] / $tnoc * 100;
                        $performance = round($performance, 1) . " %";
                        $st = $performance <= 50 ? "error" : "success";
                        if (round($performance, 1) >= 95) {
                            $remarks = "Excellent";
                        }
                        if (round($performance, 1) >= 90 && round($performance, 1) < 95) {
                            $remarks = "Very Good";
                        }
                        if (round($performance, 1) >= 80 && round($performance, 1) < 90) {
                            $remarks = "Good";
                        }
                        if (round($performance, 1) >= 70 && round($performance, 1) < 80) {
                            $remarks = "Normal";
                        }
                        if (round($performance, 1) >= 60 && round($performance, 1) < 70) {
                            $remarks = "Average";
                        }
                        if (round($performance, 1) >= 50 && round($performance, 1) < 60) {
                            $remarks = "Bad";
                        }
                        if (round($performance, 1) < 50) {
                            $remarks = "Go Out";
                        }
                    }
                    $tr .= '<tr> 
					<td style="text-align:center;">' . ($i + 1) . '</td> 
					<td style="text-align:center;"> <b>' . $allowed_subjects[$i] . '</b> </td> 
					<td style="text-align:center;"> <b>' . $tnoc . '</b> </td> 
					<td style="text-align:center;" class="text-success"><b> ' . $subjectwise[$allowed_subjects[$i] . "_P"] . '</b> </td> 
					<td style="text-align:center;" class="text-error"><b> ' . $subjectwise[$allowed_subjects[$i] . "_A"] . ' </b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b>' . $performance . '</b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b>' . $remarks . '</b></td>
				</tr>';
                    $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . round($performance, 1) . "' color='" . $colors[$i] . "'/>";
                }
                $strXML .= $datasetp . "</graph>";
                if ($nc_cls != count($allowed_subjects)) {
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5> Subject Wise Attendance Representation </h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;"  rowspan="2" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Subject  </th> 
                                <th  style="text-align:center;"  > Classes </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > Absents </th>  <th  style="text-align:center;"  > Performance </th> 
                                <th  style="text-align:center;" > Remarks </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* Subject WIse */
        } else {
            echo "<script type='text/javascript'>show_error('Error: Invalid Syntax given..');</script>";
        }
        echo <<<b
\t</div>
\t</div>
\t<div class='span3'>
b;
        go_home();
        sidepanel();
        echo "</div></div></div>";
        display_footer();
        echo "\n</body>\n</html>";
    }
}
示例#9
0
    exit;
}
if ($_REQUEST && isset($_REQUEST['email'])) {
    $sql = "Select user_id from wl_users where email_address ='{$_REQUEST['email']}'";
    $rs = $db_connection->db_query($sql);
    if (pg_num_rows($rs) == 0) {
        echo json_encode(array("status" => "FAIL", "message" => "No User Found"));
    } else {
        $row = pg_fetch_assoc($rs);
        $uid = $row['user_id'];
        echo json_encode(array("status" => 'SUCCESS', "uid" => $uid));
    }
    die;
}
display_html_start();
echo '
</head><body>', get_header_html(), '
		<h3>Create user</h3>
	</div>
		<div class="row" id="message"></div>
		<div class="row">
		<form class="form-vertical"  role="form">
			<div class="form-group">
				 <label class="sr-only" for="email">Email Address:</label>
            	 <input type="email" class="form-control" id="email" name="email"  placeholder="E-Mail" required>
			 </div>
		<button type="submit" class="btn btn-primary">Get User Name</button>
</form>
';
display_footer(array('forgot_user'));
示例#10
0
function generate_attendance($title)
{
    if (!check_login()) {
        header('location:./login.php');
    } else {
        if (!check_day()) {
            include 'config/globals.php';
            $p = $_SERVER['QUERY_STRING'];
            $reg = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
            if (preg_match($reg, $p)) {
                include 'config/db.php';
                include 'config/settings.php';
                include 'config/globals.php';
                echo "<!DOCTYPE html>\n<html>\n";
                display_headers($title);
                echo "\n<body>";
                menu();
                echo <<<a
\t\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t\t
a;
                $table = '';
                //$spread='';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $userid = $_SESSION['UserId'];
                $q = "select Branch,Class,Position from {$table} where Id = '{$userid}'";
                $res = mysql_query($q) or die(mysql_error());
                $row = mysql_fetch_array($res);
                if ($row['Position'] == "BA") {
                    $branch = $globalbranch;
                    $class = substr($p, -1);
                } else {
                    $branch = $row['Branch'];
                    $class = $row['Class'];
                    $class1 = substr($p, -1);
                    if ($class1 != $class) {
                        //echo 'i am in';
                        echo "<script type='text/javascript'>show_error('Error: Not authorised to access {$branch}{$class1} details.');</script>";
                    }
                }
                $dbname = $branchyear . '_Attendance';
                $table = $branch . $class . '_Attendance';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $class_total = mysql_num_rows(mysql_query("select `Id` from {$table}"));
                $sample = mt_rand(1, $class_total);
                $da = date('d-m-Y');
                $date = date('d-m-Y');
                echo <<<a
\t\t\t
\t\t\t
\t\t<div class="row">
\t\t\t\t<div class='span12'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname))  die(mysql_error());
                $remaining = array();
                $j = 0;
                $remaining1 = array();
                $j1 = 0;
                $confired = array();
                $j2 = 0;
                $confired1 = array();
                $j3 = 0;
                for ($i = 1; $i <= 4; $i++) {
                    $tmp = "P" . $i;
                    $tmp1 = "P" . $i . "_Con";
                    $q = mysql_query("select ISNUll(`{$tmp}`) as `P{$i}`,ISNUll(`{$tmp1}`) as `P" . $i . "_C` from {$table} where Date = '{$da}' ") or die(mysql_error());
                    $res = mysql_fetch_array($q);
                    if ($res["P" . $i]) {
                        $remaining[$j] = "P" . $i;
                        $j++;
                    } else {
                        $remaining1[$j1] = "P" . $i;
                        $j1++;
                    }
                    if ($res["P" . $i . "_C"]) {
                        $confired[$j2] = "P" . $i;
                        $j2++;
                    } else {
                        $confired1[$j3] = "P" . $i;
                        $j3++;
                    }
                }
                $dates1 = getdate(strtotime($da));
                $day = substr($dates1["weekday"], 0, 3);
                $dbname = $branchyear . '_TimeTable';
                $table = $branch . $class . '_TimeTable';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $ti = mysql_query("SELECT DayPeriod,{$day} from {$table};") or die(mysql_error());
                $subjects = array();
                while ($da1 = mysql_fetch_array($ti)) {
                    $subjects[$da1[0]] = $da1[1];
                }
                //print_r($subjects);
                //$sub = $subjects[$p];
                //echo "<h5 style='text-align:center;'> Attendance Submission Details - $branch&nbsp;$class - $date</h5><br>";
                echo <<<a
\t\t\t
\t\t\t\t<div id="step1" class="span4">     
\t\t\t\t\t<h5 class='text-info'>Today's Attendance Submission Details </h5>
\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing Data submitted from CR @ {$branch}&nbsp;{$class} </h6><br>
\t\t\t\t</div>
\t\t\t\t<div id="side1" class="span7" >
\t\t\t\t\t<h6 class='text-right'><a href='./?sub'><i class='icon-home'></i> Home&nbsp;</a> </h6>
a;
                if ($row['Position'] == "BA") {
                    echo <<<a
\t\t\t\t\t<h6 class='text-right'>
a;
                    for ($cl = 1; $cl <= $classno; $cl++) {
                        echo "<a href='?{$globalbranch}{$cl}'>{$globalbranch}{$cl}</a>&emsp;";
                    }
                    echo <<<a
\t\t\t\t\t</h6>
a;
                }
                echo <<<a
\t\t\t\t</div>
\t\t\t
a;
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select Date from {$table} where Date = '{$da}'") or die(mysql_error());
                if (count($remaining1) != 0 && mysql_num_rows($q) != 0) {
                    $html = "";
                    echo '<table class="table  table-hover table-bordered "  style="padding:0px;">
						<thead>
							<tr> 
								<th style="text-align:center;"  rowspan="2" valign="top"> RNo  </th> 
								<th style="text-align:center;"  rowspan="2" valign="top"> Id  </th> 
								<th  style="text-align:center;"  > P1 </th> <th  style="text-align:center;" > P2 </th>
								<th  style="text-align:center;"  > P3 </th>  <th  style="text-align:center;"  > P4 </th> 
								<th  style="text-align:center;" rowspan=2> Presents </th> <th rowspan=2 style="text-align:center;"  > Absents </th>
							</tr>
							<tr> 
								<th  style="text-align:center;"  > ' . $subjects['P1'] . ' </th> <th  style="text-align:center;" > ' . $subjects['P2'] . ' </th>
								<th  style="text-align:center;"  > ' . $subjects['P3'] . ' </th>  <th  style="text-align:center;"  > ' . $subjects['P4'] . ' </th> 
								
							</tr>
							
						</thead>
						<tbody>';
                    //$spread.=" \t \t P1  \t P2 \t  P3 \t P4 \t \t \t\nRno\tID\t".$subjects['P1']."\t".$subjects['P2']."\t".$subjects['P3']."\t".$subjects['P4']."\tPresents\tAbsents\n";
                    $html .= "<thead><tr> \n\t\t\t\t\t\t\t\t<th rowspan=\"2\" width=8%> RNo  </th> \n\t\t\t\t\t\t\t\t<th rowspan=\"2\" width=17%> ID  </th> \n\t\t\t\t\t\t\t\t<th  > P1 </th> <th > P2 </th>\n\t\t\t\t\t\t\t\t<th  > P3 </th>  <th  > P4 </th> \n\t\t\t\t\t\t\t\t<th rowspan=2 width=14%> Presents </th> <th rowspan=2  width=14%> Absents </th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr> \n\t\t\t\t\t\t\t\t<th  > {$subjects['P1']}</th> <th >{$subjects['P2']}</th>\n\t\t\t\t\t\t\t\t<th  > {$subjects['P3']} </th>  <th  > {$subjects['P4']} </th> \n\t\t\t\t\t\t\t</tr></thead>";
                    $Rnos = array();
                    $uid = array();
                    $dbname = $branchyear . '_Attendance';
                    $table = $branch . $class . '_Attendance';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $q = mysql_query("select Id, RNo from {$table};") or die(mysql_error());
                    while ($res = mysql_fetch_array($q)) {
                        $uid[$res['RNo']] = $res['Id'];
                    }
                    for ($s = 0; $s < count($remaining1); $s++) {
                        $p1 = $remaining1[$s];
                        if (in_array($p1, $confired1)) {
                            $period = $p1;
                            $dbname = $branchyear . '_Attendance';
                            $table = $branch . $class . '_Attendance';
                            //if(!mysql_select_db($dbname)) die(mysql_error());
                            $q = mysql_query("select RNo,Id,`{$date}` from {$table};") or die(mysql_error());
                            $aindex = 0;
                            $pindex = 0;
                            while ($res = mysql_fetch_array($q)) {
                                //$uid[$res['RNo']]=$res['Id'];
                                $z = explode(",", $res[$date]);
                                for ($m = 0; $m < count($z); $m++) {
                                    $y = explode("_", $z[$m]);
                                    if ($y[0] == $period) {
                                        if ($y[1] == "A") {
                                            $Rnos[$p1]['Absents'][$aindex] = $res[0];
                                            $aindex++;
                                        } else {
                                            $Rnos[$p1]['Presents'][$pindex] = $res[0];
                                            $pindex++;
                                        }
                                    }
                                }
                            }
                        } else {
                            $da = date('d-m-Y');
                            $a = $da . '_' . $p1;
                            $dbname = $branchyear . '_Cache';
                            $table = $branch . $class . '_Cache';
                            //if(!mysql_select_db($dbname)) die(mysql_error());
                            $q3 = mysql_query("SELECT RNo, `" . $a . "` FROM {$table}") or die(mysql_error());
                            $aindex = 0;
                            $pindex = 0;
                            while ($individual = mysql_fetch_array($q3)) {
                                if ($individual[$a] == "A") {
                                    $Rnos[$p1]["Absents"][$aindex] = $individual["RNo"];
                                    $aindex++;
                                }
                                if ($individual[$a] == "P") {
                                    $Rnos[$p1]["Presents"][$pindex] = $individual["RNo"];
                                    $pindex++;
                                }
                            }
                        }
                    }
                    $tot = array('A' => 0, 'P' => 0);
                    //print_r($uid);
                    for ($w = 1; $w <= $class_total; $w++) {
                        $tr2 = '<tr >  
						<td style="text-align:center;">' . $w . '  </td>
						<td style="text-align:center;"> ' . $uid[$w] . '  </td>';
                        echo $tr2;
                        //$spread.="$w \t {$uid[$w]} \t";
                        $html .= $tr2;
                        $pc = 0;
                        $ac = 0;
                        for ($l = 1; $l <= 4; $l++) {
                            $pl = "P" . $l;
                            if (in_array($pl, $remaining1)) {
                                if (array_key_exists("Absents", $Rnos[$pl]) && in_array($w, $Rnos[$pl]['Absents'])) {
                                    echo '<td style="text-align:center;" class="text-error"><b> <i class="icon-remove"></i> </b></td>';
                                    $ac++;
                                    $html .= "<td><font color=\"darkred\">&#x2716;</font></td>";
                                } else {
                                    echo '<td style="text-align:center;" class="text-success"><b> <i class="icon-ok"></i> </b></td>';
                                    $pc++;
                                    $html .= "<td><font color=\"green\">&#x2714;</font></td>";
                                }
                            } else {
                                echo '<td></td>';
                                $html .= '<td></td>';
                                //$spread.=" \t";
                            }
                        }
                        $tot['A'] += $ac;
                        $tot['P'] += $pc;
                        echo <<<a
\t\t\t\t\t\t<td style="text-align:center;" class="text-success"><b> {$pc} </b> </td> 
\t\t\t\t\t\t<td style="text-align:center;" class="text-error"><b> {$ac} </b></td>  
\t\t\t\t\t</tr>
\t\t\t\t\t
a;
                        $html .= "<td><font color=\"green\"><b>{$pc}</b></font></td><td><font color=\"darkred\"><b>{$ac}</b></font></td></tr>";
                        //$spread.="$pc \t $ac \n";
                    }
                    echo "<tr><td colspan=6 style='text-align:center;'><b>Total</b></td><td style='text-align:center;' class='text-success'><b>" . $tot['P'] . "</b></td><td style='text-align:center;' class='text-error'><b>" . $tot['A'] . "</b></td></tr>";
                    $html .= "<tr><th colspan=6 style=\"text-align:center;\"> <b>Total</b> </th><td><b><font color=\"green\">" . $tot['P'] . "</font></b></td><td><b><font color=\"darkred\">" . $tot['A'] . "</font></b></td></tr>";
                    //$spread.="\t \tTotal\t \t \t \t{$tot['P']} \t {$tot['A']}";
                    echo "</tbody></table>";
                    if ($row['Position'] == "BA") {
                        echo <<<a
\t\t\t<form action='print.php' method='post' name='abc'>
\t\t\t<input type='hidden' name='Title1' value="{$branch} {$class} - Daily Report">
\t\t\t<input type='hidden' name='Table1' value='{$html}'>
\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as PDF</button></center>
\t\t\t</form>
a;
                        echo <<<b
\t\t\t<form action='excel.php' method='post' name='abc'>
\t\t\t<input type='hidden' name='Title1' value="{$branch} {$class} - Daily Report">
\t\t\t<input type='hidden' name="sheet" value='{$html}'>
\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as Excel Sheet</button></center>
\t\t\t</form>
b;
                    }
                    echo <<<a
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t
a;
                } else {
                    echo "<br><h6><span class='text-error'><br><br><br>No Submissions found till now ...</span></h6><br></div>";
                }
                echo "</div> </div> ";
                display_footer();
                echo "\n</body>\n</html>";
                @mysql_close($con);
            } else {
                echo "<script type='text/javascript'>document.location.href='404.php';</script>";
            }
        } else {
            noservice();
        }
    }
}
<?php

/**
 * Redirect to the summary page
 */
if ($_REQUEST['logout'] == 'true') {
    quercus_servlet_request()->getSession()->invalidate();
    header("Location: index.php");
} else {
    require "WEB-INF/php/inc.php";
    $g_pages = load_pages("page");
    $g_page = $_GET['q'];
    if (!$g_pages[$g_page]) {
        $g_page = "summary";
    }
    include_once $g_pages[$g_page];
    display_footer($g_page);
}
示例#12
0
文件: skin.php 项目: shifter/ospap
function template_message($message, $url)
{
    display_header($url, 3);
    print "{$message}<BR>";
    if ($url != null) {
        print "<A HREF=\"{$url}\">You will be redirected in 3 seconds...</A><BR>";
    }
    display_footer();
}
示例#13
0
function poor($title)
{
    if (!check("BA")) {
        header('location:./login.php');
    } else {
        include 'config/globals.php';
        include 'config/db.php';
        include 'config/settings.php';
        $p = $_SERVER['QUERY_STRING'];
        if (in_array($p, $allowed_subjects)) {
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "\n<body>";
            menu();
            echo <<<a
\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t<div id='error'></div>
a;
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            ////if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SESSION['UserId'];
            $q = "select Position, Branch,Class from {$table} where Id = '{$userid}'";
            $res = mysql_query($q) or die(mysql_error());
            $row = mysql_fetch_array($res);
            $branch = $globalbranch;
            echo <<<a
\t\t
\t\t
\t\t<div class="row">
\t\t\t<div class='span12'>
\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
            echo <<<a
\t\t
\t\t\t<div id="step1" class="span4">     
\t\t\t\t<h5 class='text-info'>Poor Attendance Report - {$branch} </h5>
\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing Data submitted from CRs @ {$branch}  </h6><br>
\t\t\t</div>
\t\t\t<div id="side1" class="span7" >
\t\t\t\t<h6 class='text-right'><a href='./?sub'><i class='icon-home'></i> Home&nbsp;</a> </h6>
a;
            echo <<<a
\t\t\t\t\t<h6 class='text-right'>
a;
            for ($cl = 0; $cl <= count($allowed_subjects); $cl++) {
                $sub = $allowed_subjects[$cl];
                echo "<a href='?{$sub}'>{$sub}</a>&emsp;";
            }
            echo <<<a
\t\t\t\t\t</h6>
a;
            echo <<<a
\t\t\t</div>
\t\t
a;
            $poor = array();
            for ($cl = 1; $cl <= $classno; $cl++) {
                $class = $cl;
                $dbname = $branchyear . '_Attendance';
                $table = $branch . $class . '_Attendance';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $da = date('d-m-Y');
                $date = date('d-m-Y');
                $brcls = $branch . $class;
                $ar = array();
                $users = array();
                //intializing the count of A,P's to 0
                for ($j = 0; $j < count($allowed_subjects); $j++) {
                    $sub = $allowed_subjects[$j];
                    $dbname = $branchyear . '_Subjects';
                    $table = $branch . $class . '_Subjects';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $q = mysql_query("select RNo,Id from {$table}") or die(mysql_error());
                    while ($res = mysql_fetch_array($q)) {
                        if ($j == 1) {
                            $users[$res['RNo']] = $res['Id'];
                        }
                        $ar[$sub][$res['RNo']]['Absents'] = 0;
                        $ar[$sub][$res['RNo']]['Presents'] = 0;
                    }
                }
                //counting the total A's & P's
                $sub = $p;
                $dbname = $branchyear . '_Subjects';
                $table = $branch . $class . '_Subjects';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $qa = mysql_query("select RNo, `" . $sub . "_A` from {$table}") or die(mysql_error());
                $qp = mysql_query("select RNo, `" . $sub . "_P` from {$table}") or die(mysql_error());
                while ($res = mysql_fetch_array($qa)) {
                    $ar[$sub][$res['RNo']]["Absents"] += $res[$sub . "_A"];
                }
                while ($res = mysql_fetch_array($qp)) {
                    $ar[$sub][$res['RNo']]["Presents"] += $res[$sub . "_P"];
                }
                //getting the poor attendance % students
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $strength = count($users);
                for ($j = 1; $j <= $strength; $j++) {
                    $count = 1;
                    $sub = $p;
                    $abs = $ar[$sub][$j]['Absents'];
                    $pres = $ar[$sub][$j]['Presents'];
                    $p_nod = $abs + $pres;
                    @($tmp = $pres / $p_nod * 100);
                    $pr = round($tmp, 1);
                    if ($pr < 50) {
                        $cou = $count++;
                        $que_r = "Select RNo from " . $table . " where Id='" . $users[$j] . "';";
                        $que_n = "Select Name from " . $table . " where Id='" . $users[$j] . "';";
                        $poor[$brcls][$users[$j]] = mysql_fetch_array(mysql_query($que_r))[0] . "_" . $pr . "_" . mysql_fetch_array(mysql_query($que_n))[0];
                    }
                }
            }
            $pct = 0;
            $pcs = array();
            $mn = 1;
            $html = '';
            ///print_r($poor);
            $sub2 = $sub_def[$p];
            echo <<<table_head
\t
<table class="table table-hover table-bordered" style="padding:0px;">
\t\t<thead>
\t\t\t<tr> 
\t\t\t<th style="text-align:center;" >Subject</th>
\t\t\t<th style="padding-left:10px;text-align:left;" colspan=4 valign="top">{$sub2}</th> </tr>
<tr>
\t\t\t<th  style="text-align:center;width:10%;"  > Class </th> <th  style="text-align:center;width:15%;"  > Id </th><th  style="text-align:center;width:10%;"  > RNo</th> <th  style="text-align:center;"  > Name </th><th  style="text-align:center;width:10%;" > Percentage </th>
\t\t\t</tr>
\t\t</thead>
\t\t<tbody>
table_head;
            $html .= '<thead>
			<tr> 
			<th style="text-align:center;" >Subject</th>
			<th style="padding-left:10px;text-align:left;" colspan=4 valign="top"><code>' . $sub2 . '</code></th> </tr>\\n<tr>
			<th  style="text-align:center;width:10%;"  > Class </th><th  style="text-align:center;width:15%;"  > Id </th> <th  style="text-align:center;width:10%;"  > RNo</th><th  style="text-align:center;"  > Name </th><th  style="text-align:center;width:10%;" > Percentage </th>
			</tr>
		</thead>
		<tbody>';
            $pcs++;
            //print_r($poor);
            foreach ($poor as $key => $val) {
                $brcls = $key;
                //$val2 = $poor[$brcls];
                //print_r($val2);
                foreach ($val as $key1 => $value1) {
                    $det = explode("_", $value1);
                    $rn = $det[0];
                    $name = $det[2];
                    $per = $det[1];
                    $lnk = "./students.php?" . $key1 . "/sub";
                    echo '<tr onclick="document.location.href=\'' . $lnk . '\';" style="cursor:pointer;"><td style="text-align:center;">' . $brcls . '</td><td style="text-align:center;">' . $key1 . '</td><td style="text-align:center;" class = "span1">' . $rn . '</td><td class = "span3">' . $name . '</td><td style="text-align:center;" class="text-error">' . $per . '%</td></tr>';
                    $tr = '<tr ><td style="text-align:center;">' . $brcls . '</td><td style="text-align:center;">' . $key1 . '</td><td style="text-align:center;" class = "span1">' . $rn . '</td><td class = "span3" style="text-align:left;">' . $name . '</td><td style="text-align:center;" ><font color=darkred>' . $per . '%</font></td></tr>';
                    $html .= $tr;
                    $pct++;
                }
            }
            $html .= '</tbody>';
            //if($mn != count($poor)) {$html .= '</table><br>';}
            echo "</tbody></table>";
            if ($row['Position'] == "BA") {
                echo <<<a
\t\t<form action='print.php' method='post' name='abc'>
\t\t<input type='hidden' name='Title1' value="{$branch} - {$p} - Poor Attendance Report">
\t\t<input type='hidden' name='Table1' value='{$html}'>
\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as PDF</button></center>
\t\t</form>
a;
                echo <<<b
\t\t<form action='excel.php' method='post' name='abc'>
\t\t<input type='hidden' name='Title1' value="{$branch} - {$p} - Poor Attendance Report">
\t\t<input type='hidden' name="sheet" value='{$html}'>
\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as Excel Sheet</button></center>
\t\t</form>
b;
            }
            //echo $html;
            echo "</div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "invalid subject";
        }
    }
}
示例#14
0
</table>

<?php 
if ($proxy_cache) {
    $cacheable = $proxy_cache->getCacheableEntries(15);
    echo "<h3>Cacheable Pages</h3>";
    echo "<table class='data'>";
    echo "<tr><th>Count</th><th>url</th></tr>\n";
    foreach ($cacheable as $item) {
        echo "<tr>";
        echo "<td>{$item->hitCount}</td><td>{$item->url}</td>";
        echo "</tr>\n";
    }
    echo "</table>";
    $uncacheable = $proxy_cache->getUncacheableEntries(15);
    echo "<h3>Uncacheable Pages</h3>";
    echo "<table class='data'>";
    echo "<tr><th>Count</th><th>url</th></tr>\n";
    foreach ($uncacheable as $item) {
        echo "<tr>";
        echo "<td>{$item->missCount}</td><td>{$item->url}</td>";
        echo "</tr>\n";
    }
    echo "</table>";
}
?>

<?php 
display_footer("cache.php");
示例#15
0
function feedback($title)
{
    if (!check_login()) {
        header("location:login.php");
    } else {
        include 'config/globals.php';
        include 'config/db.php';
        include 'config/settings.php';
        $dbname = $branchyear . '_Logs';
        $table = $branchyear . '_Feedback';
        //if(!mysql_select_db($dbname)) die(mysql_error());
        echo "<!DOCTYPE html>\n<html>\n";
        display_headers($title);
        echo <<<js
\t\t\t\t<script type='text/javascript'>
\t\t\t\t\tfunction Preview(id,val){
\t\t\t\t\t\tdocument.getElementById(id).innerHTML=val;
\t\t\t\t\t}
\t\t\t\t</script>
js;
        echo "<body>\n";
        menu();
        echo <<<feedback
\t\t\t<div class="container" style="margin-top:-15px;">
\t\t\t\t\t<br>
\t\t\t\t\t<div id="error"></div>
\t\t\t\t\t<div class="row">
\t\t\t\t\t\t<div class="span9">
\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
\t\t\t\t\t\t\t\t<div id="stpe2_P1">
\t\t\t\t\t\t\t\t\t<h5>Give Feedback </h5>
\t\t\t\t\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Fill out below details  </h6>
\t\t\t\t\t\t\t\t\t<!--<h5>Period 1 : </h5>-->
\t\t\t\t\t\t\t\t\t<form method="POST" action="" onSubmit="return give_feedback();" >
\t\t\t\t\t\t\t\t\t\t<h6 > Feedback Type :</h6>
\t\t\t\t\t\t\t\t\t\t<label class="radio inline">
\t\t\t\t\t\t\t\t\t\t<input type="radio" id='complaint' value="Complaint" name="ftype" onclick="Preview(this.name,this.value);"> Complaint 
\t\t\t\t\t\t\t\t\t</label>
\t\t\t\t\t\t\t\t\t<label class="radio inline">
\t\t\t\t\t\t\t\t\t\t<input type="radio" id='suggestion' value="Suggestion" name="ftype" onclick="Preview(this.name,this.value);"> Suggestion
\t\t\t\t\t\t\t\t\t</label><br><br>
\t\t\t\t\t\t\t\t<h6> Subject :</h6>
\t\t\t\t\t\t\t\t<input type="text" class="span8" placeholder="Subject" id='subject' name='sub' onkeyup="Preview(this.name,this.value);"><br>
\t\t\t\t\t\t\t\t<h6> Message :</h6>
\t\t\t\t\t\t\t\t<textarea class="span8" id='feedback' name='fb' style="resize:vertical;height:90px;" onkeyup="Preview(this.name,this.value);" placeholder="Type your complaint/suggestion here"></textarea>
\t\t\t\t<br>
\t\t\t</div>
\t\t\t<div id="stpe3">
\t\t\t\t<a ><h5>Preview </h5></a>
\t\t\t\t<!--<h6> &emsp;&emsp;&emsp; - &emsp; Confirm Your Notice </h6>-->
\t\t\t\t<div class="row">
\t\t\t\t\t<div class="span8">
\t\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t\t<tr> 
\t\t\t\t\t\t\t\t\t<th class="span2"  > Feedback Type  </th>
\t\t\t\t\t\t\t\t\t<td class='span6' id='ftype'> Complaint/Suggestion  </td>
\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t<tr> 
\t\t\t\t\t\t\t\t<th class="span2"  > Suject </th>
\t\t\t\t\t\t\t\t<td class="span6" id='sub'> Feedback subject  </td>  
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t<tr> 
\t\t\t\t\t\t\t\t<th class="span2" > Feedback  </th> 
\t\t\t\t\t\t\t\t<td class="span6" id='fb'> Complaint/Suggestion  </td> 
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>
\t\t\t\t</div>
\t\t\t</div><br>
\t\t\t<input type="submit" class="btn btn-primary" value="Confirm & Send &rarr;" name="post" />
\t\t\t</form>
\t\t</div>
\t\t<br>
\t</div>
</div>
feedback;
        echo "<div class='span3'>";
        go_home();
        sidepanel();
        echo "</div></div>";
        display_footer();
        echo "\n</body>\n</html>";
    }
}
示例#16
0
function changeprofile($title)
{
    if (!check_login()) {
        header('location:login.php');
    } else {
        include 'config/globals.php';
        $p = $_SERVER['QUERY_STRING'];
        $arr = array("password", "contact", "photo");
        if (in_array($p, $arr)) {
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SESSION['UserId'];
            $q = "select Password, PhoneNo, Branch from {$table} where Id = '{$userid}'";
            $res = mysql_query($q) or die(mysql_error());
            $row = mysql_fetch_array($res);
            $branch = $row['Branch'];
            $pass = $row['Password'];
            $phoneno = $row['PhoneNo'];
            $class = substr($p, -1);
            $ex = array("png", "jpg", "jpeg", "gif", "bmp");
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "\n<body>";
            menu();
            echo <<<a
\t\t\t\t<div class='container'>
\t\t\t\t\t<div id="error" style="display:none;"></div>
\t\t\t\t\t<div class='row'>
\t\t\t\t\t<div class='span9'>
\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;height:450px;">
a;
            if ($p == 'password') {
                display_password();
            }
            if (isset($_POST['Password'])) {
                $pass1 = md5($_POST['OPass']);
                $newpass1 = md5($_POST['NPass1']);
                $newpass2 = md5($_POST['NPass2']);
                if (strlen(trim($pass1)) < 7) {
                    echo "<script>show_error('Error : Password should not be null');</script>";
                    exit;
                }
                if (strlen(trim($newpass1)) < 7) {
                    echo "<script>show_error('Error : New Password should not be null');</script>";
                    exit;
                }
                if (strlen(trim($newpass2)) < 7) {
                    echo "<script>show_error('Error : Re- New Password should not be null');</script>";
                    exit;
                }
                if ($pass1 != $pass) {
                    echo "<script>show_error('Error : Your Current Password does not matched ... Please try again....');</script>";
                } else {
                    if ($newpass1 != $newpass2) {
                        echo "<script>show_error('Error : New Password both does not matched ... Please try again....');</script>";
                    } else {
                        $q = mysql_query("update {$table} set Password = '******' where Id = '{$userid}';") or die(mysql_error());
                        insert_log("{$userid} changed his Password ");
                        echo "<script>show_success('Password has been updated');</script>";
                    }
                }
            }
            if ($p == 'contact') {
                display_contact();
            }
            if (isset($_POST['Contact'])) {
                $pass1 = md5($_POST['OPass']);
                $contact1 = $_POST['MNo'];
                if (strlen(trim($pass1)) < 7) {
                    echo "<script>show_error('Error : Password should not be null');</script>";
                    exit;
                }
                if (strlen(trim($contact1)) == 0) {
                    echo "<script>show_error('Error : Contact No should not be null');</script>";
                    exit;
                }
                if ($pass1 != $pass) {
                    echo "<script>show_error('Error : Your Current Password does not matched ... Please try again....');</script>";
                } else {
                    if (strlen($contact1) != 10) {
                        echo "<script>show_error('Error : New Contact No. to short... Please try again....');</script>";
                    } else {
                        $q = mysql_query("update {$table} set PhoneNo = '{$contact1}' where Id = '{$userid}';") or die(mysql_error());
                        insert_log("{$userid} changed his Contact No");
                        echo "<script>show_success('Contact No has been updated');</script>";
                    }
                }
            }
            if ($p == 'photo') {
                display_photo();
            }
            if (isset($_POST['Photo'])) {
                $pass1 = md5($_POST['OPass']);
                if (strlen(trim($pass1)) < 7) {
                    echo "<script>show_error('Error : Password should not be null');</script>";
                    exit;
                }
                if ($pass1 != $pass) {
                    echo "<script>show_error('Error : Your Current Password does not matched ... Please try again....');</script>";
                } else {
                    if (isset($_FILES['PhotoFile'])) {
                        $fname = $_FILES['PhotoFile']["name"];
                        $fsize = $_FILES['PhotoFile']["size"];
                        $fext = strtolower(end(explode(".", $fname)));
                        if ($fsize > 102400) {
                            echo "<script>show_error('Error : Input file is larger than 100KB ... Please try again....');</script>";
                        } else {
                            if (!in_array($fext, $ex)) {
                                echo "<script>show_error('Error : Input file is not a image file ... Please try again....');</script>";
                            } else {
                                $fname_new = "assets/img/users/" . $userid . ".png";
                                if (!move_uploaded_file($_FILES["PhotoFile"]["tmp_name"], $fname_new)) {
                                    echo "<script>show_error('Error : In moving the input file ... Please try again....');</script>";
                                } else {
                                    exec("chmod 777 {$fname_new}");
                                    $q = mysql_query("update {$table} set Picture = '{$fname_new}' where Id = '{$userid}';") or die(mysql_error());
                                    insert_log("{$userid} changed his profile photo");
                                    echo "<script>show_success('Profile Photo Updated ');</script>";
                                }
                            }
                        }
                    } else {
                        echo "<script>show_error('Error : No input file ... Please try again....');</script>";
                    }
                }
            }
            echo <<<b
\t\t</div>\t
\t\t</div>
\t\t<div class='span3'>
b;
            go_home();
            echo <<<b
\t\t<ul class="nav nav nav-tabs nav-stacked">
\t\t
\t\t<li><a href='?password'>Change Password <i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>
\t\t<li><a href='?contact'>Change Contact No<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>
\t\t<li><a href='?photo'>Change Photo <i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>
\t\t
\t\t</ul>
b;
            echo "</div></div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
示例#17
0
function changecr($title)
{
    if (!check('BA') and !check('SA')) {
        header('location:login.php');
    } else {
        include 'config/globals.php';
        $p = $_SERVER['QUERY_STRING'];
        $reg = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
        if (preg_match($reg, $p)) {
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SESSION['UserId'];
            $q = "select Branch from {$table} where Id = '{$userid}'";
            $res = mysql_query($q) or die(mysql_error());
            $row = mysql_fetch_array($res);
            $branch = $row['Branch'];
            $class = substr($p, -1);
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "\n<body>";
            menu();
            $array = array_merge(range(0, 9), range('a', 'z'));
            shuffle($array);
            $crkey = "";
            for ($i = 0; $i < 9; $i++) {
                $crkey .= $array[$i];
            }
            echo <<<a
\t\t\t\t<div class='container'>
\t\t\t\t\t<div id="error" style="display:none;"></div>
\t\t\t\t\t<div class='row'>
\t\t\t\t\t<div class='span9'>
\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;height:450px;">
a;
            if (isset($_POST["Idno"])) {
                $id = addslashes($_POST['Idno']);
                $gender = addslashes($_POST['Gender']);
                $key = addslashes($_POST['Key']);
                if (strlen(trim($id)) == 0) {
                    echo "<script>show_error('Error : Id should not be null');</script>";
                    exit;
                }
                if (strlen(trim($gender)) == 0) {
                    echo "<script>show_error('Error : CR Gender should not be null');</script>";
                    exit;
                }
                if (strlen(trim($key)) == 0) {
                    echo "<script>show_error('Error : Key should not be null');</script>";
                    exit;
                }
                include 'config/db.php';
                include 'config/settings.php';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) {die(mysql_error());}
                $userid = $id;
                $q = "select Name,Branch,Class,Gender from {$table} where Id = '{$userid}'";
                $res = mysql_query($q) or die(mysql_error());
                $row = mysql_fetch_array($res);
                $name = ucwords(strtolower($row['Name']));
                $branch = $row['Branch'];
                $class1 = $row['Class'];
                $gender1 = $row['Gender'];
                $branch = $globalbranch;
                $d = $dict[$gender . '1'];
                if ($class1 == $class && $gender1 == $gender) {
                    $table = $branchyear . '_CRs';
                    $old_id = mysql_fetch_array(mysql_query("Select Id from {$table} where Class = '{$class}'  and Gender = '{$gender}';"))['Id'];
                    $q = mysql_query("delete from {$table} where Class = '{$class}'  and Gender = '{$gender}';") or die(mysql_error());
                    $q1 = mysql_query("insert into {$table} ( `Id`, `Name`, `Gender`, `Branch`,`Class`, `Key`) values ( '{$id}', '{$name}' , '{$gender}', '{$branch}', '{$class}', '{$key}');") or die(mysql_error());
                    insert_log("Changing {$branch} {$class} {$d} CR to {$id}");
                    $dbname = $branchyear . '_Logs';
                    $table = $branchyear . '_Notifications';
                    //if(!mysql_select_db($dbname)) {die(mysql_error());}
                    $datetime = date('d/m/Y H:m:s');
                    $ip = $_SERVER['REMOTE_ADDR'];
                    $to1 = $branch . $class . "@students";
                    $query = mysql_query("INSERT INTO " . $table . "(`To`,`From`,`Subject`,`Message`,`DateTime`,`IP`) VALUES('{$to1}','" . $_SESSION['UserId'] . "','Changing the {$d} CR of {$branch} {$class}','Dear Students,<br>Please Notice that, {$branch} {$class} {$d} CR has been changed to <br> {$name}, {$id}.','{$datetime}','{$ip}');") or die(mysql_error());
                    $table = $dbname = $branchyear . '_Students';
                    $query = mysql_query("update {$table} set Position = 'CR' where Id = '{$id}'") or die(mysql_error());
                    $query1 = mysql_query("update {$table} set Position = 'S' where Id = '{$old_id}'") or die(mysql_error());
                    echo "<script>show_success('{$branch} {$class} {$d} CR has been updated with {$name} and security key <u class=\\'text-error\\'>{$key}</u> ');</script>";
                } else {
                    echo "<script>show_error('<b>Error </b> : <b>{$id}</b> is not from the <b>{$branch} {$class} {$d}</b>  Please try again.. ');</script>";
                }
            }
            echo <<<a
\t\t\t<div id="step1">    
\t\t\t<h4>Change CR of {$branch} {$class} </h4>
\t\t\t<h6> &emsp;&emsp;&emsp;&emsp; Provide Details of New CR  </h6><br>
\t\t\t<form action="?{$p}" method="POST" onsubmit="return viewcr('{$branch}',{$class});"  id="changecr">
\t\t\t<h5>Gender : </h5>  
\t\t\t<label class="radio inline"><input type="radio"  value="M" name="Gender" id="Male" /> Male </label>
\t\t\t<label class="radio inline"><input type="radio"  value="F" name="Gender" id="Female" /> Female </label> 
\t\t\t<br><br>
\t\t\t<h5>New CR ID No : </h5>
\t\t\t<input type="text" class="input-large" placeholder="N090001"  id="Idno" name="IdNo" maxlength="7" /><br>
\t\t\t<!--<h5>Security Key : </h5>-->
\t\t\t<input type="hidden" class="input-large" placeholder="Password" readonly=readonly name="Key" value="{$crkey}" ><br>
\t\t\t<input type="submit" class="btn btn-primary" name="change" value = "Continue &rarr;" />
\t\t\t</form>\t
\t\t\t<form action="?{$p}" method='post' id='sub2'>
\t\t\t<div id="confirm">
\t\t\t\t<div id="cr" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="useridlabel" aria-hidden="true">
\t\t\t\t<div class="modal-header">
\t\t\t\t<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
\t\t\t\t<h4 id="useridlabel">Caution</h4>
\t\t\t\t</div>
\t\t\t\t<div class="modal-body" id='mbody'></div>
\t\t\t\t<div class="modal-footer">
\t\t\t\t<button class="btn btn-danger"  aria-hidden="true" type="submit" onclick="a();">Confirm & Replace </button> 
\t\t\t\t<button class="btn btn-primary"  aria-hidden="true"  data-dismiss='modal' > Cancel </button>
\t\t\t\t</div>
\t\t\t</div>
\t\t\t\t<input type="hidden"  placeholder="Password" readonly=readonly name="Gender" value="" id='gender1'>
\t\t\t\t<input type="hidden"  placeholder="Password" readonly=readonly name="Idno" value="" id='idno1'>
\t\t\t\t<input type="hidden" class="input-large" placeholder="Password" readonly=readonly name="Key" value="{$crkey}" >
\t\t\t</form>
\t\t\t</div>
\t\t\t</div>\t\t
a;
            echo <<<b
\t\t\t\t
\t\t\t\t</div>\t
\t\t\t\t</div>
\t\t\t\t<div class='span3'>
b;
            go_home();
            cr_classes($classno, $globalbranch);
            echo "</div></div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
示例#18
0
function homepage($title)
{
    if (!check_login()) {
        header('location:login.php');
    } else {
        echo "<!DOCTYPE html>\n<html>\n\t<SCRIPT LANGUAGE=\"Javascript\" SRC=\"assets/charts/FusionCharts.js\"></SCRIPT>";
        display_headers($title);
        echo "\n<body>";
        menu();
        echo <<<a
\t\t\t\t<div class='container'>
\t\t\t\t\t<div id='error'></div>
\t\t\t\t\t<div class='row'>
\t\t\t\t\t<div class='span9'>
\t\t\t\t\t\t<div class="well well-large" style="background:#FFF">
\t\t\t\t\t\t
a;
        splash();
        echo <<<a
\t<div id="step1" class="span4">     
\t\t
\t</div>
\t<div id="side1" class="span4" >
\t\t<h6 class='text-right'><a href='?sub'><i class='icon-book'></i>&nbsp; Subjects</a> &emsp; <a href='?p'><i class='icon-qrcode'></i>&nbsp; Periods</a></h6>
\t</div>
a;
        /* Fetching Details */
        include 'config/db.php';
        include 'config/settings.php';
        $dbname = $branchyear . '_Users';
        $table = $branchyear . '_Students';
        //if(!mysql_select_db($dbname)) die(mysql_error());
        $userid = $_SESSION['UserId'];
        $q = "select Position, Branch, Class ,RNo from {$table} where Id = '{$userid}'";
        $res = mysql_query($q) or die(mysql_error());
        $row = mysql_fetch_array($res);
        $RNo = $row["RNo"];
        $type = $row['Position'];
        if ($row['Position'] == "BA") {
            $branch = $globalbranch;
            $p1 = substr($_SERVER["QUERY_STRING"], 0, $branchlen);
            if ($p1 == $globalbranch) {
                $p = explode("/", $_SERVER["QUERY_STRING"]);
                $class = substr($p[0], -1);
            } else {
                $class = 1;
            }
        } else {
            $branch = $row['Branch'];
            $class = $row['Class'];
        }
        $colors = array('F6BD0F', '8BBA00', 'FF8E46', '8E468E', '588526', '008ED6', '9D080D', 'D64646', 'B3AA00', 'A186BE', 'AFD8F8');
        shuffle($colors);
        $colorz = array('F6BD0F,8BBA00', 'FF8E46,8E468E', '8E468E,588526', '008ED6,9D080D');
        $reqcolorz = explode(",", $colorz[rand(0, 3)]);
        /* Deatils Fetched */
        /* Start Checking wheter he is a student or any other */
        if ($type == "S") {
            /* Starting Period Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == "p") {
                //mysql_select_db($branchyear."_Dates") or die(mysql_error());
                $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';") or die(mysql_error());
                $nofd = mysql_num_rows($query);
                if ($nofd != 0) {
                    $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0);
                    $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0);
                    $strXML = "<graph caption='Period Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>";
                    $datasetp = '';
                    while ($dates = mysql_fetch_array($query)) {
                        //mysql_select_db($branchyear."_Attendance") or die(mysql_error());
                        $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $RNo . "';");
                        while ($res = mysql_fetch_array($q)) {
                            $values = explode(",", $res[0]);
                            for ($i = 0; $i < count($values) - 1; $i++) {
                                if (substr($values[$i], -1) == "P") {
                                    $stats["Presents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                if (substr($values[$i], -1) == "A") {
                                    $stats["Absents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                $p[$values[$i]] += 1;
                            }
                        }
                    }
                    $tr = '';
                    for ($i = 1; $i <= 4; $i++) {
                        @($st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success");
                        @($tr .= '<tr>  
				<td style="text-align:center;">' . $i . '</td>
				<td style="text-align:center;"> P' . $i . ' </td> 
				<td style="text-align:center;"><b> ' . $nofd . '</b> </td> 
				<td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td>  
				<td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> 
				<td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-' . $st . '"><b> <small>' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </small></b></td>   
			</tr>');
                        @($datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>");
                    }
                    $strXML .= $datasetp . "</graph>";
                    echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for Student - ' . $userid . '</h5><br>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5 class="text-info"> Period Wise Attendance Representation for Student - {$userid}</h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Period </th> 
                                <th  style="text-align:center;"  > Days </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > P/Day </th>  <th  style="text-align:center;"  > Absents </th> 
                                <th  style="text-align:center;" > A/Day </th><th  style="text-align:center;" > Performance </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<table class='table  table-hover table-bordered ' >
\t\t<tr>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t</tr>
\t\t<tr>
\t\t\t<th><center>P/Day</center></th><td>&emsp;No. of Presents for Day</td>\t
\t\t\t<th><center>A/Day</center></th><td>&emsp;No. of Absents for Day</td>
\t\t</tr>
\t\t
\t\t
</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
\t\t
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Period Wise Attendance*/
            /* SUbjects Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == "sub") {
                //mysql_select_db($branchyear."_Subjects") or die(mysql_error());
                $query = mysql_query("Select * from " . $branch . $class . "_Subjects where RNo='{$RNo}';") or die(mysql_error());
                $subjectwise = mysql_fetch_array($query) or die(mysql_error());
                $tr = '';
                $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>";
                $datasetp = '';
                $nc_cls = 0;
                $poor = array();
                for ($i = 0; $i < count($allowed_subjects); $i++) {
                    $tnoc = $subjectwise[$allowed_subjects[$i] . "_P"] + $subjectwise[$allowed_subjects[$i] . "_A"];
                    if ($tnoc == 0) {
                        $nc_cls++;
                        $performance = "N/A  ";
                        $st = "error";
                        $remarks = "CNYS";
                    } else {
                        $performance = $subjectwise[$allowed_subjects[$i] . "_P"] / $tnoc * 100;
                        $performance = round($performance, 1) . " %";
                        $st = $performance <= 50 ? "error" : "success";
                        if (round($performance, 1) >= 95) {
                            $remarks = "Excellent";
                        }
                        if (round($performance, 1) >= 90 && round($performance, 1) < 95) {
                            $remarks = "Very Good";
                        }
                        if (round($performance, 1) >= 80 && round($performance, 1) < 90) {
                            $remarks = "Good";
                        }
                        if (round($performance, 1) >= 70 && round($performance, 1) < 80) {
                            $remarks = "Normal";
                        }
                        if (round($performance, 1) >= 60 && round($performance, 1) < 70) {
                            $remarks = "Average";
                        }
                        if (round($performance, 1) >= 50 && round($performance, 1) < 60) {
                            $remarks = "Bad";
                            $poor[$allowed_subjects[$i]] = $performance;
                        }
                        if (round($performance, 1) < 50) {
                            $remarks = "Go Out";
                            $poor[$allowed_subjects[$i]] = $performance;
                        }
                    }
                    $tr .= '<tr> 
					<td style="text-align:center;">' . ($i + 1) . '</td> 
					<td style="text-align:center;"> <b><small>' . $allowed_subjects[$i] . '</small></b> </td> 
					<td style="text-align:center;"> <b>' . $tnoc . '</b> </td> 
					<td style="text-align:center;" class="text-success"><b> ' . $subjectwise[$allowed_subjects[$i] . "_P"] . '</b> </td> 
					<td style="text-align:center;" class="text-error"><b> ' . $subjectwise[$allowed_subjects[$i] . "_A"] . ' </b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b>' . $performance . '</b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b><small>' . $remarks . '</small></b></td>
				</tr>';
                    $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . round($performance, 1) . "' color='" . $colors[$i] . "'/>";
                }
                $strXML .= $datasetp . "</graph>";
                if ($nc_cls != count($allowed_subjects)) {
                    echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for Student - ' . $userid . '</h5><br>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5 class="text-info"> Subject Wise Attendance Representation for Student - {$userid}</h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;"  rowspan="2" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Subject  </th> 
                                <th  style="text-align:center;"  > Classes </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > Absents </th>  <th  style="text-align:center;"  > Performance </th> 
                                <th  style="text-align:center;" > Remarks </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                    $st2 = "";
                    //print_r($poor);
                    foreach ($poor as $key => $value) {
                        $st2 .= $key . " ";
                    }
                    if (count($poor) != 0) {
                        echo "<script type='text/javascript'>show_error('Your Attendance is Poor in {$st2} ');</script>";
                    }
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of SUbjects Wise Attendance*/
            /* Checking for Wrong Keyword */
            if (strtolower($_SERVER["QUERY_STRING"]) != "sub" and strtolower($_SERVER["QUERY_STRING"]) != "p") {
                echo "<script type='text/javascript'>document.location.href='./?sub';</script>";
            }
            /* End of Checking for Wrong Keyword */
        }
        /* End of Checking wheter he is a student or any other */
        /////////////////////*********************///////////////
        /* Start Checking wheter he is a CR or any other */
        if ($type == "CR" or $type == "SA") {
            $branch2 = $branch . $class;
            /* Starting Period Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == "p") {
                ////mysql_select_db($branchyear."_Dates") or die(mysql_error());
                $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';");
                $nofd = mysql_num_rows($query);
                if ($nofd != 0) {
                    $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0);
                    $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0);
                    $strXML = "<graph caption='Period Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>";
                    $datasetp = '';
                    while ($dates = mysql_fetch_array($query)) {
                        //mysql_select_db($branchyear."_Attendance") or die(mysql_error());
                        $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $RNo . "';");
                        while ($res = mysql_fetch_array($q)) {
                            $values = explode(",", $res[0]);
                            for ($i = 0; $i < count($values) - 1; $i++) {
                                if (substr($values[$i], -1) == "P") {
                                    $stats["Presents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                if (substr($values[$i], -1) == "A") {
                                    $stats["Absents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                $p[$values[$i]] += 1;
                            }
                        }
                    }
                    $tr = '';
                    for ($i = 1; $i <= 4; $i++) {
                        @($st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success");
                        @($tr .= '<tr>  
				<td style="text-align:center;">' . $i . '</td>
				<td style="text-align:center;"> P' . $i . ' </td> 
				<td style="text-align:center;"><b> ' . $nofd . '</b> </td> 
				<td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td>  
				<td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> 
				<td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-' . $st . '"><b><small> ' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </small></b></td>   
			</tr>');
                        @($datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>");
                    }
                    $strXML .= $datasetp . "</graph>";
                    echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for CR ' . $branch2 . ' - ' . $userid . '</h5><br>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5 class="text-info"> Period Wise Attendance Representation for CR - {$userid} </h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Period </th> 
                                <th  style="text-align:center;"  > Days </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > P/Day </th>  <th  style="text-align:center;"  > Absents </th> 
                                <th  style="text-align:center;" > A/Day </th><th  style="text-align:center;" > Performance </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t</table>
\t\t<br>
\t\t<table class='table  table-hover table-bordered ' >
\t\t<tr>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t</tr>
\t\t<tr>
\t\t\t<th><center>P/Day</center></th><td>&emsp;No. of Presents for Day</td>\t
\t\t\t<th><center>A/Day</center></th><td>&emsp;No. of Absents for Day</td>
\t\t</tr>
\t\t
\t\t
</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Period Wise Attendance*/
            /* SUbjects Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == "sub") {
                $branch2 = $branch . $class;
                //mysql_select_db($branchyear."_Subjects") or die(mysql_error());
                $query = mysql_query("Select * from " . $branch . $class . "_Subjects where RNo='{$RNo}';") or die(mysql_error());
                $subjectwise = mysql_fetch_array($query);
                $tr = '';
                $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>";
                $datasetp = "";
                $nc_cls = 0;
                $poor = array();
                for ($i = 0; $i < count($allowed_subjects); $i++) {
                    $tnoc = $subjectwise[$allowed_subjects[$i] . "_P"] + $subjectwise[$allowed_subjects[$i] . "_A"];
                    if ($tnoc == 0) {
                        $nc_cls++;
                        $performance = "N/A  ";
                        $st = "error";
                        $remarks = "CNYS";
                    } else {
                        $performance = $subjectwise[$allowed_subjects[$i] . "_P"] / $tnoc * 100;
                        $performance = round($performance, 1) . " %";
                        $st = $performance <= 50 ? "error" : "success";
                        if (round($performance, 1) >= 95) {
                            $remarks = "Excellent";
                        }
                        if (round($performance, 1) >= 90 && round($performance, 1) < 95) {
                            $remarks = "Very Good";
                        }
                        if (round($performance, 1) >= 80 && round($performance, 1) < 90) {
                            $remarks = "Good";
                        }
                        if (round($performance, 1) >= 70 && round($performance, 1) < 80) {
                            $remarks = "Normal";
                        }
                        if (round($performance, 1) >= 60 && round($performance, 1) < 70) {
                            $remarks = "Average";
                        }
                        if (round($performance, 1) >= 50 && round($performance, 1) < 60) {
                            $remarks = "Bad";
                            $poor[$allowed_subjects[$i]] = $performance;
                        }
                        if (round($performance, 1) < 50) {
                            $remarks = "Go Out";
                            $poor[$allowed_subjects[$i]] = $performance;
                        }
                    }
                    $tr .= '<tr> 
					<td style="text-align:center;">' . ($i + 1) . '</td> 
					<td style="text-align:center;"> <b><small>' . $allowed_subjects[$i] . '</small></b> </td> 
					<td style="text-align:center;"> <b>' . $tnoc . '</b> </td> 
					<td style="text-align:center;" class="text-success"><b> ' . $subjectwise[$allowed_subjects[$i] . "_P"] . '</b> </td> 
					<td style="text-align:center;" class="text-error"><b> ' . $subjectwise[$allowed_subjects[$i] . "_A"] . ' </b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b>' . $performance . '</b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b><small>' . $remarks . '</small></b></td>
				</tr>';
                    $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . round($performance, 1) . "' color='" . $colors[$i] . "'/>";
                }
                $strXML .= $datasetp . "</graph>";
                if ($nc_cls != count($allowed_subjects)) {
                    echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for CR ' . $branch2 . ' - ' . $userid . '</h5><br>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5 class="text-info"> Subject Wise Attendance Representation for CR - {$userid}</h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;"  rowspan="2" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Subject  </th> 
                                <th  style="text-align:center;"  > Classes </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > Absents </th>  <th  style="text-align:center;"  > Performance </th> 
                                <th  style="text-align:center;" > Remarks </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                    $st2 = "";
                    //print_r($poor);
                    foreach ($poor as $key => $value) {
                        $st2 .= $key . " ";
                    }
                    if (count($poor) != 0) {
                        echo "<script type='text/javascript'>show_error('Your Attendance is Poor in {$st2} ');</script>";
                    }
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of SUbjects Wise Attendance*/
            /* Checking for Wrong Keyword */
            if (strtolower($_SERVER["QUERY_STRING"]) != "sub" and strtolower($_SERVER["QUERY_STRING"]) != "p" and strtolower($_SERVER["QUERY_STRING"]) != strtolower($branch . $class . "/p") and strtolower($_SERVER["QUERY_STRING"]) != strtolower($branch . $class . "/sub")) {
                echo "<script type='text/javascript'>document.location.href='./?sub';</script>";
            }
            /* End of Checking for Wrong Keyword */
        }
        /* End of Checking wheter he is a CR or any other */
        ////////////////////////////////****************////////////////
        if ($type == "BA" or $type == "CR") {
            /* Start of Class Period Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == strtolower($branch . $class . "/p")) {
                $branch2 = $branch . $class;
                //mysql_select_db($branchyear."_Dates") or die(mysql_error());
                $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';");
                $nofd = mysql_num_rows($query);
                if ($nofd != 0) {
                    $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0);
                    $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0);
                    $strXML = "<graph caption='Period Wise Attendance Report of {$branch} {$class}' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>";
                    $datasetp = '';
                    while ($dates = mysql_fetch_array($query)) {
                        //mysql_select_db($branchyear."_Attendance") or die(mysql_error());
                        $count_q = mysql_query("select count(`RNo`) from " . $branch . $class . "_Attendance;");
                        $countclass = mysql_fetch_array($count_q);
                        $classcount = $countclass[0];
                        for ($init = 1; $init <= $classcount; $init++) {
                            //mysql_select_db($branchyear."_Attendance") or die(mysql_error());
                            $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $init . "';");
                            while ($res = mysql_fetch_array($q)) {
                                $values = explode(",", $res[0]);
                                for ($i = 0; $i < count($values) - 1; $i++) {
                                    if (substr($values[$i], -1) == "P") {
                                        $stats["Presents"] += 1;
                                        $stats["Total"] += 1;
                                    }
                                    if (substr($values[$i], -1) == "A") {
                                        $stats["Absents"] += 1;
                                        $stats["Total"] += 1;
                                    }
                                    $p[$values[$i]] += 1;
                                }
                            }
                        }
                    }
                    $tr = '';
                    for ($i = 1; $i <= 4; $i++) {
                        @($st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success");
                        @($tr .= '<tr>  
				<td style="text-align:center;">' . $i . '</td>
				<td style="text-align:center;"> P' . $i . ' </td> 
				<td style="text-align:center;"><b> ' . $nofd . '</b> </td> 
				<td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td>  
				<td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> 
				<td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-' . $st . '"><b> <small>' . round($p["P" . $i . "_P"] / $nofd / $classcount * 100, 1) . ' %</small> </b></td>
			</tr>');
                        @($datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd / $classcount * 100, 1) . "' color='" . $colors[$i] . "'/>");
                    }
                    $strXML .= $datasetp . "</graph>";
                    echo '<br><h5 class="text-info">Chart Based Periods Attendance Representaiton for Class ' . $branch2 . '</h5><br>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_header
\t
\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t    <thead>
\t\t<tr> 
\t\t<th style="text-align:center;"   valign="top"> SNo  </th> 
\t\t<th style="text-align:center;"   valign="top"> Periods  </th> 
\t\t<th  style="text-align:center;"  > Classes </th> 
\t\t<th  style="text-align:center;" > Presents </th>
\t\t<th  style="text-align:center;" > P/C </th>
\t\t<th  style="text-align:center;"  > Absents </th>  
\t\t<th  style="text-align:center;" > A/C </th>
\t\t<th  style="text-align:center;"  > Performance </th> 
\t\t</tr>
\t    </thead>
\t    <tbody>
table_header;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br>
\t\t<table class='table  table-hover table-bordered ' >
\t\t<tr>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t</tr>
\t\t<tr>
\t\t\t<th><center>P/C</center></th><td>&emsp;No. of Presents for Class</td>\t
\t\t\t<th><center>A/C</center></th><td>&emsp;No. of Absents for Class</td>
\t\t</tr>
\t\t
\t\t
</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Class Period Wise Attendance */
            /* Start of Class Subject Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == strtolower($branch . $class . "/sub")) {
                $branch2 = $branch . $class;
                $tr = '';
                $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>";
                $datasetp = "";
                $nc_cls = 0;
                for ($i = 0; $i < count($allowed_subjects); $i++) {
                    //mysql_select_db($branchyear."_Subjects") or die(mysql_error());
                    $queryp = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_P`) as " . $allowed_subjects[$i] . "_P from " . $branch . $class . "_Subjects;");
                    $querya = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_A`) as " . $allowed_subjects[$i] . "_A from " . $branch . $class . "_Subjects;");
                    $resultp1 = mysql_fetch_array($queryp);
                    $resulta1 = mysql_fetch_array($querya);
                    $resultp = $resultp1[0];
                    $resulta = $resulta1[0];
                    //mysql_select_db($branch."09_Subjects");
                    $tn = mysql_fetch_array(mysql_query("select `" . $allowed_subjects[$i] . "_P`,`" . $allowed_subjects[$i] . "_A` from " . $branch . $class . "_Subjects;")) or die(mysql_error());
                    $tnoc = $tn[0] + $tn[1];
                    if ($tnoc == 0) {
                        $nc_cls++;
                        $performance = 0;
                        $performance1 = "N/A  ";
                        $st = "error";
                        $remarks = "CNYS";
                    } else {
                        $performance = $resultp / ($resultp + $resulta) * 100;
                        $performance1 = round($performance, 1) . " %";
                        $st = $performance <= 50 ? "error" : "success";
                        if (round($performance, 1) >= 95) {
                            $remarks = "Excellent";
                        }
                        if (round($performance, 1) >= 90 && round($performance, 1) < 95) {
                            $remarks = "Very Good";
                        }
                        if (round($performance, 1) >= 80 && round($performance, 1) < 90) {
                            $remarks = "Good";
                        }
                        if (round($performance, 1) >= 70 && round($performance, 1) < 80) {
                            $remarks = "Normal";
                        }
                        if (round($performance, 1) >= 60 && round($performance, 1) < 70) {
                            $remarks = "Average";
                        }
                        if (round($performance, 1) >= 50 && round($performance, 1) < 60) {
                            $remarks = "Bad";
                        }
                        if (round($performance, 1) < 50) {
                            $remarks = "Go Out";
                        }
                    }
                    $tr .= '<tr>  
		<td style="text-align:center;"> <small>' . ($i + 1) . '</small> </td> 
		<td style="text-align:center;"> <small>' . $allowed_subjects[$i] . '</small> </td> 
		<td style="text-align:center;"><b> <small>' . $tnoc . '</small></b> </td> 
		<td style="text-align:center; class="text-success""><b><small> ' . $resultp . ' </small></b></td>  
		<td style="text-align:center;" class="text-success"><b> <small>' . ($resultp != 0 ? round($resultp / $tnoc, 1) : 0) . '</small> </b></td>  
		<td style="text-align:center;" class="text-error"><b> <small>' . $resulta . ' </small></b></td>  
		<td style="text-align:center;" class="text-error"><b><small> ' . ($resulta != 0 ? round($resulta / $tnoc, 1) : 0) . '</small> </b></td> 
		<td style="text-align:center;" class="text-' . $st . '"><b> <small>' . $performance1 . '</small> </b></td>  
		<td style="text-align:center;" class="text-' . $st . '"><b> <small>' . $remarks . '</small> </b></td>  
		</tr>';
                    $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . $performance . "' color='" . $colors[$i] . "'/>";
                }
                $strXML .= $datasetp . "</graph>";
                if ($nc_cls != count($allowed_subjects)) {
                    echo '<br><h5 class="text-info">Chart Based  Subjects Attendance Representaiton for Class ' . $branch2 . '</h5><br>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_header
\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t<thead>
\t<tr> 
\t<th style="text-align:center;"   valign="top"> SNo  </th> 
\t<th style="text-align:center;"   valign="top"> Subject  </th> 
\t<th  style="text-align:center;"  > Classes </th> 
\t<th  style="text-align:center;" > Presents </th>
\t<th  style="text-align:center;" > P/C </th>
\t<th  style="text-align:center;"  > Absents </th>  
\t<th  style="text-align:center;" > A/C </th>
\t<th  style="text-align:center;"  > Performance </th> 
\t<th  style="text-align:center;" > Remarks </th> 
\t</tr>
\t</thead>
\t<tbody>
table_header;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<table class='table  table-hover table-bordered ' >
\t\t<tr>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t</tr>
\t\t<tr>
\t\t\t<th><center>P/C</center></th><td>&emsp;No. of Presents for Class</td>\t
\t\t\t<th><center>A/C</center></th><td>&emsp;No. of Absents for Class</td>
\t\t</tr>
\t\t
\t\t
</table>
\t\t
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Class Subject Wise Attendance */
        }
        /* Start Checking wheter he is a Branch Admin or any other */
        if ($type == "BA") {
            /* Starting Period Wise Attendance */
            if ($_SERVER["QUERY_STRING"] == "p") {
                $p = array();
                $nofday = array();
                $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0);
                $strXML = "<graph caption='Class Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='0' numberSuffix='%' xAxisName='Classes' yAxisName='Performance'>";
                $class_period = array();
                $noofperiods = array();
                $cn = 0;
                for ($cln = 1; $cln < $classno + 1; $cln++) {
                    //mysql_select_db($branchyear."_Dates") or die(mysql_error());
                    $query = mysql_query("Select Date from " . $branch . $cln . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';") or die("Here");
                    $nofday[$branch . $cln] = mysql_num_rows($query);
                    if ($nofday[$branch . $cln] == 0) {
                        $cn++;
                    }
                    $class_period[$branch . $cln] = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0);
                    $p[$branch . $cln] = array("A" => 0, "P" => 0);
                    $noofperiods[$branch . $cln] = 0;
                    while ($dates = mysql_fetch_array($query)) {
                        //mysql_select_db($branchyear."_Attendance") or die(mysql_error());
                        $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $cln . "_Attendance;");
                        $cou = 0;
                        while ($res = mysql_fetch_array($q)) {
                            $values = explode(",", $res[0]);
                            if ($cou == 0) {
                                $noofperiods[$branch . $cln] = $noofperiods[$branch . $cln] + (count($values) - 1);
                            }
                            $cou++;
                            for ($i = 0; $i < count($values) - 1; $i++) {
                                if (substr($values[$i], -1) == "P") {
                                    $stats["Presents"] += 1;
                                    $stats["Total"] += 1;
                                    $p[$branch . $cln]["P"] += 1;
                                    $class_period[$branch . $cln][$values[$i]]++;
                                }
                                if (substr($values[$i], -1) == "A") {
                                    $stats["Absents"] += 1;
                                    $stats["Total"] += 1;
                                    $p[$branch . $cln]["A"] += 1;
                                    $class_period[$branch . $cln][$values[$i]]++;
                                }
                            }
                        }
                    }
                }
                $tr = '';
                $datasetp = '';
                for ($i = 1; $i <= $classno; $i++) {
                    @($ab_per = round($p[$branch . $i]["A"] / $noofperiods[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["A"] / $noofperiods[$branch . $i], 1));
                    @($ab_day = round($p[$branch . $i]["A"] / $nofday[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["A"] / $nofday[$branch . $i], 1));
                    @($pre_per = round($p[$branch . $i]["P"] / $noofperiods[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["P"] / $noofperiods[$branch . $i], 1));
                    @($pre_day = round($p[$branch . $i]["P"] / $nofday[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["P"] / $nofday[$branch . $i], 1));
                    @($perform = round($p[$branch . $i]["P"] / ($p[$branch . $i]["P"] + $p[$branch . $i]["A"]) * 100, 1));
                    if ($nofday[$branch . $i] == 0 || $noofperiods[$branch . $i] == 0) {
                        $st = "error";
                        $remarks = "CNYS";
                    } else {
                        $st = $p[$branch . $i]["P"] / ($p[$branch . $i]["P"] + $p[$branch . $i]["A"]) * 100 <= 50 ? 'error' : 'success';
                        if ((int) $perform >= 95) {
                            $remarks = "Excellent";
                        }
                        if ((int) $perform >= 90 && (int) $perform < 95) {
                            $remarks = "VGood";
                        }
                        if ((int) $perform >= 80 && (int) $perform < 90) {
                            $remarks = "Good";
                        }
                        if ((int) $perform >= 70 && (int) $perform < 80) {
                            $remarks = "Normal";
                        }
                        if ((int) $perform >= 60 && (int) $perform < 70) {
                            $remarks = "Average";
                        }
                        if ((int) $perform >= 50 && (int) $perform < 60) {
                            $remarks = "Bad";
                        }
                        if ((int) $perform < 50) {
                            $remarks = "Go Out";
                        }
                    }
                    $tr .= '<tr>  
					<td style="text-align:center;">' . $i . '</td> 
					<td style="text-align:center;"><small>' . $branch . " " . $i . '</small></td>
					<td style="text-align:center;"><small>' . $nofday[$branch . $i] . '</small></td>
					<td style="text-align:center;"><small>' . $noofperiods[$branch . $i] . '</small></td>
					<td style="text-align:center;">4</td>
					<td style="text-align:center;" class="text-error"><b> <small>' . $p[$branch . $i]["A"] . '</small></b> </td> 
					<td style="text-align:center;" class="text-error"><b> <small>' . $ab_per . '</small> </b></td> 
					<td style="text-align:center;" class="text-error"><b> <small>' . $ab_day . '</small> </b></td> 
					<td style="text-align:center;" class="text-success"><b><small> ' . $p[$branch . $i]["P"] . '</small></b> </td> 
					<td style="text-align:center;" class="text-success"><b> <small>' . $pre_per . ' </small></b></td> 
					<td style="text-align:center;" class="text-success"><b> <small>' . $pre_day . ' </small></b></td> 
					<td style="text-align:center;" class="text-' . $st . '"><b> <small>' . round($perform, 0) . '%</small></b></td> 
					<td style="text-align:center;" class="text-' . $st . '"><b> <small>' . $remarks . ' </small></b></td> 
				</tr>';
                    $datasetp .= "<set name='" . $branch . $i . "' value='" . round($perform, 0) . "' color='" . $colors[$i] . "'/>";
                }
                $strXML .= $datasetp . "</graph>";
                if ($cn != $classno) {
                    echo '<br><h5 class="text-info">Graph based Period Attendance representation for ' . $globalbranch . '</h5>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<tabhead
\t\t<h5 class="text-info">Table based data representation </h5><br>
\t    <table class="table  table-hover table-bordered "  style="padding:0px;">
\t    <thead>
\t\t<tr> 
\t\t<th style="text-align:center;"   valign="top"> SNo  </th> 
\t\t<th style="text-align:center;"   valign="top"> Class  </th> 
\t\t<th style="text-align:center;"   valign="top"> Days  </th>
\t\t<th style="text-align:center;"   valign="top"> Periods  </th> 
\t\t<th style="text-align:center;"   valign="top"> P/Day  </th>   
\t\t<th  style="text-align:center;" > A </th>
\t\t<th  style="text-align:center;" > A/P </th>
\t\t<th  style="text-align:center;" > A/D </th>
\t\t<th  style="text-align:center;" > P </th>
\t\t<th  style="text-align:center;" > P/P </th>
\t\t<th  style="text-align:center;" > P/D </th>
\t\t<th  style="text-align:center;"  > % </th> 
\t\t<th  style="text-align:center;" > Remarks </th> 
\t\t</tr>
\t\t
\t    </thead>
\t    <tbody>
tabhead;
                    echo $tr;
                    echo <<<tableend
\t\t\t\t</tbody>
\t\t\t</table>
\t\t\t<br>
\t\t\t<table class='table  table-hover table-bordered ' >
\t\t<tr>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th>
\t\t</tr>
\t\t<tr>
\t\t\t<th><center>P</center></th><td>&emsp;No. of Presents</td>\t
\t\t\t<th><center>P/D</center></th><td>&emsp;No. of Presents for Day</td>
\t\t</tr>
\t\t<tr>\t
\t\t\t<th><center>A</center></th><td>&emsp;No. of Absents</td>
\t\t\t<th><center>A/D</center></th><td>&emsp;No of Absents for Day</td>
\t\t</tr>
\t\t<tr>\t
\t\t\t<th><center>P/P</center></th><td>&emsp;No. of Absents for Periods</td>
\t\t\t<th><center>A/P</center></th><td>&emsp;No of Absents for Periods</td>
\t\t</tr>
\t\t<tr>\t
\t\t\t<th><center>P/Day</center></th><td>&emsp;No. of Periods for Day</td>
\t\t\t<th><center>%</center></th><td>&emsp;Performace in %</td>
\t\t</tr>
\t\t
</table>
\t\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Period Wise Attendance*/
            /* Start of Subject Wise Attendance */
            if ($_SERVER["QUERY_STRING"] == "sub") {
                $tr = '';
                $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>";
                $datasetp = "";
                $sub_per = array();
                $cnt = 0;
                for ($j = 1; $j <= $classno; $j++) {
                    $sub_per[$branch . $j] = array();
                    for ($i = 0; $i < count($allowed_subjects); $i++) {
                        //mysql_select_db($branchyear."_Subjects") or die(mysql_error());
                        $queryp = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_P`) as " . $allowed_subjects[$i] . "_P from " . $branch . $j . "_Subjects;");
                        //die
                        $querya = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_A`) as " . $allowed_subjects[$i] . "_A from " . $branch . $j . "_Subjects;");
                        //die
                        @($resultp1 = mysql_fetch_array($queryp));
                        //die
                        @($resulta1 = mysql_fetch_array($querya));
                        //die
                        $resultp = $resultp1[0];
                        $resulta = $resulta1[0];
                        if ($resultp + $resulta == 0) {
                            $cnt++;
                        }
                        @($sub_per[$branch . $j][$allowed_subjects[$i]] = $resultp / ($resultp + $resulta) * 100);
                    }
                }
                if ($cnt != $classno * count($allowed_subjects)) {
                    for ($k = 1; $k <= $classno; $k++) {
                        $tr .= '<tr>  
		<td style="text-align:center;"> ' . $k . ' </td> 
		<td style="text-align:center;"><small> ' . $branch . $k . '</small> </td>';
                        $sub_count = 0;
                        for ($l = 0; $l < count($allowed_subjects); $l++) {
                            if (round($sub_per[$branch . $k][$allowed_subjects[$l]], 1) == 0) {
                                $sub_count++;
                            }
                            @($tr .= '<td style="text-align:center;"><b> ' . round($sub_per[$branch . $k][$allowed_subjects[$l]], 1) . '</b> </td>');
                        }
                        @($tr .= '<td style="text-align:center; class="text-success""><b> ' . round(array_sum($sub_per[$branch . $k]) / abs(count($allowed_subjects) - $sub_count), 1) . ' </b></td> ');
                        @($performance = round(array_sum($sub_per[$branch . $k]) / abs(count($allowed_subjects) - $sub_count), 1));
                        $st = $performance <= 50 ? "error" : "success";
                        if (round($performance, 1) >= 95) {
                            $remarks = "Excellent";
                        }
                        if (round($performance, 1) >= 90 && round($performance, 1) < 95) {
                            $remarks = "Very Good";
                        }
                        if (round($performance, 1) >= 80 && round($performance, 1) < 90) {
                            $remarks = "Good";
                        }
                        if (round($performance, 1) >= 70 && round($performance, 1) < 80) {
                            $remarks = "Normal";
                        }
                        if (round($performance, 1) >= 60 && round($performance, 1) < 70) {
                            $remarks = "Average";
                        }
                        if (round($performance, 1) >= 50 && round($performance, 1) < 60) {
                            $remarks = "Bad";
                        }
                        if (round($performance, 1) < 50) {
                            $remarks = "Go Out";
                        }
                        //echo $sub_count;
                        @($tr .= '<td style="text-align:center;" class="text-' . $st . '"><b><small> ' . $remarks . ' </small></b></td>  
		</tr>');
                        @($datasetp .= "<set name='" . $branch . $k . "' value='" . array_sum($sub_per[$branch . $k]) / abs(count($allowed_subjects) - $sub_count) . "' color='" . $colors[$k] . "'/>");
                    }
                    $strXML .= $datasetp . "</graph>";
                    $branch2 = $branch . $class;
                    echo '<br><h5 class="text-info">Graph based Subjects Attendance representation for ' . $globalbranch . ' </h5>';
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_header
\t<h5 class="text-info">Table based data representation </h5><br>
\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t<thead>
\t<tr> 
\t<th style="text-align:center;"   valign="top"> SNo  </th> 
\t<th style="text-align:center;"   valign="top"> Class  </th> 
table_header;
                    for ($i = 0; $i < count($allowed_subjects); $i++) {
                        echo '<th style="text-align:center;"   valign="top">' . $allowed_subjects[$i] . '</th>';
                    }
                    echo <<<table_1
\t<th  style="text-align:center;"  > % </th> 
\t<th  style="text-align:center;" > Remarks </th> 
\t</tr>
\t</thead>
\t<tbody>
table_1;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Subject Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == "") {
                echo "<script type='text/javascript'>document.location.href='./?sub';</script>";
            }
        }
        /* End of Checking wheter he is Branch Admin or any other */
        echo <<<b
\t

\t</div>
\t</div>
\t<div class='span3'>
b;
        sidepanel();
        /* Creating a Sidepanel for CR */
        /* END Creating a Sidepanel for CR */
        echo "</div></div></div>";
        display_footer();
        echo "\n</body>\n</html>";
    }
}
示例#19
0
}
display_html_start();
echo '
</head><body>', get_header_html(), '
		<h3>Login</h3>
	</div>
		<div class="row">
		<form class="form-inline"  role="form" >
			 <div class="form-group">
				 <label class="sr-only" for="inputUserName">User Name:</label>
            <input type="text" class="form-control" name="inputUserName" id="inputUserName" placeholder="User Name" required>
			</div>
			<div class="form-group">
            <label class="sr-only" for="password">Password:</label>
            <input type="password" class="form-control" name="password" id="password" placeholder="Password" required>
        </div>
		
		<button type="submit" class="btn btn-primary">Login</button>
	</form>
		</div>

		<div class="row">
		<a href="forget_user.php">Forget UserName</a>
		<a href="forget.php">Forget Password</a>
		</div><div class="row">
		<a href="signup.php">Create Account</a>
		
	
	';
display_footer(array('login'));
示例#20
0
        	</div>
			<div class="form-group">
            <label class="sr-only" for="email">Email Address:</label>
            <input type="email" class="form-control" id="email" name="email"  placeholder="E-Mail" required>
        	</div>
			<div class="form-group">
            <label class="sr-only" for="secquestion">Security Question:</label>
            <input type="text" class="form-control" id="secquestion" name="secquestion" placeholder="Security Question" min="10" max="500" required>
        	</div>
			<div class="form-group">
            <label class="sr-only" for="secans">Security Answer:</label>
            <input type="text" class="form-control" id="secans" name="secans" placeholder="Security Answer" min="3" max="100" required>
        	</div>
			<div class="form-group">
				<label for="wtc">Choose Challange:</label>
				<select name="wtc" id="wtc" class="form-control">', get_active_changlanges(), '</select>
			</div>
			<div class="form-group">
            <label class="sr-only" for="dollars">Intial Investment:</label>
            <input type="number" class="form-control" id="dollars" name="dollars" placeholder="Invest Dollars" min="5" max="1000"  step="5" required>
        	</div>
			<div class="form-group">
            <label  class="sr-only" for="initWeight">Intial Weight:</label>
            <input type="number" class="form-control" id="initWeight" name="initWeight" placeholder="Invest Weight" min="80" max="400" step="any" required>
        	</div>
		
		<button type="submit" class="btn btn-primary">Create User</button>
	</form>
';
display_footer(array('signup'));
示例#21
0
function generate_attendance($title)
{
    if (!check_login()) {
        header('location:./login.php');
    } else {
        if (!check_day()) {
            include 'config/globals.php';
            $p = $_SERVER['QUERY_STRING'];
            $reg = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
            if (preg_match($reg, $p)) {
                include 'config/db.php';
                include 'config/settings.php';
                include 'config/globals.php';
                echo "<!DOCTYPE html>\n<html>\n";
                display_headers($title);
                echo "\n<body>";
                menu();
                echo <<<a
\t\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t\t
a;
                $table = '';
                //$spread='';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $userid = $_SESSION['UserId'];
                $q = "select Branch,Class,Position from {$table} where Id = '{$userid}'";
                $res = mysql_query($q) or die(mysql_error());
                $row = mysql_fetch_array($res);
                if ($row['Position'] == "BA") {
                    $branch = $globalbranch;
                    $class = substr($p, -1);
                } else {
                    $branch = $row['Branch'];
                    $class = $row['Class'];
                    $class1 = substr($p, -1);
                    if ($class1 != $class) {
                        //echo 'i am in';
                        echo "<script type='text/javascript'>show_error('Error: Not authorised to access {$branch}{$class1} details.');</script>";
                    }
                }
                echo <<<a
\t\t\t
\t\t\t
\t\t<div class="row">
\t\t\t\t<div class='span12'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
                echo <<<a
\t\t\t
\t\t\t\t<div id="step1" class="span4">     
\t\t\t\t\t<h5 class='text-info'>Time Table Details for Class {$branch}&nbsp;{$class} </h5>
\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing Data present in our database </h6><br>
\t\t\t\t</div>
\t\t\t\t<div id="side1" class="span7" >
\t\t\t\t\t<h6 class='text-right'><a href='./?sub'><i class='icon-home'></i> Home&nbsp;</a> </h6>
a;
                if ($row['Position'] == "BA") {
                    echo <<<a
\t\t\t\t\t<h6 class='text-right'>
a;
                    for ($cl = 1; $cl <= $classno; $cl++) {
                        echo "<a href='?{$globalbranch}{$cl}'>{$globalbranch}{$cl}</a>&emsp;";
                    }
                    echo <<<a
\t\t\t\t\t</h6>
a;
                }
                echo <<<a
\t\t\t\t</div>
\t\t\t
a;
                $html = "";
                echo '<table class="table  table-hover table-bordered "  style="padding:0px;">
						<thead>
							<tr> 
								<th style="text-align:center;"  > Period/Day  </th> 
								<th style="text-align:center;"  > Monday  </th> 
								<th style="text-align:center;"  > Tuesday  </th> 
								<th style="text-align:center;"  > Wednesday  </th> 
								<th style="text-align:center;"  > Thursday  </th> 
								<th style="text-align:center;"  > Friday  </th> 
								<th style="text-align:center;"  > Saturday  </th> 
							</tr>
						</thead>
						<tbody>';
                //$spread.=" \t \t P1  \t P2 \t  P3 \t P4 \t \t \t\nRno\tID\t".$subjects['P1']."\t".$subjects['P2']."\t".$subjects['P3']."\t".$subjects['P4']."\tPresents\tAbsents\n";
                $html .= "<thead><tr> \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<th > Period/Day </th> \n\t\t\t\t\t\t\t\t<th > Monday </th>\n\t\t\t\t\t\t\t\t<th > Tuesday </th>  \n\t\t\t\t\t\t\t\t<th > Wednesday </th>\n\t\t\t\t\t\t\t\t<th > Thursday </th>\n\t\t\t\t\t\t\t\t<th > Friday </th>  \n\t\t\t\t\t\t\t\t<th > Saturday </th> \n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead><tbody>";
                $dbname = $branchyear . '_TimeTable';
                $table = $branch . $class . '_TimeTable';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $ti = mysql_query("SELECT * from {$table};") or die(mysql_error());
                while ($res = mysql_fetch_array($ti)) {
                    echo "<tr>";
                    $html .= "<tr>";
                    for ($ct = 0; $ct < 7; $ct++) {
                        if ($ct == 0) {
                            echo "<th><center>" . $res[$ct] . "</center></th>";
                            $html .= "<th><center>" . $res[$ct] . "</center></th>";
                        } else {
                            echo "<td><center>" . $res[$ct] . "</center></td>";
                            $html .= "<td><center>" . $res[$ct] . "</center></td>";
                        }
                    }
                    $html .= "</tr>";
                    echo "</tr>";
                }
                $html .= "</tbody></table><br><br><table style=\"border-collapse:collapse;width:100%;margin-left:0%;font-size:12px;\" border=1 ><tr>\n\t\t\t<th width=25% ><center>Short Name</center></th><th> Long Name</th></tr>";
                echo "</tbody></table>";
                echo <<<a
\t\t\t<br>
\t\t\t<table class='table  table-hover table-bordered' >
\t\t<tr>
\t\t\t<th width=25% ><center>Short Name</center></th><th> Long Name</th>
\t\t</tr>
\t\t
a;
                foreach ($sub_def as $key => $val) {
                    echo "<tr><th><center>{$key}</center></th><td>{$val}</td></tr>";
                    $html .= "<tr><th><center>{$key}</center></th><td>&emsp;{$val}</td></tr>";
                }
                echo <<<a
\t\t</table>\t
a;
                if ($row['Position'] == "BA") {
                    echo <<<a
\t\t\t<form action='print.php' method='post' name='abc'>
\t\t\t<input type='hidden' name='Title1' value="{$branch} {$class} - Time Table Report">
\t\t\t<input type='hidden' name='Table1' value='{$html}'>
\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as PDF</button></center>
\t\t\t</form>
a;
                    echo <<<b
\t\t\t<form action='excel.php' method='post' name='abc'>
\t\t\t<input type='hidden' name='Title1' value="{$branch} {$class} - Time Table Report">
\t\t\t<input type='hidden' name="sheet" value='{$html}'>
\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as Excel Sheet</button></center>
\t\t\t</form>
b;
                }
                echo <<<a
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t
a;
                echo "</div> </div> ";
                display_footer();
                echo "\n</body>\n</html>";
                @mysql_close($con);
            } else {
                echo "<script type='text/javascript'>document.location.href='404.php';</script>";
            }
        } else {
            noservice();
        }
    }
}
示例#22
0
function searchStudents($title)
{
    if (!check_login()) {
        header("location:login.php");
    } else {
        include 'config/globals.php';
        $page = $_GET['p'];
        $key = $_GET['q'];
        //$queries = explode('&',$q);
        $pagereg = '/^[\\d]+$/';
        $keyreg = '/^[\\w]*$/';
        if (preg_match($pagereg, $page)) {
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "<body>\n";
            menu();
            $id_check = isset($_GET['id']) ? "checked='checked'" : '';
            $name_check = isset($_GET['name']) ? "checked='checked'" : '';
            echo <<<search_form
\t\t\t\t\t<div class="container" style="margin-top:-15px;"><br>
\t\t\t\t\t\t<div id="error"></div>
\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t<div class="span12">
\t\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF"> 
\t\t\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t\t\t<div id="step1" class="span8">     
\t\t\t\t\t\t\t\t\t\t\t<a><h5>Search students @ {$globalbranch} </h5></a>
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t<div id="page1" class="span3">
\t\t\t\t\t\t\t\t\t\t\t<a class="pull-right"><h6 >Page {$page}  </h6></a>
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t\t\t<div class='span2'></div>
\t\t\t\t\t\t\t\t\t\t<div class=span7>
\t\t\t\t\t\t\t\t\t\t\t<div class="input-append"><br>
\t\t\t\t\t\t\t\t\t\t\t\t<form action="" method='GET' onsubmit = "return searchStudents();">
\t\t\t\t\t\t\t\t\t\t\t\t\t<input class="input-xxlarge" id="query" type="text" placeholder="Seach" name="q" value='{$key}'/>
\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='submit' value="Search" class="btn btn-primary"  /><br>
\t\t\t\t\t\t\t\t\t\t\t\t\t<label class='checkbox inline'>Search by </label>
\t\t\t\t\t\t\t\t\t\t\t\t\t<label class="checkbox inline">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type="checkbox" id="ID" value="id" {$id_check} name='id'> Id
\t\t\t\t\t\t\t\t\t\t\t\t\t</label>
\t\t\t\t\t\t\t\t\t\t\t\t\t<label class="checkbox inline">
\t\t\t\t\t\t\t\t\t\t\t\t\t<input type="checkbox" id="NAME" value="name" {$name_check} name='name'> Name
\t\t\t\t\t\t\t\t\t\t\t\t\t</label>
\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='hidden' value="1" class="btn btn-primary" name='p' style="visibility:hidden;" />
\t\t\t\t\t\t\t\t\t\t\t\t</form>
\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t</div>
search_form;
            if (isset($_GET['q']) && strlen($_GET['q']) != 0) {
                include 'config/globals.php';
                include 'config/db.php';
                include 'config/settings.php';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                //echo $queries[0];
                $keyword = htmlentities(mysql_real_escape_string($_GET['q']));
                $id = isset($_GET['id']) ? $_GET['id'] : '';
                $name = isset($_GET['name']) ? $_GET['name'] : '';
                if (($id == null or $id == "") and $name == "name") {
                    $query = "SELECT Id,Name,Branch,Class,Gender FROM " . $table . " WHERE Name like '%{$keyword}%' and (Position='S' or Position='CR');";
                } elseif (($name == null or $name == "") and $id == "id") {
                    $query = "SELECT Id,Name,Branch,Class,Gender FROM " . $table . " WHERE Id like '%{$keyword}%' and (Position='S' or Position='CR');";
                } elseif ($name == "name" and $id == "id") {
                    $query = "SELECT Id,Name,Branch,Class,Gender FROM " . $table . " WHERE Id like '%{$keyword}%' or Name like '%{$keyword}%' and (Position='S' or Position='CR');";
                }
                $exec = mysql_query($query) or die(mysql_error());
                $total = mysql_num_rows($exec);
                if ($total > 0) {
                    echo <<<results
\t\t\t\t\t\t\t\t\t
\t\t\t\t\t\t\t\t\t<h6>Search results for &nbsp; : &nbsp;<span class="text-success"><b>"{$keyword}"</b> 
\t\t\t\t\t\t\t\t\t\t</span> &emsp; <small><span class="text-error" >{$total} record(s) Found</span></small> </h6>
\t\t\t\t\t\t\t\t\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t\t\t\t\t\t\t\t\t<thead>
\t\t\t\t\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1"> ID #  </th>
\t\t\t\t\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span3"> Name </th> 
\t\t\t\t\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1"> Class</th>
\t\t\t\t\t\t\t\t\t\t\t\t\t<th class="span1" style="text-align:center;" >Gender</th>
\t\t\t\t\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t\t\t\t\t</thead>
\t\t\t\t\t\t\t\t\t\t\t<tbody>
results;
                    $page = $_GET['p'];
                    $prev = $page - 1;
                    $next = $page + 1;
                    $per_page = 10;
                    $slimit = ($page - 1) * 10;
                    $lastpage = ceil($total / $per_page);
                    if (($id == null or $id == "") and $name == "name") {
                        $query1 = "SELECT Id,Name,Branch,Class,Gender FROM " . $table . " WHERE Name like '%{$keyword}%' and (Position='S' or Position='CR') LIMIT {$slimit},{$per_page};";
                    } elseif (($name == null or $name == "") and $id == "id") {
                        $query1 = "SELECT Id,Name,Branch,Class,Gender FROM " . $table . " WHERE Id like '%{$keyword}%' and (Position='S' or Position='CR') LIMIT {$slimit},{$per_page};";
                    } elseif ($name == "name" and $id == "id") {
                        $query1 = "SELECT Id,Name,Branch,Class,Gender FROM " . $table . " WHERE Id like '%{$keyword}%' or Name like '%{$keyword}%' and (Position='S' or Position='CR') LIMIT {$slimit},{$per_page};";
                    }
                    $exec1 = mysql_query($query1) or die(mysql_error());
                    $ppage = mysql_num_rows($exec1);
                    for ($i = 0; $i < $ppage; $i++) {
                        $record = mysql_fetch_array($exec1);
                        $lnk = "./students.php?" . $record[0] . "/sub";
                        echo <<<show
\t\t\t\t\t\t\t\t<tr onclick="document.location.href='{$lnk}';" style='cursor:pointer;'>
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class="span1">{$record['0']}</td>
\t\t\t\t\t\t\t\t\t<td class="span3">{$record['1']}</td> 
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class="span1">{$record['2']}{$record['3']}</td>
\t\t\t\t\t\t\t\t\t<td class="span1" style="text-align:center;" >{$record['4']}</td>
\t\t\t\t\t\t\t\t</tr>
show;
                    }
                    echo <<<next
\t\t\t\t\t\t\t</tbody>
\t\t\t\t\t\t\t</table>\t\t\t
\t\t\t\t\t\t\t
\t\t\t\t\t\t\t<div class="pagination pagination-centered">
\t\t\t\t\t\t\t<ul>
next;
                    $lnk = "?q=" . $key;
                    $lnk .= isset($_GET['id']) ? "&id=id" : '';
                    $lnk .= isset($_GET['name']) ? "&name=name" : '';
                    if ($page < $total / 10 + 1) {
                        if ($page != 1) {
                            echo "<li><a href='" . $lnk . "&p={$prev}'>&larr; Prev</a></li>";
                        } else {
                            echo "<li class='disabled'><a>&larr; Prevt</a></li>";
                        }
                        if ($lastpage <= 10) {
                            for ($i = 1; $i <= $lastpage; $i++) {
                                if ($page == $i) {
                                    echo "<li class='active'><a href='" . $lnk . "&p={$i}'><b class='text-error'> {$i}</b></a></li>";
                                } else {
                                    echo "<li><a href='" . $lnk . "&p={$i}'>{$i}</a></li>";
                                }
                            }
                        } else {
                            $init1 = $page % 10 == 0 ? (floor($page / 10) - 1) * 10 + 1 : floor($page / 10) * 10 + 1;
                            // total no of records total pages pages range
                            //echo $page/10; echo $lastpage/10;
                            $end1 = floor(($page - 1) / 10) == floor($lastpage / 10) ? $lastpage : ceil($page / 10) * 10;
                            for ($i = $init1; $i <= $end1; $i++) {
                                if ($page == $i) {
                                    echo "<li class='active'><a href='" . $lnk . "&p={$i}'><b class='text-error'> {$i}</b></a></li>";
                                } else {
                                    echo "<li><a href='" . $lnk . "&p={$i}'>{$i}</a></li>";
                                }
                            }
                        }
                        if ($page != $lastpage) {
                            echo "<li><a href='" . $lnk . "&p={$next}'>Next &rarr;</a></li>";
                        } else {
                            echo "<li class='disabled'><a>Next &rarr;</a></li>";
                        }
                    }
                    echo <<<next
\t\t\t\t\t\t\t\t</ul>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t</div>
next;
                } else {
                    echo "<center><p>No search results found.</p></center>";
                }
            } else {
                echo "<center><b><i>Specify search key word</i></b></center>";
            }
            echo "</div>";
            display_footer();
            echo "\n</div></body>\n</html>";
        } else {
            echo "Error : Invalid syntax found in URL<br>";
        }
    }
}
示例#23
0
function generate_attendance($title)
{
    if (!check("BA")) {
        header('location:./login.php');
    } else {
        include 'config/db.php';
        include 'config/settings.php';
        include 'config/globals.php';
        $p = $_SERVER['QUERY_STRING'];
        if (in_array($p, $allowed_subjects)) {
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "\n<body>";
            menu();
            echo <<<a
\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t<div id='error'></div>
a;
            $branch = $globalbranch;
            echo <<<a
\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t
\t\t<div class="row">
\t\t\t<div class='span12'>
\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
            $ar1 = array();
            for ($cln = 1; $cln <= $classno; $cln++) {
                $class = $cln;
                $ar = array();
                $dbname = $branchyear . '_Subjects';
                $table = $branch . $class . '_Subjects';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select RNo,Id from {$table}") or die(mysql_error());
                $strength = mysql_num_rows($q);
                $sub = $p;
                $dbname = $branchyear . '_Subjects';
                $table = $branch . $class . '_Subjects';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $qa = mysql_query("select RNo, `" . $sub . "_A` from {$table}") or die(mysql_error());
                $qp = mysql_query("select RNo, `" . $sub . "_P` from {$table}") or die(mysql_error());
                while ($res = mysql_fetch_array($qa)) {
                    @($ar[$sub]["Absents"] += $res[$sub . "_A"]);
                }
                while ($res = mysql_fetch_array($qp)) {
                    @($ar[$sub]["Presents"] += $res[$sub . "_P"]);
                }
                $ar[$sub]['nod'] = ($ar[$sub]["Absents"] + $ar[$sub]["Presents"]) / $strength;
                $ar1[$branch . $class] = $ar;
            }
            //print_r($ar1);
            echo <<<a
\t\t
\t\t\t<div id="step1" class="span6">     
\t\t\t\t<h5 class='text-info'>All Classes Attendance  Details for {$p}</h5>
\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Lising Data submitted from CRs @ {$branch} </h6><br>
\t\t\t</div>
\t\t\t<div id="side1" class="span5" >
\t\t\t\t<h6 class='text-right'><a href='./?sub'><i class='icon-home'></i> Home&nbsp;</a> </h6>
a;
            echo <<<a
\t\t\t\t\t<h6 class='text-right'>
a;
            for ($cl = 0; $cl < count($allowed_subjects); $cl++) {
                $sub = $allowed_subjects[$cl];
                echo "<a href='?{$sub}'>{$sub}</a>&emsp;";
            }
            echo <<<a
\t\t\t\t\t</h6>
a;
            echo <<<a
\t\t\t</div>
\t\t
a;
            $tr = '';
            $html = '';
            $html .= "<thead><tr><th> SNo </th><th> Class </th><th> Days </th><th> Presents </th><th> Pre/Day </th><th> Absents </th><th> Abs/Day</th><th> Performance </th></tr>";
            @($strength = count($users));
            for ($j = 1; $j <= $classno; $j++) {
                $cls = $branch . $j;
                $tr .= '<tr><td style="text-align:center;"  >' . $j . ' </td> <td  style="text-align:center;" >' . $cls . ' </td>';
                $html .= "<tr><td>" . $j . "</td><td>" . $cls . "</td>";
                $sub = $p;
                $abs = $ar1[$cls][$sub]['Absents'];
                $pres = $ar1[$cls][$sub]['Presents'];
                $p_nod = $abs + $pres;
                @($tmp = $pres / $p_nod * 100);
                $pr = round($tmp, 1);
                $cl = $pr > 50 ? "success" : 'error';
                $cl1 = $pr > 50 ? "green" : "darkred";
                @($perday = $pres / $ar1[$cls][$sub]['nod']);
                @($absday = $abs / $ar1[$cls][$sub]['nod']);
                $tr .= '
					 <td style="text-align:center;">' . round($ar1[$cls][$sub]['nod']) . '</td> 
					<td style="text-align:center;" class="text-success" > ' . $pres . ' </td> 		
					<td style="text-align:center;" class="text-success" > ' . round($perday, 1) . ' </td> 
					<td style="text-align:center;" class="text-error" > ' . $abs . ' </td> 		
					<td style="text-align:center;" class="text-error" > ' . round($absday, 1) . ' </td> 
					<td  style="text-align:center;" class="text-' . $cl . '"  > ' . $pr . '</td>   																
					';
                $tr .= '</tr>';
                $html .= "<td>" . round($ar1[$cls][$sub]['nod']) . "</td><td><font color=\"green\">" . $pres . "</font></td><td><font color=\"{$cl1}\">" . round($perday, 1) . "</font></td><td><font color=\"darkred\">" . $abs . "</td><td>" . round($absday, 1) . "</td><td><font color=\"{$cl1}\">" . $pr . "</font></td>";
                $html .= "</tr>";
            }
            echo <<<a
\t\t 
\t\t <table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t\t\t<thead>
\t\t\t\t\t\t<tr> 
\t\t\t\t\t\t\t<th style="text-align:center;" rowspan=2 valign="top"> SNo </th> 
\t\t\t\t\t\t\t<th style="text-align:center;" rowspan=2 valign="top"> Class </th>
\t\t\t\t\t</tr>
a;
            echo <<<a
\t\t\t\t\t
\t\t\t\t\t<tr> 
a;
            echo <<<a
\t\t\t\t\t\t\t<th  style="text-align:center;"  > Days </th>
\t\t\t\t\t\t\t<th  style="text-align:center;"  > Presents </th>
\t\t\t\t\t\t\t<th  style="text-align:center;"  > Pre/Day </th> 
\t\t\t\t\t\t\t<th  style="text-align:center;"  > Absents </th>
\t\t\t\t\t\t\t<th  style="text-align:center;"  > Abs/Day </th>
\t\t\t\t\t\t\t<th  style="text-align:center;"  > Performance </th>
a;
            echo <<<a
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t
\t\t\t\t\t</thead>
\t\t\t\t\t<tbody>\t\t\t\t\t\t\t
a;
            echo $tr;
            echo "</tbody></table>";
            echo <<<a
\t\t\t<form action='print.php' method='post' name='abc'>
\t\t\t<input type='hidden' name='Title1' value="{$branch} Period Wise Report">
\t\t\t<input type='hidden' name='Table1' value='{$html}'>
\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as PDF</button></center>
\t\t\t</form>
a;
            echo <<<b
\t\t\t<form action='excel.php' method='post' name='abc'>
\t\t\t<input type='hidden' name='Title1' value="{$branch} _Period_Wise_Report">
\t\t\t<input type='hidden' name="sheet" value='{$html}'>
\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as Excel Sheet</button></center>
\t\t\t</form>
b;
            echo "</div> </div> </div> ";
            display_footer();
            echo "\n</body>\n</html>";
            @mysql_close($con);
        } else {
            echo "Subject not Found";
        }
    }
}
示例#24
0
function generate_attendance($title)
{
    if (!check_login()) {
        header('location:./login.php');
    } else {
        include 'config/globals.php';
        $qs1 = $_SERVER['QUERY_STRING'];
        $reg1 = "/^[0-9]{2}-[0-9]{2}-[0-9]{4}\$/";
        $reg2 = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
        $qs = explode('/', $qs1);
        $len = count($qs);
        if ($len == 2 or $len == 3 && $qs[2] == "") {
            $ar = explode('-', $qs[0]);
            if (preg_match($reg1, $qs[0]) && preg_match($reg2, $qs[1])) {
                if (checkdate($ar[1], $ar[0], $ar[2])) {
                    include 'config/db.php';
                    include 'config/settings.php';
                    include 'config/globals.php';
                    $dbname = $branchyear . '_Users';
                    $table = $branchyear . '_Students';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $p = $qs[1];
                    $userid = $_SESSION['UserId'];
                    $q = "select Branch,Class,Position from {$table} where Id = '{$userid}'";
                    $res = mysql_query($q) or die(mysql_error());
                    $row = mysql_fetch_array($res);
                    if ($row['Position'] == "BA") {
                        $branch = $globalbranch;
                        $class = substr($p, -1);
                    } else {
                        $branch = $row['Branch'];
                        $class = $row['Class'];
                        $class1 = substr($p, -1);
                        if ($class1 != $class) {
                            display_error("Error : Not allowed to access  {$class1} details");
                            die;
                        }
                    }
                    $da = $qs[0];
                    $date = $qs[0];
                    $dif = strtotime($da) - strtotime(date('d-m-Y'));
                    if ($dif > 0) {
                        display_error("Error : Not allowed to access future Attendance");
                    } else {
                        if (check_day2($da, $branch . $class)) {
                            display_error("Error : Not allowed to access Attendance of semester starting dates");
                        } else {
                            if (check_day1($da)) {
                                echo noservice();
                            } else {
                                echo "<!DOCTYPE html>\n<html>\n";
                                display_headers($title);
                                echo "\n<body>";
                                menu();
                                echo <<<a
\t\t\t\t\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t\t\t\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t\t\t\t\t
a;
                                $table = '';
                                //$spread='';
                                $dbname = $branchyear . '_Attendance';
                                $table = $branch . $class . '_Attendance';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $class_total = mysql_num_rows(mysql_query("select `Id` from {$table}"));
                                $sample = mt_rand(1, $class_total);
                                echo <<<a
\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t
\t\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
                                $dbname = $branchyear . '_Dates';
                                $table = $branch . $class . '_Dates';
                                //if(!mysql_select_db($dbname))  die(mysql_error());
                                $remaining = array();
                                $j = 0;
                                $remaining1 = array();
                                $j1 = 0;
                                $confired = array();
                                $j2 = 0;
                                $confired1 = array();
                                $j3 = 0;
                                for ($i = 1; $i <= 4; $i++) {
                                    $tmp = "P" . $i;
                                    $tmp1 = "P" . $i . "_Con";
                                    $q = mysql_query("select ISNUll(`{$tmp}`) as `P{$i}`,ISNUll(`{$tmp1}`) as `P" . $i . "_C` from {$table} where Date = '{$da}' ") or die(mysql_error());
                                    $res = mysql_fetch_array($q);
                                    if ($res["P" . $i]) {
                                        $remaining[$j] = "P" . $i;
                                        $j++;
                                    } else {
                                        $remaining1[$j1] = "P" . $i;
                                        $j1++;
                                    }
                                    if ($res["P" . $i . "_C"]) {
                                        $confired[$j2] = "P" . $i;
                                        $j2++;
                                    } else {
                                        $confired1[$j3] = "P" . $i;
                                        $j3++;
                                    }
                                }
                                $dates1 = getdate(strtotime($da));
                                $day = substr($dates1["weekday"], 0, 3);
                                $dbname = $branchyear . '_TimeTable';
                                $table = $branch . $class . '_TimeTable';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $ti = mysql_query("SELECT DayPeriod,{$day} from {$table};") or die(mysql_error());
                                $subjects = array();
                                while ($da1 = mysql_fetch_array($ti)) {
                                    $subjects[$da1[0]] = $da1[1];
                                }
                                //print_r($subjects);
                                //$sub = $subjects[$p];
                                //echo "<h5 style='text-align:center;'> Attendance Submission Details - $branch&nbsp;$class - $date</h5><br>";
                                echo <<<a
\t\t\t\t\t\t
\t\t\t\t\t\t\t<div id="step1" class="span5">     
\t\t\t\t\t\t\t\t<h5 class='text-info'>Daily  Attendance Submission Details for {$date} </h5>
\t\t\t\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing Data submitted from CR @ {$branch}&nbsp;{$class} </h6><br>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div id="side1" class="span6" >
\t\t\t\t\t\t\t\t<h6 class='text-right'><a href='./?sub'><i class='icon-home'></i> Home&nbsp;</a> </h6>
a;
                                if ($row['Position'] == "BA") {
                                    echo <<<a
\t\t\t\t\t\t\t\t<h6 class='text-right'>
a;
                                    for ($cl = 1; $cl <= $classno; $cl++) {
                                        echo "<a href='?{$date}/{$globalbranch}{$cl}'>{$globalbranch}{$cl}</a>&emsp;";
                                    }
                                    echo <<<a
\t\t\t\t\t\t\t\t</h6>
\t\t\t\t\t\t\t\t
a;
                                }
                                $dbname = $branchyear . '_Dates';
                                $table = $branch . $class . '_Dates';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $q = mysql_query("select Date from {$table} where Date = '{$da}'") or die(mysql_error());
                                if (count($remaining1) != 0 && mysql_num_rows($q) != 0) {
                                    $table = $branch . $class . "_Dates";
                                    $q = mysql_query("select SNo from {$table} where Date = '{$date}'") or die(mysql_error());
                                    if (mysql_num_rows($q) == 0) {
                                        echo "<script>show_error('Attendance has been not yet uploaded ');</script>";
                                    }
                                    $sn = mysql_fetch_array($q) or die(mysql_error());
                                    $sn1 = $sn['SNo'] < 5 ? 0 : $sn['SNo'] - 5;
                                    echo '<ul class="nav nav-pills pull-right">
							  <li class="dropdown" style="margin-top:2px;">
							  <a href="#" class="dropdown-toggle" data-toggle="dropdown"> 
							   <i class="icon-calendar"></i> Date - ' . $date . ' &nbsp;<b class="caret"></b></a>
									<ul class="dropdown-menu">';
                                    //echo $sn1;
                                    $q = mysql_query("select Date from {$table}  order by SNo limit {$sn1},5") or die(mysql_errno());
                                    while ($res = mysql_fetch_array($q)) {
                                        $st1 = $res['Date'] == $date ? "active" : " ";
                                        echo "<li class='{$st1}'><a href='?" . $res['Date'] . "/" . $branch . $class . "'>" . $res['Date'] . "</a></li>";
                                    }
                                    echo '</ul>
							  </li>
							</ul>';
                                    echo <<<a
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t
\t\t\t\t\t\t\t
a;
                                    $html = "";
                                    echo '<table class="table  table-hover table-bordered "  style="padding:0px;">
									<thead>
										<tr> 
											<th style="text-align:center;"  rowspan="2" valign="top"> RNo  </th> 
											<th style="text-align:center;"  rowspan="2" valign="top"> Id  </th> 
											<th  style="text-align:center;"  > P1 </th> <th  style="text-align:center;" > P2 </th>
											<th  style="text-align:center;"  > P3 </th>  <th  style="text-align:center;"  > P4 </th> 
											<th  style="text-align:center;" rowspan=2> Presents </th> <th rowspan=2 style="text-align:center;"  > Absents </th>
										</tr>
										<tr> 
											<th  style="text-align:center;"  > ' . $subjects['P1'] . ' </th> <th  style="text-align:center;" > ' . $subjects['P2'] . ' </th>
											<th  style="text-align:center;"  > ' . $subjects['P3'] . ' </th>  <th  style="text-align:center;"  > ' . $subjects['P4'] . ' </th> 
											
										</tr>
										
									</thead>
									<tbody>';
                                    //$spread.=" \t \t P1  \t P2 \t  P3 \t P4 \t \t \t\nRno\tID\t".$subjects['P1']."\t".$subjects['P2']."\t".$subjects['P3']."\t".$subjects['P4']."\tPresents\tAbsents\n";
                                    $html .= "<thead><tr> \n\t\t\t\t\t\t\t\t\t\t\t<th rowspan=\"2\" width=8%> RNo  </th> \n\t\t\t\t\t\t\t\t\t\t\t<th rowspan=\"2\" width=17%> ID  </th> \n\t\t\t\t\t\t\t\t\t\t\t<th  > P1 </th> <th > P2 </th>\n\t\t\t\t\t\t\t\t\t\t\t<th  > P3 </th>  <th  > P4 </th> \n\t\t\t\t\t\t\t\t\t\t\t<th rowspan=2 width=14%> Presents </th> <th rowspan=2  width=14%> Absents </th>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr> \n\t\t\t\t\t\t\t\t\t\t\t<th  > {$subjects['P1']}</th> <th >{$subjects['P2']}</th>\n\t\t\t\t\t\t\t\t\t\t\t<th  > {$subjects['P3']} </th>  <th  > {$subjects['P4']} </th> \n\t\t\t\t\t\t\t\t\t\t</tr></thead>";
                                    $Rnos = array();
                                    $uid = array();
                                    $dbname = $branchyear . '_Attendance';
                                    $table = $branch . $class . '_Attendance';
                                    //if(!mysql_select_db($dbname)) die(mysql_error());
                                    $q = mysql_query("select Id, RNo from {$table};") or die(mysql_error());
                                    while ($res = mysql_fetch_array($q)) {
                                        $uid[$res['RNo']] = $res['Id'];
                                    }
                                    for ($s = 0; $s < count($remaining1); $s++) {
                                        $p1 = $remaining1[$s];
                                        if (in_array($p1, $confired1)) {
                                            $period = $p1;
                                            $dbname = $branchyear . '_Attendance';
                                            $table = $branch . $class . '_Attendance';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q = mysql_query("select RNo,Id,`{$date}` from {$table};") or die(mysql_error());
                                            $aindex = 0;
                                            $pindex = 0;
                                            while ($res = mysql_fetch_array($q)) {
                                                //$uid[$res['RNo']]=$res['Id'];
                                                $z = explode(",", $res[$date]);
                                                for ($m = 0; $m < count($z); $m++) {
                                                    $y = explode("_", $z[$m]);
                                                    if ($y[0] == $period) {
                                                        if ($y[1] == "A") {
                                                            $Rnos[$p1]['Absents'][$aindex] = $res[0];
                                                            $aindex++;
                                                        } else {
                                                            $Rnos[$p1]['Presents'][$pindex] = $res[0];
                                                            $pindex++;
                                                        }
                                                    }
                                                }
                                            }
                                        } else {
                                            //$da = date('d-m-Y');
                                            $a = $da . '_' . $p1;
                                            $dbname = $branchyear . '_Cache';
                                            $table = $branch . $class . '_Cache';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q3 = mysql_query("SELECT RNo, `" . $a . "` FROM {$table}") or die(mysql_error());
                                            $aindex = 0;
                                            $pindex = 0;
                                            while ($individual = mysql_fetch_array($q3)) {
                                                if ($individual[$a] == "A") {
                                                    $Rnos[$p1]["Absents"][$aindex] = $individual["RNo"];
                                                    $aindex++;
                                                }
                                                if ($individual[$a] == "P") {
                                                    $Rnos[$p1]["Presents"][$pindex] = $individual["RNo"];
                                                    $pindex++;
                                                }
                                            }
                                        }
                                    }
                                    $tot = array('A' => 0, 'P' => 0);
                                    //print_r($uid);
                                    for ($w = 1; $w <= $class_total; $w++) {
                                        $tr2 = '<tr >  
									<td style="text-align:center;">' . $w . '  </td>
									<td style="text-align:center;"> ' . $uid[$w] . '  </td>';
                                        echo $tr2;
                                        //$spread.="$w \t {$uid[$w]} \t";
                                        $html .= $tr2;
                                        $pc = 0;
                                        $ac = 0;
                                        for ($l = 1; $l <= 4; $l++) {
                                            $pl = "P" . $l;
                                            if (in_array($pl, $remaining1)) {
                                                $edit_error = "";
                                                $edit_success = "";
                                                if (check('BA') or check('CR')) {
                                                    //echo $pl; print_r($confired1);
                                                    if (!in_array($pl, $confired1)) {
                                                        //echo "i am in";
                                                        //echo $pl;print_r($confired1);echo "<br>";
                                                        $fun = "";
                                                        if (array_key_exists("Absents", $Rnos[$pl]) && in_array($w, $Rnos[$pl]['Absents'])) {
                                                            $fun = "update_rno('{$date}','{$pl}','{$w}','P','{$class}');";
                                                        } else {
                                                            $fun = "update_rno('{$date}','{$pl}','{$w}','A','{$class}');";
                                                        }
                                                        $edit_error = '|  <i class="icon-edit text-success" onclick="' . $fun . '" style="cursor:pointer;"></i>';
                                                        $edit_success = '|  <i class="icon-edit text-error" onclick="' . $fun . '" style="cursor:pointer;"></i>';
                                                    }
                                                } else {
                                                    $edit_error = "";
                                                    $edit_success = "";
                                                }
                                                if (array_key_exists("Absents", $Rnos[$pl]) && in_array($w, $Rnos[$pl]['Absents'])) {
                                                    echo '<td style="text-align:center;" ><b class="text-error"> <i class="icon-remove"></i>  </b> ' . $edit_error . ' </td>';
                                                    $ac++;
                                                    $html .= "<td><font color=\"darkred\">&#x2716;</font></td>";
                                                } else {
                                                    echo '<td style="text-align:center;" ><b class="text-success"> <i class="icon-ok"></i> </b> ' . $edit_success . '</td>';
                                                    $pc++;
                                                    $html .= "<td><font color=\"green\">&#x2714;</font></td>";
                                                }
                                            } else {
                                                echo '<td></td>';
                                                $html .= '<td></td>';
                                                //$spread.=" \t";
                                            }
                                        }
                                        $tot['A'] += $ac;
                                        $tot['P'] += $pc;
                                        echo <<<a
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class="text-success"><b> {$pc} </b> </td> 
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class="text-error"><b> {$ac} </b></td>  
\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t\t
a;
                                        $html .= "<td><font color=\"green\"><b>{$pc}</b></font></td><td><font color=\"darkred\"><b>{$ac}</b></font></td></tr>";
                                        //$spread.="$pc \t $ac \n";
                                    }
                                    echo "<tr><td colspan=6 style='text-align:center;'><b>Total</b></td><td style='text-align:center;' class='text-success'><b>" . $tot['P'] . "</b></td><td style='text-align:center;' class='text-error'><b>" . $tot['A'] . "</b></td></tr>";
                                    $html .= "<tr><th colspan=6 style=\"text-align:center;\"> <b>Total</b> </th><td><b><font color=\"green\">" . $tot['P'] . "</font></b></td><td><b><font color=\"darkred\">" . $tot['A'] . "</font></b></td></tr>";
                                    //$spread.="\t \tTotal\t \t \t \t{$tot['P']} \t {$tot['A']}";
                                    echo "</tbody></table>";
                                    if ($row['Position'] == "BA") {
                                        echo <<<a
\t\t\t\t\t\t<form action='print.php' method='post' name='abc'>
\t\t\t\t\t\t<input type='hidden' name='Title1' value="{$branch} {$class} - Daily Report">
\t\t\t\t\t\t<input type='hidden' name='Table1' value='{$html}'>
\t\t\t\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as PDF</button></center>
\t\t\t\t\t\t</form>
a;
                                        echo <<<b
\t\t\t\t\t\t<form action='excel.php' method='post' name='abc'>
\t\t\t\t\t\t<input type='hidden' name='Title1' value="{$branch} {$class} - Daily Report">
\t\t\t\t\t\t<input type='hidden' name="sheet" value='{$html}'>
\t\t\t\t\t<center><button type="submit" class="btn btn-primary"><i class='icon-download-alt'></i>&nbsp;&nbsp;Save as Excel Sheet</button></center>
\t\t\t\t\t\t</form>
b;
                                    }
                                    echo <<<a
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t
a;
                                } else {
                                    echo "</div><br><h6><span class='text-error'><br><br><br>No Submissions found till now ...</span></h6><br>";
                                }
                                echo "</div></div>";
                                display_footer();
                                echo "\n</body>\n</html>";
                                @mysql_close($con);
                            }
                        }
                    }
                } else {
                    display_error("Error : Invalid date");
                }
            } else {
                display_error("Error : Invalid input pattern");
            }
        } else {
            display_error("Error : Invalid no. of input arguments ");
        }
    }
}
示例#25
0
function display_send_files_form($error_filename)
{
    display_header("Could not save config file");
    $hidden = get_hidden_vars();
    global $root_dir;
    $files = get_config_files();
    $conf = htmlentities($files[0]);
    print <<<CUT
    <p><b>Installation script is unable to save file <i>{$error_filename}</i></b>. <br>
    For complete setup you may download new config files to your computer and upload
    it back to your server.</p>

    <p>File <i>config.inc.php</i>. Upload it to your FTP:
    <br><i>{$root_dir}/config.inc.php</i><br>
    <form name=f1 method=post>
    <input type=submit value="Download config.inc.php">
    <input type=hidden name=step value=9>
    <input type=hidden  name=file value=0>
    {$hidden}
    </form>
    </p>

    <p><font color=red><b>Internet Expolorer sometimes rename <br>
    files when save it. For example, it may rename <i>config.inc.php</i><br>
    to <i>config[1].inc.php</i>. Don't forget to  fix it before uploading!
    </b></font></p>
<script language="JavaScript">
function copyc(){
    holdtext = document.getElementById('conf');
    Copied = holdtext.createTextRange();
    Copied.execCommand("Copy");
}    
</script>    
    
    
    Or, alternatively, you may copy&paste this text to amember/config.inc.php 
    file.<br/>
    <textarea rows="10" cols="80" readonly name="conf" id="conf"
    >{$conf}</textarea>
    <br>
    <a href="javascript:copyc()">Copy to clipboard</a>
    <br><br><br>
    
    <b>When the file is copied or created, 
    <a href="index.php?a=cce">click this link to continue</a>.

    <br><br><br>
    <br><br><br>
CUT;
    display_footer();
}
示例#26
0
        echo "<td align='right'>";
        printf("%.3fM", $entry->getChildSize() / (1024 * 1024));
        echo "</td>";
        echo "<td align='right'>";
        printf("%d", $entry->getCount());
        echo "</td>";
        echo "<td>";
        echo "{$entry->getClassName()}";
        echo "</td>";
        echo "</tr>\n";
    }
    echo "</table>\n";
} else {
    if (!$is_heap_available) {
        echo "<h2>Heap dump is not available</h2>\n";
        echo "<p>The heap dump requires Resin Professional and compiled JNI. It\n";
        echo "also requires an '-agentlib:resin' JVM argument:</p>\n";
        echo "<pre>\n";
        echo "&lt;resin ...>\n";
        echo "  &lt;cluster id='...'>\n";
        echo "    &lt;server id='...'>\n";
        echo "       ...\n";
        echo "       &lt;jvm-arg>-agentlib:resin&lt;/jvm-arg>\n";
        echo "    &lt;/server>\n";
        echo "  &lt;/cluster>\n";
        echo "&lt;/resin>\n";
        echo "</pre>\n";
    }
}
display_footer("heap.php");
示例#27
0
<?php

//link to functions and database models
require_once "includes/initialize.php";
// set up url query strign driven variables - defines parameters fe dinto funcitons
$portal_id = !empty($_GET['p']) ? (int) $_GET['p'] : 156;
$topic_id = !empty($_GET['t']) ? (int) $_GET['t'] : 156;
$sub_topic_1_id = !empty($_GET['st1']) ? (int) $_GET['st1'] : 156;
$sub_topic_2_id = !empty($_GET['st2']) ? (int) $_GET['st2'] : 156;
$sub_topic_3_id = !empty($_GET['st3']) ? (int) $_GET['st3'] : 156;
$sub_topic_4_id = !empty($_GET['st4']) ? (int) $_GET['st4'] : 156;
$category_id = !empty($_GET['c']) ? (int) $_GET['c'] : 156;
//header
//- <head meta data, title>; global navigation log & bar plus header title bar
// include this as last line in display header function return - wrapper start -: echo "<div class=\"container\"">;
display_header($portal_id, $topic_id, $sub_topic_1_id, $sub_topic_2_id, $sub_topic_3_id, $sub_topic_4_id, $category_id);
// local navigation & breadcrumb
display_local_nav($portal_id, $topic_id, $sub_topic_1_id, $sub_topic_2_id, $sub_topic_3_id, $sub_topic_4_id, $category_id);
//main section content
//- intro-box/ content-box, tabbed-pannel, quick-links-sidebar
display_main_content($portal_id, $topic_id, $sub_topic_1_id, $sub_topic_2_id, $sub_topic_3_id, $sub_topic_4_id, $category_id);
// footer
display_footer($portal_id, $topic_id, $sub_topic_1_id, $sub_topic_2_id, $sub_topic_3_id, $sub_topic_4_id, $category_id);
示例#28
0
function homepage($title)
{
    if (!check("BA") || !check('BA')) {
        header('location:login.php');
    } else {
        include "config/globals.php";
        include 'config/db.php';
        include 'config/settings.php';
        $qs = $_SERVER["QUERY_STRING"];
        $reg1 = "/^" . $globalbranch . "[1-" . $classno . "]\$/";
        $reg2 = "/^P[1-4]\$/";
        $reg3 = "/^[0-9]{2}-[0-9]{2}-[0-9]{4}\$/";
        $reg4 = "/^all\$/";
        $p = explode('/', $qs);
        $len = count($p);
        echo "<!DOCTYPE html>\n<html id='con2'>\n";
        display_headers($title);
        echo "\n<body>";
        menu();
        echo <<<a
\t\t\t<div class='container' id='con1'>
\t\t\t\t<div id="error"></div>
\t\t\t\t<div class='row'>
\t\t\t\t<div class='span9'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
        if ($len == 3 or $len == 4 && $p[3] == "") {
            if (preg_match($reg1, $p[0]) && (preg_match($reg2, $p[1]) or preg_match($reg4, $p[1])) && preg_match($reg3, $p[2])) {
                $ar = explode('-', $p[2]);
                if (checkdate($ar[1], $ar[0], $ar[2])) {
                    $lockfile = str_replace("/", "_", $qs);
                    if (file_exists("assets/tmp/" . $lockfile)) {
                        echo "<script>show_error('Request in Progress');</script>";
                    } else {
                        exec("> assets/tmp/" . $lockfile);
                        $dbname = $branchyear . '_Dates';
                        $table = $p[0] . '_Dates';
                        //if(!mysql_select_db($dbname)) {die(mysql_error());}
                        $date_sub = $p[2];
                        $n = mysql_num_rows(mysql_query("select * from {$table} where Date = '{$date_sub}';"));
                        if ($n == 0) {
                            echo "<script>show_error('{$date_sub} not found ');</script>";
                        } else {
                            $pcount = 1;
                            $remaining = array();
                            $j = 0;
                            $uploaded = array();
                            $j1 = 0;
                            $confirmed = array();
                            $j2 = 0;
                            if ($p[1] == "all") {
                                for ($i = 1; $i <= 4; $i++) {
                                    $tmp = "P" . $i . "_Con";
                                    $tmp1 = "P" . $i;
                                    $q = mysql_query("select `{$tmp}`,`{$tmp1}` from {$table} where Date = '{$date_sub}'; ") or die(mysql_error());
                                    $res = mysql_fetch_array($q);
                                    if ($res[$tmp1] == 'ok' && $res[$tmp] == null) {
                                        $remaining[$j] = "P" . $i;
                                        $j++;
                                    }
                                }
                            } else {
                                $remaining[$j] = $p[1];
                            }
                            for ($r = 1; $r <= count($remaining); $r++) {
                                $tmp = "P" . $r . "_Con";
                                $tmp1 = "P" . $r;
                                $q = mysql_query("select `{$tmp}`,`{$tmp1}` from {$table} where Date = '{$date_sub}'; ") or die(mysql_error());
                                $res = mysql_fetch_array($q);
                                if ($res[$tmp] == 'ok') {
                                    $uploaded[$j1] = $tmp1;
                                    $j1++;
                                }
                                if ($res[$tmp1] == 'ok') {
                                    $confirmed[$j2] = $tmp1;
                                    $j2++;
                                }
                            }
                            //print_r($remaining);
                            if (count($uploaded) != 4) {
                                $cou = 0;
                                $str2 = "";
                                for ($r = 0; $r < count($remaining); $r++) {
                                    $period1 = $remaining[$r];
                                    $tmp = $period1 . "_Con";
                                    $tmp1 = $period1;
                                    $q = mysql_query("select {$tmp}, {$tmp1} from  {$table} where Date = '{$date_sub}';") or die(mysql_error());
                                    $res = mysql_fetch_array($q);
                                    if ($res[$tmp] == 'ok') {
                                        echo "<script>show_error('{$period1} already confirmed ');</script>";
                                    } else {
                                        if ($res[$tmp1] != 'ok') {
                                            $str2 .= $period1 . " ";
                                            echo "<script>show_error('{$str2} &nbsp;attendance not uploaded');</script>";
                                        } else {
                                            $dbname = $branchyear . '_Cache';
                                            $table = $p[0] . '_Cache';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $class_total = mysql_num_rows(mysql_query("select `Id` from {$table}")) or die(mysql_error());
                                            $dbname = $branchyear . '_Attendance';
                                            $table = $p[0] . '_Attendance';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $f = mysql_query("show columns from `{$table}` like '{$date_sub}';") or die(mysql_error());
                                            $val = mysql_num_rows($f) ? True : False;
                                            if (!$val) {
                                                mysql_query("alter table `{$table}` add (`{$date_sub}` varchar(30) default '');") or die(mysql_error());
                                            }
                                            insert_log($_SESSION['UserId'] . " added {$date_sub} to {$table}");
                                            $dbname = $branchyear . '_Attendance';
                                            $table = $p[0] . '_Attendance';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q = mysql_query("select isnull (`{$date_sub}`) as Date from {$table};") or die(mysql_error());
                                            $res = mysql_fetch_array($q);
                                            $strs = array();
                                            $strs1 = array();
                                            if (!$res['Date']) {
                                                $dbname = $branchyear . '_Cache';
                                                $table = $p[0] . '_Cache';
                                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                                for ($k = 1; $k <= $class_total; $k++) {
                                                    $a12 = mysql_query("Select `" . $date_sub . "_" . $remaining[$r] . "`  from `{$table}` where RNo='{$k}';") or die(mysql_error());
                                                    $b12 = mysql_fetch_array($a12);
                                                    $strs[$k] = $remaining[$r] . "_" . $b12[0] . ",";
                                                }
                                                $dbname = $branchyear . '_Attendance';
                                                $table = $p[0] . '_Attendance';
                                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                                for ($k = 1; $k <= $class_total; $k++) {
                                                    $a12 = mysql_query("Select `" . $date_sub . "`from `{$table}` where RNo='{$k}';") or die(mysql_error());
                                                    $b12 = mysql_fetch_array($a12);
                                                    if ($b12[$date_sub] == null) {
                                                        $strs1[$k] = $strs[$k];
                                                    } else {
                                                        $strs1[$k] = $b12[$date_sub] . $strs[$k];
                                                    }
                                                }
                                            }
                                            $dbname = $branchyear . '_Attendance';
                                            $table = $p[0] . '_Attendance';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            for ($k = 1; $k <= $class_total; $k++) {
                                                if (in_array($k, $exp[$p[0]])) {
                                                    continue;
                                                }
                                                $a12 = mysql_query("update {$table} set `" . $date_sub . "` = '" . $strs1[$k] . "' where RNo = '" . $k . "';") or die(mysql_error());
                                            }
                                            $dbname = $branchyear . '_TimeTable';
                                            $table = $p[0] . '_TimeTable';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $dates1 = getdate(strtotime($date_sub));
                                            //$date=$dates[$r];
                                            $day = substr($dates1["weekday"], 0, 3);
                                            $per = $p[1] == 'all' ? $remaining[$r] : $p[1];
                                            $ti = mysql_query("SELECT DayPeriod,{$day} from {$table} where DayPeriod = '" . $per . "';") or die(mysql_error());
                                            $subjects = array();
                                            while ($da = mysql_fetch_array($ti)) {
                                                $subjects[$da[0]] = $da[1];
                                            }
                                            $dbname = $branchyear . '_Subjects';
                                            $table = $p[0] . '_Subjects';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            for ($k = 1; $k <= $class_total; $k++) {
                                                if (in_array($k, $exp[$p[0]])) {
                                                    continue;
                                                }
                                                $st = strtoupper(substr($strs[$k], -2, -1));
                                                $sub = $subjects[$per];
                                                $q = mysql_query("select `" . $sub . "_" . $st . "` from {$table} where RNo = '{$k}';") or die(mysql_error());
                                                $res = mysql_fetch_array($q);
                                                $subcount = $res[0] + 1;
                                                $a12 = mysql_query("update {$table} set `" . $sub . "_" . $st . "` = '" . $subcount . "' where RNo = '" . $k . "';") or die(mysql_error());
                                            }
                                            $dbname = $branchyear . '_Cache';
                                            $table = $p[0] . '_Cache';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q = mysql_query("alter table `{$table}` drop `" . $date_sub . "_" . $per . "`;");
                                            $dbname = $branchyear . '_Dates';
                                            $table = $p[0] . '_Dates';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q = mysql_query("update {$table} set `{$tmp}` = 'ok' where Date = '{$date_sub}';") or die(mysql_error());
                                            $cou++;
                                        }
                                    }
                                }
                                if ($cou == count($remaining) && $cou != 0) {
                                    $abz = count($remaining);
                                    $st = "";
                                    for ($s = 0; $s < $abz; $s++) {
                                        if ($s == $abz - 1) {
                                            $st .= $remaining[$s];
                                        } else {
                                            $st .= $remaining[$s] . ", ";
                                        }
                                    }
                                    insert_log($_SESSION['UserId'] . " uploaded {$st} Attendance");
                                    echo "<script>show_success('{$st} attendance updated ');</script>";
                                } else {
                                    if (in_array($p[1], $confirmed)) {
                                        echo "<script>show_error('" . $p[1] . " already updated');</script>";
                                    }
                                    if (in_array($p[1], $uploaded)) {
                                        echo "<script>show_error('" . $p[1] . " attendance already confirmed');</script>";
                                    }
                                    if ($p[1] == 'all') {
                                        echo "<script>show_error('" . $p[1] . " uploaded fields are already confirmed');</script>";
                                    }
                                }
                            } else {
                                $abz = count($confirmed);
                                $st = "";
                                for ($s = 0; $s < $abz; $s++) {
                                    if ($s == $abz - 1) {
                                        $st .= $confirmed[$s];
                                    } else {
                                        $st .= $confirmed[$s] . ", ";
                                    }
                                }
                                echo "<script>show_error('{$st} &nbsp;attendance not yet uploaded');</script>";
                            }
                        }
                        unlink("assets/tmp/" . $lockfile);
                    }
                } else {
                    echo "<script>show_error('Invalid Date Sent');</script>";
                }
            } else {
                echo "<script>show_error('Invalid Input Sent');</script>";
            }
        }
        if (preg_match($reg1, $p[0])) {
            echo '<h4>Confirm Uploads </h4> <h5> &emsp;&emsp;&emsp; - &emsp; Below records need to be confirmed. </h5>';
            $qs = $p[0];
            $dbname = $branchyear . '_Dates';
            $table = $qs . '_Dates';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $new = mysql_query("SELECT `Date` FROM `{$table}` WHERE P1_Con IS NULL OR P2_Con IS NULL OR P3_Con IS NULL OR P4_Con IS NULL") or die(mysql_error());
            if (mysql_num_rows($new) == 0) {
                echo "<span class='text-error'><b>No records found</b></span>";
            } else {
                $dates = array();
                $i = 0;
                while ($res = mysql_fetch_row($new)) {
                    $dates[$i] = $res[0];
                    $i++;
                }
                for ($l = 0; $l < count($dates); $l++) {
                    $dates1 = getdate(strtotime($dates[$l]));
                    $date = $dates[$l];
                    $day = substr($dates1["weekday"], 0, 3);
                    $dbname = $branchyear . '_TimeTable';
                    $table = $qs . '_TimeTable';
                    //if(!mysql_select_db($dbname))  die(mysql_error());
                    $ti = mysql_query("SELECT DayPeriod,{$day} from {$table};") or die(mysql_error());
                    $subjects = array();
                    while ($da = mysql_fetch_array($ti)) {
                        $subjects[$da[0]] = $da[1];
                    }
                    $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0);
                    $dbname = $branchyear . '_Dates';
                    $table = $qs . '_Dates';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $remaining = array();
                    $j = 0;
                    $remaining1 = array();
                    $j1 = 0;
                    $confirmed = array();
                    $j2 = 0;
                    $confirmed1 = array();
                    $j3 = 0;
                    for ($i = 1; $i <= 4; $i++) {
                        $tmp = "P" . $i;
                        $tmp1 = "P" . $i . "_Con";
                        $q = mysql_query("select ISNUll(`{$tmp}`) as `P{$i}`,ISNUll(`{$tmp1}`) as `P" . $i . "_C` from {$table} where Date = '{$date}' ") or die(mysql_error());
                        $res = mysql_fetch_array($q);
                        if ($res["P" . $i]) {
                            $remaining[$j] = "P" . $i;
                            $j++;
                        } else {
                            $remaining1[$j1] = "P" . $i;
                            $j1++;
                        }
                        if ($res["P" . $i . "_C"]) {
                            $confirmed[$j2] = "P" . $i;
                            $j2++;
                        } else {
                            $confirmed1[$j3] = "P" . $i;
                            $j3++;
                        }
                    }
                    $dbname = $branchyear . '_Cache';
                    $table = $qs . '_Cache';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    //print_r($confirmed);
                    $a = $date . "_";
                    $q = mysql_query("SELECT * FROM {$table}") or die(mysql_error());
                    while ($q1 = mysql_fetch_array($q)) {
                        for ($i = 0; $i < count($confirmed); $i++) {
                            $tmp2 = $a . $confirmed[$i];
                            //print_r($q1);
                            if ($q1[$tmp2] == "A") {
                                $p[$confirmed[$i] . "_A"]++;
                            }
                            if ($q1[$tmp2] == "P") {
                                $p[$confirmed[$i] . "_P"]++;
                            }
                        }
                    }
                    //print_r($p);echo "<br>";
                    if (count($confirmed1) != 0) {
                        $dbname = $branchyear . '_Attendance';
                        $table = $qs . '_Attendance';
                        //if(!mysql_select_db($dbname))die(mysql_error());
                        $q = mysql_query("SELECT `{$date}` FROM {$table};") or die(mysql_error());
                        while ($res = mysql_fetch_array($q)) {
                            $z = explode(",", $res[$date], -1);
                            for ($m = 0; $m < count($z); $m++) {
                                $p[$z[$m]] += 1;
                            }
                        }
                    }
                    //print_r($p);
                    $a = $date . "_P";
                    $li1 = "?{$qs}/all/{$date}";
                    echo <<<main
\t\t\t\t<div id="Date{$a}">
\t\t\t\t\t<ul class="nav nav-pills span8">
\t\t\t\t\t\t<li><h5><i class="icon-calendar"></i> {$date} &nbsp;@&nbsp;{$qs}</h5> </li>
main;
                    echo <<<main
\t\t\t\t<li class="pull-right"><h6><span class="text-success"><i class="icon-ok-circle"></i> <a href="{$li1}" class="text-success">Confirm All</a></span> &emsp;</h6></li>
main;
                    echo <<<main
\t\t\t\t</ul>
\t\t\t\t<div class="row">
\t\t\t\t\t<div class="span8">
\t\t\t\t\t<table class="table  table-hover table-bordered"  style="padding:0px;">
\t\t\t\t\t\t<thead>
\t\t\t\t\t\t\t<tr>  <th style="text-align:center;"> Subject </th>  <th style="text-align:center;" class="span1"> Period  </th> 
\t\t\t\t\t\t\t<th class="span1" style="text-align:center;"> Absents </th> <th class="span1" style="text-align:center;"> Presents </th> 
\t\t\t\t\t\t\t <th class="span4" style="text-align:center;"> Options</th> </tr>
\t\t\t\t\t\t</thead>
\t\t\t\t\t\t<tbody>
main;
                    for ($j = 1; $j <= 4; $j++) {
                        if (!in_array("P" . $j, $remaining)) {
                            echo '<tr><td style="text-align:center;">' . $subjects["P" . $j] . '</td><td style="text-align:center;">' . "P" . $j . '</td> 
							<td style="text-align:center;" class="text-error">' . $p["P" . $j . "_A"] . '</td> <td style="text-align:center;" class="text-success"> ' . $p["P" . $j . "_P"] . ' </td> 
							<td style="text-align:center;">';
                            if (in_array("P" . $j, $confirmed1)) {
                                echo ' <span class="text-success" >Confirmed</span>';
                            } else {
                                $li = "?{$qs}/P{$j}/{$date}";
                                $li1 = "./today1.php?{$date}/{$qs}";
                                echo ' <span class="text-success" ><i class="icon-ok-circle"></i> <a href="' . $li . '" class="text-success">Confirm </a></span> &emsp;	';
                                echo ' <span class="text-error" ><i class="icon-edit"></i> <a href="' . $li1 . '" class="text-error">Edit </a></span>';
                            }
                            echo ' &emsp; <span class="text-info"><i class="icon-globe"></i> <a href="#' . $a . $j . '" class="text-info"  data-toggle="modal">Browse</a> </span></td> </tr>';
                        }
                    }
                    echo <<<main
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<br>
\t\t\t\t
main;
                    for ($j = 1; $j <= 4; $j++) {
                        if (!in_array("P" . $j, $remaining)) {
                            echo <<<confirm
\t\t\t\t\t\t
<div id="{$a}{$j}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="useridlabel" aria-hidden="true">
\t\t\t\t\t\t\t<div class="modal-header">
\t\t\t\t\t\t\t<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
\t\t\t\t\t\t\t<h4 id="useridlabel">{$qs} @ P{$j} Attendance Details</h4>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="modal-body">
\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t<div class="span6">
\t\t\t\t\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t\t\t\t<tr> <td class="span2" style="text-align:center"> Date </td> <th class="text-warning span2" style="text-align:center"> {$date}</th> 
\t\t\t\t\t\t\t\t\t\t<td class="span2" style="text-align:center"> Subject </td> <th class="text-success span2" style="text-align:center"> {$subjects["P" . $j]}&nbsp;</th> </tr>
\t\t\t\t\t\t\t\t\t\t</tbody>
\t\t\t\t\t\t\t\t\t</table>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t<div class="span6">
\t\t\t\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t\t\t<thead>
\t\t\t\t\t\t\t\t\t<tr> <th class="span2"  style="text-align:center"> Period # </th> <th class="span3"> Presents  </th> <th class="span3"> Absents  </th> </tr>
\t\t\t\t\t\t\t\t</thead>
\t\t\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t\t\t<tr><td style="text-align:center;" >P{$j}</td>
confirm;
                            $dbname = $branchyear . '_Dates';
                            $table = $qs . '_Dates';
                            //if(!mysql_select_db($dbname)) die(mysql_error());
                            $q = mysql_query("select ISNULL(`P" . $j . "_Con`) as `P{$j}` from {$table} where Date = '{$date}'; ") or die(mysql_error());
                            $row = mysql_fetch_array($q);
                            if (!$row["P" . $j]) {
                                $period = "P" . $j;
                                $dbname = $branchyear . '_Attendance';
                                $table = $qs . '_Attendance';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $q = mysql_query("select RNo,`{$date}` from {$table};") or die(mysql_error());
                                $Rnos = array("Absents" => array(), "Presents" => array());
                                $aindex = 0;
                                $pindex = 0;
                                while ($res = mysql_fetch_array($q)) {
                                    $z = explode(",", $res[$date]);
                                    for ($m = 0; $m < count($z); $m++) {
                                        $y = explode("_", $z[$m]);
                                        if ($y[0] == $period) {
                                            if ($y[1] == "A") {
                                                $Rnos['Absents'][$aindex] = $res[0];
                                                $aindex++;
                                            } else {
                                                $Rnos['Presents'][$pindex] = $res[0];
                                                $pindex++;
                                            }
                                        }
                                    }
                                }
                            } else {
                                $dbname = $branchyear . '_Cache';
                                $table = $qs . '_Cache';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $q3 = mysql_query("SELECT RNo, `" . $a . $j . "` FROM {$table}") or die(mysql_error());
                                $Rnos = array("Absents" => array(), "Presents" => array());
                                $aindex = 0;
                                $pindex = 0;
                                while ($individual = mysql_fetch_array($q3)) {
                                    if ($individual[$a . $j] == "A") {
                                        $Rnos["Absents"][$aindex] = $individual["RNo"];
                                        $aindex++;
                                    }
                                    if ($individual[$a . $j] == "P") {
                                        $Rnos["Presents"][$pindex] = $individual["RNo"];
                                        $pindex++;
                                    }
                                }
                            }
                            $pc = count($Rnos["Presents"]);
                            $ac = count($Rnos["Absents"]);
                            $tot = $pc + $ac;
                            echo "<td>";
                            for ($i = 0; $i < $pc; $i++) {
                                if ($i % 8 == 0 && $i != 0) {
                                    echo "<br>";
                                }
                                if ($i == $pc - 1) {
                                    echo $Rnos["Presents"][$i];
                                } else {
                                    echo $Rnos["Presents"][$i] . ",";
                                }
                            }
                            echo "</td><td>";
                            for ($i = 0; $i < $ac; $i++) {
                                if ($i % 8 == 0 && $i != 0) {
                                    echo "<br>";
                                }
                                if ($i == $ac - 1) {
                                    echo $Rnos["Absents"][$i];
                                } else {
                                    echo $Rnos["Absents"][$i] . ",";
                                }
                            }
                            echo <<<confirm1
\t\t\t\t\t\t\t</td></tr>
\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" >Total (<b>{$tot}</b>)</td>
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class='text-success'> {$pc}</td>
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class='text-error'>{$ac}</td>
\t\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t\t</tbody>
\t\t\t\t\t\t\t</table>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="modal-footer">
\t\t\t\t\t\t<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
confirm1;
                        }
                    }
                }
            }
            echo "</div></div>";
            echo "<div class='span3'>";
            go_home();
            echo "<ul class='nav nav-tabs nav-stacked'>";
            for ($i = 1; $i <= $classno; $i++) {
                $branch = $globalbranch;
                $cls = $branch . $i;
                $table = $cls . '_Dates';
                $remaining = array();
                $j = 0;
                $q = mysql_query("select * from {$table} ; ") or die(mysql_error());
                while ($res = mysql_fetch_array($q)) {
                    if ($res["P1_Con"] != 'ok' or $res["P2_Con"] != 'ok' or $res["P3_Con"] != 'ok' or $res["P4_Con"] != 'ok') {
                        $remaining[$j++] = $res['Date'];
                    }
                }
                $str1 = count($remaining) != 0 ? "<i class='icon-remove pull-right text-error' style='padding-top:5px;'></i>" : "<i class='icon-ok pull-right text-success' style='padding-top:5px;'></i>";
                //echo $str1;
                echo <<<a
\t\t\t\t<li><a href="?{$branch}{$i}">{$branch}{$i}<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i> {$str1} </a> </li>

a;
            }
            echo "</ul>";
            echo "</div></div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
示例#29
0
<?php

/**Заголовок*/
require_once "scripts/generete_header.php";
$bootstrap = array('main' => true, 'stars' => true);
display_head("Quantum Reality", $bootstrap);
echo "<body>";
echo "<div class=\"container col-md-8  col-md-offset-2\">";
//8 Колонок Ширина и 2 отступ слева
/**Навигация*/
require_once "scripts/generate_navigation.php";
display_navigation("about");
?>
<div class="row">
	<div class="embed-responsive embed-responsive-16by9">
  		<iframe src="//vk.com/video_ext.php?oid=8570225&id=171795178&hash=98017c6c2712e815&hd=1" width="640" height="360"  frameborder="0"></iframe>
		</div>
</div>

<div class="row textblock">
    <p>Quantum Reality Центр развлечений в городе Калтане, Виртуальная реальность. Комнаты реалити-квестов. Психологическая игра "Мафия"	</p>
</div>
<?php 
display_footer();
<br/>
</li>

<li>
<?php 
    $prompt = gettext('Once the file has been saved, you can <a href=\'$login_uri\'>continue to the administration area</a>. This will trigger a server restart, so just refresh your browser until you see the login page again.');
    $prompt = preg_replace('/\\$login_uri/', $login_uri, $prompt);
    echo $prompt;
    ?>
<br/>&nbsp;</li>

<li>
<?php 
    echo gettext('When prompted, use the username and password you provided.');
    ?>
<br/></li>

</ol>

<?php 
}
?>

<br/>
<br/>

<?php 
display_footer("login.php");
?>