protected function renderContent()
    {
        $day = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
        if (Yii::app()->user->getState('stud_id')) {
            $date = date('Y-m-d');
            $ts = strtotime($date);
            $week_number = date('W', $ts);
            $year = date('Y');
            for ($day1 = 1; $day1 < 7; $day1++) {
                $alldate[] = date('d-m-Y', strtotime($year . "W" . $week_number . $day1));
            }
            $criteria = new CDbCriteria();
            //$criteria->select = 'academic_term_id'; // select fields which you want in output
            $criteria->condition = 'current_sem = 1 AND academic_term_organization_id = ' . Yii::app()->user->getState('org_id');
            $semname = AcademicTerm::model()->findAll($criteria);
            $data = CHtml::listData($semname, 'academic_term_id', 'academic_term_id');
            $stud_model = StudentTransaction::model()->findByPk(Yii::app()->user->getState('stud_id'));
            $check_sem = in_array($stud_model->student_academic_term_name_id, $data);
            //var_dump($check_sem); exit;
            $timetableid = 0;
            if (!$check_sem) {
                echo "<h3 align=center style=color:red>Sorry, No timetable available for this student.</h3>";
            } else {
                $check_timetable = TimeTableDetail::model()->findByAttributes(array('acdm_name_id' => $stud_model->student_academic_term_name_id, 'division_id' => $stud_model->student_transaction_division_id));
                if (empty($check_timetable)) {
                    echo "<h3 align=center style=color:red>Sorry, No timetable available for this student.</h3>";
                } else {
                    $timetableid = $check_timetable->timetable_id;
                    $model = TimeTable::model()->findByPk($timetableid);
                    $nooflec = $model->No_of_Lec;
                    $sum = $nooflec;
                    $lec_duration = LecDuration::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id ', $params = array(':table_id' => $timetableid));
                    $lec = array();
                    foreach ($lec_duration as $l) {
                        $lec[] = $l['duration'];
                    }
                    $createdate = date_create($model->creation_date);
                    $starti = 1;
                    if ($model->zero_lec == 1) {
                        $starti = 0;
                    }
                    $time = $model->clg_start_time;
                    $time = date('H:i A', strtotime($time));
                    $timestamp = strtotime($time);
                    $time = date('g:i A', $timestamp);
                    ?>

			<table id="time-table-struc" bgcolor="#CBE7ED"  border="2" style= width:auto;font-size:8px;border-collapse:collapse; height:auto;"  align="center">
			<th  align=center>
				Day/Time
			</th>

<?php 
                    $i = 0;
                    while ($i < 6) {
                        echo "<th>" . $day[$i] . "</br>(" . $alldate[$i] . ")</th>";
                        $i++;
                    }
                    $break = "";
                    $l = 0;
                    $count = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0);
                    for ($i = $starti; $i <= $nooflec; $i++) {
                        $days = count($day);
                        echo "<tr>";
                        $duration = NoOfBreakTable::model()->findByAttributes(array('timetable_id' => $timetableid, 'after_lec_break' => $i));
                        $dur = $duration['duration'];
                        if ($dur) {
                            $dur1 = date('i', strtotime($dur));
                        }
                        if ($break) {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + $dur1 * 60) . "</td><td colspan=7 align=center><font color='green'><b>Break</b></font></td></tr>";
                            $break = "";
                            $timestamp = strtotime($time) + $dur1 * 60;
                            $time = date('g:i A', $timestamp);
                            $i--;
                            continue;
                        } else {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + 60 * $lec[$l]) . "</td>";
                            $timestamp = strtotime($time) + 60 * $lec[$l];
                            $l++;
                            $time = date('g:i A', $timestamp);
                        }
                        for ($j = 1; $j <= $days; ++$j) {
                            $subname = "";
                            $room = "";
                            $faculty = "";
                            $batch = "";
                            if ($count[$j] > 0) {
                                $count[$j]--;
                                continue;
                            }
                            $result = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id AND day = :day AND lec = :lec AND division_id = :div_id AND lecture_date = :lecdate and proxy_status <> :proxy_status', $params = array(':table_id' => $timetableid, ':day' => $j, ':lec' => $i, ':div_id' => $stud_model->student_transaction_division_id, ':lecdate' => date('Y-m-d', strtotime($alldate[$j - 1])), ':proxy_status' => 2));
                            $break = NoOfBreakTable::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id  AND after_lec_break = :lec', $params = array(':table_id' => $timetableid, ':lec' => $i));
                            if ($result) {
                                foreach ($result as $list) {
                                    if ($list['lect_hour'] > 1) {
                                        $count[$j] = $list['lect_hour'] - 1;
                                    }
                                    echo "<td rowspan=" . $list['lect_hour'] . " align=center style=background:#C0CCCC; width:100px;>";
                                    break;
                                }
                                foreach ($result as $check) {
                                    if ($check->batch_id != 0) {
                                        $batch = "(" . Batch::model()->findByPk($check->batch_id)->batch_name . ")";
                                    }
                                    $subname = SubjectMaster::model()->findByPk($check->subject_id)->subject_master_alias;
                                    $room = "(" . RoomDetailsMaster::model()->findByPk($check->room_id)->room_name . ")";
                                    $faculty = "(" . EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $check->faculty_emp_id))->employee_name_alias . ")";
                                    if ($batch) {
                                        echo "</br>" . $subname . "</br>" . $batch . "</br>" . $room . "</br>" . $faculty;
                                    } else {
                                        echo "</br>" . $subname . "</br>" . $room . "</br>" . $faculty;
                                    }
                                }
                                echo "</td>";
                            } else {
                                echo "<td style=width:100px;>" . $subname . "</br>" . $batch . "</br>" . $room . "</br>" . $faculty . "</td>";
                            }
                        }
                        echo "</tr>";
                    }
                    echo "</table>";
                    ?>
<h5>Proxy details</h5>

<table id="time-table-struc" style="font-size:10px;">
<tr>
<th>Sr. No.</th>
<th>Employee Name</th>
<th>Proxy Employee Name</th>
<th>Subject</th>
<th>Lecture No.</th>
<th>Date</th>
</tr>
<?php 
                    $proxy_data = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'timetable_id = :timetable_id and division_id = :div_id and lecture_date >= :start and lecture_date< :end and proxy_status = :proxy order by lec', $params = array(':timetable_id' => $timetableid, ':div_id' => $stud_model->student_transaction_division_id, ':start' => date('Y-m-d', strtotime($alldate[0])), ':end' => date('Y-m-d', strtotime($alldate[5])), ':proxy' => 1));
                    $n = 0;
                    foreach ($proxy_data as $list) {
                        $result = TimeTableDetail::model()->findByPk($list->proxy_id);
                        ?>

<tr>
<td><?php 
                        echo ++$n;
                        ?>
</td>
<td><?php 
                        echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $list->faculty_emp_id))->employee_first_name;
                        ?>
</td>
<td><?php 
                        echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $result->faculty_emp_id))->employee_first_name;
                        ?>
</td>
<td><?php 
                        echo SubjectMaster::model()->findByPk($result->subject_id)->subject_master_alias;
                        ?>
</td>
<td><?php 
                        echo $result->lec;
                        ?>
</td>
<td><?php 
                        echo date('d-m-Y', strtotime($result->lecture_date));
                        ?>
</td>
</tr>
<?php 
                    }
                    ?>
</table>
<?php 
                }
                //ELSE END
            }
        } else {
            if (Yii::app()->user->getState('emp_id')) {
                $timetableid = 0;
                $date = date('Y-m-d');
                $ts = strtotime($date);
                $week_number = date('W', $ts);
                $alldate[0] = 'No';
                $year = date('Y');
                for ($day2 = 1; $day2 < 7; $day2++) {
                    $alldate[$day2] = date('d-m-Y', strtotime($year . "W" . $week_number . $day2));
                }
                $semname = AcademicTerm::model()->findAllByAttributes(array(), $condition = 'current_sem = :current_sem and academic_term_organization_id=:org_id', $params = array(':current_sem' => 1, ':org_id' => Yii::app()->user->getState('org_id')));
                foreach ($semname as $s) {
                    $semid = $s['academic_term_id'];
                    $check = TimeTableDetail::model()->findByAttributes(array('acdm_name_id' => $semid, 'faculty_emp_id' => Yii::app()->user->getState('emp_id')));
                    if ($check) {
                        $timetableid = $check['timetable_id'];
                        break;
                    }
                }
                if (!empty($timetableid)) {
                    $day = array(" ", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
                    $model = TimeTable::model()->findByPk($timetableid);
                    $nooflec = $model->No_of_Lec;
                    $sum = $nooflec;
                    $lec_duration = LecDuration::model()->findAllByAttributes(array(), $condition = 'timetable_id = :table_id ', $params = array(':table_id' => $timetableid));
                    $lec = array();
                    foreach ($lec_duration as $l) {
                        $lec[] = $l['duration'];
                    }
                    $starti = 1;
                    if ($model->zero_lec == 1) {
                        $starti = 0;
                    }
                    $time = $model->clg_start_time;
                    $time = date('H:i A', strtotime($time));
                    $createdate = date_create($model->creation_date);
                    ?>

			<table id="time-table-struc" bgcolor="#CBE7ED" border="2" style="width:auto;font-size:9px;border-collapse:collapse; height:auto;" >
			<th>
				Day/Time
			</th>

			<?php 
                    $i = 0;
                    while ($i < 7) {
                        echo "<th style='font-size:8px'>" . $day[$i] . "</br>(" . $alldate[$i] . ")</th>";
                        $i++;
                    }
                    $l = 0;
                    $break = "";
                    $dur1 = 0;
                    $count = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0);
                    for ($i = $starti; $i <= $nooflec; $i++) {
                        $days = count($day);
                        echo "<tr>";
                        $duration = NoOfBreakTable::model()->findByAttributes(array('timetable_id' => $timetableid, 'after_lec_break' => $i));
                        if ($duration) {
                            $dur = $duration['duration'];
                            $dur1 = date('i', strtotime($dur));
                        }
                        if ($break) {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + $dur1 * 60) . "</td><td colspan=7 align=center ><font color='green'><b>Break</b></font></td></tr>";
                            $break = "";
                            $timestamp = strtotime($time) + $dur1 * 60;
                            $time = date('g:i A', $timestamp);
                            $i--;
                            continue;
                        } else {
                            echo "<td style=width:100px;>" . $time . "-</br>" . date('g:i A', strtotime($time) + 60 * $lec[$l]) . "</td><td style=width:25px;><b>" . $i . "</b></td>";
                            $timestamp = strtotime($time) + 60 * $lec[$l];
                            $l++;
                            $time = date('g:i A', $timestamp);
                        }
                        for ($j = 1; $j <= $days - 1; ++$j) {
                            $subname = "";
                            $room = "";
                            $faculty = "";
                            $batch = "";
                            if ($count[$j] > 0) {
                                $count[$j]--;
                                continue;
                            }
                            $result = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'day = :day AND lec = :lec AND faculty_emp_id = :emp_id AND timetable_id=:table_id AND lecture_date =:lecdate and proxy_status <> :status', $params = array(':table_id' => $timetableid, ':day' => $j, ':lec' => $i, ':emp_id' => Yii::app()->user->getState('emp_id'), ':lecdate' => date('Y-m-d', strtotime($alldate[$j])), ':status' => 2));
                            $break = NoOfBreakTable::model()->findAllByAttributes(array(), $condition = 'after_lec_break = :lec AND timetable_id=:table_id', $params = array(':table_id' => $timetableid, ':lec' => $i));
                            if ($result) {
                                foreach ($result as $list) {
                                    if ($list['lect_hour'] > 1) {
                                        $count[$j] = $list['lect_hour'] - 1;
                                    }
                                    echo "<td rowspan=" . $list['lect_hour'] . " align=center style=background:#C0CCCC; border-color:black; width:150px;>";
                                    break;
                                }
                                foreach ($result as $check) {
                                    if ($check->batch_id != 0) {
                                        $batch = "(" . Batch::model()->findByPk($check->batch_id)->batch_name . ")";
                                    }
                                    $subname = SubjectMaster::model()->findByPk($check->subject_id)->subject_master_alias;
                                    $room = "(" . RoomDetailsMaster::model()->findByPk($check->room_id)->room_name . ")";
                                    $div = Division::model()->findByPk($check->division_id)->division_code;
                                    //$faculty="(".EmployeeInfo::model()->findByPk($check->faculty_emp_id)->employee_name_alias.")";
                                    if ($batch) {
                                        echo $subname . "</br>" . $batch . "</br>" . $room;
                                    } else {
                                        echo $subname . "</br>" . "(" . $div . ")" . "</br>" . $room;
                                    }
                                }
                                echo "</td>";
                            } else {
                                echo "<td style=width:150px;>" . $subname . "</br>" . $batch . "</br>" . $room . "</td>";
                            }
                        }
                        //for j end
                        echo "</tr>";
                    }
                    //for i end
                    echo "</table>";
                    ?>
<h5>Proxy Lectures</h5>

<table id="time-table-struc" border="1" style="font-size:10px;">
<tr>
<th>Sr. No.</th>
<th>Employee Name</th>
<th>Division</th>
<th>Subject</th>
<th>Room</th>
<th>Lecture No.</th>
<th>Date</th>
</tr>
<?php 
                    $proxy_data = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'timetable_id = :timetable_id and proxy_employee_id = :emp_id and lecture_date >= :start and lecture_date< :end and proxy_status = :proxy order by lec', $params = array(':timetable_id' => $timetableid, ':emp_id' => Yii::app()->user->getState('emp_id'), ':start' => date('Y-m-d', strtotime($alldate[0])), ':end' => date('Y-m-d', strtotime($alldate[5])), ':proxy' => 1));
                    $n = 0;
                    foreach ($proxy_data as $list) {
                        $result = TimeTableDetail::model()->findByPk($list->proxy_id);
                        ?>

<tr>
<td><?php 
                        echo ++$n;
                        ?>
</td>
<td><?php 
                        echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $list->faculty_emp_id))->employee_first_name;
                        ?>
</td>
<td><?php 
                        echo Division::model()->findByPk($result->division_id)->division_code;
                        ?>
</td>
<td><?php 
                        echo SubjectMaster::model()->findByPk($result->subject_id)->subject_master_alias;
                        ?>
</td>
<td><?php 
                        echo RoomDetailsMaster::model()->findByPk($result->room_id)->room_name;
                        ?>
</td>
<td><?php 
                        echo $result->lec;
                        ?>
</td>
<td><?php 
                        echo date('d-m-Y', strtotime($result->lecture_date));
                        ?>
</td>
</tr>
<?php 
                    }
                    ?>
</table>		

<?php 
                } else {
                    echo "<h3 align=center style=color:red>Sorry, No timetable available.</h3>";
                }
            }
        }
    }
Ejemplo n.º 2
0
 public function actiongetTimetableItemName1()
 {
     $data = array();
     $day = $_POST['TimeTableDetail']['day'];
     $lec = $_POST['TimeTableDetail']['lec'];
     $acdm_period_id = $_POST['TimeTableDetail']['acdm_period_id'];
     $org_id = Yii::app()->user->getState('org_id');
     $timetable_id = $_POST['TimeTableDetail']['timetable_id'];
     $check = TimeTableDetail::model()->findAllByAttributes(array(), $condition = 'day = :day AND lec = :lec AND branch_id = :branch_id AND acdm_name_id = :acdm_name_id AND timetable_id = :timetable_id', $params = array(':day' => $day, ':lec' => $lec, ':branch_id' => (int) $_REQUEST['TimeTableDetail']['branch_id'], ':timetable_id' => $timetable_id, ':acdm_name_id' => (int) $_REQUEST['TimeTableDetail']['acdm_name_id']));
     $flag = 0;
     foreach ($check as $c) {
         if ($c['subject_type'] == 2) {
             $flag = 1;
             break;
         }
     }
     $data = array();
     if ($flag == 1) {
         $data = Division::model()->findAll(array('condition' => 'academic_name_id=' . (int) $_REQUEST['TimeTableDetail']['acdm_name_id'] . ' and academic_period_id=' . $acdm_period_id . ' and branch_id=' . (int) $_REQUEST['TimeTableDetail']['branch_id'] . ' and division_organization_id=' . $org_id));
         $data = CHtml::listData($data, 'division_id', 'division_code');
     } else {
         $div1 = Yii::app()->db->createCommand()->select('division_id , division_code')->from('division')->where('branch_id=' . (int) $_REQUEST['TimeTableDetail']['branch_id'] . ' and academic_name_id=' . (int) $_REQUEST['TimeTableDetail']['acdm_name_id'] . ' and division_organization_id=' . $org_id . ' and division_id NOT IN(select division_id from time_table_detail where day=' . $day . ' and lec=' . $lec . ' and branch_id=' . (int) $_REQUEST['TimeTableDetail']['branch_id'] . ' and acdm_period_id=' . $acdm_period_id . ' and acdm_name_id=' . (int) $_REQUEST['TimeTableDetail']['acdm_name_id'] . ' and timetable_id=' . $timetable_id . ' and subject_type=1' . ')')->queryAll();
         if (empty($div1)) {
             echo "<b style='color:red;'>No Division Availble.Create division first.</b>";
             $f = 1;
         } else {
             foreach ($div1 as $n) {
                 $temp = $n['division_id'];
                 $data[$temp] = Division::model()->findByPk($n['division_id'])->division_code;
             }
         }
     }
     //$data=CHtml::listData($data,'division_id','division_code');
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
	echo "<tr align=center> <th  colspan = 15 style=text-align:left;> ".CHtml::image(Yii::app()->controller->createUrl('/site/loadImage', array('id'=>$org_data->organization_id)),'No Image',array('width'=>80,'height'=>55,'style'=>'float:left;margin-left:200px;')) ."
	 <big> <b>".$org_data->organization_name ."</big><br>". $org_data->address_line1." ".$org_data->address_line2."</br>"  . City::model()->findBypk($org_data->city)->city_name.", ".State::model()->findBypk($org_data->state)->state_name.", ".Country::model()->findBypk($org_data->country)->name."." ." </th> <br>	 </tr>";
	echo "<tr><th colspan=16><h3> Branch  of ".$branch_model->branch_name." Semester-".$acd_model->academic_term_name." Students  Attendence of Date-".date("d-m-Y", strtotime($date))." Report</h3></th> </tr>";
	echo "<tr><th colspan=2><b> Academic Year </b></th> <th colspan = 10 ><b> ".$pe_data->academic_term_period."</b></th></tr>";
	
	echo "<tr align=center>"; 
	echo "<th rowspan=6>SI No.</th>";
	echo "<th rowspan=6 >Enroll No</th>";
	echo "<th rowspan=6 colspan=5>Student Name</th>";
	echo "<th colspan=10> No. Of Lectures </th></tr><tr>"; 
	$j=1;
	$lec_hour=1;
	$comb_subject=array();	
	for($i=1;$i<=$lecture;$i++)
	{
		$check_timetable=TimeTableDetail::model()->findAll(
		array('condition'=>'acdm_name_id='.$sem.' and branch_id='.$branch.' and lecture_date="'.$date.'" and lec='.$i.' and proxy_status <> 1 order by lec '));
		
		$f=0;	
		if(empty($check_timetable)) 
		{
			echo "<th >$i</th>";
			$cols[]=1;
			$subject[]=0;
			$batch[]=0;
			$faculty[]=0;
			$lectures[]=0;
			$comb_subject[]=0;
			$j++;
		}
		else
Ejemplo n.º 4
0
  height: 39px;
  padding: 9px;
}
'); 

$current_date = date('Y-m-d');
$criteria = new CDbCriteria;
	$criteria->condition = 'current_sem = 1';

	$semname = AcademicTerm::model()->findAll($criteria);

	$data = CHtml::listData($semname,'academic_term_id','academic_term_id');
	$stud_model=StudentTransaction::model()->findByPk(Yii::app()->user->getState('stud_id'));
	$check_sem = in_array($stud_model->student_academic_term_name_id, $data);
	$timetableid=0;
        $check_timetable=TimeTableDetail::model()->findAllByAttributes(
	array(
	     'acdm_name_id' => $stud_model->student_academic_term_name_id,
	     'division_id' => $stud_model->student_transaction_division_id,
	     'lecture_date'=>$current_date,
   ),'proxy_status <> :status', array(':status'=>1));

if($check_timetable) {?>
<div class="wob wob-in-top-threshold wob-0-degrees read-only" style="height: 444px; width: 525px; z-index: 1;">
<div class="timeline textstream widget news-stream google-news vertical">
<div class="widget-header">
  <i class="header-icon"></i>
  <div class="title">Time Table</div>
</div>
<div class="timeline-items-wrapper">
<?php
Ejemplo n.º 5
0
</div>
<!-- Employee birthday Complete-->
<?php
$current_date = date('Y-m-d');
$criteria = new CDbCriteria;
//$criteria->select = 'academic_term_id';
$criteria->condition = 'current_sem = 1 AND academic_term_organization_id = '.Yii::app()->user->getState('org_id');
$data_arr = 0;
$semname = AcademicTerm::model()->findAll($criteria);
if($semname){
$data = CHtml::listData($semname,'academic_term_id','academic_term_id');
$data_arr = implode(',',$data);
}
$timetable_criteria = new CDbCriteria;
$timetable_criteria->condition = 'acdm_name_id in ('.$data_arr.') AND faculty_emp_id = '.Yii::app()->user->getState('emp_id').' AND lecture_date = "'.date('Y-m-d').'" order by lec';
$time_table_details = TimeTableDetail::model()->findAll($timetable_criteria);

if($time_table_details) {
?>
<div class="box">

<div class="box-header">
<h1>Your Timetable</h1>
</div>
<div class="box-content">
	<?php
		$timetable = TimeTable::model()->findByPk($time_table_details[0]->timetable_id);

		$time1 = date('H:i A',strtotime($timetable['clg_start_time']));

	   	if($timetable->zero_lec==1)
 protected function renderContent()
 {
     $current_date = date('Y-m-d');
     if (Yii::app()->user->getState('stud_id')) {
         $criteria = new CDbCriteria();
         //$criteria->select = 'academic_term_id'; // select fields which you want in output
         $criteria->condition = 'current_sem = 1 AND academic_term_organization_id = ' . Yii::app()->user->getState('org_id');
         $semname = AcademicTerm::model()->findAll($criteria);
         $data = CHtml::listData($semname, 'academic_term_id', 'academic_term_id');
         $stud_model = StudentTransaction::model()->findByPk(Yii::app()->user->getState('stud_id'));
         $check_sem = in_array($stud_model->student_academic_term_name_id, $data);
         $timetableid = 0;
         if (!$check_sem) {
             echo "<h3 align=center style=color:red>Sorry, No timetable available for this student.</h3>";
         } else {
             $check_timetable = TimeTableDetail::model()->findAllByAttributes(array('acdm_name_id' => $stud_model->student_academic_term_name_id, 'division_id' => $stud_model->student_transaction_division_id, 'lecture_date' => $current_date), 'proxy_status <> :status', array(':status' => 1));
             if (empty($check_timetable)) {
                 echo "<h3 align=center style=color:red>Sorry, No timetable available for this student.</h3>";
             } else {
                 $timetable = TimeTable::model()->findByPk($check_timetable[0]->timetable_id);
                 $time1 = date('H:i A', strtotime($timetable['clg_start_time']));
                 if ($timetable->zero_lec == 1) {
                     $time[] = $time1;
                 } else {
                     $time[1] = $time1;
                 }
                 $lec_dur = LecDuration::model()->findAll(array('condition' => 'timetable_id=' . $timetable['timetable_id']));
                 foreach ($lec_dur as $list) {
                     $break = NoOfBreakTable::model()->findByAttributes(array('after_lec_break' => $list['lecture'], 'timetable_id' => $timetable['timetable_id']));
                     if ($break) {
                         $dur1 = date('i', strtotime($break['duration']));
                         $timestamp = strtotime($time1) + 60 * $dur1;
                         $time1 = date('g:i A', $timestamp);
                         $timestamp = strtotime($time1) + 60 * $list['duration'];
                         $time1 = date('g:i A', $timestamp);
                         $time[] = $time1;
                     } else {
                         $timestamp = strtotime($time1) + 60 * $list['duration'];
                         $time1 = date('g:i A', $timestamp);
                         $time[] = $time1;
                     }
                 }
                 print '<table id="time-table-struc" style="font-size:10px;">';
                 print '<tr>';
                 print '<th>Lecture No.</th>';
                 print '<th>Subject</th>';
                 print '<th>Faculty Name</th>';
                 print '<th>Room No.</th>';
                 print '<th>Time</th>';
                 foreach ($check_timetable as $list) {
                     if ($list->subject_type != 1 && $list->batch_id != $stud_model->student_transaction_batch_id) {
                         continue;
                     }
                     print '<tr>';
                     print '<td>' . $list->lec . '</td>';
                     print '<td>' . SubjectMaster::model()->findByPk($list->subject_id)->subject_master_alias . '</td>';
                     print '<td>' . EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id' => $list->faculty_emp_id))->employee_first_name . '</td>';
                     print '<td>' . RoomDetailsMaster::model()->findByPk($list->room_id)->room_name . '</td>';
                     print '<td>' . $time[$list->lec] . '</td></tr>';
                 }
                 print '</table>';
             }
         }
     } else {
         if (Yii::app()->user->getState('emp_id')) {
             $criteria = new CDbCriteria();
             //$criteria->select = 'academic_term_id';
             $criteria->condition = 'current_sem = 1 AND academic_term_organization_id = ' . Yii::app()->user->getState('org_id');
             $semname = AcademicTerm::model()->findAll($criteria);
             $data = CHtml::listData($semname, 'academic_term_id', 'academic_term_id');
             $data_arr = implode(',', $data);
             $timetable_criteria = new CDbCriteria();
             $timetable_criteria->condition = 'acdm_name_id in (' . $data_arr . ') AND faculty_emp_id = ' . Yii::app()->user->getState('emp_id') . ' AND lecture_date = "' . date('Y-m-d') . '"';
             $time_table_details = TimeTableDetail::model()->findAll($timetable_criteria);
             if ($time_table_details) {
                 $timetable = TimeTable::model()->findByPk($time_table_details[0]->timetable_id);
                 $time1 = date('H:i A', strtotime($timetable['clg_start_time']));
                 if ($timetable->zero_lec == 1) {
                     $time[] = $time1;
                 } else {
                     $time[1] = $time1;
                 }
                 $lec_dur = LecDuration::model()->findAll(array('condition' => 'timetable_id=' . $timetable['timetable_id']));
                 foreach ($lec_dur as $list) {
                     $break = NoOfBreakTable::model()->findByAttributes(array('after_lec_break' => $list['lecture'], 'timetable_id' => $timetable['timetable_id']));
                     if ($break) {
                         $dur1 = date('i', strtotime($break['duration']));
                         $timestamp = strtotime($time1) + 60 * $dur1;
                         $time1 = date('g:i A', $timestamp);
                         $timestamp = strtotime($time1) + 60 * $list['duration'];
                         $time1 = date('g:i A', $timestamp);
                         $time[] = $time1;
                     } else {
                         $timestamp = strtotime($time1) + 60 * $list['duration'];
                         $time1 = date('g:i A', $timestamp);
                         $time[] = $time1;
                     }
                 }
                 print '<table id="time-table-struc" style="font-size:10px;">';
                 print '<tr>';
                 print '<th>Lecture No.</th>';
                 print '<th>Branch</th>';
                 print '<th>Sem</th>';
                 print '<th>Division</th>';
                 print '<th>Subject</th>';
                 print '<th>Room No.</th>';
                 print '<th>Time</th>';
                 foreach ($time_table_details as $list) {
                     print '<tr>';
                     print '<td>' . $list->lec . '</td>';
                     print '<td>' . Branch::model()->findByPk($list->branch_id)->branch_name . '</td>';
                     print '<td>' . AcademicTerm::model()->findByPk($list->acdm_name_id)->academic_term_name . '</td>';
                     print '<td>' . Division::model()->findByPk($list->division_id)->division_code . '</td>';
                     print '<td>' . SubjectMaster::model()->findByPk($list->subject_id)->subject_master_alias . '</td>';
                     print '<td>' . RoomDetailsMaster::model()->findByPk($list->room_id)->room_name . '</td>';
                     print '<td>' . $time[$list->lec] . '</td></tr>';
                 }
                 print '</table>';
             } else {
                 echo "<h3 align=center style=color:red>Sorry, No timetable available.</h3>";
             }
         }
     }
 }
Ejemplo n.º 7
0
<th>Date</th>
</tr>
<?php
      $proxy_data=TimeTableDetail::model()->findAllByAttributes(
	array(),
	$condition  = 'timetable_id = :timetable_id and division_id = :div_id and lecture_date >= :start and lecture_date< :end and proxy_status = :proxy order by lec',
		$params = array(
			':timetable_id' => $timetableid,
			':div_id'=>$stud_model->student_transaction_division_id,
			':start'=>date('Y-m-d',strtotime($alldate[0])),
			':end'=>date('Y-m-d',strtotime($alldate[5])),
			':proxy'=>1,
			));
	$n = 0; 
   foreach($proxy_data as $list) {
	$result = TimeTableDetail::model()->findByPk($list->proxy_id);
?>

<tr>
<td><?php echo ++$n; ?></td>
<td><?php echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id'=>$list->faculty_emp_id))->employee_first_name; ?></td>
<td><?php echo EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id'=>$result->faculty_emp_id))->employee_first_name; ?></td>
<td><?php echo SubjectMaster::model()->findByPk($result->subject_id)->subject_master_alias; ?></td>
<td><?php echo $result->lec; ?></td>
<td><?php echo date('d-m-Y',strtotime($result->lecture_date)); ?></td>
</tr>
<?php } ?>
</table></div>
<?php
	}
Ejemplo n.º 8
0
	public function actionAttendencedivisionreport() //changes done by janvi.
    	{
        $model = new Attendence;
        $model->scenario = 'attendencedivisionreport';
        $this->performAjaxValidation($model);
        $month = null;       
        $student=array();
        $subject_data=array();
        $sid=array();
        $subject=0;
        $subjectid=array();
        $deleivered_topic=array();	
		if(isset($_POST['Attendence'])|| isset($_REQUEST['branch_id']))
		{
		    $query=null;      
		    $timetable_query=null;	     
		    if(!empty($_REQUEST['branch_id']))
		    {
		        $branch = $_REQUEST['branch_id'];
		        $query .="branch_id=".$branch. " AND ";
			$timetable_query.="branch_id=".$branch. " AND ";
		    }
		    else
		    {
		        $branch =$_POST['Attendence']['branch_id'];
		        $query .="branch_id=".$branch. " AND ";
			$timetable_query.="branch_id=".$branch. " AND ";
		    }
		    if(!empty($_REQUEST['sem_id']))
		    {
		        $sem = $_REQUEST['sem_id'];
		        $query .="sem_name_id=".$sem. " AND ";
			$timetable_query.="acdm_name_id=".$sem. " AND ";
		    }
		    else
		    {
		        $sem =$_POST['Attendence']['sem_name_id'];
		        $query .="sem_name_id=".$sem." AND ";
			$timetable_query.="acdm_name_id=".$sem. " AND ";
		    }
		    if(!empty($_REQUEST['div_id']))   
		    {
		        $div=$_REQUEST['div_id'];
		        $query .="div_id=".$div;
			$timetable_query.="division_id=".$div. " AND ";
		    }
		    if(!empty($_POST['Attendence']['div_id']))
		    {
		        $div=$_POST['Attendence']['div_id'];
		        $query .="div_id=".$div;
			$timetable_query.="division_id=".$div. " AND ";
		    }           
		 if(!empty($_POST['months']) && !empty($_POST['subject']) || !empty($_REQUEST['month']) && !empty($_REQUEST['subject']) )
		{
		    if(!empty($_REQUEST['month']))
		    {
		        $month=$_REQUEST['month'];
		        $subject=$_REQUEST['subject'];
			$timetable_query.="subject_id=".$subject." AND ";			
		    }
		    else
		    {
		        $month = $_POST['months'];			
		        $subject=$_POST['subject'];
			$timetable_query.="subject_id=".$subject." AND ";
		    }       
		
    //query for display list of regular student attendence( not to display detain/left student)

            $student=Attendence::model()->findAll(array(
		'select'=>'st_id','distinct'=>true,
	        'condition'=>$query));    
	    $timetabledetail=TimeTableDetail::model()->findAll(array('select'=>'lecture_date,actual_topic,lect_hour','condition'=>$timetable_query.' month(lecture_date)='.$month,'order' => 'lecture_date ASC'));
		 
		    $timetable=array();
		    foreach($timetabledetail as $t)
		    {
			if($t['actual_topic']!='')	
                          $deleivered_topic[$t['lecture_date']]=$t['actual_topic'];
		    }	
       
            foreach($student as $s )
            {                       
            //student name
                $data3 =Attendence::model()->findAll(array('condition'=>'st_id='.$s['st_id']));
                $stud_name=StudentInfo::model()->findByPk($s['st_id']);
                $sid[]=$s['st_id'];                           
            }
        }
            if(isset($_REQUEST['pdf']))
            {
                Yii::import('application.extensions.tcpdf.*');
                require_once('tcpdf/tcpdf.php');
                require_once('tcpdf/config/lang/eng.php');
                                       
                $html = $this->renderPartial('attendence_division_pdf', array('total'=>$total,
                                'present'=>$present,
                                'subject'=>$sub,
                                'div_id'=>$div
                                ),
                                 true);
                //$session->close();       
                //die($html);
                ob_clean();
                $pdf = new TCPDF();
                $pdf->SetCreator(PDF_CREATOR);
                $pdf->SetAuthor(Yii::app()->name);
                $pdf->SetTitle('Division Attendence Report');
                $pdf->SetSubject('Division Attendence Report');
                $pdf->SetKeywords('example, text, report');
                $pdf->SetHeaderData('', 0, "Division Attendence", '');
                //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
                $pdf->setHeaderFont(Array('helvetica', '', 8));
                $pdf->setFooterFont(Array('helvetica', '', 6));
                $pdf->SetMargins(15, 18, 15);
                $pdf->SetHeaderMargin(5);
                $pdf->SetFooterMargin(10);
                $pdf->SetAutoPageBreak(TRUE, 15);
                $pdf->SetFont('dejavusans', '', 7);
                $resolution= array(150, 150);
                $pdf->AddPage('P', $resolution);
                $pdf->writeHTML($html, true, false, true, false, '');
                $pdf->LastPage();
                $pdf->Output("attendenceDivision.pdf", "I");   
            }
            else if(isset($_REQUEST['excel']))
            {
		
                Yii::app()->request->sendFile(date('YmdHis').'.xls',
                $this->renderPartial('attendence_division_pdf', array(
                                'branch_id'=>$branch,
                                'div_id'=>$div,
                                'student_id'=>$sid,
                                'month'=>$month,
                                'selsub'=>$subject,
                                'sem'=>$sem,
				'deleivered_topic'=>$deleivered_topic,
                                ),
                                 true));
            }
            else if(isset($_REQUEST['studentpdf']))
            {
                Yii::import('application.extensions.tcpdf.*');
                require_once('tcpdf/tcpdf.php');
                require_once('tcpdf/config/lang/eng.php');   
                      
            $html = $this->renderPartial('divisionwise_student_attendance_pdfexcel', array('total'=>$total,
                                'present'=>$present,
                                'subject'=>$sub,
                                'div_id'=>$div,
                                'sub_id'=>$subject,
                                'all_data'=>$all_data,
                                'subjectid'=>$subjectid,
                                'subject_data'=>$subject_data,
                                'student_data'=>$student_data,
                                'sid'=>$sid,
               
                'start'=>$start,'end'=>$end,'month_value'=>$month,'year'=>$year
                                ),
                                 true);
                //$session->close();       
                //die($html);
                ob_clean();
                $pdf = new TCPDF();
                $pdf->SetCreator(PDF_CREATOR);
                $pdf->SetAuthor(Yii::app()->name);
                $pdf->SetTitle('Division Attendence Report');
                $pdf->SetSubject('Division Attendence Report');
                $pdf->SetKeywords('example, text, report');
                $pdf->SetHeaderData('', 0, "Division Attendence", '');
                //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
                $pdf->setHeaderFont(Array('helvetica', '', 8));
                $pdf->setFooterFont(Array('helvetica', '', 6));
                $pdf->SetMargins(15, 18, 15);
                $pdf->SetHeaderMargin(5);
                $pdf->SetFooterMargin(10);
                $pdf->SetAutoPageBreak(TRUE, 15);
                $pdf->SetFont('dejavusans', '', 7);
                $resolution= array(150, 150);
                $pdf->AddPage('P', $resolution);
                $pdf->writeHTML($html, true, false, true, false, '');
                $pdf->LastPage();
                $pdf->Output("StudentAttendance.pdf", "I");   
            }
            else if(isset($_REQUEST['studentexcel']))
            {
                Yii::app()->request->sendFile(date('YmdHis').'.xls',
                $this->renderPartial('divisionwise_student_attendance_pdfexcel', array('total'=>$total,
                                'present'=>$present,
                                'subject'=>$sub,
                                'div_id'=>$div,
                                'sub_id'=>$subject,
                                'all_data'=>$all_data,
                                'subjectid'=>$subjectid,				
                                ),
                                 true));
            }
            else
            {
		
	        $this->render('attendence_division_report_view',array(
                                'branch_id'=>$branch,
                                'div_id'=>$div,
                                'student_id'=>$sid,
                                'month'=>$month,
                                'selsub'=>$subject,
				'subjectid'=>$subjectid,
                                'sem'=>$sem,
                               'deleivered_topic'=>$deleivered_topic,       
                                ));
            }           
        }
        else
        {
            $this->render('attendence_division_report',array('model'=>$model));
        }
    }
 public function beforeDelete()
 {
     $id = $this->employee_transaction_id;
     $emp_leave = EmployeeLeaveMaster::model()->findAll(array('condition' => 'empid=' . $id));
     $att_check = Attendence::model()->findAll(array('condition' => 'employee_id=' . $id));
     $emp_att = Employee_attendence::model()->findAll(array('condition' => 'employee_id=' . $id));
     $emp_leave_app = EmployeeLeaveApplication::model()->findAll(array('condition' => 'employee_leave_application_employee_code=' . $id . ' OR employee_leave_application_approved_by_code=' . $id . ' OR employee_leave_application_approved_by_code_2=' . $id));
     $emp_rep = EmployeeReportingTable::model()->findAll(array('condition' => 'emp_reporting_table_user_id=' . $id . ' OR emp_reporting_table_reporting_level_1=' . $id . ' OR emp_reporting_table_reporting_level_2=' . $id));
     $emp_sal = EmployeeSalaryStructure::model()->findAll(array('condition' => 'employee_id=' . $id));
     $ass_sub = AssignSubject::model()->findAll(array('condition' => 'subject_faculty_id=' . $id));
     $time_table = TimeTableDetail::model()->findAll(array('condition' => 'faculty_emp_id=' . $id));
     if (!empty($emp_leave) || !empty($att_check) || !empty($emp_att) || !empty($emp_leave_app) || !empty($emp_rep) || !empty($emp_sal) || !empty($ass_sub) || !empty($time_table)) {
         Yii::app()->user->setFlash('error', "You can not delete this record because it is used in another table.");
         return false;
     } else {
         Yii::app()->user->setFlash('success', "Deleted Sucessfully");
         return true;
     }
 }