示例#1
0
    
    </td>
    <td valign="top">
    <div class="cont_right formWrapper">
    <h1><?php 
echo Yii::t('fees', 'Transaction Details');
?>
</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(FinanceFeeCollections::model()->findAll("is_deleted=:y", array(':y' => 0)), 'id', 'name');
if (isset($_REQUEST['collection'])) {
    $sel = $_REQUEST['collection'];
} else {
    $sel = '';
}
echo '<span style="font-size:14px; font-weight:bold; color:#666;">' . Yii::t('fees', 'Collection') . '</span>&nbsp;&nbsp;&nbsp;&nbsp;<br>';
echo CHtml::dropDownList('id', '', $data, array('prompt' => 'Select', 'onchange' => 'collection()', 'id' => 'collection', 'options' => array($sel => array('selected' => true))));
echo '</td></tr><tr><td style="padding-top:13px;">';
?>

<?php 
$data_1 = array();
if (isset($_REQUEST['collection'])) {
    $data_1 = CHtml::listData(FinanceTransaction::model()->findAll("collection_id=:x", array(':x' => $_REQUEST['collection'])), 'id', 'student_id');
}
 public function actionAjax_delete()
 {
     $id = $_POST['id'];
     $deleted = $this->loadModel($id);
     if ($deleted->delete()) {
         FinanceFeeParticulars::model()->DeleteAllByAttributes(array('finance_fee_category_id' => $id));
         //FinanceFeeCollections::model()->DeleteAllByAttributes(array('fee_category_id'=>$id));
         $fee_collections = FinanceFeeCollections::model()->findAllByAttributes(array('fee_category_id' => $id));
         foreach ($fee_collections as $fee_collection) {
             FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $fee_collection->id));
             FinanceTransaction::model()->deleteAll('collection_id=:x', array(':x' => $fee_collection->id));
         }
         FinanceFeeCollections::model()->DeleteAllByAttributes(array('fee_category_id' => $id));
         echo json_encode(array('success' => true));
         exit;
     } else {
         echo json_encode(array('success' => false));
         exit;
     }
 }
 public function actionAjax_Create()
 {
     if (isset($_POST['FinanceFeeParticulars'])) {
         //return the JSON result to provide feedback.
         $list = $_POST['FinanceFeeParticulars'];
         $count = sizeof($list['id']);
         for ($i = 0; $i < $count; $i++) {
             $model = new FinanceFeeParticulars();
             //set the submitted values
             $model->attributes = $_POST['FinanceFeeParticulars'];
             $model->student_category_id = $list['id'][$i];
             $model->amount = str_replace(",", "", $model->amount);
             if ($model->save(false)) {
                 $finance_fee_collections = FinanceFeeCollections::model()->findAll(array('condition' => 'fee_category_id = :id', 'params' => array(':id' => $model->finance_fee_category_id)));
                 foreach ($finance_fee_collections as $finance_fee_collection) {
                     $finance_fees = FinanceFees::model()->findAll(array('condition' => 'fee_collection_id = :id', 'params' => array(':id' => $finance_fee_collection->id)));
                     foreach ($finance_fees as $finance_fee) {
                         $finance_fee->is_paid = 0;
                         $finance_fee->save(false);
                     }
                 }
             }
         }
         echo json_encode(array('success' => true, 'id' => $model->primaryKey));
         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'));
     }
 }
示例#5
0
        </tr>
         <?php 
$res = FinanceFees::model()->findAll(array('condition' => 'student_id=:vwid AND is_paid=:vpid', 'params' => array(':vwid' => $_REQUEST['id'], ':vpid' => 1)));
if (count($res) == 0) {
    ?>
    	<tr>
          <td colspan="3"><?php 
    echo Yii::t('students', 'No details of the fees paid available.');
    ?>
</td>             
        </tr>
	<?php 
} else {
    foreach ($res as $res_1) {
        $amount = 0;
        $posts = FinanceFeeCollections::model()->findByAttributes(array('id' => $res_1->fee_collection_id));
        $cat = FinanceFeeCategories::model()->findByAttributes(array('id' => $posts->fee_category_id));
        /*$particular = FinanceFeeParticulars::model()->findAllByAttributes(array('finance_fee_category_id'=>$posts->fee_category_id));
        		if($particular!=NULL)
        		{
        			foreach($particular as $particulars)
        			{
        				$amount = $amount+$particulars->amount;
        			}
        		}*/
        ?>
		  
			<tr>
			  <td><?php 
        if (@$cat) {
            echo $cat->name;
示例#6
0
$this->renderPartial('//assesments/left_side');
?>
    
    </td>
    <td valign="top">
    <div class="cont_right formWrapper">
    
    <h1>Create Additional View</h1>
    
    <div class="formCon" style="width:60%">

    <div class="formConInner">
    <?php 
if (isset($_REQUEST['id'])) {
    $posts_1 = FinanceFeeCategories::model()->findByAttributes(array('id' => $_REQUEST['id']));
    $posts = FinanceFeeCollections::model()->findByAttributes(array('fee_category_id' => $posts_1->id));
    ?>
	<table width="50%">
    <tr>
     <td>Category Name</td>
     <td></td>
     <td><?php 
    echo $posts_1->name;
    ?>
</td>
    </tr>
    <tr>
     <td>Description</td>
     <td></td>
     <td><?php 
    echo $posts_1->description;
示例#7
0
 $batch = $_REQUEST['batch'];
 $student_category_list = Yii::app()->db->createCommand('select id,name from student_categories')->queryAll();
 $categ = array();
 foreach ($student_category_list as $stu_cat) {
     $categ[$stu_cat["id"]] = $stu_cat["name"];
 }
 $student_list = Yii::app()->db->createCommand('select students.id from students where batch_id=:batch_id')->bindValue('batch_id', $batch)->queryAll();
 $student_count = count($students_list);
 $student_arr_1 = array();
 foreach ($student_list as $student) {
     foreach ($student as $item) {
         array_push($student_arr_1, $item);
         // Get the ids of students and push into an array
     }
 }
 $collection = FinanceFeeCollections::model()->findByAttributes(array('id' => $_REQUEST['collection']));
 //$particular = FinanceFeeParticulars::model()->findByAttributes(array('finance_fee_category_id'=>$collection->fee_category_id));
 $particular = FinanceFeeParticulars::model()->findAll("finance_fee_category_id=:x", array(':x' => $collection->fee_category_id));
 $currency = Configurations::model()->findByPk(5);
 if (count($particular) != 0) {
     //$amount = 0;
     $list = FinanceFees::model()->findAll("fee_collection_id=:x", array(':x' => $_REQUEST['collection']));
     $student_arr_2 = array();
     foreach ($list as $item) {
         array_push($student_arr_2, $item->student_id);
         // Push the students present in Finance fees tables
     }
     foreach ($student_arr_2 as $student) {
         if (!in_array($student, $student_arr_1)) {
             $command = Yii::app()->db->createCommand('delete from finance_fees where student_id=:id and fee_collection_id=:coll_id and date is null')->bindValue('id', $student)->bindValue('coll_id', $_REQUEST['collection']);
             $command->execute();
 public function actionSendsms()
 {
     /*echo 'Batch ID: '.$_REQUEST['batch_id'].'<br/>';
     		echo 'Fee Collection ID: '.$_REQUEST['collection'].'<br/>';
     		echo 'Days in between: '.$_REQUEST['date_status'].'<br/>';
     		echo 'Amount: '.$_REQUEST['amount'].'<br/>';*/
     $sms_settings = SmsSettings::model()->findAll();
     if ($sms_settings[0]->is_enabled == '1' and $sms_settings[7]->is_enabled == '1') {
         // Checking if SMS is enabled.
         $collection = FinanceFeeCollections::model()->findByAttributes(array('id' => $_REQUEST['collection']));
         /*echo 'Fees Name: '.$collection->name.'<br/>';
         		echo 'Due Date: '.$collection->due_date.'<br/>';*/
         $unpaid_students = FinanceFees::model()->findAll("fee_collection_id=:x and is_paid=:y", array(':x' => $_REQUEST['collection'], ':y' => 0));
         //echo 'Total unpaid students: '.count($unpaid_students).'<br/><br/>';
         foreach ($unpaid_students as $unpaid_student) {
             //echo 'Student ID: '.$unpaid_student->student_id.'<br/>';
             $student = Students::model()->findByAttributes(array('id' => $unpaid_student->student_id));
             $guardian = Guardians::model()->findByAttributes(array('ward_id' => $student->id));
             /*echo 'Name: '.$student->first_name.'<br/>';
             		echo 'Phone 1: '.$student->phone1.'<br/>';*/
             $to_parent = '';
             $to_student = '';
             $message = '';
             if (count($guardian) != 0 and $guardian->mobile_phone != NULL) {
                 // If guardian is added
                 $to_parent = $guardian->mobile_phone;
             }
             if ($student->phone1) {
                 // Checking if phone number is provided
                 $to_student = $student->phone1;
             } elseif ($student->phone2) {
                 $to_student = $student->phone2;
             }
             //echo 'Message To: '.$to.'<br/>';
             $college = Configurations::model()->findByPk(1);
             $from = $college->config_value;
             // Checking the days between the current date and due date. And, the customising the message accordingly
             if ($_REQUEST['date_status'] < 1) {
                 $message = 'Last date for the payment of [' . $collection->name . '] fees was ' . $collection->due_date;
             } elseif ($_REQUEST['date_status'] > 1 and $_REQUEST['date_status'] <= 7) {
                 $message = 'Last date for the payment of [' . $collection->name . '] fees is ' . $collection->due_date;
             } elseif ($_REQUEST['date_status'] == 1) {
                 $message = 'Last date for the payment of [' . $collection->name . '] fees is today. i.e.,' . $collection->due_date;
             }
             //echo 'Message: '.$message.'<br/><br/>';
             if ($message != '' && 0) {
                 // Send SMS if message is set
                 if ($to_parent != '') {
                     // If unpaid and parent phone number is provided, send SMS
                     SmsSettings::model()->sendSms($to_parent, $from, $message);
                 }
                 // End check if parent phone number is provided
                 if ($to_student != '') {
                     // If unpaid and student phone number is provided, send SMS
                     SmsSettings::model()->sendSms($to_student, $from, $message);
                 }
                 // End check if student phone number is provided
                 Yii::app()->user->setFlash('notification', 'SMS send Successfully!');
             }
             // End check if message is set
         }
         // End for each student
         //exit;
     }
     // End check whether SMS is enabled
     $this->redirect(array('unpaid', 'batch' => $_REQUEST['batch_id'], 'course' => $_REQUEST['collection']));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Students();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Students'])) {
         $model->attributes = $_POST['Students'];
         $list = $_POST['Students'];
         if ($model->admission_date) {
             $model->admission_date = date('Y-m-d', strtotime($model->admission_date));
         }
         if ($model->date_of_birth) {
             $model->date_of_birth = date('Y-m-d', strtotime($model->date_of_birth));
         }
         //$model->photo_data=CUploadedFile::getInstance($model,'photo_data');
         if ($file = CUploadedFile::getInstance($model, 'photo_data')) {
             $model->photo_file_name = $file->name;
             $model->photo_content_type = $file->type;
             $model->photo_file_size = $file->size;
             $model->photo_data = file_get_contents($file->tempName);
         }
         /*else{
         	  if(isset($_POST['photo_file_name'])){
                      $model->photo_file_name=$_POST['photo_file_name'];
         		  $model->photo_content_type=$_POST['photo_content_type'];
         		  $model->photo_file_size=$_POST['photo_file_size'];
         		  $model->photo_data=hex2bin($_POST['photo_data']);
         	  }
           }*/
         //echo $model->photo_data.'----';
         /*if(isset($_FILES['Students']))
         		{
         			print_r($_FILES['Students']);
         			exit;
         			$tmpName = $_FILES['Students']['tmp_name'];
         		  $fp      = fopen($tmpName, 'r');
         		  $data = fread($fp, filesize($tmpName));
         		  $data = addslashes($data);
         		  fclose($fp);
         		  $model->photo_data = $data;
         		}*/
         if ($model->save()) {
             //adding user for current student
             $user = new User();
             $profile = new Profile();
             $user->username = substr(md5(uniqid(mt_rand(), true)), 0, 10);
             $user->email = $model->email;
             $user->activkey = UserModule::encrypting(microtime() . $model->first_name);
             $password = substr(md5(uniqid(mt_rand(), true)), 0, 10);
             $user->password = UserModule::encrypting($password);
             $user->superuser = 0;
             $user->status = 1;
             if ($user->save()) {
                 //assign role
                 $authorizer = Yii::app()->getModule("rights")->getAuthorizer();
                 $authorizer->authManager->assign('student', $user->id);
                 //profile
                 $profile->firstname = $model->first_name;
                 $profile->lastname = $model->last_name;
                 $profile->user_id = $user->id;
                 $profile->save();
                 //saving user id to students table.
                 $model->saveAttributes(array('uid' => $user->id));
                 // for sending sms
                 $sms_settings = SmsSettings::model()->findAll();
                 $to = '';
                 if ($sms_settings[0]->is_enabled == '1' and $sms_settings[2]->is_enabled == '1') {
                     // Checking if SMS is enabled.
                     if ($model->phone1) {
                         $to = $model->phone1;
                     } elseif ($model->phone2) {
                         $to = $model->phone2;
                     }
                     if ($to != '') {
                         // Send SMS if phone number is provided
                         $college = Configurations::model()->findByPk(1);
                         $from = $college->config_value;
                         $message = 'Welcome to ' . $college->config_value;
                         SmsSettings::model()->sendSms($to, $from, $message);
                     }
                     // End send SMS
                 }
                 // End check if SMS is enabled
                 UserModule::sendMail($model->email, UserModule::t("You are registered from {site_name}", array('{site_name}' => Yii::app()->name)), UserModule::t("Please login to your account with your email id as username and password {password}", array('{password}' => $password)));
             }
             // for saving in fee table
             $fee_collection = FinanceFeeCollections::model()->findAll('batch_id=:x', array(':x' => $model->batch_id));
             if ($fee_collection != NULL) {
                 for ($i = 0; $i < count($fee_collection); $i++) {
                     $fee = new FinanceFees();
                     $fee->fee_collection_id = $fee_collection[$i]['id'];
                     $fee->student_id = $model->id;
                     $fee->is_paid = '0';
                     $fee->save();
                 }
             }
             $this->redirect(array('guardians/create', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function actionRemove()
 {
     $val = $_GET['val1'];
     $model = Batches::model()->findByPk($val);
     $model->is_active = 0;
     $model->is_deleted = 1;
     $model->employee_id = ' ';
     if ($model->save()) {
         // Student Deletion
         $students = Students::model()->findAllByAttributes(array('batch_id' => $model->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' => $model->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' => $model->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' => $model->id));
         foreach ($collections as $collection) {
             // Finance Fees Deletion
             $student_fees = FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $collection->id));
             $collection->delete();
             // Fee Collection Deleted
         }
         //Fee Category Deletion
         $categories = FinanceFeeCategories::model()->findAllByAttributes(array('batch_id' => $model->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' => $model->id));
         //Class Timings Deletion
         $class_timings = ClassTimings::model()->DeleteAllByAttributes(array('batch_id' => $model->id));
         //Delete Weekdays
         $weekdays = Weekdays::model()->DeleteAllByAttributes(array('batch_id' => $model->id));
     }
     echo $val;
 }
 public function actionAjax_Create()
 {
     if (isset($_POST['FinanceFeeCollections'])) {
         $list = $_POST['FinanceFeeCollections'];
         $model = new FinanceFeeCollections();
         $model->attributes = $_POST['FinanceFeeCollections'];
         if ($model->start_date) {
             $model->start_date = date('Y-m-d', strtotime($model->start_date));
         }
         if ($model->end_date) {
             $model->end_date = date('Y-m-d', strtotime($model->end_date));
         }
         if ($model->due_date) {
             $model->due_date = date('Y-m-d', strtotime($model->due_date));
         }
         $cat = FinanceFeeCategories::model()->findByAttributes(array('id' => $list['fee_category_id']));
         $model->batch_id = $cat->batch_id;
         //return the JSON result to provide feedback.
         $student = Students::model()->findAll("batch_id=:x and is_active=:y and is_deleted=:z", array(':x' => $cat->batch_id, ':y' => 1, ':z' => 0));
         if ($model->save(false)) {
             foreach ($student as $students) {
                 $finance = new FinanceFees();
                 $finance->fee_collection_id = $model->id;
                 $finance->student_id = $students->id;
                 $finance->is_paid = 0;
                 $finance->save();
             }
             echo json_encode(array('success' => true, 'id' => $model->primaryKey));
             exit;
         } else {
             echo json_encode(array('success' => false));
             exit;
         }
     }
 }
示例#12
0
echo $student->admission_no;
?>
                    </td>
                </tr>
                <tr>
                	<td colspan="4">&nbsp;</td>
                </tr>
                <tr>
                	<td class="partial_fee_heading">
                    	<?php 
echo Yii::t('fees', 'Fees :');
?>
                    </td>
                    <td align="left">
                    	<?php 
$collection = FinanceFeeCollections::model()->findByAttributes(array('id' => $model->fee_collection_id));
$currency = Configurations::model()->findByPk(5);
$check_admission_no = FinanceFeeParticulars::model()->findAllByAttributes(array('finance_fee_category_id' => $collection->fee_category_id, 'admission_no' => $student->admission_no));
if (count($check_admission_no) > 0) {
    // If any particular is present for this student
    $adm_amount = 0;
    foreach ($check_admission_no as $adm_no) {
        $adm_amount = $adm_amount + $adm_no->amount;
    }
    $fees = $adm_amount;
    //echo $adm_amount.' '.$currency->config_value;
    $balance = $adm_amount - $model->fees_paid;
} else {
    // If any particular is present for this student category
    $check_student_category = FinanceFeeParticulars::model()->findAllByAttributes(array('finance_fee_category_id' => $collection->fee_category_id, 'student_category_id' => $student->student_category_id, 'admission_no' => ''));
    if (count($check_student_category) > 0) {
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Students();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Students'])) {
         $model->attributes = $_POST['Students'];
         $list = $_POST['Students'];
         if ($model->admission_date) {
             $model->admission_date = date('Y-m-d', strtotime($model->admission_date));
         }
         if ($model->date_of_birth) {
             $model->date_of_birth = date('Y-m-d', strtotime($model->date_of_birth));
         }
         //$model->photo_data=CUploadedFile::getInstance($model,'photo_data');
         if ($file = CUploadedFile::getInstance($model, 'photo_data')) {
             $model->photo_file_name = $file->name;
             $model->photo_content_type = $file->type;
             $model->photo_file_size = $file->size;
             $model->photo_data = file_get_contents($file->tempName);
         }
         /*else{
         	  if(isset($_POST['photo_file_name'])){
                      $model->photo_file_name=$_POST['photo_file_name'];
         		  $model->photo_content_type=$_POST['photo_content_type'];
         		  $model->photo_file_size=$_POST['photo_file_size'];
         		  $model->photo_data=hex2bin($_POST['photo_data']);
         	  }
           }*/
         //echo $model->photo_data.'----';
         /*if(isset($_FILES['Students']))
         		{
         			print_r($_FILES['Students']);
         			exit;
         			$tmpName = $_FILES['Students']['tmp_name'];
         		  $fp      = fopen($tmpName, 'r');
         		  $data = fread($fp, filesize($tmpName));
         		  $data = addslashes($data);
         		  fclose($fp);
         		  $model->photo_data = $data;
         		}*/
         if ($model->save()) {
             //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, '3', $model->id, ucfirst($model->first_name) . ' ' . ucfirst($model->middle_name) . ' ' . ucfirst($model->last_name), NULL, NULL, NULL);
             //adding user for current student
             $user = new User();
             $profile = new Profile();
             $user->username = substr(md5(uniqid(mt_rand(), true)), 0, 10);
             $user->email = $model->email;
             $user->activkey = UserModule::encrypting(microtime() . $model->first_name);
             $password = substr(md5(uniqid(mt_rand(), true)), 0, 10);
             $user->password = UserModule::encrypting($password);
             $user->superuser = 0;
             $user->status = 1;
             if ($user->save()) {
                 //assign role
                 $authorizer = Yii::app()->getModule("rights")->getAuthorizer();
                 $authorizer->authManager->assign('student', $user->id);
                 //profile
                 $profile->firstname = $model->first_name;
                 $profile->lastname = $model->last_name;
                 $profile->user_id = $user->id;
                 $profile->save();
                 //saving user id to students table.
                 $model->saveAttributes(array('uid' => $user->id));
                 // UserModule::sendMail($model->email,UserModule::t("You are registered from {site_name}",array('{site_name}'=>Yii::app()->name)),UserModule::t("Please login to your account with your email id as username and password {password}",array('{password}'=>$password)));
             }
             // for saving in fee table
             $fee_collection = FinanceFeeCollections::model()->findAll('batch_id=:x', array(':x' => $model->batch_id));
             if ($fee_collection != NULL) {
                 for ($i = 0; $i < count($fee_collection); $i++) {
                     $fee = new FinanceFees();
                     $fee->fee_collection_id = $fee_collection[$i]['id'];
                     $fee->student_id = $model->id;
                     $fee->is_paid = '0';
                     $fee->save();
                 }
             }
             if (defined('EMAIL_ALERT_ADDRESS')) {
                 $name = $model->first_name . " " . $model->last_name;
                 UserModule::sendMail(constant('EMAIL_ALERT_ADDRESS'), UserModule::t("New student admitted : {student_name}", array('{student_name}' => $name)), UserModule::t("A new student has been admitted: {student_name}", array('{student_name}' => $name)));
             }
             $this->redirect(array('guardians/create', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
示例#14
0
         <th><strong><?php 
    echo Yii::t('fees', 'Student Name');
    ?>
</strong></th>
         <th><strong><?php 
    echo Yii::t('fees', 'Paticulars');
    ?>
</strong></th>
          <th><strong><?php 
    echo Yii::t('fees', 'Amount');
    ?>
</strong></th>
        </tr>
        <?php 
    foreach ($list as $list_1) {
        $collection = FinanceFeeCollections::model()->findAllByAttributes(array('batch_id' => $list_1->batch_id));
        for ($i = 0; $i < count($collection); $i++) {
            $particular = FinanceFeeParticulars::model()->findAll("finance_fee_category_id=:x", array(':x' => $collection[$i]->fee_category_id));
            $list = FinanceFees::model()->findAll("fee_collection_id=:x", array(':x' => $collection[$i]->id));
        }
        $k = 1;
        for ($j = 0; $j < count($particular); $j++) {
            $amount = $amount + $particular[$i]->amount;
            $k++;
        }
    }
    ?>
        <tr>
        	<td><?php 
    echo $i;
    ?>