function getBatch($id) { $batch = Batches::model()->findByAttributes(array("id" => $id)); if ($batch != NULL) { echo $batch->name; } }
public function actionIndex() { $criteria = new CDbCriteria(); $criteria->condition = '`file`<>:null'; $criteria->params = array(':null' => ''); $roles = Rights::getAssignedRoles(Yii::app()->user->id); // check for single role $user_roles = array(); foreach ($roles as $role) { $user_roles[] = '"' . $role->name . '"'; } $teacher = Employees::model()->findByAttributes(array('uid' => Yii::app()->user->id)); $batches = Batches::model()->findAllByAttributes(array('employee_id' => $teacher->id)); foreach ($batches as $classteacher) { $batch[] = $classteacher->id; } $timetable = TimetableEntries::model()->findAllByAttributes(array('employee_id' => $teacher->id)); foreach ($timetable as $period) { $batch[] = $period->batch_id; } $unique_batch = array_unique($batch); if (count($unique_batch) > 0) { $criteria->condition .= ' AND (`placeholder`=:null OR `created_by`=:user_id OR (`placeholder` IN (' . implode(',', $user_roles) . ')) AND (`batch` IS NULL OR `batch` IN (' . implode(',', $unique_batch) . '))) '; } else { $criteria->condition .= ' AND (`placeholder`=:null OR `created_by`=:user_id) OR (`placeholder` IN (' . implode(',', $user_roles) . '))'; } $criteria->params[':user_id'] = Yii::app()->user->id; $criteria->order = '`created_at` DESC'; $files = FileUploads::model()->findAll($criteria); if (isset($_POST['Downfiles'])) { $selected_files = $_POST['Downfiles']; $slfiles = array(); foreach ($selected_files as $s_file) { $model = FileUploads::model()->findByPk($s_file); if ($model != NULL) { $slfiles[] = 'uploads/shared/' . $model->id . '/' . $model->file; } } $zip = Yii::app()->zip; $fName = $this->generateRandomString(rand(10, 20)) . '.zip'; $zipFile = 'compressed/' . $fName; if ($zip->makeZip($slfiles, $zipFile)) { $fcon = file_get_contents($zipFile); header('Content-type:text/plain'); header('Content-disposition:attachment; filename=' . $fName); header('Pragma:no-cache'); echo $fcon; unlink($zipFile); } else { Yii::app()->user->setFlash('success', 'Can\'t download'); } } $this->render('/fileUploads/index', array('files' => $files)); }
/** * Specifies the access control rules. * This method is used by the 'accessControl' filter. * @return array access control rules */ public function actionIndex() { $criteria = new CDbCriteria(); $criteria->condition = ''; $roles = Rights::getAssignedRoles(Yii::app()->user->id); // check for single role $user_roles = array(); foreach ($roles as $role) { $user_roles[] = '"' . $role->name . '"'; } $student = Students::model()->findByAttributes(array('uid' => Yii::app()->user->id)); $batch = Batches::model()->findByAttributes(array('id' => $student->batch_id)); $criteria->condition .= '`file`<>:null AND (`placeholder`=:null OR `placeholder` IN (' . implode(',', $user_roles) . ')) AND ((`course` IS NULL) OR (`course`=:course) OR (`course`=0)) AND ((`batch` IS NULL) OR (`batch`=:batch) OR (`batch`=0))'; $criteria->params = array(':null' => '', ':course' => $batch->course_id, ':batch' => $batch->id); $criteria->order = '`created_at` DESC'; //print_r($criteria); exit; $files = FileUploads::model()->findAll($criteria); if (isset($_POST['Downfiles'])) { $selected_files = $_POST['Downfiles']; $slfiles = array(); foreach ($selected_files as $s_file) { $model = FileUploads::model()->findByPk($s_file); if ($model != NULL) { $slfiles[] = 'uploads/shared/' . $model->id . '/' . $model->file; } } $zip = Yii::app()->zip; $fName = $this->generateRandomString(rand(10, 20)) . '.zip'; $zipFile = 'compressed/' . $fName; if ($zip->makeZip($slfiles, $zipFile)) { $fcon = file_get_contents($zipFile); header('Content-type:text/plain'); header('Content-disposition:attachment; filename=' . $fName); header('Pragma:no-cache'); echo $fcon; unlink($zipFile); } else { Yii::app()->user->setFlash('success', 'Can\'t download'); } } $this->render('/fileUploads/index', array('files' => $files)); }
<div> <?php /*If $flag = 1, list of batches will be displayed. *If $flag = 2, exam schedule page will be displayed. *If $flag = 3, exam result page will be displayed. *If $flag = 0, Employee not teaching in any batch. A message will be displayed. */ if ($_REQUEST['id'] != NULL) { } else { // Get batch ID from Batches $batches_id = Batches::model()->findAll("employee_id=:x AND is_active=:y AND is_deleted=:z", array(':x' => $employee_id, ':y' => 1, ':z' => 0)); if (count($batches_id) >= 1) { // List of batches is needed $flag = 1; } elseif (count($batches_id) <= 0) { // If not teaching in any batch $flag = 0; } } if ($flag == 0) { // Displaying message ?> <div class="yellow_bx" style="background-image:none;width:90%;padding-bottom:45px;margin-top:60px;"> <div class="y_bx_head"> <?php echo Yii::t('examination', 'No period is assigned to you now!'); ?> </div> </div> <?php }
border-top:1px #CCC solid; margin:30px 0px; font-size:9px; border-right:1px #CCC solid; } .attendance_table td{ border-left:1px #CCC solid; padding:5px 6px; border-bottom:1px #CCC solid; } </style> <div class="atnd_Con" style="padding-left:20px; padding-top:30px;"> <?php $student = Students::model()->findByAttributes(array('id' => $_REQUEST['id'])); $batch = Batches::model()->findByAttributes(array('id' => $student->batch_id)); $course_id = $batch->course_id; $course = Courses::model()->findByAttributes(array('id' => $course_id)); ?> <?php function getweek($date, $month, $year) { $date = mktime(0, 0, 0, $month, $date, $year); $week = date('w', $date); switch ($week) { case 0: return 'S<br>'; break; case 1: return 'M<br>';
</td> </tr> <tr> <td>Description</td> <td></td> <td><?php echo $posts_1->description; ?> </td> </tr> <tr> <td>Course</td> <td></td> <td> <?php $batch = Batches::model()->findByPk($posts_1->batch_id); echo $batch->course123->course_name; ?> </td> </tr> <tr> <td>Start Date</td> <td></td> <td><?php echo $posts->start_date; ?> </td> </tr> <tr> <td>End Date</td> <td></td>
// Get unique batch ID from Timetable. Checking if the employee is teaching. $criteria = new CDbCriteria(); $criteria->select = 'batch_id'; $criteria->distinct = true; $criteria->condition = 'employee_id=:emp_id'; $criteria->params = array(':emp_id' => $employee->id); $batches_id = TimetableEntries::model()->findAll($criteria); $teach_count = count($batches_id); //echo 'Employee ID: '.$employee->id.'<br/>Teaching in '.count($batches_id).' batch(es)<br/>'; //Get unique batch ID from Batches. Checking if the employee is a class teacher. $criteria = new CDbCriteria(); $criteria->select = 'id'; $criteria->distinct = true; $criteria->condition = 'employee_id=:emp_id'; $criteria->params = array(':emp_id' => $employee->id); $class_teacher = Batches::model()->findAll($criteria); $class_count = count($class_teacher); //echo 'Class Teacher of '.count($class_teacher).' batch(es)'; if ($teach_count > 0 or $class_count > 0) { $this->renderPartial('examination/exam_tab', array('teach_count' => $teach_count, 'class_count' => $class_count)); } else { ?> <div class="yellow_bx" style="background-image:none;width:90%;padding-bottom:45px;"> <div class="y_bx_head"> <?php echo Yii::t('examination', 'No exam details are available now!'); ?> </div> </div> <?php }
<?php $course = Courses::model()->findByAttributes(array('id' => $val, 'is_deleted' => 0)); $batch = Batches::model()->findAll("course_id=:x AND is_deleted=:y", array(':x' => $val, ':y' => 0)); ?> <div class="cbtablebx" id="dropwin"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody> <tr class="cbtablebx_topbg"> <td><?php echo Yii::t('Courses', 'Batch Name'); ?> </td> <td><?php echo Yii::t('Courses', 'Start Date'); ?> </td> <td><?php echo Yii::t('Courses', 'End Date'); ?> </td> <td style="border-right:none;">Actions</td> </tr> <tr class="even"> <td><?php echo $course->course_name; ?> (21 Students) </td> <td>12/10/2010</td> <td>10/10/2010</td> <td style="border-right:none;"><a href="#">EDIT</a> | <a href="#">DELETE</a> | <a href="#">ADD STUDENT</a></td>
?> </li> <li> <?php echo CHtml::link('<span>' . Yii::t('weekdays', 'Set Class Timings') . '</span>', array('/courses/classTiming', 'id' => $_REQUEST['id']), array('class' => 'addbttn last')); ?> </li> </ul> <div class="clear"></div> </div> <!-- END div class="edit_bttns" --> </div> <!-- END div class="c_subbutCon" --> <div style="width:100%"> <div> <?php $times = Batches::model()->findAll("id=:x", array(':x' => $_REQUEST['id'])); $weekdays = Weekdays::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])); if (count($weekdays) == 0) { $weekdays = Weekdays::model()->findAll("batch_id IS NULL"); } ?> <br /><br /> <?php $criteria = new CDbCriteria(array("order" => "STR_TO_DATE(start_time,'%h:%i%p') ASC")); $criteria->addCondition('batch_id=:x'); $criteria->params = array(':x' => $_REQUEST['id']); $timing = ClassTimings::model()->findAll($criteria); $count_timing = count($timing); if ($timing != NULL) { ?> <div style="position:absolute; top:13px; left:0px; width:240px; height:35px;">
<?php foreach ($posts as $posts_1) { ?> <div class="mcbrow" id="jobDialog1"> <ul> <li class="gtcol1" onclick="details('<?php echo $posts_1->id; ?> ');" style="cursor:pointer;"> <?php echo $posts_1->course_name; ?> <?php $course = Courses::model()->findByAttributes(array('id' => $posts_1->id, 'is_deleted' => 0)); $batch = Batches::model()->findAll("course_id=:x AND is_deleted=:y AND is_active=:z", array(':x' => $posts_1->id, ':y' => 0, ':z' => 1)); ?> <span><?php echo count($batch); ?> - Batch(es)</span> </li> <li class="col2"> <?php echo CHtml::ajaxLink(Yii::t('Courses', 'Edit'), $this->createUrl('courses/Edit'), array('onclick' => '$("#jobDialog11").dialog("open"); return false;', 'update' => '#jobDialog1', 'type' => 'GET', 'data' => array('val1' => $posts_1->id), 'dataType' => 'text'), array('id' => 'showJobDialog123' . $posts_1->id, 'class' => 'edit')); ?> </li> <li class="col3"><?php echo CHtml::link(Yii::t('Courses', 'Delete'), array('deactivate', 'id' => $posts_1->id), array('confirm' => "Are you sure?\n\n Note: All details (batches, students, timetable, fees, exam) related to this course will be deleted.", 'class' => 'delete')); ?> </li>
public function actionStudentmonthlypdf() { $batch_name = Batches::model()->findByAttributes(array('id' => $_REQUEST['id'])); $pdf_name = ucfirst($batch_name->name) . ' Students Monthly Attendance Report ' . $_REQUEST['month'] . '.pdf'; # HTML2PDF has very similar syntax $html2pdf = Yii::app()->ePdf->HTML2PDF(); $html2pdf->WriteHTML($this->renderPartial('studentmonthlypdf', array(), true)); $html2pdf->Output($pdf_name); }
} else { echo $list_2->admission_date; } ?> </td> <td align="center"><?php echo CHtml::link($list_2->first_name . ' ' . $list_2->middle_name . ' ' . $list_2->last_name, array('/students/students/view', 'id' => $list_2->id)); ?> </td> <td align="center"><?php echo $list_2->admission_no; ?> </td> <td align="center"> <?php $batc = Batches::model()->findByAttributes(array('id' => $list_2->batch_id)); if ($batc != NULL) { $cours = Courses::model()->findByAttributes(array('id' => $batc->course_id)); ?> <?php echo $cours->course_name . ' / ' . $batc->name; ?> <?php } else { ?> - <?php } ?> </td> <td align="center">
</td> <td valign="top"> <div class="cont_right formWrapper"> <h1><?php echo Yii::t('fees', 'Fees Collection'); ?> </h1> <div class="formCon" style="padding:3px;"> <div class="formConInner" style="padding:3px 10px;"> <table width="80%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <?php $data = CHtml::listData(Batches::model()->findAll("is_active=:x and is_deleted=:y ORDER BY start_date DESC", array(':x' => 1, ':y' => 0)), 'id', 'coursename'); if (isset($_REQUEST['batch'])) { $sel = $_REQUEST['batch']; } else { $sel = ''; } echo '<span style="font-size:14px; font-weight:bold; color:#666;">' . Yii::t('fees', 'Batch') . '</span> '; echo CHtml::dropDownList('id', '', $data, array('prompt' => 'Select', 'onchange' => 'batch()', 'id' => 'batch', 'options' => array($sel => array('selected' => true)))); echo '</td><td style="padding-top:13px;">'; ?> <?php $data_1 = array(); if (isset($_REQUEST['batch'])) { $data_1 = CHtml::listData(FinanceFeeCollections::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['batch'])), 'id', 'name'); }
?> </td> <td><?php echo $model->name; ?> </td> </tr> <tr> <td><?php echo Yii::t('Electives', 'Subject Code'); ?> </td> <td><?php echo $model->code; ?> </td> </tr> <tr> <td><?php echo Yii::t('Electives', 'Batch Name'); ?> </td> <td><?php $posts = Batches::model()->findByAttributes(array('id' => $model->batch_id)); echo $posts->name; ?> </td> </tr> </table> </div>
<div class="edit_bttns" style="width:550px; top:40px; left:30px;"> <ul> <!-- For attendence --> <li><span> <?php if (Yii::app()->controller->action->id == 'attendance' or Yii::app()->controller->action->id == 'studentattendance') { echo CHtml::link('<span>' . 'View My Attendance' . '</span>', array('/teachersportal/default/employeeattendance')); } ?> </span></li> <li><span> <?php $employee = Employees::model()->findByAttributes(array('uid' => Yii::app()->user->id)); $is_classteacher = Batches::model()->findAllByAttributes(array('employee_id' => $employee->id)); if ($is_classteacher != NULL) { if (Yii::app()->controller->action->id == 'attendance' or Yii::app()->controller->action->id == 'employeeattendance') { echo CHtml::link('<span>' . 'Manage Student Attendance' . '</span>', array('/teachersportal/default/studentattendance')); } } ?> </span></li> <li><span> <?php if (count($is_classteacher) > 1 and Yii::app()->controller->action->id == 'studentattendance' and isset($_REQUEST['id'])) { echo CHtml::link('<span>' . 'Change Batch' . '</span>', array('/teachersportal/default/studentattendance')); } ?> </span></li> <!-- End For attendence --> <li><span> <?php
?> </div> </div> <!-- END div class="formConInner" --> </div> <!-- END div class="formCon" --> <br /> <?php //if(isset($_REQUEST['flag']) and $_REQUEST['flag']==1) if ($flag == 1) { echo '<div class="listhdg" align="center">' . Yii::t('report', 'Invalid search! Please enter a student name.') . '</div>'; } else { } if (isset($list)) { $details = Students::model()->findByAttributes(array('id' => $student, 'is_deleted' => 0, 'is_active' => 1)); $batch = Batches::model()->findByAttributes(array('id' => $details->batch_id, 'is_deleted' => 0, 'is_active' => 1)); $course = Courses::model()->findByAttributes(array('id' => $batch->course_id)); ?> <h3><?php echo Yii::t('report', 'Student Information'); ?> </h3> <div class="tablebx"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="tablebx_topbg"> <td><?php echo Yii::t('report', 'Admission No.'); ?> </td> <td><?php echo Yii::t('report', 'Student Name');
<td align="center"><?php echo Yii::t('Courses', 'Batch Name'); ?> </td> <td align="center"><?php echo Yii::t('Courses', 'Class Teacher'); ?> </td> <td align="center"><?php echo Yii::t('Courses', 'Actions'); ?> </td> </tr> <?php foreach ($batches_id as $batch_id) { $batch = Batches::model()->findByAttributes(array('id' => $batch_id->batch_id, 'is_active' => 1, 'is_deleted' => 0)); echo '<tr id="batchrow' . $batch->id . '">'; /*echo '<td style="text-align:center; padding-left:10px; font-weight:bold;">'.CHtml::link($batch->name, array('/teachersportal/default/employeetimetable','id'=>$batch->id)).'</td>';*/ echo '<td style="text-align:center; padding-left:10px; font-weight:bold;">' . $batch->coursename . '</td>'; $teacher = Employees::model()->findByAttributes(array('id' => $batch->employee_id)); echo '<td align="center">'; if ($teacher) { echo $teacher->first_name . ' ' . $teacher->last_name; } else { echo '-'; } // Count if any exam timetables are published in a batch. $exams_published = ExamGroups::model()->countByAttributes(array('batch_id' => $batch->id, 'is_published' => 1)); // Count if any exam results are published in a batch. $result_published = ExamGroups::model()->countByAttributes(array('batch_id' => $batch->id, 'result_published' => 1)); echo '<td align="center">';
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')); } }
?> <?php echo CHtml::checkBoxList('sid', '', $posts1, array('id' => '1', 'template' => '{input}{label}</tr><tr><td width="10%">', 'checkAll' => 'All')); ?> </td> <td colspan="2"> </td> </tr> </table> <?php $data1 = CHtml::listData(Batches::model()->findAll(array('order' => 'name DESC')), 'id', 'name'); echo CHtml::dropDownList('batch_id', '', $data1, array('prompt' => 'Select', 'id' => 'batch_id')); ?> <?php echo CHtml::submitButton(Yii::t('Batch', 'Promote'), array('name' => 'promote', 'onclick' => 'formSubmit()', 'class' => '')); ?> <?php } else { echo '<br><div class="notifications nt_red" style="padding-top:10px">' . Yii::t('Batch', '<i>No Active Students In This Batch</i>') . '</div>'; } } ?>
public function actionAjax_Create() { if (isset($_POST['FinanceFeeCategories'])) { //$model=new FinanceFeeCategories; //set the submitted values $model->attributes = $_POST['FinanceFeeCategories']; $list = $_POST['FinanceFeeCategories']; $count = sizeof($list['batch_id']); for ($i = 0; $i < $count; $i++) { $batch = Batches::model()->findByAttributes(array('id' => $list['batch_id'][$i])); $course = Courses::model()->findByAttributes(array('id' => $batch->course_id)); $model = new FinanceFeeCategories(); $model->name = $list['name']; $model->description = $list['name'] . ' for ' . $batch->name . '( ' . $course->course_name . ') ' . $list['description']; $model->batch_id = $list['batch_id'][$i]; $model->is_deleted = $list['is_deleted']; $model->is_master = $list['is_master']; $model->created_at = $list['created_at']; $model->updated_at = $list['updated_at']; $model->save(); } echo json_encode(array('success' => true)); exit; } }
</div> <!-- END Batch Details --> <!-- Week Timetable --> <?php if ($_REQUEST['mode'] == 1) { $this->renderPartial('/weekdays/viewtable', array('course_id' => $course, 'batch_id' => $batch->id, 'mode' => $_REQUEST['mode'])); } elseif ($_REQUEST['mode'] == 2) { $this->renderPartial('/weekdays/viewtable', array('course_id' => $course, 'batch_id' => $batch->id, 'mode' => $_REQUEST['mode'], 'day' => $_REQUEST['day'])); } ?> <!-- END Week Timetable --> <?php } // END foreach($batches as $batch) } else { $batch = Batches::model()->findByAttributes(array('id' => $_REQUEST['bid'], 'course_id' => $course->id, 'is_active' => 1, 'is_deleted' => 0)); ?> <!-- Batch Details --> <div class="formCon"> <div class="formConInner"> <table style="text-align:center;"> <tr> <td style="width:auto; min-width:200px;"> <?php echo Yii::t('timetable', 'Course') . ' : ' . ucfirst($course->course_name); ?> </td> <td width="20px"> </td> <td style="width:auto; min-width:200px;">
///JSON2JS Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js_plugins/json2/json2.js'); //jqueryform js Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js_plugins/ajaxform/jquery.form.js', CClientScript::POS_HEAD); Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js_plugins/ajaxform/form_ajax_binding.js', CClientScript::POS_HEAD); Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/js_plugins/ajaxform/client_val_form.css', 'screen'); ?> <div class="emp_cont_left"> <div class="empleftbx"> <div class="empimgbx"> <ul> <?php if (isset($_REQUEST['id'])) { ?> <?php $batch = Batches::model()->findByAttributes(array('id' => $_REQUEST['id'])); ?> <?php if ($batch != NULL) { ?> <li class="img_text"> <?php echo '<strong>' . Yii::t('Batch', 'Batch: ') . '</strong>'; echo $batch->name; ?> <br> <span><strong><?php echo Yii::t('Batch', 'Course:'); ?> </strong>
</tr> </table> </div> <div class="inner_new_formCon_row"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20%"><?php echo $form->labelEx($model, 'batch'); ?> </td> <td width="80%"><?php $data1 = CHtml::listData(Batches::model()->findAll('is_active=:x AND is_deleted=:y', array(':x' => '1', ':y' => 0), array('order' => 'name DESC')), 'id', 'name'); echo CHtml::activeDropDownList($model, 'batch', $data1, array('prompt' => 'Select', 'id' => 'batch_id')); ?> <?php echo $form->error($model, 'batch'); ?> </td> </tr> </table> </div> <div class="inner_new_formCon_row">
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { if (Yii::app()->request->isPostRequest) { $model = ExamScores::model()->findByAttributes(array('id' => $id)); $student = Students::model()->findByAttributes(array('id' => $model->student_id)); $student_name = ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name); $exam = Exams::model()->findByAttributes(array('id' => $model->exam_id)); $subject_name = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id)); $batch = Batches::model()->findByAttributes(array('id' => $examgroup->batch_id)); $exam_name = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')'; $goal_name = $student_name . ' for the exam ' . $exam_name; // we only allow deletion via POST request $this->loadModel($id)->delete(); //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value) ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '22', $model->id, $goal_name, NULL, NULL, NULL); // we only allow deletion via POST request //$this->loadModel($id)->delete(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
<td> </td> <td style="width:100px;"><strong><?php echo Yii::t('report', 'Batch'); ?> </strong></td> <td> </td> <?php $criteria = new CDbCriteria(); $criteria->compare('is_deleted', 0); ?> <td> <?php if ($batch_id != NULL) { echo CHtml::dropDownList('batch', '', CHtml::listData(Batches::model()->findAll($criteria), 'id', 'coursename'), array('prompt' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/report/default/batch'), 'update' => '#exam_id', 'data' => 'js:$(this).serialize()'), 'style' => 'width:270px;', 'options' => array($batch_id => array('selected' => true)))); } else { echo CHtml::dropDownList('batch', '', CHtml::listData(Batches::model()->findAll($criteria), 'id', 'coursename'), array('prompt' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/report/default/batch'), 'update' => '#exam_id', 'data' => 'js:$(this).serialize()'), 'style' => 'width:270px;')); } ?> </td> </tr> <tr> <td colspan="4"> </td> </tr> <tr> <td> </td> <td valign="top"><strong><?php echo Yii::t('report', 'Examination'); ?> </strong></td> <td> </td>
</td> <td> </td> <td valign="bottom"><?php echo $form->labelEx($model, Yii::t('students', 'date_of_birth')); ?> </td> <td> </td> <td valign="bottom"><?php echo $form->labelEx($model, Yii::t('students', 'gender')); ?> </td> </tr> <tr> <td valign="top"> <?php $models = Batches::model()->findAll("is_deleted=:x", array(':x' => '0')); $data = array(); foreach ($models as $model_1) { //$posts=Batches::model()->findByPk($model_1->id); $data[$model_1->id] = $model_1->course123->course_name . '-' . $model_1->name; } ?> <?php if (isset($_REQUEST['bid']) and $_REQUEST['bid'] != NULL) { echo $form->dropDownList($model, 'batch_id', $data, array('options' => array($_REQUEST['bid'] => array('selected' => true)), 'style' => 'width:170px;', 'empty' => 'Select Batch')); } else { echo $form->dropDownList($model, 'batch_id', $data, array('style' => 'width:170px;', 'empty' => 'Select Batch')); } ?> <?php echo $form->error($model, 'batch_id');
public function actionPdf() { $batch_name = Batches::model()->findByAttributes(array('id' => $_REQUEST['id'])); $exam = Exams::model()->findByAttributes(array('id' => $_REQUEST['examid'])); $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id)); $subject = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); $filename = $batch_name->name . ' ' . $examgroup->name . ' ' . $subject->name . '.pdf'; # HTML2PDF has very similar syntax $html2pdf = Yii::app()->ePdf->HTML2PDF(); $html2pdf->WriteHTML($this->renderPartial('scorepdf', array(), true)); $html2pdf->Output($filename); }
?> <div class="flash-success"> <?php echo Yii::app()->user->getFlash('notification'); ?> </div> <?php } ?> <?php $models = Batches::model()->findAll("is_deleted=:x", array(':x' => '0')); $data = array(); $data['NULL'] = 'common'; foreach ($models as $model_1) { $posts = Batches::model()->findByPk($model_1->id); $data[$model_1->id] = $model_1->name; } ?> <div class="bbtb"> <!--<h3>Set Weekdays For : --> <?php //echo CHtml::dropDownList('mydropdownlist','mydropdownlist',$data,array('onchange'=>'getid();','id'=>'drop','options'=>array($_REQUEST['id']=>array('selected'=>true)))); ?> <!--</h3>--> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'courses-form', 'enableAjaxValidation' => false)); ?> <!-- Default one --> <?php
} ?> <h2><?php echo $student->first_name . ' ' . $student->middle_name . ' ' . $student->last_name; ?> </h2> <ul> <li class="rleft"><?php echo Yii::t('parentportal', 'Course :'); ?> </li> <li class="rright"> <?php $batch = Batches::model()->findByPk($student->batch_id); echo $batch->course123->course_name; ?> </li> <li class="rleft"><?php echo Yii::t('parentportal', 'Batch :'); ?> </li> <li class="rright"><?php echo $batch->name; ?> </li> <li class="rleft"><?php echo Yii::t('parentportal', 'Admission No :'); ?> </li>
public function getbatchname() { $batches = Batches::model()->findByAttributes(array('id' => $this->batch_id, 'is_deleted' => 0)); return $this->name . '(' . $batches->name . ')'; }