/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function checkunique() { $record = ParentLogin::model()->findByAttributes(array('parent_user_name' => $this->user_organization_email_id)); if (!empty($record)) { $this->addError('user_organization_email_id', 'Email ID must be unique'); } }
public function authenticate() { $record = ParentLogin::model()->findByAttributes(array('parent_user_name' => $this->username)); if ($record === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if ($record->parent_password !== md5($this->password . $this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $record->parent_id; $this->errorCode = self::ERROR_NONE; } } return !$this->errorCode; }
public function actionChange() { $model=ParentLogin::model()->findByPk(Yii::app()->user->id); $model->setScenario('change'); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if(isset($_POST['ParentLogin'])) { $model->attributes=$_POST['ParentLogin']; $model->parent_password = md5($model->new_pass.$model->new_pass); if($model->save()) $this->redirect(array('/site/newdashboard')); } $this->render('change_password',array( 'model'=>$model, )); }
$AcademicTermPeriod = AcademicTermPeriod::model()->findByPk($student_transaction[0]->academic_term_period_id); $AcademicTerm = AcademicTerm::model()->findByPk($student_transaction[0]->academic_term_id); if($student_transaction[0]->student_transaction_nationality_id != null) $Nationality = Nationality::model()->findByPk($student_transaction[0]->student_transaction_nationality_id); else $Nationality = new Nationality; $Batch = Batch::model()->findByPk($student_transaction[0]->student_transaction_batch_id); $Course = Course::model()->findByPk($student_transaction[0]->course_id); if($student_transaction[0]->student_transaction_languages_known_id != null) $LanguagesKnown = LanguagesKnown::model()->findByPk($student_transaction[0]->student_transaction_languages_known_id); if($student_transaction[0]->student_transaction_student_address_id != null) $StudentAddress = StudentAddress::model()->findByPk($student_transaction[0]->student_transaction_student_address_id); else $StudentAddress = new StudentAddress; if($student_transaction[0]->student_transaction_parent_id != null || $student_transaction[0]->student_transaction_parent_id != 0) $parent = ParentLogin::model()->findByPk($student_transaction[0]->student_transaction_parent_id); else $parent = new ParentLogin; ?> <h3 class="title">Student Detail</h3> <table class="no_border"> <tr> <td rowspan='4' width="135px" align="center" style="border:1px solid #74b9f0;"> <img src="college_data/stud_images/<?php echo StudentPhotos::model()->findBypk($student_transaction[0]->student_transaction_student_photos_id)->student_photos_path; ?>" height="147px" width="129px" class="photo" /> </td> <td class="label" style="border:1.5px solid white;"><b>Name</b></td><td><?php echo $StudentInfo->title." ". $StudentInfo->student_first_name." ".$StudentInfo->student_middle_name." ".$StudentInfo->student_last_name;?></td>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model=ParentLogin::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }
<?php echo $form->textField($info,'student_guardian_occupation',array('size'=>13,'maxlength'=>50)); ?><span class="status"> </span> <?php echo $form->error($info,'student_guardian_occupation'); ?> </div> </div> <div class="row"> <div class="row-left"> <?php echo $form->labelEx($info,'student_guardian_income'); ?> <?php echo $form->textField($info,'student_guardian_income',array('size'=>13,'maxlength'=>15)); ?><span class="status"> </span> <?php echo $form->error($info,'student_guardian_income'); ?> </div> </div> <div class="row"> <?php if($model->student_transaction_parent_id != 0) $parent->parent_user_name = ParentLogin::model()->findByPk($model->student_transaction_parent_id)->parent_user_name; ?> <?php if (isset(Yii::app()->modules['parents'])) { ?> <?php echo $form->labelEx($parent,'parent_user_name'); ?> <?php echo $form->textField($parent,'parent_user_name',array('size'=>59,'maxlength'=>60)); ?><span class="status"> </span> <?php echo $form->error($parent,'parent_user_name'); ?> </div> <?php } ?> <div class="row"> <?php echo $form->labelEx($info,'student_guardian_occupation_address'); ?> <?php echo $form->textArea($info,'student_guardian_occupation_address',array('size'=>59,'maxlength'=>100,'style'=>'width:500px;height:80px;margin-bottom:15px')); ?><span class="status"> </span> <?php echo $form->error($info,'student_guardian_occupation_address'); ?> </div> <div class="row">
public function actionParentlogin() { $this->layout = 'login_layout'; if (Yii::app()->user->isGuest) { $login = new LoginUser(); $model = $this->captchaRequired() ? new LoginForm('parentcaptchaRequired') : new LoginForm('parentlogin'); if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; if ($model->validate() && $model->parentlogin()) { $login->user_id = Yii::app()->user->id; $loginuser = $login->user_id; $res = ParentLogin::model()->findByPk($loginuser); $studlogin = StudentTransaction::model()->findByAttributes(array('student_transaction_parent_id' => $res->parent_id)); Yii::app()->user->setState('stud_id', $studlogin->student_transaction_id); Yii::app()->user->setState('parent_id', $loginuser); Yii::app()->user->setState('org_id', $res->parent_organization_id); $login->status = 1; $login->log_in_time = new CDbExpression('NOW()'); $login->user_ip_address = $_SERVER['REMOTE_ADDR']; //$login->login_oraganization_id=$res->parent_organization_id; $login->save(); $this->redirect(array('parents/parent/studentprofile?id=' . $studlogin->student_transaction_id)); } else { $this->counter = Yii::app()->session->itemAt('captchaRequired') + 1; Yii::app()->session->add('captchaRequired', $this->counter); } } $this->render('parent_login', array('model' => $model)); } else { if (Yii::app()->user->getState('org_id') != NULL) { $this->redirect(array('site/dashboard')); } else { Yii::app()->user->logout(); $this->redirect(Yii::app()->homeUrl); } } }
public function checkOldPassword($attribute,$params) { $record=ParentLogin::model()->findByAttributes(array('parent_password'=>md5($this->current_pass.$this->current_pass))); if($record===null){ $this->addError($attribute, 'Invalid password'); } }