Ejemplo n.º 1
0
        } else {
            $class = 'class="even"';
        }
        ?>
<tr <?php 
        echo $class;
        ?>
 >
    <td class="name"><?php 
        echo $posts_1->first_name;
        ?>
</td>
    <?php 
        for ($i = 1; $i <= $num; $i++) {
            echo '<td>';
            $find = StudentAttentance::model()->findAll("date=:x AND student_id=:y", array(':x' => $_REQUEST['year'] . '-' . $mon_num . '-' . $i, ':y' => $posts_1->id));
            if (count($find) == 0) {
                echo '';
            } else {
                echo "<span style='color:#ce0606'><strong>X</strong></span>";
            }
            echo '</td>';
        }
        ?>
</tr>
<?php 
        $j++;
    }
    ?>
</table>
<?php 
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = StudentAttentance::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 3
0
<?php

$find = StudentAttentance::model()->findAll("date=:x AND student_id=:y", array(':x' => $year . '-' . $month . '-' . $day, ':y' => $emp_id));
if (count($find) == 0) {
    echo CHtml::ajaxLink('ll', $this->createUrl('StudentAttentance/addnew'), array('onclick' => '$("#jobDialog' . $day . $emp_id . '").dialog("open"); return false;', 'update' => '#jobDialog123' . $day . $emp_id, 'type' => 'GET', 'data' => array('day' => $day, 'month' => $month, 'year' => $year, 'emp_id' => $emp_id)), array('id' => 'showJobDialog' . $day . $emp_id, 'class' => 'at_abs'));
    //echo '<div id="jobDialog'.$day.$emp_id.'"></div>';
} else {
    /*
    	Column with leave marked
    */
    echo CHtml::ajaxLink('<span class="abs"></span>', $this->createUrl('StudentAttentance/EditLeave'), array('onclick' => '$("#jobDialog' . $day . $emp_id . '").dialog("open"); return false;', 'update' => '#jobDialogupdate' . $day . $emp_id, 'type' => 'GET', 'data' => array('id' => $find[0]['id'], 'day' => $day, 'month' => $month, 'year' => $year, 'emp_id' => $emp_id)), array('id' => 'showJobDialog' . $day . $emp_id, 'title' => 'Reason: ' . $find['0']['reason']));
}
Ejemplo n.º 4
0
	 <!--navigation ends here-->
     <!--banner starts here-->
     <!--<section id="innerbanner"><img src="images/innerbanner.png" width="1000" height="168"></section>-->
      <!--banner ends here-->
      <!--midsection starts here-->
      
      <!--midsection ends here-->
      <!--innersection starts here-->
      <div id="parent_Sect">
      <?php 
$this->renderPartial('leftside');
?>
 
      <?php 
$std = StudentAttentance::model()->findAll("student_id=:x", array(':x' => '12'));
function getweek($date, $month, $year)
{
    $date = mktime(0, 0, 0, $month, $date, $year);
    $week = date('w', $date);
    switch ($week) {
        case 0:
            return 'Sun';
            break;
        case 1:
            return 'Mon';
            break;
        case 2:
            return 'Tue';
            break;
        case 3:
Ejemplo n.º 5
0
Batch : <?php 
    echo $batchname;
    ?>
</h5>
<table width="100%" cellspacing="0" cellpadding="0" class="attendance_table" align="center">
<tr style="background:#dfdfdf;">
    <th><?php 
    echo Yii::t('attendance', 'Name');
    ?>
</th>
    <th><?php 
    echo Yii::t('attendance', 'Leaves');
    ?>
</th></tr>
   
    <?php 
    $data = Students::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id']));
    foreach ($data as $data1) {
        echo '<tr>';
        echo '<td>' . $data1->first_name . '</td>';
        $fullday = count(StudentAttentance::model()->findAllByAttributes(array('student_id' => $data1->id)));
        echo '<td>' . $fullday . '</td>';
        echo '</tr>';
    }
    ?>
 
  </table>
  <?php 
}
?>
</div>
Ejemplo n.º 6
0
        $yearly_sl++;
        ?>
</td>
				<td><?php 
        echo $student->admission_no;
        ?>
</td>
				<td><?php 
        echo ucfirst($student->first_name) . '  ' . ucfirst($student->middle_name) . '  ' . ucfirst($student->last_name);
        ?>
</td>
				
				 <!-- Yearly Attendance column -->
				<td>
					<?php 
        $attendances = StudentAttentance::model()->findAllByAttributes(array('student_id' => $student->id));
        $required_year = $_REQUEST['year'];
        //$admission_year = date('Y',strtotime($student->admission_date));
        //if($required_year >= $joining_year)
        //{
        $leaves = 0;
        foreach ($attendances as $attendance) {
            $attendance_year = date('Y', strtotime($attendance->date));
            if ($attendance_year == $required_year) {
                $leaves++;
            }
        }
        echo $leaves;
        //}
        //else
        //{
Ejemplo n.º 7
0
 public function actionDeleteLeave()
 {
     $flag = true;
     $model = StudentAttentance::model()->findByAttributes(array('id' => $_REQUEST['id']));
     if ($model->delete()) {
         $flag = false;
         $student = Students::model()->findByAttributes(array('id' => $model->student_id));
         $settings = UserSettings::model()->findByAttributes(array('user_id' => 1));
         if ($settings != NULL) {
             $date = date($settings->displaydate, strtotime($model->date));
         }
         //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
         ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '10', $model->student_id, ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name), $date, NULL, NULL);
     }
     if ($flag) {
         Yii::app()->clientScript->scriptMap['jquery.js'] = false;
         $this->renderPartial('update', array('model' => $model, 'day' => $_GET['day'], 'month' => $_GET['month'], 'year' => $_GET['year'], 'emp_id' => $_GET['emp_id']), false, true);
     }
 }
Ejemplo n.º 8
0
                    echo '-';
                }
                ?>
                                                </td>
                                                <td>
                                                    <strong><?php 
                echo Yii::t('report', 'Leaves Taken');
                ?>
</strong>
                                                </td>
                                               <td>
                                                    <strong>:</strong>
                                                </td>
                                                <td>
                                                    <?php 
                $leaves = StudentAttentance::model()->findAll('student_id=:x ORDER BY date ASC', array(':x' => $individual->id));
                echo count($leaves);
                ?>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                                <!-- END Individual Details -->                            
                                
                                <!-- Individual Report Table -->
                                <div class="tablebx">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr class="tablebx_topbg">
                                            <td><?php 
                echo Yii::t('report', 'Sl No');
 public function actionAjax_Create()
 {
     if (isset($_POST['StudentAttentance'])) {
         $model = new StudentAttentance();
         //set the submitted values
         $model->attributes = $_POST['StudentAttentance'];
         $settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
         if ($settings != NULL) {
             $model->date = date('y-m-d', strtotime($_POST['StudentAttentance']['date']));
         }
         //return the JSON result to provide feedback.
         if ($model->save(false)) {
             echo json_encode(array('success' => true, 'id' => $model->primaryKey));
             exit;
         } else {
             echo json_encode(array('success' => false));
             exit;
         }
     }
 }
Ejemplo n.º 10
0
<div id="parent_Sect">
      <?php 
$this->renderPartial('leftside');
?>
 
<?php 
$cal = '{
					title: "All Day Event",
					start: new Date(y, m, 1)
				},';
$m = '';
$d = '';
$y = '';
//$result=TaskAssignToPatients::model()->findAll(('status=:t1 OR status=:t2 OR status=:t3 OR status=:t4 OR  status=:t5 OR status IS NULL group by target_date'),array(':t1'=>'C',':t2'=>'S',':t3'=>'A',':t4'=>'E',':t5'=>'R'));
$studentdetails = Students::model()->findByAttributes(array('uid' => Yii::app()->user->id));
$student = StudentAttentance::model()->findAll('student_id=:x group by date', array(':x' => $studentdetails->id));
foreach ($student as $student_1) {
    $m = date('m', strtotime($student_1['date'])) - 1;
    $d = date('d', strtotime($student_1['date']));
    $y = date('Y', strtotime($student_1['date']));
    $cal .= "{\n\t\t\t\t\ttitle: '" . '<div align="center" title="Reason: ' . $student_1->reason . '"><img src="images/portal/atend_cross.png" width="26" border="0"  height="25" /></div>' . "',\n\t\t\t\t\tstart: new Date('" . $y . "', '" . $m . "', '" . $d . "')\n\t\t\t\t},";
}
?>

                              
                
                 
                 
                 <div class="right_col"  id="req_res123">
                           
                          
 public function actionSendsms()
 {
     // Function to send Attendance SMS to all students of a batch
     $sms_settings = SmsSettings::model()->findAll();
     if ($sms_settings[0]->is_enabled == '1' and $sms_settings[3]->is_enabled == '1') {
         // Checking if SMS is enabled.
         $students = Students::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['batch_id']));
         // Selecting the students of the batch
         $today = date("Y-m-d");
         $sms_status = 0;
         // Setting a flag variable to check whether atleast one sms was sent.
         if ($students != NULL) {
             foreach ($students as $student) {
                 $is_absent = StudentAttentance::model()->find("date=:x AND student_id=:y", array(':x' => $today, ':y' => $student->id));
                 $absent_no = count($is_absent);
                 if (count($is_absent) != '0' and count($is_absent) != NULL) {
                     // Checking whether the student was absent
                     $guardian = Guardians::model()->findByAttributes(array('ward_id' => $student->id));
                     if (count($guardian) != '0') {
                         // Check if guardian added
                         $to = '';
                         if ($guardian->mobile_phone) {
                             //Checking if phone number is provided
                             $to = $guardian->mobile_phone;
                         }
                         if ($to != '') {
                             // If absent and phone number is provided, send SMS
                             $college = Configurations::model()->findByPk(1);
                             $from = $college->config_value;
                             $message = 'Your child ' . $student->first_name . ' was absent today.';
                             //SmsSettings::model()->sendSms($to,$from,$message);
                             $sms_status = 1;
                             // Set flag variable to 1 if atleast one sms was sent.
                             Yii::app()->user->setFlash('notification', 'Attendance SMS is disabled');
                         }
                         // End check phone number
                     }
                     // End check if guardian added
                 }
                 // End check whether the student was absent
             }
             // End for each student
             if ($sms_status == 0) {
                 // This flag variable will be one if atleast one sms was sent.
                 Yii::app()->user->setFlash('notification', 'No absentees today!');
             }
         } else {
             Yii::app()->user->setFlash('notification', 'No students!');
         }
     }
     // End check if SMS is enabled
     if (isset($_REQUEST['flag']) and $_REQUEST['flag'] == 1) {
         $this->redirect(array('/courses/studentAttentance', 'id' => $_REQUEST['batch_id']));
     } else {
         $this->redirect(array('index', 'id' => $_REQUEST['batch_id']));
     }
 }
 public function actionStudentattendancepdf()
 {
     $data = Students::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id']));
     Yii::import('application.extensions.fpdf.*');
     require 'fpdf.php';
     $pdf = new FPDF();
     $pdf->AddPage();
     $pdf->SetFont('Arial', 'BU', 15);
     $pdf->Cell(75, 10, 'Employee Attendance Report', 0, 0, 'C');
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('Arial', 'BU', 10);
     $w = array(40, 40, 60);
     $header = array('Name', 'Leaves', 'Remarks');
     //Header
     for ($i = 0; $i < count($header); $i++) {
         $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', false);
     }
     $pdf->Ln();
     $pdf->SetFont('Arial', '', 10);
     $fill = false;
     $i = 40;
     foreach ($data as $data1) {
         $pdf->Cell($i, 6, $data1->first_name, 1, 0, 'L', $fill);
         $fullday = count(StudentAttentance::model()->findAllByAttributes(array('student_id' => $data1->id)));
         $total = $fullday;
         $pdf->Cell($i, 6, $total, 1, 0, 'C', $fill);
         $pdf->Cell($i + 20, 6, '', 1, 0, 'C', $fill);
         $pdf->Ln();
     }
     $pdf->Output();
     Yii::app()->end();
 }
Ejemplo n.º 13
0
    <?php 
$cal = '{
    title: "All Day Event",
    start: new Date(y, m, 1)
    },';
$m = '';
$d = '';
$y = '';
$guardian = Guardians::model()->findByAttributes(array('uid' => Yii::app()->user->id));
$students = Students::model()->findAllByAttributes(array('parent_id' => $guardian->id));
if (count($students) == 1) {
    $attendances = StudentAttentance::model()->findAll('student_id=:x group by date', array(':x' => $students[0]->id));
} elseif (isset($_REQUEST['id']) and $_REQUEST['id'] != NULL) {
    $attendances = StudentAttentance::model()->findAll('student_id=:x group by date', array(':x' => $_REQUEST['id']));
} elseif (count($students) > 1) {
    $attendances = StudentAttentance::model()->findAll('student_id=:x group by date', array(':x' => $students[0]->id));
}
foreach ($attendances as $attendance) {
    $m = date('m', strtotime($attendance['date'])) - 1;
    $d = date('d', strtotime($attendance['date']));
    $y = date('Y', strtotime($attendance['date']));
    $cal .= "{\n\t\ttitle: '" . '<div align="center" title="Reason: ' . $attendance->reason . '"><img src="images/portal/atend_cross.png" width="26" border="0"  height="25" /></div>' . "',\n\t\tstart: new Date('" . $y . "', '" . $m . "', '" . $d . "')\n\t\t},";
}
?>
    <div class="right_col"  id="req_res123">
		<script type='text/javascript'>
        $(document).ready(function(){
			var date = new Date();
			var d = date.getDate();
			var m = date.getMonth();
			var y = date.getFullYear();
Ejemplo n.º 14
0
</tr>
<?php 
    $posts = Students::model()->findByAttributes(array('id' => $_REQUEST['id']));
    $class = 'class="even"';
    ?>
<tr <?php 
    echo $class;
    ?>
 >
    <td class="name"><?php 
    echo $posts->first_name;
    ?>
</td>
    <?php 
    for ($i = 1; $i <= $num; $i++) {
        echo '<td>';
        $find = StudentAttentance::model()->findAll("date=:x AND student_id=:y", array(':x' => $curr_year . $mon_num . '-' . $i, ':y' => $posts->id));
        if (count($find) == 0) {
            echo '';
        } else {
            echo "<span style='color:#ce0606'><strong>X</strong></span>";
        }
        echo '</td>';
    }
    ?>
</tr>
</table>
<?php 
}
?>
</div>
Ejemplo n.º 15
0
                $student->admission_date = date($settings->displaydate, strtotime($student->admission_date));
            }
            echo $student->admission_date;
        } else {
            echo '-';
        }
        ?>
					</td>
					<td><?php 
        echo ucfirst($student->first_name) . '  ' . ucfirst($student->middle_name) . '  ' . ucfirst($student->last_name);
        ?>
</td>
					<!-- Overall Attendance column -->
					<td>
						<?php 
        $leaves = StudentAttentance::model()->countByAttributes(array('student_id' => $student->id));
        echo $leaves;
        ?>
					</td>
					<!-- End overall Attendance column -->
				</tr>
				<?php 
    }
    ?>
            
        </table>
    </div>
    <!-- END Overall Attendance Table -->
   
   <?php 
} else {