$employee = Employees::model()->findByAttributes(array('id' => $batch->employee_id)); if ($employee != NULL) { echo $employee->first_name . ' ' . $employee->middle_name . ' ' . $employee->last_name; } ?> </li> <!--<li><strong>Class Teacher:</strong>Mary Symon</li> <li><strong>Class Teacher:</strong>Mary Symon</li>--> </ul> <div class="clear"></div> </div> <?php $time = 'nt_red'; ?> <?php $week = Weekdays::model()->findByAttributes(array('batch_id' => $batch->id)); if ($week == NULL) { ?> <div class="notifications nt_green"> <?php echo '<span>' . Yii::t('Batch', 'Notice') . '</span>'; ?> <?php echo Yii::t('Batch', 'No Batch weekdays are defined.Default Settings Selected.'); ?> <br /> <?php echo CHtml::link(Yii::t('Batch', 'Define Now'), array('/courses/weekdays', 'id' => $_REQUEST['id'])); ?> </div> <?php
<td class="listbx_subhdng">Student Name</td> <td class="listbx_subhdng">Admission Number</td> <td class="listbx_subhdng">Gender</td> <td class="listbx_subhdng">Actions</td> </tr> <tr><td>1</td><td><a href="/osv2.1/osadmin/index.php?r=students/view&id=1">Balusamy</a></td><td>1</td><td>fff</td><td>gggg</td> </tr></tbody></table> </div>--> <!--</div> </div>--> </div> <!-- END div class="emp_tabwrapper" --> </div> <!-- END div class="emp_right_contner"--> </div> <!-- END DIV 2 --> <?php $batch = Weekdays::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])); if (count($batch) == 0) { $batch = Weekdays::model()->findAll("batch_id IS NULL"); } ?> <?php } ?> </td> </tr> </table> </div> <!-- END DIV 1 -->
public function actionDeactivate($id) { $model = Courses::model()->findByPk($id); $model->is_deleted = 1; if ($model->save()) { // Batch Deletion $batches = Batches::model()->findAllByAttributes(array('course_id' => $id)); //Selecting all batches under the course with id = $id foreach ($batches as $batch) { // Student Deletion $students = Students::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($students as $student) { //Making student user inactive if ($student->uid != NULL and $student->uid != 0) { $student_user = User::model()->findByAttributes(array('id' => $student->uid)); if ($student_user != NULL) { $student_user->saveAttributes(array('status' => '0')); } } //Making parent user inactive $parent = Guardians::model()->findByAttributes(array('ward_id' => $student->id)); if ($parent->uid != NULL and $parent->uid != 0) { $parent_user = User::model()->findByAttributes(array('id' => $parent->uid)); if ($parent_user != NULL) { $parent_user->saveAttributes(array('status' => '0')); } } $student->saveAttributes(array('is_active' => '0', 'is_deleted' => '1')); // Student Deleted } // Subject Association Deletion $subjects = Subjects::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($subjects as $subject) { EmployeesSubjects::model()->DeleteAllByAttributes(array('subject_id' => $subject->id)); $subject->delete(); } // Exam Group Deletion $examgroups = ExamGroups::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($examgroups as $examgroup) { // Exams Deletion $exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $examgroup->id)); foreach ($exams as $exam) { //Exam Score Deletion $examscores = ExamScores::model()->DeleteAllByAttributes(array('exam_id' => $exam->id)); $exam->delete(); //Exam Deleted } $examgroup->delete(); //Exam Group Deleted } //Fee Collection Deletion $collections = FinanceFeeCollections::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($collections as $collection) { // Finance Fees Deletion $student_fees = FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $collection->id)); $transaction = FinanceTransaction::model()->DeleteAllByAttributes(array('collection_id' => $collection->id)); $collection->delete(); // Fee Collection Deleted } //Fee Category Deletion $categories = FinanceFeeCategories::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($categories as $category) { // Fee Particular Deletion $particulars = FinanceFeeParticulars::model()->DeleteAllByAttributes(array('finance_fee_category_id' => $category->id)); $category->delete(); // Fee Category Deleted } //Timetable Entry Deletion $periods = TimetableEntries::model()->DeleteAllByAttributes(array('batch_id' => $batch->id)); //Class Timings Deletion $class_timings = ClassTimings::model()->DeleteAllByAttributes(array('batch_id' => $batch->id)); //Delete Weekdays $weekdays = Weekdays::model()->DeleteAllByAttributes(array('batch_id' => $batch->id)); $batch->is_active = 0; $batch->is_deleted = 1; $batch->employee_id = ' '; $batch->save(); // Batch Deleted } Yii::app()->user->setFlash('success', "Selected course is deleted!"); $this->redirect(array('managecourse')); } }
/** * 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 = Weekdays::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionRemove() { $val = $_GET['val1']; $model = Batches::model()->findByPk($val); $model->is_active = 0; $model->is_deleted = 1; $model->employee_id = ' '; if ($model->save()) { // Student Deletion $students = Students::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($students as $student) { //Making student user inactive if ($student->uid != NULL and $student->uid != 0) { $student_user = User::model()->findByAttributes(array('id' => $student->uid)); if ($student_user != NULL) { $student_user->saveAttributes(array('status' => '0')); } } //Making parent user inactive $parent = Guardians::model()->findByAttributes(array('ward_id' => $student->id)); if ($parent->uid != NULL and $parent->uid != 0) { $parent_user = User::model()->findByAttributes(array('id' => $parent->uid)); if ($parent_user != NULL) { $parent_user->saveAttributes(array('status' => '0')); } } $student->saveAttributes(array('is_active' => '0', 'is_deleted' => '1')); // Student Deleted } // Subject Association Deletion $subjects = Subjects::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($subjects as $subject) { EmployeesSubjects::model()->DeleteAllByAttributes(array('subject_id' => $subject->id)); $subject->delete(); } // Exam Group Deletion $examgroups = ExamGroups::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($examgroups as $examgroup) { // Exams Deletion $exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $examgroup->id)); foreach ($exams as $exam) { //Exam Score Deletion $examscores = ExamScores::model()->DeleteAllByAttributes(array('exam_id' => $exam->id)); $exam->delete(); //Exam Deleted } $examgroup->delete(); //Exam Group Deleted } //Fee Collection Deletion $collections = FinanceFeeCollections::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($collections as $collection) { // Finance Fees Deletion $student_fees = FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $collection->id)); $collection->delete(); // Fee Collection Deleted } //Fee Category Deletion $categories = FinanceFeeCategories::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($categories as $category) { // Fee Particular Deletion $particulars = FinanceFeeParticulars::model()->DeleteAllByAttributes(array('finance_fee_category_id' => $category->id)); $category->delete(); // Fee Category Deleted } //Timetable Entry Deletion $periods = TimetableEntries::model()->DeleteAllByAttributes(array('batch_id' => $model->id)); //Class Timings Deletion $class_timings = ClassTimings::model()->DeleteAllByAttributes(array('batch_id' => $model->id)); //Delete Weekdays $weekdays = Weekdays::model()->DeleteAllByAttributes(array('batch_id' => $model->id)); } echo $val; }
?> <div class="timetable" style="text-align:center"> <?php //$weekdays = Weekdays::model()->findByAttributes(array('batch_id'=>$batch_id,'weekday'=>$day)); /*$weekdays = Weekdays::model()->findAll("batch_id=:x", array(':x'=>$batch_id)); // Selecting weekdays of the batch if(count($weekdays) == 0) { $weekdays = Weekdays::model()->findAll("batch_id IS NULL"); }*/ $criteria = new CDbCriteria(array("order" => "STR_TO_DATE(start_time,'%h:%i%p') ASC")); $criteria->addCondition('batch_id=:x'); $criteria->params = array(':x' => $batch_id); $timing = ClassTimings::model()->findAll($criteria); $count_timing = count($timing); if ($timing != NULL) { $weekdays = Weekdays::model()->findByAttributes(array('batch_id' => $batch_id, 'weekday' => $day)); //echo count($weekdays).$weekdays->weekday.'/'.$day; if ($weekdays->weekday != 0) { ?> <table border="0" align="center" width="100%" id="table" cellspacing="0"> <tbody> <tr> <td class="loader"> </td> <td class="td-blank"></td> <?php foreach ($timing as $timing_1) { echo '<td class="td"><div class="top">' . $timing_1->start_time . ' - ' . $timing_1->end_time . '</div></td>'; } ?>