function getBatch($id) { $batch = Batches::model()->findByAttributes(array("id" => $id)); if ($batch != NULL) { echo $batch->name; } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Courses(); $model_1 = new Batches(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Courses'])) { $model_1->attributes = $_POST['Batches']; $model->attributes = $_POST['Courses']; if ($model->save()) { $model_1->course_id = Yii::app()->db->getLastInsertId(); $model_1->save(); $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'model_1' => $model_1)); }
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)); }
static function getScheduleCountForBatch($batchId, $startDate, $endDate) { $batchEndDate = Batches::select('end_date')->where("id", "=", $batchId)->get(); //$batchEndDate['0']->end_date; /* BatchSchedule::where('batch_id', '=', $batchId) ->whereBetween('schedule_date', array($startDate, $endDate)) ->count(); print_r(DB::getQueryLog()); exit(); */ return BatchSchedule::where('batch_id', '=', $batchId)->whereBetween('schedule_date', array($startDate, $endDate))->count(); }
/** * 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)); }
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>';
public function edit_batch($id) { $batch = Batches::getBatch($id); $data['batch'] = $batch[0]; $data['title'] = "Stock Management::Edit Stock Entry"; $data['content_view'] = "add_batch_view"; $this->base_params($data); }
/** * 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.'); } }
///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>
?> </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;">
} 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">
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); }
public function get($year, $vaccine) { $receipts = Batches::getYearlyReceipts($year, $vaccine); $plans = Provisional_Plan::getYearlyPlan($year, $vaccine); $month_margins = array(0, 31, 60, 90, 121, 151, 182, 213, 243, 274, 304, 335, 366); $chart = ' <chart palette="2" caption="Provisional Plan" subcaption="For the year ' . $year . '" xAxisName="Date" yAxisName="Quantity" showValues="0" alternateHGridColor="FCB541" alternateHGridAlpha="20" divLineColor="FCB541" divLineAlpha="50" canvasBorderColor="666666" baseFontColor="666666" lineColor="FCB541" xAxisMaxValue="366" xAxisMinValue="0"> <categories verticalLineColor="666666" verticalLineThickness="1"> <category label="Jan" x="0" showVerticalLine="1"/> <category label="Feb" x="31" showVerticalLine="1"/> <category label="Mar" x="60" showVerticalLine="1"/> <category label="Apr" x="90" showVerticalLine="1"/> <category label="May" x="121" showVerticalLine="1"/> <category label="Jun" x="151" showVerticalLine="1"/> <category label="Jul" x="182" showVerticalLine="1"/> <category label="Aug" x="213" showVerticalLine="1"/> <category label="Sep" x="243" showVerticalLine="1"/> <category label="Oct" x="274" showVerticalLine="1"/> <category label="Nov" x="304" showVerticalLine="1"/> <category label="Dec" x="335" showVerticalLine="1"/> <category label="Jan" x="366" showVerticalLine="1"/> </categories> <dataSet seriesName="Planned Arrivals" color="009900" anchorSides="3" anchorRadius="7" anchorBgColor="D5FFD5" anchorBorderColor="009900">'; foreach ($plans as $plan) { $date = $plan->expected_date; $quantity = $plan->expected_amount; $split_date = explode("/", $date); $month = $split_date[0] - 1; $month_delimiter = $month_margins[$month]; $day = $split_date[1]; $x_axis_value = $month_delimiter + $day; $chart .= '<set y="' . $quantity . '" x="' . $x_axis_value . '" toolText="' . $quantity . " Expected on " . $date . '"/>'; } $chart .= ' </dataSet> <dataSet seriesName="Actual Arrivals" color="0000FF" anchorSides="7" anchorRadius="7" anchorBgColor="C6C6FF" anchorBorderColor="0000FF">'; foreach ($receipts as $receipt) { $date = $receipt->Arrival_Date; $quantity = $receipt->Total; $split_date = explode("/", $date); $month = $split_date[0] - 1; $month_delimiter = $month_margins[$month]; $day = $split_date[1]; $x_axis_value = $month_delimiter + $day; $chart .= '<set y="' . $quantity . '" x="' . $x_axis_value . '" toolText="' . $quantity . " (Batch No. " . $receipt->Batch_Number . ") Arrived on " . $date . '"/>'; } $chart .= ' </dataSet> <styles> <definition> <style name="Anim1" type="animation" param="_xscale" start="0" duration="1"/> <style name="Anim2" type="animation" param="_alpha" start="0" duration="0.6"/> <style name="DataShadow" type="Shadow" alpha="40"/> </definition> <application> <apply toObject="DIVLINES" styles="Anim1"/> <apply toObject="HGRID" styles="Anim2"/> <apply toObject="DATALABELS" styles="DataShadow,Anim2"/> </application> </styles> </chart> '; echo $chart; }
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; } }
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 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>
</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 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">';
?> <?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>'; } } ?>
?> </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> <!-- 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;">
?> <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
</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">
/** * @return \yii\db\ActiveQuery */ public function getBatches() { return $this->hasMany(Batches::className(), ['updated_by' => 'user_id']); }
<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>
static function deleteBatchById($batchId) { return Batches::where('id', '=', $batchId)->delete(); }
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); }
public function getbatchname() { $batches = Batches::model()->findByAttributes(array('id' => $this->batch_id, 'is_deleted' => 0)); return $this->name . '(' . $batches->name . ')'; }
} ?> <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>
<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 }