Exemple #1
0
 public function getClasses()
 {
     return ClassInfo::model()->findAllBySql('select class_info.*
           from class_info
           left join instructor_assignment
            on instructor_assignment.class_id = class_info.id
           where instructor_assignment.instructor_id = :iid
             and class_info.session_id = :sid', array('sid' => ClassSession::savedSessionId(), 'iid' => $this->id));
 }
Exemple #2
0
 public function getClasses()
 {
     return ClassInfo::model()->findAllBySql('select class_info.* 
           from signup
           left join class_info
            on signup.class_id = class_info.id
           where signup.student_id = :stid
             and class_info.session_id = :ssid', array('ssid' => ClassSession::savedSessionId(), 'stid' => $this->id));
 }
 public function actionAutoPopulate()
 {
     foreach (ClassInfo::model()->findAllBySQL("select class_info.* from class_info where session_id = :sess", array('sess' => ClassSession::savedSessionId())) as $model) {
         if ($model->active_mtg_count < 1) {
             $model->populate_meetings(Yii::app()->params['defaultNumMeetings']);
         }
     }
     //TODO: flash it!
     $this->redirect($this->redirect(Yii::app()->user->returnUrl));
 }
Exemple #4
0
	<div class="row">

        <?php 
echo $form->labelEx($model, 'class_id');
if (isset($model->class_id) && !$model->hasErrors()) {
    echo CHtml::encode($model->class->summary);
    echo $form->hiddenField($model, "class_id");
} else {
    $classparams = array();
    $constraint = "";
    if (isset($model->instructor_id)) {
        $classparams = array('condition' => 'company_id = :coid', 'params' => array(':coid' => $model->instructor->company_id));
        $constraint = " (this instructor is " . $model->instructor->company->name . ')';
    }
    echo $form->dropDownList($model, 'class_id', CHtml::listData(ClassInfo::model()->findAll($classparams), 'id', 'summary'));
    echo $constraint;
}
echo $form->error($model, 'class_id');
?>

	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'percentage');
?>
    <?php 
echo $form->textField($model, 'percentage', array('size' => 3, 'maxlength' => 3));
echo CHtml::encode(' %');
?>
Exemple #5
0
<h3>Choose class to copy from <?php 
echo $fromsession->summary;
?>
 to <?php 
echo ClassSession::current()->summary;
?>
 </h3>

     <?php 
echo CHtml::form();
echo CHtml::dropDownList('ClassInfo[id]', '', CHtml::listData(ClassInfo::model()->findAllBySql('select class_info.* from class_info where session_id = :sid', array('sid' => $fromsession->id)), 'id', 'summary'), array('submit' => '', 'empty' => 'Choose One'));
echo CHtml::submitButton('Change');
echo CHtml::endForm();
Exemple #6
0
<?php

return array('title' => 'Enter a check', 'showErrorSummary' => true, 'elements' => array('check' => array('type' => 'form', 'title' => 'Check Details', 'showErrorSummary' => true, 'elements' => array('amount' => array('type' => 'text', 'maxlength' => 20), 'check_num' => array('type' => 'text', 'maxlength' => 10), 'check_date' => array('type' => 'zii.widgets.jui.CJuiDatePicker', 'attribute' => 'check_date', 'model' => 'check', 'options' => array('showAnim' => 'fold', 'showButtonPanel' => true, 'autoSize' => true, 'dateFormat' => 'yy-mm-dd')), 'payee_id' => array('items' => CHtml::listData(Company::model()->findAll(), 'id', 'name'), 'type' => 'dropdownlist'), 'payer' => array('type' => 'text', 'maxlength' => 128), 'deposit_id' => array('items' => CHtml::listData(DepositDetails::model()->findAll(), 'id', 'deposited_date'), 'type' => 'dropdownlist'))), 'income' => array('type' => 'form', 'title' => 'Apply Payment', 'showErrorSummary' => true, 'elements' => array('student_id' => array('maxlength' => 10, 'prompt' => "Choose student...", 'items' => CHtml::listData(Student::model()->findAll(), 'id', 'full_name'), 'type' => 'dropdownlist'), 'class_id' => array('maxlength' => 10, 'prompt' => "Choose class...", 'items' => CHtml::listData(ClassInfo::model()->findAll(), 'id', 'class_name'), 'type' => 'dropdownlist'), 'amount' => array('type' => 'text', 'maxlength' => 10)))), 'buttons' => array('entry_form' => array('type' => 'submit', 'label' => 'Save')));
Exemple #7
0
	</div>



	<div class="row">
		<?php 
echo $form->labelEx($model, 'class_id');
?>

    <?php 
// I cannot use the multiendeddropdown here, because of the odd dropdown
if (isset($model->class_id) && !$model->hasErrors()) {
    echo CHtml::encode($model->class->summary);
    echo $form->hiddenField($model, "class_id");
} else {
    echo $form->dropDownList($model, 'class_id', array('In Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade >= min_grade_allowed and :grade <= max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary'), 'Outside Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade < min_grade_allowed or :grade > max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary')), array('class' => 'chzn-select', 'empty' => 'Choose One', 'ajax' => array('type' => 'POST', 'dataType' => 'json', 'data' => 'js:{id:$("#Signup_class_id").val()}', 'url' => CController::createUrl('ClassInfo/json'), 'success' => "function(data){\n\$('#Signup_additional_info').text( data['enrolled_count']  + ' signed up (' + data['max_students'] + ' max)');\nif(parseInt(data['enrolled_count']) > parseInt(data['max_students'])){\n    \$('#Signup_status').val('Waitlist');\n} else{\n    \$('#Signup_status').val('Enrolled');\n}\n;}")));
}
?>
 

		<?php 
echo $form->error($model, 'class_id');
?>
    <div id="Signup_additional_info" class="infoMessage" ></div>
	</div>





	<div class="row">
Exemple #8
0
<?php 
$es = $form->errorSummary($model);
if (isset($es)) {
    echo '<tr><td colspan="5">' . $es . '</td></tr>';
}
?>

<tr>
<td>
<?php 
// I cannot use the multiendeddropdown here, because of the odd dropdown
if (isset($model->class_id) && !$model->hasErrors()) {
    echo CHtml::encode($model->class->summary);
    echo $form->hiddenField($model, "[{$index}]class_id");
} else {
    echo $form->dropDownList($model, "[{$index}]class_id", array('In Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade >= min_grade_allowed and :grade <= max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary'), 'Outside Grade Range' => CHtml::listData(ClassInfo::model()->findAll('(:grade < min_grade_allowed or :grade > max_grade_allowed) and session_id = :sid', array('grade' => $model->student->grade, 'sid' => ClassSession::savedSessionId())), 'id', 'summary')), array('class' => 'chzn-select', 'empty' => "Choose a class"));
}
echo $form->error($model, "[{$index}]class_id");
echo '<div id="Signup_' . $index . '_additional_info"  >';
?>
 


</td>
<td>
<?php 
echo $form->textField($model, "[{$index}]signup_date", array('size' => 20));
echo $form->error($model, "[{$index}]signup_date");
?>

</td>
 public function actionIntegrityCheck()
 {
     $unassigned = CheckIncome::model()->findAllBySql("select check_income.*\nfrom check_income\nleft join  (select sum(income.amount) as total, \n                   income.check_id as check_id\n           from income\n           group by income.check_id) as assigned\non assigned.check_id = check_income.id\nwhere coalesce(assigned.total,0) != coalesce(check_income.amount,0)\nand (check_income.returned is null or check_income.returned < '2000-01-01')\nand check_income.session_id = :sid\n", array('sid' => ClassSession::savedSessionId()));
     $instructorbalance = ClassInfo::model()->findAllBySql("select class_info.*\nfrom class_info\nleft join  (select sum(instructor_assignment.percentage) as total, \n                   instructor_assignment.class_id as class_id\n           from instructor_assignment\n           group by instructor_assignment.class_id) as assigned\non assigned.class_id = class_info.id\nwhere coalesce(assigned.total,0) != 100\nand class_info.session_id = :sid\n", array('sid' => ClassSession::savedSessionId()));
     $this->render('integrity_check', array('unassigned' => $unassigned, 'instructorbalance' => $instructorbalance));
 }
Exemple #10
0
 public static function findAllWeekdays($weekdays, $session)
 {
     $classes = array();
     // only weekdays, no sat/sun
     foreach ($weekdays as $n) {
         // XXX the current session is hardcoded in here!
         // needs to be defaulted programatically and saved in cookie!
         foreach (ClassInfo::model()->findAllBySql("select class_info.* \nfrom class_info\nwhere class_info.day_of_week = :wkd\n      and class_info.session_id = :sess\norder by class_info.class_name\n; ", array('wkd' => $n, 'sess' => $session)) as $c) {
             $classes[$n][] = $c;
         }
     }
     return $classes;
 }
Exemple #11
0
 function getClasses()
 {
     return ClassInfo::model()->findAllBySql("select class_info.*\nfrom class_info\nleft join instructor_assignment\n   on instructor_assignment.class_id = class_info.id\nleft join instructor\n   on instructor_assignment.instructor_id = instructor.id\nwhere instructor.company_id = :id\n  and class_info.session_id = :sid\norder by class_info.class_name asc", array('id' => $this->id, 'sid' => ClassSession::savedSessionId()));
 }
 /**
  * Gives the class status as json
  */
 public function actionJson()
 {
     $model = ClassInfo::model()->findByPk($_POST['id']);
     echo CJSON::encode(array('min_grade_allowed' => $model->min_grade_allowed, 'max_grade_allowed' => $model->max_grade_allowed, 'min_students' => $model->min_students, 'max_students' => $model->max_students, 'cost_per_class' => $model->cost_per_class, 'enrolled_count' => $model->enrolled_count));
 }