/** * 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 = ClassTimings::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?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 } ?> <?php $timing = ClassTimings::model()->findByAttributes(array('batch_id' => $batch->id)); if ($timing == NULL) { $time = 'nt_gray'; ?> <div class="notifications nt_red"> <?php echo '<span>' . Yii::t('Batch', 'Notice') . '</span>'; ?> <?php echo Yii::t('Batch', 'No Batch Class Timings are defined.'); ?> <br /> <?php echo CHtml::link(Yii::t('Batch', 'Define Now'), array('#'), array('id' => 'add_class-timings-side')); ?> </div>
?> <tr> <td class="td"><div class="name"><?php echo Yii::t('weekdays', 'SAT'); ?> </div></td> <td class="td-blank"></td> <?php for ($i = 0; $i < $count_timing; $i++) { echo ' <td class="td"> <div onclick="" style="position: relative; "> <div class="tt-subject"> <div class="subject">'; $set = TimetableEntries::model()->findByAttributes(array('batch_id' => $_REQUEST['id'], 'weekday_id' => $weekdays[6]['weekday'], 'class_timing_id' => $timing[$i]['id'])); if (count($set) == 0) { $is_break = ClassTimings::model()->findByAttributes(array('id' => $timing[$i]['id'], 'is_break' => 1)); if ($is_break == NULL) { echo CHtml::ajaxLink(Yii::t('weekdays', 'Assign'), $this->createUrl('TimetableEntries/settime'), array('onclick' => '$("#jobDialog' . $timing[$i]['id'] . $weekdays[6]['weekday'] . '").dialog("open"); return false;', 'update' => '#jobDialog' . $timing[$i]['id'] . $weekdays[6]['weekday'], 'type' => 'GET', 'data' => array('batch_id' => $_REQUEST['id'], 'weekday_id' => $weekdays[6]['weekday'], 'class_timing_id' => $timing[$i]['id']), 'dataType' => 'text'), array('id' => 'showJobDialog' . $timing[$i]['id'] . $weekdays[6]['weekday'])); } else { echo Yii::t('weekdays', 'Break'); } } else { $time_sub = Subjects::model()->findByAttributes(array('id' => $set->subject_id)); if ($time_sub != NULL) { echo $time_sub->name . '<br>'; } $time_emp = Employees::model()->findByAttributes(array('id' => $set->employee_id)); if ($time_emp != NULL) { echo '<div class="employee">' . $time_emp->first_name . '</div>'; } echo CHtml::link('', array('timetableEntries/remove', 'id' => $set->id, 'batch_id' => $_REQUEST['id']), array('confirm' => 'Are you sure?', 'class' => 'delete'));
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')); } }
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; }
echo Yii::t('Timing', 'View Class Timings'); ?> </h3> <?php //echo CHtml::dropDownList('mydropdownlist','mydropdownlist', // CHtml::listData(Batches::model()->findAll(), //'id', 'name'),array('onchange'=>'getid();','id'=>'drop','prompt'=>'Select Batch')); ?> <?php if (isset($_REQUEST['id'])) { echo CHtml::ajaxLink(Yii::t('Timing', 'Add'), $this->createUrl('ClassTimings/addnew'), array('onclick' => '$("#jobDialog").dialog("open"); return false;', 'update' => '#jobDialog', 'data' => array('batch_id' => $_REQUEST['id']), 'dataType' => 'text'), array('id' => 'showJobDialog1')); $timing = ClassTimings::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])); if (count($timing) != 0) { ?> <br /><br /> <div class="tablelist"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td><?php echo Yii::t('Timing', 'Name'); ?> </td> <td><?php echo Yii::t('Timing', 'Start Time'); ?> </td> <td><?php