Esempio n. 1
0
 public function get_biaya_fix()
 {
     $id = $this->input->post('id');
     if ($id == '0') {
         echo '-';
     } else {
         $id = get_nik($id);
         $grade = get_grade($id);
         $pos_group = get_pos_group($id);
         if ($grade == 'G08' && $pos_group == 'AMD') {
             $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/7'));
         } elseif ($grade == 'G08' && $pos_group == 'MGR') {
             $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/6'));
         } elseif ($grade == 'G08' && $pos_group == 'KACAB') {
             $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/5'));
         } elseif ($grade == 'G07') {
             $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/4'));
         } elseif ($grade == 'G06' || $grade == 'G05') {
             $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/3'));
         } elseif ($grade == 'G04' || $grade == 'G03') {
             $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/2'));
         } elseif ($grade == 'G02' || $grade == 'G01') {
             $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/1'));
         }
         $this->load->view('form_spd_luar/biaya_fix', $this->data);
     }
 }
 function get_content()
 {
     global $CFG, $USER, $COURSE;
     if (!empty($this->content)) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->footer = '';
     $this->content->text = '';
     if (!($att = array_pop(get_all_instances_in_course('attforblock', $COURSE, NULL, true)))) {
         $this->content->text = get_string('needactivity', 'block_attendance');
         return $this->content;
     }
     $cmid = $att->coursemodule;
     require_once $CFG->dirroot . '/mod/attforblock/locallib.php';
     if (!($context = get_context_instance(CONTEXT_MODULE, $cmid))) {
         print_error('badcontext');
     }
     // link to attendance
     if (has_capability('mod/attforblock:takeattendances', $context) or has_capability('mod/attforblock:changeattendances', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/manage.php?id=' . $cmid . '&amp;from=block">' . get_string('takeattendance', 'attforblock') . '</a><br />';
     }
     if (has_capability('mod/attforblock:manageattendances', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/sessions.php?id=' . $cmid . '&amp;action=add">' . get_string('add', 'attforblock') . '</a><br />';
     }
     if (has_capability('mod/attforblock:viewreports', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/report.php?id=' . $cmid . '&amp;view=weeks">' . get_string('report', 'attforblock') . '</a><br />';
     }
     if (has_capability('mod/attforblock:export', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/export.php?id=' . $cmid . '">' . get_string('export', 'quiz') . '</a><br />';
     }
     if (has_capability('mod/attforblock:changepreferences', $context)) {
         $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/attsettings.php?id=' . $cmid . '">' . get_string('settings', 'attforblock') . '</a><br />';
     }
     $context2 = get_context_instance(CONTEXT_COURSE, $COURSE->id);
     if (has_capability('moodle/course:view', $context) && has_capability('mod/attforblock:view', $context)) {
         $complete = get_attendance($USER->id, $COURSE);
         if ($complete == 0) {
             //attendance not generated yet
             $this->content->text .= get_string('attendancenotstarted', 'attforblock');
         } else {
             //attendance taken
             $statuses = get_statuses($COURSE->id);
             foreach ($statuses as $st) {
                 $this->content->text .= $st->description . ':&nbsp;' . get_attendance($USER->id, $COURSE, $st->id) . '<br />';
             }
             $percent = get_percent($USER->id, $COURSE);
             $grade = get_grade($USER->id, $COURSE);
             $this->content->text .= get_string('attendancepercent', 'attforblock') . ':&nbsp;' . $percent . '&nbsp;%<br />';
             $this->content->text .= get_string('attendancegrade', 'attforblock') . ":&nbsp;{$grade}<br />";
             $this->content->text .= '<a href="' . $CFG->wwwroot . '/mod/attforblock/view.php?id=' . $cmid . '">' . get_string('indetail', 'attforblock') . '</a>';
         }
     }
     return $this->content;
 }
 $course->attendance_margin = $cselected['margin'][$j];
 if (!key_exists($students["userid"][$row_ite], (array) $cselected["students"][$j])) {
     $table->data[$row][] = '---';
     $table->data[$row][] = '---';
     continue;
 }
 $user_id = $students['userid'][$row_ite];
 $grade_item = $DB->get_record("grade_items", array('courseid' => $course->id, 'itemtype' => 'course'));
 $sql = "SELECT *\n                    FROM mdl_grade_grades\n                    WHERE itemid = (\n                    SELECT id\n                    FROM mdl_grade_items\n                    WHERE courseid ={$course->id}\n                    AND itemtype = 'course' )\n                    AND userid ={$user_id}";
 // $credithours=$course->credithours;
 $credithours = explode("+", $course->credithours);
 $credithours = $credithours[0] + $credithours[1];
 $grade = $DB->get_record_sql($sql);
 // print_r($grade);
 $attendance = get_percent_absent($students["userid"][$row_ite], $course);
 $course_sess_att = get_grade($students["userid"][$row_ite], $course);
 $course_sessions = get_maxgrade($students["userid"][$row_ite], $course);
 $all_sessions += $course_sessions;
 $course_sess_missed = $course_sessions - $course_sess_att;
 $all_sessions_missed += $course_sess_missed;
 $subjgrade = grade_format_gradevalue_letter($grade->finalgrade, $grade_item);
 if ($grade) {
     // $grade->finalgrade= number_format(($grade->finalgrade), 0);
     switch ($subjgrade) {
         case $subjgrade == 'A':
             $gradepoint = 4.0;
             break;
         case $subjgrade == 'B+':
             $gradepoint = 3.5;
             break;
         case $subjgrade == 'B':
Esempio n. 4
0
    //check if an exam has been selected
    if (!empty($exam['id'])) {
        $counter = 0;
        $total_mark = 0;
        $average_mark = 0;
        foreach ($page_list as $row) {
            $marks = '';
            $comments = '';
            $mark_grade = array('grade' => '', 'value' => '');
            if (!empty($mark_sheet_data)) {
                foreach ($mark_sheet_data as $mark_sheet_data_key => $mark_sheet_data_value) {
                    if ($mark_sheet_data_value['student'] == $row['studentid']) {
                        $marks = $mark_sheet_data_value['mark'];
                        $comments = $mark_sheet_data_value['comment'];
                        if (!empty($grading_scale_details)) {
                            $mark_grade = get_grade($grading_scale_details, $marks);
                        }
                        unset($mark_sheet_data[$mark_sheet_data_key]);
                        $total_mark += $mark_sheet_data_value['mark'];
                        break;
                    }
                }
            }
            echo '<tr class="mark_sheet_row" id="student_grades_' . $row['studentid'] . '" style="' . get_row_color($counter, 2) . '">
										<td><div>' . $row['studentname'] . '</div></td>
										<td>
										<div>
											<input name="students[std_' . $row['studentid'] . '][marks]" value="' . $marks . '" id="marks_cell_' . $row['studentid'] . '" type="text" size="2" maxlength="5" class="marks_cell" />
										</div>
										</td>
										<td>
 function get_biaya_pjd($id)
 {
     $grade = get_grade($id);
     $pos_group = get_pos_group($id);
     if ($grade == 'G08' && $pos_group == 'AMD') {
         return $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/7'));
     } elseif ($grade == 'G08' && $pos_group == 'MGR') {
         return $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/6'));
     } elseif ($grade == 'G08' && $pos_group == 'KACAB') {
         return $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/5'));
     } elseif ($grade == 'G07') {
         return $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/4'));
     } elseif ($grade == 'G06' || $grade == 'G05') {
         return $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/3'));
     } elseif ($grade == 'G04' || $grade == 'G03') {
         return $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/2'));
     } elseif ($grade == 'G02' || $grade == 'G01') {
         return $this->data['biaya_fix'] = getAll('pjd_biaya', array('type_grade' => 'where/1'));
     }
 }
Esempio n. 6
0
<?php

if (get_grade($nik) == 'G08' || get_grade($nik) == 'G09') {
    ?>
<div class="row form-row">
  <div class="col-md-2">
    <label class="form-label text-left"><?php 
    echo 'Admin Asset Management';
    ?>
</label>
  </div>
  <div class="col-md-4">
    <?php 
    $style_up = 'class="form-control select2" id=""';
    echo form_dropdown('asset_mng', $result, '', $style_up);
    ?>
  </div>
</div>
<?php 
} else {
    echo '';
}
function print_attendance_line($student, $course)
{
    echo '<table class="generaltable"><thead><tr>';
    foreach ($statuses as $st) {
        echo '<th>' . $st->description . '</th>';
    }
    echo '<th>' . get_string('grade') . '</th>';
    echo '<th>%</th></tr><tr><td></td>';
    echo '</tr></thead><tbody><tr>';
    foreach ($statuses as $st) {
        echo '<td>' . get_attendance($student->id, $course, $st->id) . '</td>';
    }
    echo '<td>' . get_grade($student, $course) . '&nbsp;/&nbsp;' . get_maxgrade($student->id, $course) . '</td>';
    echo '<td>' . get_percent($student, $course) . '%' . '</td>';
    echo '</tr></tbody></table>';
}
    </tr>
  </thead>
  <tbody>
    <?php 
foreach ($detail->result() as $key) {
    ?>
      <tr>
        <td height="50">
          
          <?php 
    echo get_name($key->user_id);
    ?>
        </td>
        <td align="center">
          <?php 
    echo get_grade($key->user_id);
    ?>
        </td>
        <?php 
    $c = $ci->db->select('users_spd_luar_group_biaya.jumlah_biaya')->from('users_spd_luar_group_biaya')->join('pjd_biaya', 'pjd_biaya.id = users_spd_luar_group_biaya.pjd_biaya_id', 'left')->where('user_spd_luar_group_id', $id)->where('user_id', $key->user_id)->where('pjd_biaya.type_grade != ', 0)->get();
    foreach ($c->result() as $c) {
        ?>
        <td><?php 
        echo number_format($c->jumlah_biaya * $jml_pjd, 0);
        ?>
        </td>
        <?php 
    }
    ?>
        <?php 
    $b = $ci->db->select('users_spd_luar_group_biaya.jumlah_biaya')->from('users_spd_luar_group_biaya')->join('pjd_biaya', 'pjd_biaya.id = users_spd_luar_group_biaya.pjd_biaya_id', 'left')->where('user_spd_luar_group_id', $id)->where('user_id', $key->user_id)->where('pjd_biaya.type_grade', 0)->get();
Esempio n. 9
0
     $url .= '&debug=true';
 }
 echo '<tr>';
 echo '<td class="label">' . strtoupper($student->lastname) . '</a></td><td class="label">' . ucfirst(strtolower($student->firstname)) . '</td><td><a class="noprint" href="' . $url . '">' . get_string('show', 'block_progress') . '</a></td>';
 foreach ($all_courses as $key => $val) {
     if (isset($val['student'][$student->id])) {
         # has the student got a record for this course?
         $courseid = $val['course']->id;
         if (!isset($stu_on_course[$courseid])) {
             $stu_on_course[$courseid] = 0;
         }
         //echo '<p>'.$stuid.'</p>';
         $stu_on_course[$courseid]++;
         $courses_per_stu[$stuid]++;
         $c = $val['course']->id;
         $grade = get_grade($CFG->prefix, $student->id, $val['course']->id);
         $g = get_grades($CFG->prefix, $val['course']->id);
         $a = get_achieved($CFG->prefix, $student->id, $val['course']->id);
         if (!isset($totalgrades[$c])) {
             $totalgrades[$c] = 0;
         }
         $totalgrades[$c] += $g['P'];
         if (!isset($totalgr_stu[$stuid])) {
             $totalgr_stu[$stuid] = 0;
         }
         $totalgr_stu[$stuid] += $g['P'];
         if (!isset($achievedgrades[$c])) {
             $achievedgrades[$c] = 0;
         }
         $achievedgrades[$c] += $a['P'];
         if (!isset($achievedgr_stu[$stuid])) {
Esempio n. 10
0
	<div id='events-page'>

	
	</div>
	 <div id="events-page">
	   <div class='b-tbl' >
	   <table width='100%' border='1px'>
			<tr>
				<td align='center'><b>Section:</b></td>
				<td><input style='height:50px;width:100%' placeholder="Type the Section here..."type="text" name="section" required/></td>	
			</tr>
			<tr>
			   <td align='center'>Grade:</td><td><br/><select id='g'name='grade' style='height:50px;width:190px;' required/>
			   <option value=''>Grade</option>
			   <?php 
echo get_grade();
?>
       			   </select></td>
			</tr>
		
		
		<tr align='right'><td colspan='6'>
				     <a href='list_classlist.php'> |&nbsp;View All Class Record</a>|&nbsp;
					 <input  style='width:150px; height:50px;'type='submit' id="add" value='Proceed'>
					 <input  style='width:140px;cursor:pointer;height:50px;' type='button' onclick='window.history.back()' value='Back'/>
				</td></tr></table>
				<!---Blur effect -->
		<div class="md-overlay" onclick="clear1()"></div>
		<!-- Ito ang Javascriptelement -->
		<script src="modaljs/classie.js"></script>
		<script src="modaljs/modalEffects.js"></script>
Esempio n. 11
0
                          </div>
                          <div class="col-md-8">
                            <input name="title" id="title" type="text"  class="form-control" placeholder="Dalam Rangka" value="<?php 
        echo dateIndo($td->date_spd_end);
        ?>
" disabled="disabled">
                          </div>
                        </div>
                      </div>
                    </div>

                  <hr/>
                  <h5 class="text-center"><span class="semi-bold">Ketentuan Biaya Perjalanan Dinas</span></h5>
                  <p>&nbsp;</p>
                      <p class="bold">Grade Penerima Tugas : <span id="grade" class="semi-bold"><?php 
        echo get_grade($tc_id);
        ?>
</span></p>
                        <div class="row form-row">
                          <div class="col-md-12">
                          <table class="table table-bordered">
                            <thead>
                              <tr>
                                <th width="2%">No</th>
                                <th width="40%">Jenis Biaya</th>
                                <th width="40%">Jumlah Biaya</th>
                              </tr>
                            </thead>
                            <tbody>
                            <?php 
        $i = 1;
Esempio n. 12
0
<tr><td height="40"></td></tr>
<tr class="style4"><td>Memberi tugas / ijin kepada : </td></tr>
<tr><td height="30"></td></tr>
  <tr>
    <td width="275" height="40"><span class="style3">Nama</span></td>
    <td width="10" height="40"><div align="center">:</div></td>
    <td width="440" height="40"><?php 
        echo get_name($td->task_receiver);
        ?>
</td>
  </tr>
  <tr>
    <td height="40"><span class="style3">Golongan </span></td>
    <td height="40"><div align="center">:</div></td>
    <td height="40"><?php 
        echo get_grade($td->task_receiver);
        ?>
</td>
  </tr>
  <tr>
    <td height="40"><span class="style3">Bagian / Dept </span></td>
    <td height="40"><div align="center">:</div></td>
    <td height="40"><?php 
        echo get_user_organization($td->task_receiver);
        ?>
</td>
  </tr>
  <tr>
    <td height="40"><span class="style3">Jabatan</span></td>
    <td height="40"><div align="center">:</div></td>
    <td height="40"><?php 
                         $statuses = get_statuses($course->id);
                         foreach ($statuses as $st) {
                             echo '<th>' . $st->description . '</th>';
                         }
                         echo '<th>' . get_string('grade') . '</th>';
                         echo '<th>%</th></tr><tr><td></td>';
                         echo '</tr></thead>';
                         echo '<tbody><tr>';
                         echo '<td id="tshowstudent" name="tshowstudent">';
                         echo "<a href=\"view.php?id={$id}&amp;student={$student->id}\">" . fullname($student);
                         echo '</a></td><td id="tshowcourse" name="tshowcourse">';
                         echo "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">" . $course->fullname . '</a></td>';
                         foreach ($statuses as $st) {
                             echo '<td>' . get_attendance($student->id, $course, $st->id) . '</td>';
                         }
                         echo '<td>' . get_grade($studentselected, $course) . '&nbsp;/&nbsp;' . get_maxgrade($student->id, $course) . '</td>';
                         echo '<td>' . get_percent($studentselected, $course) . '%' . '</td>';
                         echo '</tr></tbody></table>';
                     }
                     if ($reportselected === 'all' or $reportselected === 'detailed') {
                         echo '<h3>' . "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">" . $course->fullname . '</a></h3>';
                         print_detailed_report($studentselected, $cm, $course->id);
                     }
                 }
             }
         }
     }
     if ($reportselected === 'detailed') {
         echo '</table>';
     }
 }
Esempio n. 14
0
function attforblock_user_outline($course, $user, $mod, $attforblock)
{
    /// Return a small object with summary information about what a
    /// user has done with a given particular instance of this module
    /// Used for user activity reports.
    /// $return->time = the time they did it
    /// $return->info = a short text description
    require_once 'locallib.php';
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    if (has_capability('moodle/course:view', $context)) {
        //if (isstudent($course->id, $user->id)) {
        if ($sescount = get_attendance($user->id, $course)) {
            $strgrade = get_string('grade');
            $maxgrade = get_maxgrade($user->id, $course);
            $usergrade = get_grade($user->id, $course);
            $percent = get_percent($user->id, $course);
            $result->info = "{$strgrade}: {$usergrade} / {$maxgrade} ({$percent}%)";
        }
    }
    return $result;
}
Esempio n. 15
0
 function is_spv($nik)
 {
     $grade = substr(get_grade($nik), -1);
     if ($grade > 4) {
         return true;
     } else {
         return false;
     }
 }
function attforblock_user_outline($course, $user, $mod, $attforblock)
{
    /// Return a small object with summary information about what a
    /// user has done with a given particular instance of this module
    /// Used for user activity reports.
    /// $return->time = the time they did it
    /// $return->info = a short text description
    require_once 'locallib.php';
    $result = false;
    // this line was added as per Juan Carlos Rodr&#237;guez-del-Pino advice
    if (isstudent($course->id, $user->id)) {
        if ($sescount = get_attendance($user->id, $course)) {
            $strgrade = get_string('grade');
            $maxgrade = get_maxgrade($user->id, $course);
            $usergrade = get_grade($user->id, $course);
            $percent = get_percent($user->id, $course);
            $result->info = "{$strgrade}: {$usergrade} / {$maxgrade} ({$percent}%)";
        }
    }
    return $result;
}
            $table->data[$student->id][] = print_user_picture($student->id, $course->id, $student->picture, 20, true, true);
            $table->data[$student->id][] = "<a href=\"view.php?id={$id}&amp;student={$student->id}\">" . fullname($student) . '</a>';
            foreach ($course_sess as $sessdata) {
                if ($att = get_record('attendance_log', 'sessionid', $sessdata->id, 'studentid', $student->id)) {
                    if (isset($statuses[$att->statusid])) {
                        $table->data[$student->id][] = $statuses[$att->statusid]->acronym;
                    } else {
                        $table->data[$student->id][] = '<font color="red"><b>' . $allstatuses[$att->statusid]->acronym . '</b></font>';
                    }
                } else {
                    $table->data[$student->id][] = '-';
                }
            }
            foreach ($statuses as $st) {
                $table->data[$student->id][] = get_attendance($student->id, $course, $st->id);
            }
            $table->data[$student->id][] = get_grade($student->id, $course) . '&nbsp;/&nbsp;' . get_maxgrade($student->id, $course);
            $table->data[$student->id][] = get_percent($student->id, $course) . '%';
        }
        echo '<br />';
        print_table($table);
    } else {
        print_heading(get_string('nothingtodisplay'), 'center');
    }
    echo get_string('status', 'attforblock') . ':<br />';
    foreach ($statuses as $st) {
        echo $st->acronym . ' - ' . $st->description . '<br />';
    }
}
print_footer($course);
exit;
function print_attendance_table($user, $course)
{
    $complete = get_attendance($user->id, $course);
    $percent = get_percent($user->id, $course) . '&nbsp;%';
    $grade = get_grade($user->id, $course);
    echo '<table border="0" cellpadding="0" cellspacing="0" class="list">';
    attendance_print_row(get_string('sessionscompleted', 'attforblock') . ':', "<strong>{$complete}</strong>");
    $statuses = get_statuses($course->id);
    foreach ($statuses as $st) {
        attendance_print_row($st->description . ': ', '<strong>' . get_attendance($user->id, $course, $st->id) . '</strong>');
    }
    attendance_print_row(get_string('attendancepercent', 'attforblock') . ':', "<strong>{$percent}</strong>");
    attendance_print_row(get_string('attendancegrade', 'attforblock') . ':', "<strong>{$grade}</strong> / " . get_maxgrade($user->id, $course));
    attendance_print_row('&nbsp;', '&nbsp;');
    echo '</table>';
}
Esempio n. 19
0
function compteur()
{
    global $s_joueur, $config, $db, $dbprefix, $s_type, $Sess;
    if ($db) {
        $time = time();
        $duree = $time + $config['stats_timeout'];
        if ($s_joueur > 0) {
            $grade = get_grade($s_joueur);
            $c_grade = 0;
            if (stripos($grade, 'v') !== false) {
                $c_grade++;
            }
            if (stripos($grade, 'w') !== false) {
                $c_grade++;
            }
            if (stripos($grade, 'x') !== false) {
                $c_grade++;
            }
            if (stripos($grade, 'y') !== false) {
                $c_grade++;
            }
            if (stripos($grade, 'z') !== false) {
                $c_grade++;
            }
            if (strlen($grade) - $c_grade > 0) {
                $s_type = 2;
            } else {
                if ($s_joueur > 0) {
                    $s_type = 1;
                }
            }
        }
        //on vide toutes les addresses ip obsoletes enregistr&eacute;es dans la table
        $db->delete("{$dbprefix}compteur");
        $db->where("date < {$time}");
        $db->exec();
        //on incremente la nb de pages vues
        $db->update("{$dbprefix}stats");
        $db->set("count = count + 1");
        $db->where("nom='pages vues' AND type='compteur'");
        $db->exec();
        //on verifie l adresse ip du visiteur et aussi son heure de passage
        $db->select("*");
        $db->from("{$dbprefix}compteur");
        $db->where("id = '" . md5($Sess->ip) . "'");
        $res = $db->exec();
        if ($db->num_rows($res) > 0) {
            //on met a jour les info de l'ip d&eacute;tect&eacute;e
            $db->update("{$dbprefix}compteur");
            if (!isset($s_joueur) || empty($s_joueur)) {
                $s_joueur = '0';
            }
            if (!isset($s_joueur) || empty($s_joueur)) {
                $s_type = '0';
            }
            $db->set("date = {$duree}, joueur = '{$s_joueur}', type = '{$s_type}'");
            $db->where("id = '" . md5($Sess->ip) . "'");
            $db->exec();
        } else {
            //on enregistre l adresse ip si elle est inconnu et on incremente le compteur
            $db->insert("{$dbprefix}compteur (id,date,joueur,type)");
            if (!is_int($s_joueur)) {
                $s_joueur = '0';
            }
            if (!is_int($s_type)) {
                $s_type = '0';
            }
            $db->values("'" . md5($Sess->ip) . "','{$duree}','{$s_joueur}','{$s_type}'");
            $db->exec();
            if (ereg("Nav", getenv("HTTP_USER_AGENT")) || ereg("Gold", getenv("HTTP_USER_AGENT")) || ereg("X11", getenv("HTTP_USER_AGENT")) || ereg("Mozilla", getenv("HTTP_USER_AGENT")) || ereg("Netscape", getenv("HTTP_USER_AGENT")) and !ereg("MSIE", getenv("HTTP_USER_AGENT"))) {
                $browser = "Netscape";
            } elseif (ereg("MSIE", getenv("HTTP_USER_AGENT"))) {
                $browser = "Internet Explorer";
            } elseif (ereg("Lynx", getenv("HTTP_USER_AGENT"))) {
                $browser = "Lynx";
            } elseif (ereg("Opera", getenv("HTTP_USER_AGENT"))) {
                $browser = "Opera";
            } elseif (ereg("WebTV", getenv("HTTP_USER_AGENT"))) {
                $browser = "WebTV";
            } elseif (ereg("Konqueror", getenv("HTTP_USER_AGENT"))) {
                $browser = "Konqueror";
            } elseif (eregi("bot", getenv("HTTP_USER_AGENT")) || ereg("Google", getenv("HTTP_USER_AGENT")) || ereg("Slurp", getenv("HTTP_USER_AGENT")) || ereg("Scooter", getenv("HTTP_USER_AGENT")) || eregi("Spider", getenv("HTTP_USER_AGENT")) || eregi("Infoseek", getenv("HTTP_USER_AGENT"))) {
                $browser = "Moteurs de recherche";
            } else {
                $browser = "Autres";
            }
            if (ereg("Win", getenv("HTTP_USER_AGENT"))) {
                $os = "Windows";
            } elseif (ereg("Mac", getenv("HTTP_USER_AGENT")) || ereg("PPC", getenv("HTTP_USER_AGENT"))) {
                $os = "Mac";
            } elseif (ereg("Linux", getenv("HTTP_USER_AGENT"))) {
                $os = "Linux";
            } elseif (ereg("FreeBSD", getenv("HTTP_USER_AGENT"))) {
                $os = "FreeBSD";
            } elseif (ereg("SunOS", getenv("HTTP_USER_AGENT"))) {
                $os = "SunOS";
            } elseif (ereg("IRIX", getenv("HTTP_USER_AGENT"))) {
                $os = "IRIX";
            } elseif (ereg("BeOS", getenv("HTTP_USER_AGENT"))) {
                $os = "BeOS";
            } elseif (ereg("OS/2", getenv("HTTP_USER_AGENT"))) {
                $os = "OS/2";
            } elseif (ereg("AIX", getenv("HTTP_USER_AGENT"))) {
                $os = "AIX";
            } else {
                $os = "Autres";
            }
            $db->update("{$dbprefix}stats");
            $db->set("count = count + 1");
            $db->where("((nom='visites' AND type='compteur') OR (type = 'browser' AND nom = '{$browser}') OR (type = 'os' AND nom = '{$os}'))");
            $db->exec();
        }
        // recup des resultats
        $db->select("count(id) as nb,type");
        $db->from("{$dbprefix}compteur");
        $db->group_by("type");
        $res1 = $db->exec();
        $compteur['nb_anonyme'] = $compteur['nb_enregistre'] = $compteur['nb_admin'] = 0;
        while ($stats = $db->fetch($res1)) {
            if ($stats->type == 0) {
                $compteur['nb_anonyme'] += $stats->nb;
            } elseif ($stats->type == 1) {
                $compteur['nb_enregistre'] += $stats->nb;
            } elseif ($stats->type > 1) {
                $compteur['nb_admin'] += $stats->nb;
            }
        }
        $compteur['nb_connecte'] = $compteur['nb_enregistre'] + $compteur['nb_admin'];
        $compteur['nb_total'] = $compteur['nb_anonyme'] + $compteur['nb_connecte'];
        $db->select("nom,count");
        $db->from("{$dbprefix}stats");
        $db->where("type='compteur'");
        $res = $db->exec();
        while ($result = $db->fetch($res)) {
            $compteur[$result->nom] = $result->count;
        }
        return $compteur;
    }
}