public function Employeenotassigned($id, $sub) { $results = array(); $emp = Employees::model()->findAllByAttributes(array('employee_department_id' => $id)); if ($emp != NULL) { $i = 0; foreach ($emp as $emp1) { if (EmployeesSubjects::model()->findByAttributes(array('employee_id' => $emp1->id, 'subject_id' => $sub)) == NULL) { $results[$i] = $emp1; $i++; } } } return $results; }
public function actionRemove() { EmployeesSubjects::model()->findByAttributes(array('subject_id' => $_REQUEST['subject_id'], 'employee_id' => $_REQUEST['employee_id']))->delete(); $this->redirect(Yii::app()->createUrl('EmployeesSubjects/create')); }
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')); } }
/*$data_1=Subjects::model()->findAll(array('join' => 'JOIN batches ON batch_id = batches.id','condition'=>'batches.course_id=:id', 'params'=>array(':id'=>(int) $_REQUEST['cou'])));*/ $data_1 = CHtml::listData(Subjects::model()->findAll(array('join' => 'JOIN batches ON batch_id = batches.id', 'condition' => 'batches.course_id=:id and elective_group_id=:x', 'params' => array(':id' => (int) $_REQUEST['cou'], ':x' => 0))), 'id', 'batchname'); } if (isset($_REQUEST['sub'])) { $sel_1 = $_REQUEST['sub']; } else { $sel_1 = ''; } echo CHtml::dropDownList('sub', '', $data_1, array('prompt' => 'Select', 'onchange' => 'course()', 'id' => 'sub', 'onchange' => 'batch()', 'options' => array($sel_1 => array('selected' => true)))); echo '<br/></div><div class="clear"></div></div></div>'; ?> <?php if (isset($_REQUEST['sub'])) { $emp_sub = EmployeesSubjects::model()->findAll("subject_id=:x", array(':x' => $_REQUEST['sub'])); if (count($emp_sub) == 0) { echo '<br> <br>' . Yii::t('employees', '<i>No Employee assigned yet.</i>') . '<br> <br>'; } else { ?> <div class="clear"></div> <h3><?php echo Yii::t('employees', 'Currently Assigned:'); ?> </h3> <div id="success" style="color:#F00; display:none;"><?php echo Yii::t('employees', 'Details Removed Successfully'); ?> </div>
?> <td> <strong><?php echo Yii::t('examination', 'Subject'); ?> : </strong><?php echo $subject->name; ?> </td> <?php } ?> </tr> <tr> <?php $empid = EmployeesSubjects::model()->findByAttributes(array('subject_id' => $subject_id->subject_id)); if (count($empid) > 0) { $subject_teacher = Employees::model()->findByAttributes(array('id' => $empid->employee_id)); ?> <td> <strong><?php echo Yii::t('examination', 'Subject Teacher'); ?> : </strong><?php echo $subject_teacher->first_name . ' ' . $subject_teacher->last_name; ?> </td> <?php } $is_classteacher = Batches::model()->findByAttributes(array('id' => $batch_id)); $classteacher = Employees::model()->findByAttributes(array('id' => $is_classteacher->employee_id));
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; }
public function actionDynamiccities() { //please enter current controller name because yii send multi dim array $data = EmployeesSubjects::model()->findAll('subject_id=:sub_id', array(':sub_id' => (int) $_POST['TimetableEntries']['subject_id'])); echo CHtml::tag('option', array('value' => ''), CHtml::encode('Select Employee'), true); $data = CHtml::listData($data, 'id', 'employee_id'); foreach ($data as $value => $name) { $emp_name = Employees::model()->findByAttributes(array('id' => $name)); echo CHtml::tag('option', array('value' => $emp_name->id), $emp_name->first_name . ' ' . $emp_name->last_name, true); } }
<?php $data = EmployeesSubjects::model()->findAll(array('condition' => 'subject_id=:id', 'params' => array(':id' => (int) $subject_id))); if ($data != NULL) { foreach ($data as $value) { echo Employees::model()->findByPk($value->employee_id)->first_name; echo CHtml::link(Yii::t('employees', 'delete'), array('EmployeesSubjects/remove', 'subject_id' => $subject_id, 'employee_id' => $value->employee_id)); } }