/** * * Переобъявляем сохранение * **/ public function save() { $student = Students::model()->findByPk(Yii::app()->my->id); $student->settings = json_encode($this->_attributes); $student->save(); $_SESSION["settings"] = $student->settings; }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { if (isset($_POST['idProfile']) && isset($_POST['idEssay']) && isset($_POST['stardate']) && isset($_POST['enddate'])) { if (!empty($_POST['idProfile']) && !empty($_POST['idEssay']) && !empty($_POST['stardate']) && !empty($_POST['enddate'])) { $essay = $this->loadModel($id); $model = new EssaysHasCrugeUser(); $idStudent = Students::model()->find('profile_id=' . $_POST['idProfile'])->id; $model->status = 1; $model->stardate = strtotime($_POST['stardate']); $model->enddate = strtotime($_POST['enddate']); $model->essays_id = $_POST['idEssay']; $model->title_essay = $essay->getNameTitleEssay($idStudent, $essay->colleges_has_majors_colleges_id, $essay->type_essay_id, $_POST['idEssay']); $model->students_id = $idStudent; /* echo "<pre>"; echo print_r($model->enddate); echo "</pre>"; Yii::app()->end(); */ if ($model->save()) { Yii::app()->user->setFlash('save', 'El Estudiante se ha agregado correctamente.'); $this->redirect(array('view', 'id' => $model->essays_id)); } } Yii::app()->user->setFlash('error', 'Debe seleccionar un Estudiante, la fecha de inicio y culminación del Essay.'); $this->redirect(array('view', 'id' => $_POST['idEssay'])); } $this->render('view', array('model' => $this->loadModel($id))); }
public function studentname($data, $row) { $student = Students::model()->findByAttributes(array('id' => $data->student_id)); if ($student != NULL) { return ucfirst($student->first_name) . ' ' . ucfirst($student->last_name); } else { return '-'; } }
public function actionBatch() { if (isset($_POST['batch'])) { $data = Students::model()->findAll('batch_id=:x', array(':x' => $_POST['batch'])); } // echo CHtml::tag('option', array('value' => 0), CHtml::encode('Select'), true); $data = CHtml::listData($data, 'id', 'phone1'); foreach ($data as $phoneno) { if ($phoneno != "") { echo $phoneno; echo ","; } } }
public function actionAddpoint($id) { $student = Students::model()->findByPk($id); $bonus = new Points(); if (isset($_REQUEST['Points'])) { $data = $_REQUEST['Points']; $bonus->student = $data['student']; $bonus->earned = $data['earned']; $bonus->comment = $data['comment']; $bonus->by = $data['by']; if ($bonus->save()) { Yii::app()->notify->add("Бонус добавлен"); } else { Yii::app()->notify->addErrors($bonus->getErrors()); } } $this->render('addpoint', array('student' => $student, "point" => $bonus)); }
public function actionStudent() { if (isset($_POST['studentuser'])) { $students = Students::model()->findAll(array('condition' => 'uid=:x and is_deleted=:y', 'params' => array(':x' => 0, ':y' => 0), 'limit' => '1000', 'order' => 'id ASC')); if ($students != NULL) { foreach ($students as $student) { $user = new User(); $profile = new Profile(); if ($student->email != NULL) { $user->username = substr(md5(uniqid(mt_rand(), true)), 0, 10); $user->email = $student->email; $user->activkey = UserModule::encrypting(microtime() . $student->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 = $student->first_name; $profile->lastname = $student->last_name; $profile->user_id = $user->id; $profile->save(); //saving user id to students table. $student->saveAttributes(array('uid' => $user->id)); UserModule::sendMail($student->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))); $flash = "User created successfully"; $type = 'success'; } } else { $flash = "No email id given"; $type = 'error'; } } } Yii::app()->user->setFlash($type, $flash); $this->redirect(array('/importcsv')); } else { $this->render('/default/student'); } }
/** * 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)); }
public function actionAddguardian() { $model = new Guardians(); if (isset($_POST['Guardians'])) { $list = $_POST['Guardians']; $student = Students::model()->findByAttributes(array("id" => $list['ward_id'])); $student->immediate_contact_id = $list['radio']; $student->save(); $this->redirect(array('studentPreviousDatas/create', 'id' => $list['ward_id'])); //$this->redirect(array('students/view','id'=>$list['ward_id'])); } $this->render('addguardian', array('model' => $model)); }
public function getNameTitleEssay($id, $idColleges, $idTypeEssay, $idEssay) { $numEssay = EssaysHasCrugeUser::model()->calcularEssay($id, $idEssay, $idColleges, $idTypeEssay); return Students::model()->getNameShort($id) . "-" . $this->getNameFileEssay($idColleges, $idTypeEssay) . $numEssay; }
/** * 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.'); } }
<?php $course = Courses::model()->findByAttributes(array('id' => $batch->course_id)); if ($course != NULL) { echo $course->course_name; } ?> </span> </li> </ul> <div class="clear"></div> </div> <div class="status_bx"> <ul> <li style="border-right:1px #d9e1e7 solid"><span><?php echo count(Students::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id']))); ?> </span><?php echo Yii::t('Batch', 'Students'); ?> </li> <li style="border-left:1px #fff solid;border-right:1px #d9e1e7 solid;"><span><?php echo count(Subjects::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id']))); ?> </span><?php echo Yii::t('Batch', 'Subjects'); ?> </li> <li style="border-left:1px #fff solid"><span><?php echo count(TimetableEntries::model()->findAll(array('condition' => 'batch_id=:x', 'group' => 'employee_id', 'params' => array(':x' => $_REQUEST['id'])))); ?>
?> <td style="width:auto; min-width:80px; text-align:center;"><?php if (count($list) > 7) { echo @$subject->code; } else { echo @$subject->name; } ?> </td> <?php } ?> </tr> <!-- End Table Headers --> <?php $students = Students::model()->findAllByAttributes(array('batch_id' => $batch_id, 'is_deleted' => 0, 'is_active' => 1)); if (isset($students) and $students != NULL) { foreach ($students as $student) { ?> <tr class=<?php echo $cls; ?> > <td> <?php echo $student->admission_no; ?> </td> <td> <?php echo CHtml::link(ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name), array('/students/students/view', 'id' => $student->id));
public function actionStudentindividualpdf() { $student_name = Students::model()->findByAttributes(array('id' => $_REQUEST['student'])); $pdf_name = ucfirst($student_name->first_name) . ' ' . ucfirst($student_name->last_name) . ' Student Attendance Report.pdf'; # HTML2PDF has very similar syntax $html2pdf = Yii::app()->ePdf->HTML2PDF(); $html2pdf->WriteHTML($this->renderPartial('studentindividualpdf', array(), true)); $html2pdf->Output($pdf_name); }
public function getStudentadm() { $student = Students::model()->findByAttributes(array('id' => $this->student_id)); return $student->admission_no; }
public function actionAutocomplete1() { if (isset($_GET['term'])) { $criteria = new CDbCriteria(); $criteria->alias = "last_name"; $criteria->condition = "last_name like '%" . $_GET['term'] . "%'"; $userArray = Students::model()->findAll($criteria); $hotels = Students::model()->findAll($criteria); $return_array = array(); foreach ($hotels as $hotel) { $return_array[] = array('label' => $hotel->last_name . ' ' . $hotel->first_name, 'value' => $hotel->last_name, 'id' => $hotel->id); } echo CJSON::encode($return_array); } }
function studentname($data, $row) { $posts = Students::model()->findAllByAttributes(array('parent_id' => $data->id)); if ($posts != NULL) { $students = array(); foreach ($posts as $post) { echo $post->first_name . ' ' . $post->last_name . '<br/>'; } } else { return '-'; } }
public function actionAutocomplete() { if (isset($_GET['term'])) { $criteria = new CDbCriteria(); $criteria->alias = "first_name"; $criteria->condition = "first_name like '" . $_GET['term'] . "%'" . " or last_name like '" . $_GET['term'] . "%'"; $criteria->addSearchCondition('is_active', 1); $criteria->addSearchCondition('is_deleted', 0); $criteria->order = 'first_name ASC'; $Students = Students::model()->findAll($criteria); $return_array = array(); foreach ($Students as $Student) { $return_array[] = array('label' => ucfirst($Student->first_name) . ' ' . ucfirst($Student->middle_name) . ' ' . ucfirst($Student->last_name), 'id' => $Student->id); } echo CJSON::encode($return_array); Yii::app()->end(); } }
</table> <table width="100%" cellspacing="0" cellpadding="0" class="attendance_table"> <tr style="background:#dfdfdf;"> <td><?php echo Yii::t('attendance', 'Name'); ?> </td> <?php for ($i = 1; $i <= $num; $i++) { echo '<td>' . getweek($i, $_REQUEST['mon'], $_REQUEST['year']) . '<span>' . $i . '</span></td>'; } ?> </tr> <?php $posts = Students::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])); $j = 0; foreach ($posts as $posts_1) { if ($j % 2 == 0) { $class = 'class="odd"'; } else { $class = 'class="even"'; } ?> <tr <?php echo $class; ?> > <td class="name"><?php echo $posts_1->first_name; ?>
public function actionPdf1() { $student = Students::model()->findByAttributes(array('id' => $_REQUEST['id'])); $student = $student->first_name . ' ' . $student->last_name . ' Attendance.pdf'; # HTML2PDF has very similar syntax $html2pdf = Yii::app()->ePdf->HTML2PDF(); $html2pdf->WriteHTML($this->renderPartial('attentstud', array(), true)); $html2pdf->Output($student); //////////////////////////////////////////////////////////////////////////////////// }
public function actionAjax_delete() { $id = $_POST['id']; $deleted = $this->loadModel($id); $deleted_batch_id = $deleted->batch_id; // Saving the id of the batch that is going to be deleted. if ($deleted->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, '13', $deleted_batch_id, ucfirst($deleted->name), NULL, NULL, NULL); // For SMS $sms_settings = SmsSettings::model()->findAll(); $to = ''; if ($sms_settings[0]->is_enabled == '1' and $sms_settings[5]->is_enabled == '1') { // Checking if SMS is enabled. $students = Students::model()->findAll("batch_id=:x", array(':x' => $deleted_batch_id)); //Selecting students of the batch foreach ($students as $student) { if ($student->phone1) { // Checking if phone number is provided $to = $student->phone1; } elseif ($student->phone2) { $to = $student->phone2; } if ($to != '') { // Sending SMS to each student $college = Configurations::model()->findByPk(1); $from = $college->config_value; $message = $deleted->name . ' is cancelled'; SmsSettings::model()->sendSms($to, $from, $message); } } } // End For SMS // Delete Exam and exam score $exam = Exams::model()->findAllByAttributes(array('exam_group_id' => $id)); //print_r($exam); foreach ($exam as $exam1) { $examscore = ExamScores::model()->findAllByAttributes(array('exam_id' => $exam1->id)); foreach ($examscore as $examscore1) { $examscore1->delete(); } $exam1->delete(); } // End Delete Exam and exam score echo json_encode(array('success' => true)); exit; } else { echo json_encode(array('success' => false)); exit; } }
font-size:15px; font-style:italic; text-shadow: 1px -1px 2px #862626; text-align:left; } .container{ background:#FFF; } </style> <div class="formCon"> <div class="formConInner"> <?php if (isset($_REQUEST['id'])) { $posts = Students::model()->findAll("batch_id=:x and is_active=:y and is_deleted=:z", array(':x' => $_REQUEST['id'], ':y' => 1, ':z' => 0)); ?> <?php if ($posts != NULL) { ?> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'exam-scores-form', 'enableAjaxValidation' => false)); if (Yii::app()->user->hasFlash('success')) { ?> <div class="infogreen_bx" style="margin:10px 0 10px 10px; width:575px;"><?php echo Yii::app()->user->getFlash('success'); ?> </div> <?php } else {
public function actionRemind() { $model = new BorrowBook(); $id = $_REQUEST['id']; $headers = ''; $loggeduser = User::model()->findByAttributes(array('id' => Yii::app()->user->id)); $student = Students::model()->findByAttributes(array('id' => $id)); $to = $student->email; $subject = 'Renewal of book'; $message = 'Your due date will expire within' . $_REQUEST['due'] . 'days. To avoid fine please renew your book'; $headers .= "From:" . $loggeduser->email . "\r\n"; $headers .= "X-Sender-IP: {$_SERVER['SERVER_ADDR']}\r\n"; $headers .= 'Date: ' . date('n/d/Y g:i A') . "\r\n"; mail($to, $subject, $message, $headers); }
public function actionRemove($id) { if (Yii::app()->request->isPostRequest) { // we only allow deletion via POST request //$this->loadModel($id)->delete(); $model = Students::model()->findByPk($id); $model->requirements_id = null; if ($model->save()) { Yii::app()->user->setFlash('remove', 'El Estudiante se ha removido correctamente.'); } $this->redirect(array('view', 'id' => $_POST['idx'])); //$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
<!--banner starts here--> <!--<section id="innerbanner"><img src="images/innerbanner.png" width="1000" height="168"></section>--> <!--banner ends here--> <!--midsection starts here--> <!--midsection ends here--> <!--innersection starts here--> <div id="parent_Sect"> <?php $this->renderPartial('leftside'); ?> <?php $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id)); $guard = Guardians::model()->findByAttributes(array('uid' => $user->id)); $student = Students::model()->findByAttributes(array('id' => $guard->ward_id)); $exam = ExamScores::model()->findAll("student_id=:x", array(':x' => $student->id)); ?> <div id="parent_rightSect"> <div class="parentright_innercon"> <h1><?php echo Yii::t('parentportal', 'Exams'); ?> </h1> <div class="profile_top"> <div class="prof_img"> <?php if ($student->photo_data != NULL) { echo '<img src="' . $this->createUrl('/students/Students/DisplaySavedImage&id=' . $student->primaryKey) . '" alt="' . $student->photo_file_name . '" width="100" height="103" />'; } else { echo '<img src="images/portal/prof-img001.png" alt=' . $student->first_name . ' width="100" height="103" />';
<td width="247" valign="top"> <?php $this->renderPartial('left_side'); ?> </td> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" width="75%"><div style="padding-left:20px;"> <h1>Accounting Dashboard</h1> <div class="overview"> <div class="overviewbox ovbox1"> <?php $total = Students::model()->findAll('is_deleted=:status', array(':status' => '0')); ?> <h1><strong>Total Students</strong></h1> <div class="ovrBtm"><?php echo count($total); ?> </div> </div> <div class="overviewbox ovbox2"> <h1><strong>New Admissions</strong></h1> <div class="ovrBtm">122</div> </div> <div class="overviewbox ovbox3"> <h1><strong>Pending Leads</strong></h1> <?php
?> </strong></th> <th><strong><?php echo Yii::t('fees', 'Date'); ?> </strong></th> <th><strong><?php echo Yii::t('fees', 'Receipt'); ?> </strong></th> </tr> <tr> <?php $i = 1; foreach ($list as $list_item) { $student = Students::model()->findByAttributes(array('id' => $list_item['student_id'])); $batch = Batches::model()->findByAttributes(array('id' => $student['batch_id'])); if ($batch != NULL) { $batch_name = $batch->name; } else { $batch_name = "-"; } echo '<td>' . $list_item['id'] . '</td>'; echo '<td>' . $student['admission_no'] . '</td>'; echo '<td>' . $batch_name . '</td>'; echo '<td>' . $list_item['amount'] . '</td>'; echo '<td>' . $list_item['transaction_date'] . '</td>'; echo '<td><a href="index.php?r=fees/FinanceFees/partialreceipt&id=' . $list_item['id'] . '" target="_blank">Print</a></td>'; ?>
<?php $criteria = new CDbCriteria(); $criteria->order = 'id DESC'; $total = Transportation::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(Yii::app()->params['listPerPage']); $pages->applyLimit($criteria); // the trick is here! $route = Transportation::model()->findAll($criteria); $page_size = Yii::app()->params['listPerPage']; ?> <?php //$route=Transportation::model()->findAll(); if ($route) { foreach ($route as $route1) { $student = Students::model()->findByAttributes(array('id' => $route1->student_id)); $stop = StopDetails::model()->findByAttributes(array('id' => $route1->stop_id)); $route = RouteDetails::model()->findByAttributes(array('id' => $stop->route_id)); ?> <td align="center"> <?php echo $student->last_name . ' ' . $student->first_name; ?> </td> <td align="center"> <?php echo $route->route_name; ?> </td>
</tr> </table> </td> </tr> </table> </div> <!-- End Header --> <?php if (isset($_REQUEST['id'])) { ?> <br /><br /> <span align="center"><h4>STUDENT ASSESSMENT REPORT</h4></span> <?php $student = Students::model()->findByAttributes(array('id' => $_REQUEST['id'], 'is_deleted' => 0, 'is_active' => 1)); ?> <!-- Batch details --> <div style="border:#CCC 1px; width:700px; padding:10px 10px; background:#E1EAEF;"> <table style="font-size:14px;"> <tr> <td style="width:100px;"><b><?php echo Yii::t('report', 'Student Name'); ?> </b></td> <td style="width:10px;">:</td> <td style="width:250px;"><?php echo ucfirst($student->first_name) . ' ' . ucfirst($student->last_name); ?> </td>
</script> <div id="parent_Sect"> <?php $this->renderPartial('leftside'); ?> <?php $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id)); $guardian = Guardians::model()->findByAttributes(array('uid' => Yii::app()->user->id)); $students = Students::model()->findAllByAttributes(array('parent_id' => $guardian->id)); if (count($students) == 1) { $student = Students::model()->findByAttributes(array('id' => $students[0]->id)); } elseif (isset($_REQUEST['id']) and $_REQUEST['id'] != NULL) { $student = Students::model()->findByAttributes(array('id' => $_REQUEST['id'])); } elseif (count($students) > 1) { $student = Students::model()->findByAttributes(array('id' => $students[0]->id)); } $exam = ExamScores::model()->findAll("student_id=:x", array(':x' => $student->id)); ?> <div id="parent_rightSect"> <div class="parentright_innercon"> <h1><?php echo Yii::t('parentportal', 'Exams'); ?> </h1> <div class="profile_top"> <div class="prof_img"> <?php if ($student->photo_data != NULL) { echo '<img src="' . $this->createUrl('/students/Students/DisplaySavedImage&id=' . $student->primaryKey) . '" alt="' . $student->photo_file_name . '" width="100" height="103" />'; } elseif ($student->gender == 'M') {
echo Yii::t('attendance', 'Course : ') . ($coursename = $course->course_name); ?> <table width="100%" cellspacing="0" cellpadding="0" class="attendance_table"> <tr style="background:#dfdfdf;"> <td><?php echo Yii::t('attendance', 'Name'); ?> </td> <?php for ($i = 1; $i <= $num; $i++) { echo '<td>' . getweek($i, $mon_num, $curr_year) . '<span>' . $i . '</span></td>'; } ?> </tr> <?php $posts = Students::model()->findByAttributes(array('id' => $_REQUEST['id'])); $class = 'class="even"'; ?> <tr <?php echo $class; ?> > <td class="name"><?php echo $posts->first_name; ?> </td> <?php for ($i = 1; $i <= $num; $i++) { echo '<td>'; /*$find = StudentAttentance::model()->findAll("date=:x AND student_id=:y", array(':x'=>$curr_year.$mon_num.'-'.$i,':y'=>$posts->id));*/ $find = StudentAttentance::model()->findAll("date=:x AND student_id=:y", array(':x' => $_REQUEST['year'] . '-' . $mon_num . '-' . $i, ':y' => $posts->id));