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