本文整理汇总了PHP中Batches类的典型用法代码示例。如果您正苦于以下问题:PHP Batches类的具体用法?PHP Batches怎么用?PHP Batches使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Batches类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBatch
function getBatch($id)
{
$batch = Batches::model()->findByAttributes(array("id" => $id));
if ($batch != NULL) {
echo $batch->name;
}
}
示例2: actionCreate
/**
* 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));
}
示例3: actionIndex
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));
}
示例4: getScheduleCountForBatch
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();
}
示例5: actionIndex
/**
* 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));
}
示例6: getweek
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>';
示例7: edit_batch
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);
}
示例8: actionDelete
/**
* 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.');
}
}
示例9:
///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>
示例10: array
?>
</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;">
示例11: array
} 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">
示例12: actionStudentmonthlypdf
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);
}
示例13: get
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;
}
示例14: actionAjax_Create
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;
}
}
示例15: actionDeactivate
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'));
}
}