/**
  * 
  * @return Division[]
  */
 public function getDivList()
 {
     if ($this->_divList === FALSE) {
         if (($rec = $this->getRec()) != NULL) {
             $this->_divList = Division::model()->findAllByRecId($rec->id);
         } else {
             // FIXME null ??
             $this->_divList = array();
         }
     }
     return $this->_divList;
 }
 public function actionDivision()
 {
     $divisions = Division::model()->findAllByRecId($this->rec->id);
     if (!O::app()->user->isGuest) {
         $userId = O::app()->user->id;
         $model = new DivisionChoiceForm('', $this->rec, $divisions);
         if (isset($_POST['DivisionChoiceForm'])) {
             $model->attributes = $_POST['DivisionChoiceForm'];
             if ($model->validate() && $model->save($userId)) {
                 //if ($this->isWizard) $this->redirect($this->getURL('form', array('wiz' => 1)));
                 if ($this->afterSave('form')) {
                     return;
                 }
                 //return;
             }
         } else {
             $model->setUserId($userId);
         }
         $this->render('division', array('divisions' => $divisions, 'model' => $model));
     } else {
         $this->render('division', array('divisions' => $divisions));
     }
 }
Example #3
0
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'div');
?>
	</div>

	<!--<div class="row">
		<?php 
echo $form->labelEx($model, 'batch');
?>
		<?php 
echo $form->dropDownList($model, 'batch', Batch::items(), array('empty' => '---------------Select-------------', 'tabindex' => 7));
?>
		<!--<?php 
if (isset($model->batch)) {
    echo $form->dropDownList($model, 'batch', CHtml::listData(Division::model()->findAll(array('condition' => 'batch_id=' . $model->batch)), 'batch_id', 'batch_name'));
} else {
    echo $form->dropDownList($model, 'batch', array('prompt' => '---------------Select-------------'), array('tabindex' => 3));
}
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'batch');
?>
    	</div>-->
	
	<div class="row">
		<?php 
echo $form->labelEx($model, 'subject');
?>
		<?php 
				
		                }')));
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'student_transaction_branch_id');
?>
	</div>
	
	<div class="row-right">
		<?php 
echo $form->labelEx($model, 'student_transaction_division_id');
?>
		<?php 
if (isset($model->student_transaction_division_id)) {
    echo $form->dropDownList($model, 'student_transaction_division_id', CHtml::listData(Division::model()->findAll(array('condition' => 'academic_name_id=' . $model->student_academic_term_name_id . ' and branch_id=' . $model->student_transaction_branch_id . ' and division_organization_id=' . $org_id)), 'division_id', 'division_code'), array('prompt' => '-----------Select-----------', 'tabindex' => 12, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/getStudbatch'), 'update' => '#StudentTransaction_student_transaction_batch_id')));
} else {
    echo $form->dropDownList($model, 'student_transaction_division_id', array(), array('prompt' => '-----------Select-----------', 'tabindex' => 12, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/getStudbatch'), 'update' => '#StudentTransaction_student_transaction_batch_id')));
}
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'student_transaction_division_id');
?>
	</div>

 </div>
 <div class="row">
	<div class="row-left">
        <?php 
echo $form->labelEx($model, 'student_transaction_batch_id');
 public function actiongetelectivedivision()
 {
     $subject_id = $_REQUEST['ElectiveSubjectDetails']['elective_subject_id'];
     $subject_branch = SubjectMaster::model()->findByAttributes(array('subject_master_id' => $subject_id));
     $org_id = Yii::app()->user->getState('org_id');
     $data = array();
     $data = Division::model()->findAll(array('condition' => 'division_organization_id=' . $org_id . ' and branch_id=' . $subject_branch['subject_master_branch_id'] . ' and academic_name_id=' . $subject_branch['subject_master_academic_terms_name_id']));
     $data = CHtml::listData($data, 'division_id', 'division_code');
     echo "<option value=''>Select Division</option>";
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
    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>";
                }
            }
        }
    }
<?php

$this->breadcrumbs = array('Division Report');
?>


<?php 
echo CHtml::link('GO BACK', Yii::app()->createUrl('/student/attendence/attendencedivisionreport'));
$m = 1;
if ($subject) {
    $this->menu[] = array('label' => '', 'url' => array('attendencedivisionreport', 'pdf' => 'pdf', 'div_id' => $div_id), 'linkOptions' => array('class' => 'export-pdf', 'title' => 'Export to PDF', 'target' => '_blank'));
    $this->menu[] = array('label' => '', 'url' => array('attendencedivisionreport', 'excel' => 'excel', 'div_id' => $div_id), 'linkOptions' => array('class' => 'export-excel', 'title' => 'Export to Excel', 'target' => '_blank'));
    $div_model = Division::model()->findByPk($div_id);
    $acd_model = AcademicTerm::model()->findByPk($div_model->academic_name_id);
    ?>
<table  border="2px" id="twoColThinTable">
<tr class="row">	
	<td class="col1">Division </td> 
	<td class="col2"><?php 
    echo $div_model->division_code;
    ?>
</td>
</tr>	
<tr class="row">
	<td class="col1">Semester </td> 
	<td class="col2"> <?php 
    echo $acd_model->academic_term_name;
    ?>
</td>
</tr>
	<tr class="row">	
 public function actionShowstudentview()
 {
     $model = new Attendence();
     $count = 0;
     $row1 = array();
     $div = Division::model()->findByPk($_REQUEST['division_id']);
     $branch_id = $div->branch_id;
     $period_no = $_REQUEST['lec_no'];
     $sub_id = $_REQUEST['subject_id'];
     $sem_id = $div->academic_period_id;
     $date = date('Y-m-d', strtotime($_REQUEST['date']));
     $sem_name = $div->academic_name_id;
     $shift_id = 1;
     $div_id = $_REQUEST['division_id'];
     $subject_type = SubjectMaster::model()->findByPk($sub_id)->subject_master_type_id;
     $subject_type_name = SubjectType::model()->findByPk($subject_type)->subject_type_name;
     if ($subject_type_name == 'Elective') {
         $row1 = Yii::app()->db->createCommand()->select('student_transaction_id,student_transaction_student_id, student_enroll_no,student_first_name')->from('student_transaction st')->join('student_info', 'student_info_transaction_id=student_transaction_id')->join('elective_subject_details esd', 'esd.elective_subject_student_id =st.student_transaction_student_id')->where('st.student_transaction_division_id=' . $div_id . ' and esd.elective_subject_sem_id=' . $sem_name . ' and esd.elective_subject_id=' . $sub_id . ' order by student_enroll_no')->queryAll();
         $all_array = array('branch_id' => $branch_id, 'period_no' => $period_no, 'shift_id' => $shift_id, 'faculty_id' => $_REQUEST['faculty_id'], 'div_id' => $div_id, 'sub_id' => $sub_id, 'sem_id' => $sem_id, 'date' => $date, 'sem_name' => $sem_name);
     } else {
         if ($_REQUEST['batch'] != 0) {
             $batch_id = $_REQUEST['batch'];
             $row1 = Yii::app()->db->createCommand()->select('student_transaction_id,student_transaction_student_id, student_enroll_no,student_first_name')->from('student_transaction')->join('student_info', 'student_info_transaction_id=student_transaction_id')->where('student_transaction_branch_id=' . $branch_id . ' and student_transaction_division_id=' . $div_id . ' and student_transaction_batch_id=' . $batch_id . ' and student_academic_term_name_id=' . $sem_name . ' and student_academic_term_period_tran_id =' . $sem_id . ' and student_transaction_detain_student_flag <> 2 order by student_enroll_no')->queryAll();
             $all_array = array('branch_id' => $branch_id, 'period_no' => $period_no, 'shift_id' => $shift_id, 'faculty_id' => $_REQUEST['faculty_id'], 'div_id' => $div_id, 'batch_id' => $batch_id, 'sub_id' => $sub_id, 'sem_id' => $sem_id, 'date' => $date, 'sem_name' => $sem_name);
         } else {
             $row1 = Yii::app()->db->createCommand()->select('student_transaction_id,student_transaction_student_id, student_enroll_no,student_first_name')->from('student_transaction')->join('student_info', 'student_info_transaction_id=student_transaction_id')->where('student_transaction_branch_id=' . $branch_id . ' and student_transaction_division_id=' . $div_id . ' and student_academic_term_name_id=' . $sem_name . ' and student_academic_term_period_tran_id =' . $sem_id . ' and student_transaction_detain_student_flag <> 2 order by student_enroll_no')->queryAll();
             $all_array = array('branch_id' => $branch_id, 'shift_id' => $shift_id, 'div_id' => $div_id, 'batch_id' => "", 'sub_id' => $sub_id, 'sem_id' => $sem_id, 'date' => $date, 'sem_name' => $sem_name, 'period_no' => $period_no, 'faculty_id' => $_REQUEST['faculty_id']);
         }
     }
     if ($date > date('Y-m-d') || $date < date('Y-m-d', strtotime('-1 days'))) {
         echo "you can not take attendance of before date of yesterday or future date!";
         exit;
     }
     if ($_REQUEST['batch'] != 0) {
         $check = Attendence::model()->findByAttributes(array('employee_id' => $_REQUEST['faculty_id'], 'batch_id' => $_REQUEST['batch'], 'attendence_date' => $date, 'div_id' => $div_id, 'attendence_organization_id' => Yii::app()->user->getState('org_id')));
     } else {
         $check = Attendence::model()->findByAttributes(array('student_attendence_period_id' => $period_no, 'attendence_date' => $date, 'div_id' => $div_id, 'attendence_organization_id' => Yii::app()->user->getState('org_id')));
     }
     if ($check) {
         echo "you can not take attendance more than one time.!";
         exit;
     }
     $count = count($row1);
     if ($count == 0) {
         Yii::app()->user->setFlash('not-select-attendece', "No Student Found for this Criteria");
     }
     Yii::app()->user->setState('stud_array', $row1);
     Yii::app()->user->setState('all_array', $all_array);
     if (isset($_POST['save'])) {
         $model->employee_id = $all_array['faculty_id'];
         $model->branch_id = $all_array['branch_id'];
         $model->shift_id = $all_array['shift_id'];
         $model->div_id = $all_array['div_id'];
         $model->batch_id = $all_array['batch_id'];
         $model->sub_id = $all_array['sub_id'];
         $model->sem_id = $all_array['sem_id'];
         $model->sem_name_id = $all_array['sem_name'];
         $model->attendence_date = $all_array['date'];
         $model->student_attendence_period_id = $all_array['period_no'];
         $model->attendence_organization_id = Yii::app()->user->getState('org_id');
         foreach ($_POST['Attendence']['st_id'] as $index => $student_id) {
             $model->setIsNewRecord(true);
             $model->attendence = 'A';
             if ($student_id != 0) {
                 $model->attendence = 'P';
             }
             $model->st_id = $index;
             $model->id = null;
             $model->save();
         }
         $this->redirect(array('admin'));
     }
     $this->render('show_student_view', array('model' => $model, 'row1' => $row1));
 }
<?php

if ($subject) {
    $key = array_search($_REQUEST['sb_id'], $subjectid);
    echo "<h4>Subject Name:-" . $subject[$key] . "</h4>";
    echo "<h4>Division :-" . Division::model()->findByPk($_REQUEST['div_id'])->division_code . "</h4>";
    $t = -1;
    $m = 0;
    $sel_month = $_REQUEST['month'];
    if (!empty($_REQUEST['sb_id']) && $_REQUEST['sb_id'] != '') {
        echo '<table class="table_data" >';
        foreach ($all_data as $list) {
            if ($t % 2 == 0) {
                $class = "odd";
            } else {
                $class = "even";
            }
            if ($t == -1) {
                echo '<tr class="table_header"><th>Sr No.</th><th>En.No.</th><th>Name</th>';
                echo '<th>Total</th><th>Present</th><th>%</th>';
                echo '</tr>';
                ++$t;
            }
            $tcon = count(Attendence::model()->findAll(array('condition' => 'sub_id=' . $_REQUEST['sb_id'] . ' and st_id=' . $list['st_id'] . ' and month(attendence_date) in(' . $sel_month . ')')));
            $pcon = count(Attendence::model()->findAll(array('condition' => 'sub_id=' . $_REQUEST['sb_id'] . ' and st_id=' . $list['st_id'] . ' and attendence="P" and month(attendence_date) in(' . $sel_month . ')')));
            $perc = 0;
            if ($pcon > 0) {
                $perc = (double) ($pcon * 100 / $tcon);
                $perc = round($perc, 2);
            }
            $stud_model = StudentInfo::model()->findByAttributes(array('student_info_transaction_id' => $list['st_id']));
	<?php echo CHtml::button('Submit',  array('submit' => array('studentTransaction/studentMultipleDivisionAssign'), 'class'=>'submit')); ?>
	</div>
</div>
<?php $this->endWidget(); ?>
</fieldset>
<?php $div = new Division; $batch = new Batch; ?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'division-form',
	'htmlOptions'=>array('enctype'=>'multipart/form-data'),
)); ?>
	<fieldset style="min-width: 360px ! important; width: 425px; border: 1px solid rgb(204, 204, 204); border-radius: 5px 5px 5px 5px;padding: 15px;"> <legend>Assign Division & Batch</legend>
	<div class="row">	
		<?php echo $form->labelEx($div,'division_name'); ?>
		<?php if(!empty($_REQUEST['StudentTransaction']['student_transaction_branch_id']) && !empty($_REQUEST['StudentTransaction']['student_academic_term_name_id'])) { ?>
		<?php echo $form->dropDownList($div,'division_name', CHtml::listData(Division::model()->findAll('branch_id ='.$_REQUEST['StudentTransaction']['student_transaction_branch_id'].' AND academic_name_id ='.$_REQUEST['StudentTransaction']['student_academic_term_name_id']),'division_id','division_code'), array('tabindex'=>4,
					'prompt' => 'Select Division',
					'ajax' => array(
					'type'=>'POST', 
					'url'=>CController::createUrl('dependent/getAssignBatch'), 
					'update'=>'#Batch_batch_name'
					))); ?><span class="status">&nbsp;</span>
		<?php }
		else { ?>
		<?php echo $form->dropDownList($div,'division_name', array(), array('empty'=>'Select Division')); }?><span class="status">&nbsp;</span> 
		<?php echo $form->error($div,'division_name'); ?>		
	 </div>
	<div class="row">
		<?php echo $form->labelEx($batch,'batch_name'); ?>
		<?php echo $form->dropDownList($batch,'batch_name', array(), array('empty' => 'Select Batch','tabindex'=>4)); ?><span class="status">&nbsp;</span>
		<?php echo $form->error($batch,'batch_name'); ?>		
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['Batch'])) {
         $model->attributes = $_POST['Batch'];
         $model->batch_code = '';
         $batchname = $model->batch_name;
         $branch_code = Branch::model()->findByPk($model->branch_id)->branch_alias;
         $division_name = Division::model()->findByPk($model->div_id)->division_name;
         $acdm_name = AcademicTerm::model()->findByPk($model->academic_name_id)->academic_term_name;
         $concatdivname = $batchname . '-' . $branch_code . '-' . $acdm_name . '-' . $division_name;
         $model->batch_code = $concatdivname;
         if ($model->save()) {
             $this->redirect(array('admin'));
         }
         //$this->redirect(array('view','id'=>$model->batch_id));
     }
     $this->render('update', array('model' => $model));
 }
 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>";
             }
         }
     }
 }
					else if($s=='division_code')
						$label = "<b id=\"label_info\">Division Name :</b>";
					else
						$label = CHtml::activeLabel($student_info,$s)." :"; 
									
					echo $label;
				?>
			    </span>
			    <span>
				<?php //echo $name->$s;
					if($s=='quota_name')
						$field_value = Quota::model()->findByPk($info['student_transaction_quota_id'])->quota_name;
					else if($s=='branch_name')
						$field_value = Branch::model()->findByPk($info['student_transaction_branch_id'])->branch_name;
					else if($s=='division_code')
						$field_value = Division::model()->findByPk($info['student_transaction_division_id'])->$s;
					else if($s=='sem')
						$field_value = AcademicTerm::model()->findByPk($info['student_academic_term_name_id'])->academic_term_name;
					else if($s=='student_address_c_line1')
					{	$field_value = StudentAddress::model()->findByPk($info['student_transaction_student_address_id'])->student_address_c_line1." ".StudentAddress::model()->findByPk($info['student_transaction_student_address_id'])->student_address_c_line2;
					}
					else if($s=='student_address_p_line1')
					{	$field_value = StudentAddress::model()->findByPk($info['student_transaction_student_address_id'])->student_address_p_line1." ".StudentAddress::model()->findByPk($info['student_transaction_student_address_id'])->student_address_p_line2;
					}
					else if($s=='category_name')
						$field_value = Category::model()->findByPk($info['student_transaction_category_id'])->category_name;
					else if($s=='city')
						$field_value = City::model()->findByPk(StudentAddress::model()->findByPk($info['student_transaction_student_address_id'])->student_address_c_city)->city_name;
					else	
					{	$field_value = StudentInfo::model()->findByPk($info['student_transaction_student_id'])->$s;
					}
 public function actiongetSmsDivision()
 {
     $org_id = Yii::app()->user->getState('org_id');
     $data = array();
     $data = Division::model()->findAll(array('condition' => 'branch_id=' . (int) $_REQUEST['StudentSmsEmailDetails']['branch_id'] . ' and academic_name_id=' . (int) $_REQUEST['StudentSmsEmailDetails']['academic_name_id'] . ' and division_organization_id=' . $org_id));
     $data = CHtml::listData($data, 'division_id', 'division_code');
     echo "<option value=''>Select Division</option>";
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
} else {
    $Nationality = new Nationality();
}
if ($student_transaction[0]->student_transaction_quota_id != null) {
    $Quota = Quota::model()->findByPk($student_transaction[0]->student_transaction_quota_id);
} else {
    $Quota = new Quota();
}
if ($student_transaction[0]->student_transaction_religion_id != null) {
    $Religion = Religion::model()->findByPk($student_transaction[0]->student_transaction_religion_id);
} else {
    $Religion = new Religion();
}
$Branch = Branch::model()->findByPk($student_transaction[0]->student_transaction_branch_id);
$Shift = Shift::model()->findByPk($student_transaction[0]->student_transaction_shift_id);
$Division = Division::model()->findByPk($student_transaction[0]->student_transaction_division_id);
$Batch = Batch::model()->findByPk($student_transaction[0]->student_transaction_batch_id);
$Organization = Organization::model()->findByPk($student_transaction[0]->student_transaction_organization_id);
if ($student_transaction[0]->student_transaction_languages_known_id != null) {
    $LanguagesKnown = LanguagesKnown::model()->findByPk($student_transaction[0]->student_transaction_languages_known_id);
} else {
    $LanguagesKnown = new $LanguagesKnown();
}
if ($student_transaction[0]->student_transaction_languages_known_id != null) {
    $StudentAddress = StudentAddress::model()->findByPk($student_transaction[0]->student_transaction_student_address_id);
} else {
    $StudentAddress = new $StudentAddress();
}
?>
<h3>Student Detail</h3>
<h4>Personal Info</h4>
 if ($m % 2 == 0) {
     $class = "odd";
 } else {
     $class = "even";
 }
 echo "<tr class=" . $class . ">";
 echo "<td style='text-align:center;'>" . $i . "</td>";
 foreach ($selected_list as $s) {
     if ($s == 'quota_name') {
         echo "<td style='text-align:center;'>" . Quota::model()->findByPk($sd['student_transaction_quota_id'])->quota_name . "</td>";
     } else {
         if ($s == 'branch_name') {
             echo "<td style='text-align:center;'>" . Branch::model()->findByPk($sd['student_transaction_branch_id'])->branch_name . "</td>";
         } else {
             if ($s == 'division_code') {
                 echo "<td style='text-align:center;'>" . Division::model()->findByPk($sd['student_transaction_division_id'])->{$s} . "</td>";
             } else {
                 if ($s == 'sem') {
                     echo "<td style='text-align:center;'>" . AcademicTerm::model()->findByPk($sd['student_academic_term_name_id'])->academic_term_name . "</td>";
                 } else {
                     if ($s == 'student_address_c_line1') {
                         if ($sd['student_transaction_student_address_id'] != 0) {
                             echo "<td style='text-align:center;min-width:400px;'>" . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_c_line1 . " " . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_c_line2 . "</td>";
                         } else {
                             echo "<td style='text-align:center;'>&nbsp;</td>";
                         }
                     } else {
                         if ($s == 'student_address_p_line1') {
                             if ($sd['student_transaction_student_address_id'] != 0) {
                                 echo "<td style='text-align:center; min-width:400px;'>" . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_p_line1 . " " . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_p_line2 . "</td>";
                             } else {
<?php

$this->breadcrumbs = array('Attendance');
?>
<table  border="2px" id="twoColThinTable">
<tr class="row">
	<td class="col1">Division </td>
	<td class="col2"><?php 
echo Division::model()->findByPk($_REQUEST['division_id'])->division_code;
?>
</td>
</tr>
<tr class="row">
	<td class="col1">Batch</td> 
	<td class="col2"> <?php 
if ($_REQUEST['batch'] != 0) {
    echo Batch::model()->findByPk($_REQUEST['batch'])->batch_code;
}
?>
</td>
</tr>
<tr class="row">
	<td class="col1">Subject </td> 
	<td class="col2"> <?php 
echo SubjectMaster::model()->findByPk($_REQUEST['subject_id'])->subject_master_name;
?>
</td>
</tr>	
<tr class="row">
	<td class="col1">Date </td> 
	<td class="col2"> <?php 
	<div class="rowv">
		<?php 
echo '<lable><b>Division :</b></lable>';
?>
		<div class="rown">
			<?php 
//if(isset($model->Rel_Division->division_name)) echo $model->Rel_Division->division_name .'<br>';
//else echo "N/A";
?>
				<?php 
$divisionid = StudentTransaction::model()->findByPk($model->student_archive_stud_tran_id)->student_transaction_division_id;
?>
				<?php 
if (isset($divisionid)) {
    echo Division::model()->findByPk($divisionid)->division_name;
} else {
    echo "N/A";
}
?>
		
			
		</div>
	</div>
</div>

<div class = "row_all_vm">
	<div class="rowv">
		<?php 
echo '<lable><b>Batch :</b></lable>';
?>
 public function actiongetStudDivision()
 {
     $org_id = Yii::app()->user->getState('org_id');
     $div = array();
     $sub = array();
     $bat = array();
     $data = array();
     $data1 = array();
     $data2 = array();
     $data3 = array();
     // for update division
     $data = Division::model()->findAll(array('condition' => 'branch_id=' . (int) $_REQUEST['StudentTransaction']['student_transaction_branch_id'] . ' and academic_name_id=' . (int) $_REQUEST['StudentTransaction']['student_academic_term_name_id'] . ' and division_organization_id=' . $org_id));
     foreach ($data as $d1) {
         $data2 = Batch::model()->findAll(array('condition' => 'div_id=' . $d1['division_id']));
         break;
     }
     $data2 = CHtml::listData($data2, 'batch_id', 'batch_code');
     foreach ($data2 as $value2 => $name2) {
         $bat .= CHtml::tag('option', array('value' => $value2), CHtml::encode($name2), true);
     }
     $data3 = CHtml::listData($data, 'division_id', 'division_code');
     foreach ($data3 as $value => $name) {
         $div .= CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
     echo CJSON::encode(array('div' => $div, 'bat' => $bat));
 }
		    }
		   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>';
?>
</div>
</div>
<?php
}
?>
<!-- End  timetable-->
<!-- Start Attendance Chart -->
<?php
 if ($m % 2 == 0) {
     $class = "odd";
 } else {
     $class = "even";
 }
 echo "<tr class=" . $class . ">";
 echo "<td>" . $i . "</td>";
 foreach ($selected_list as $s) {
     if ($s == 'quota_name') {
         echo "<td>" . Quota::model()->findByPk($sd['student_transaction_quota_id'])->quota_name . "</td>";
     } else {
         if ($s == 'branch_name') {
             echo "<td>" . Branch::model()->findByPk($sd['student_transaction_branch_id'])->branch_name . "</td>";
         } else {
             if ($s == 'division_code') {
                 echo "<td>" . Division::model()->findByPk($sd['student_transaction_division_id'])->{$s} . "</td>";
             } else {
                 if ($s == 'sem') {
                     echo "<td>" . AcademicTerm::model()->findByPk($sd['student_academic_term_name_id'])->academic_term_name . "</td>";
                 } else {
                     if ($s == 'student_address_c_line1') {
                         echo "<td>" . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_c_line1 . " " . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_c_line2 . "</td>";
                     } else {
                         if ($s == 'student_address_p_line1') {
                             echo "<td>" . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_p_line1 . " " . StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_p_line2 . "</td>";
                         } else {
                             if ($s == 'category_name') {
                                 echo "<td>" . Category::model()->findByPk($sd['student_transaction_category_id'])->category_name . "</td>";
                             } else {
                                 if ($s == 'city') {
                                     echo "<td>" . City::model()->findByPk(StudentAddress::model()->findByPk($sd['student_transaction_student_address_id'])->student_address_c_city)->city_name . "</td>";
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'branch_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'div_id');
?>
		<?php 
//echo $form->dropDownList($model,'div_id',Division::items(), array('empty' => '---------------Select-------------','tabindex'=>5));
?>
		<?php 
if (isset($model->div_id)) {
    echo $form->dropDownList($model, 'div_id', CHtml::listData(Division::model()->findAll(array('condition' => 'branch_id=' . $model->branch_id . ' and division_organization_id=' . $org_id)), 'division_id', 'division_code'));
} else {
    //echo $form->dropDownList($model,'div_id',array(),array('prompt' => '---------------Select-------------','tabindex'=>5));
    echo $form->dropDownList($model, 'div_id', array(), array('prompt' => 'Select Division', 'tabindex' => 5, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/getAttendenceBatch'), 'update' => '#Attendence_batch')));
}
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'div_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'sub_id');
?>
<th>Receipt No</th>
<th>Amount</th>
</tr>


<?php 
    foreach ($var as $list) {
        $stud_data = StudentTransaction::model()->findByPk($list['fees_student_id']);
        echo '<tr><td>' . $i . '</td>';
        echo '<td>' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_enroll_no . '</td>';
        echo '<td>' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_roll_no . '</td>';
        echo '<td>' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_first_name . ' ' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_middle_name . ' ' . StudentInfo::model()->findByPk($stud_data->student_transaction_student_id)->student_last_name . '</td>';
        echo '<td>' . Branch::model()->findByPk($stud_data->student_transaction_branch_id)->branch_name . '</td>';
        echo '<td>' . AcademicTerm::model()->findByPk($stud_data->student_academic_term_name_id)->academic_term_name . '</td>';
        echo '<td>' . AcademicTermPeriod::model()->findByPk($stud_data->student_academic_term_period_tran_id)->academic_term_period . '</td>';
        echo '<td>' . Division::model()->findByPk($stud_data->student_transaction_division_id)->division_name . '</td>';
        echo '<td>' . $list['fees_received_date'] . '</td>';
        $rec_no = FeesReceipt::model()->findByPk($list['fees_receipt_id'])->fees_receipt_number;
        if ($list['fees_payment_method_id'] == '1') {
            $cash_id = $list['fees_payment_cash_cheque_id'];
            $amunt = FeesPaymentCash::model()->findByPk($cash_id)->fees_payment_cash_amount;
            $final_total += $amunt;
            $type = "Cash";
            echo '<td>' . $type . '</td>';
            echo '<td>-</td>';
            echo '<td>-</td>';
            echo '<td>' . $rec_no . '</td>';
            echo '<td>' . $amunt . '</td>';
        } else {
            $cheque_id = $list['fees_payment_cash_cheque_id'];
            $cheque_status = "Return cheque";
            ?>
		</td>
		<td>
			<?php 
            echo $v['batch_code'];
            ?>
		</td>	
		<td>
			<?php 
            echo Branch::model()->findByPk($v['branch_id'])->branch_name;
            ?>
	
		</td>
		<td>
			<?php 
            echo Division::model()->findByPk($v['div_id'])->division_code;
            ?>
		</td>	
		<td>
		      <?php 
            echo User::model()->findBypk($v['batch_created_by'])->user_organization_email_id;
            ?>
	
		</td>
		<td>
		      <?php 
            echo Organization::model()->findBypk($v['batch_organization_id'])->organization_name;
            ?>
	
		</td>	
		
Example #25
0
			<?php 
        echo CHtml::image(Yii::app()->baseUrl . "/college_data/stud_images/" . $studphoto, "no-images", array("width" => "60px", "height" => "60px"));
        ?>
		</div>
		<div class="contentinfo">
		
		<?php 
        foreach ($selected_list as $key => $value) {
            if ($key == 'quota_name') {
                $field_value = Quota::model()->findByPk($stud['student_transaction_quota_id'])->quota_name;
            } else {
                if ($key == 'branch_name') {
                    $field_value = Branch::model()->findByPk($stud['student_transaction_branch_id'])->branch_name;
                } else {
                    if ($key == 'division_code') {
                        $field_value = Division::model()->findByPk($stud['student_transaction_division_id'])->{$key};
                    } else {
                        if ($key == 'sem') {
                            $field_value = AcademicTerm::model()->findByPk($stud['student_academic_term_name_id'])->academic_term_name;
                        } else {
                            if ($key == 'student_first_name') {
                                $lname = $StudentInfo->student_last_name;
                                $fname = $StudentInfo->student_first_name;
                                $mname = $StudentInfo->student_middle_name;
                                $label = $value;
                                $field_value = $lname . " " . $fname . " " . $mname;
                            } else {
                                $field_value = $stud[$key];
                            }
                        }
                    }
			var d = d+"&sb_id="+urlParams['sb_id'];	
			}
			if(urlParams['less'] !=="undefined") {
			var d = d+"&less="+urlParams['less'];	
			}
			if(urlParams['greate'] !=='undefined') {
			var d = d+"&greate="+urlParams['greate'];	
			}
			window.location = d;
    		}); 	
});
</script>
<?php 
$this->menu[] = array('label' => '', 'url' => array('attendencedivisionreport', 'studentpdf' => 'studentpdf', 'div_id' => $_REQUEST['div_id'], 'sb_id' => $_REQUEST['sb_id'], 'greate' => $_REQUEST['greate'], 'less' => $_REQUEST['less'], 'month' => $_REQUEST['month']), 'linkOptions' => array('class' => 'export-pdf', 'title' => 'Export Student Data', 'target' => '_blank'));
$this->menu[] = array('label' => '', 'url' => array('attendencedivisionreport', 'studentexcel' => 'studentexcel', 'div_id' => $_REQUEST['div_id'], 'sb_id' => $_REQUEST['sb_id'], 'greate' => $_REQUEST['greate'], 'less' => $_REQUEST['less'], 'month' => $_REQUEST['month']), 'linkOptions' => array('class' => 'export-excel', 'title' => 'Export Student Data', 'target' => '_blank'));
$div_model = Division::model()->findByPk($_REQUEST['div_id']);
$acd_model = AcademicTerm::model()->findByPk($div_model->academic_name_id);
$key = array_search($_REQUEST['sb_id'], $subjectid);
$d1 = strtotime($acd_model->academic_term_start_date);
$d2 = strtotime($acd_model->academic_term_end_date);
$min_date = min($d1, $d2);
$max_date = max($d1, $d2);
$i = 0;
$m_num = date('m', $min_date);
$month_array[$m_num] = date("F", mktime(0, 0, 0, $m_num, 10));
while (($min_date = strtotime("+1 MONTH", $min_date)) <= $max_date) {
    $m_num = date('m', $min_date);
    $month_array[$m_num] = date("F", mktime(0, 0, 0, $m_num, 10));
}
?>
</br>
 /**
  * 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 = Division::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
<style>
table, th, td {
  vertical-align: middle;
}
th, td, caption {
  padding: 4px 0 10px;
  text-align: center;
}

</style>

<!--<h5>Attendance Report</h5>-->
<h4>Division Name : <?php echo Division::model()->findByPk($div_id)->division_code; ?></h4>

<?php 
$i=0;
$m=1;
if($subject)
{
echo '<table border="1">
<tr><th>Lacture No</th><th>Faculty Name</th><th>Subject Name</th><th>Total</th><th>Present</th><th>Attendance %</th></tr>';
for($i=0;$i<count($subject);$i++)
{
		$percentage = ($present[$i]*100)/$total[$i];
		echo '<tr>';		
?>
		<td>
			<?php echo $lecture[$i];?>
		</td>
		<td>
			<?php echo $faculty[$i];?>
foreach($studModel as $list) {
$stud_info = StudentInfo::model()->findByAttributes(array('student_info_transaction_id'=>$list['student_transaction_id']));	
if($stud_info)
{
	$trans = StudentTransaction::model()->findByPk($stud_info->student_info_transaction_id); 
	$titl = "<b>".$stud_info->title."</b>";
	$name = "<b>".$stud_info->student_first_name." ".$stud_info->student_middle_name." ".$stud_info->student_last_name."</b>"; 
	$smobile = "<b>".$stud_info->student_mobile_no."</b>";
	$pmobile = "<b>".$stud_info->student_guardian_mobile."</b>";

	$branch_model=Branch::model()->findByPk($trans->student_transaction_branch_id);
	$en_no = "<b>".$stud_info->student_enroll_no."</b>";
	$branch = "<b>".$branch_model->branch_name."</b>";
	$sem = "<b>Sem-".AcademicTerm::model()->findByPk($trans->student_academic_term_name_id)->academic_term_name."</b>";
        if($trans->student_transaction_division_id != 0)
	$div = "<b>".Division::model()->findByPk($trans->student_transaction_division_id)->division_name."</b>";
	else
	$div = '-';
	$photos=StudentPhotos::model()->findByPk($trans->student_transaction_student_photos_id)->student_photos_path;
	$photo=CHtml::image(Yii::app()->request->baseUrl.'/college_data/stud_images/'.$photos,'image',array('width'=>120,'height'=>140,'class'=>'photo','style'=>'padding-right:0px;','border'=>1));
	$gender = "<b>".$stud_info->student_gender."</b>";
	$cdate = "<b>".date('d/m/Y')."</b>";
	if($trans->student_transaction_category_id !=0)
		$category = "<b>".Category::model()->findByPk($trans->student_transaction_category_id)->category_name."</b>";
	else 
		$category = "<b>not set</b>";
	$lin1 = "<b>not set</b>";
	$lin2 = "<b>not set</b>";
	$ct = "<b>not set</b>";
	$stat = "<b>not set</b>";
	$pc = "<b>not set</b>";
 public function actionSaveDivision()
 {
     if (isset($_POST['Division'])) {
         $db = O::app()->getDb();
         if ($_POST['Division']['div_id'] == 0) {
             $this->checkAccess('division.add');
             $row = CDbCommandEx::create($db)->select('MAX(t1.div_id) as i, MAX(t2.weight) as m, COUNT(t2.weight) c ')->from(TableNames::DIVISION . ' t1')->leftJoin(TableNames::DIVISION . ' t2', '$t2.rec_id = :rec_id', array('rec_id' => $this->rec->id))->queryRow();
             $div_id = $row['i'] + 1;
             $db->createCommand()->insert(TableNames::DIVISION, array('div_id' => $div_id, 'rec_id' => $this->rec->id, 'name' => $_POST['Division']['name'], 'description' => $_POST['Division']['description'], 'weight' => max($row['m'], $row['c']) + 1));
         } else {
             $this->checkAccess('division.edit');
             $div_id = $_POST['Division']['div_id'];
             $db->createCommand()->update(TableNames::DIVISION, array('name' => $_POST['Division']['name'], 'description' => $_POST['Division']['description']), 'div_id = :div_id', array('div_id' => $div_id));
         }
         if (O::app()->getRequest()->isAjaxRequest) {
             $division = Division::model()->findByPk($div_id);
             echo CJSON::encode(array('status' => 'OK', 'div_id' => $div_id, 'html' => $this->renderPartial('_division_item', array('item' => $division), true)));
         } else {
             $this->redirect(array('division'));
         }
     } else {
         throw new CHttpException(403);
     }
 }