/** * Authenticates a user. * The example implementation makes sure if the username and password * are both 'demo'. * In practical applications, this should be changed to authenticate * against some persistent user identity storage (e.g. database). * @return boolean whether authentication succeeds. */ public function authenticate() { /** @var $model User */ $model = User::model()->find('email=LOWER(:email)', array(':email' => $this->name)); if ($model === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; $this->errorMessage = t('Sorry, An account was not found with that email address.'); } else { if (!$model->checkPassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; $this->errorMessage = t('Sorry, The password did not match to the one in our records.'); } else { $this->_id = $model->id; $this->errorCode = self::ERROR_NONE; // Set states $this->setState('name', $model->name); $this->setState('employee_id', $model->employee->id); $this->setState('email', $model->email); $this->setState('role', $model->role); $this->setState('role_approval', $model->role_approval); $employee = MastersEmployees::model()->findByPk($model->employee->id); $this->setState('department_id', $employee->department_id); $this->setState('outlet_id', $employee->outlet_id); } } return !$this->errorCode; }
public function loadModel($id) { $model = MastersEmployees::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function is_manager() { $employee = MastersEmployees::model()->findByAttributes(array('code' => $this->nik)); // $department = $employee->department_i_lead; // $outlet = $employee->outlet_i_lead; // $area = $employee->area_i_lead; if (!isset($employee->department_i_lead) and !isset($employee->outlet_i_lead) and !isset($employee->area_i_lead)) { $this->addError('nik', at('Sorry, That Employee is not manager name.')); } }
public function actionIndex() { $model = new PayrollSalary('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PayrollSalary'])) { $model->attributes = $_GET['PayrollSalary']; } $this->render('index', array('model' => $model, 'employee' => MastersEmployees::model()->findByPk(getUser()->id))); }
public function is_manager() { $employee = MastersEmployees::model()->findByAttributes(array('code' => $this->nik)); $department = $employee->department_i_lead; $outlet = $employee->outlet_i_lead; $area = $employee->area_i_lead; $role = User::model()->findByAttributes(array('employee_id' => $employee->id))->role; if (!$role == 'qa') { $this->addError('nik', at('Sorry, That Employee is not manager name.')); } }
public function setSchedulleDays($model) { if ($model->employee_id > 0) { $employee = MastersEmployees::model()->findByPk($model->employee_id); if (count($employee) == 0) { $model->employee_id = ''; } else { $c = new CDbCriteria(); $c->select = 'schedulle_date, DAY(schedulle_date) AS sch_day, shift_id'; $c->compare('employee_id', $model->employee_id); $c->compare('department_id', $employee->department_id); $c->compare('YEAR(schedulle_date)', $model->year); $c->compare('MONTH(schedulle_date)', $model->month + 1); $schedulles = AttendanceSchedulle::model()->findAll($c); foreach ($schedulles as $schedulle) { $model->days[$schedulle->sch_day] = $schedulle->shift_id; } } } return $model; }
public function actionIndex() { if (isset($_GET['token'])) { if ($_GET['token'] == $this->token) { $deptId = isset($_GET['dept']) ? $_GET['dept'] : ''; $outId = isset($_GET['out']) ? $_GET['out'] : ''; $c = new CDbCriteria(); if ($deptId != '') { $c->condition = "department_id = " . $deptId; } if ($outId != '') { $c->condition .= " AND outlet_id = " . $outId; } $model = MastersEmployees::model()->findAll($c); $payment = array(); foreach ($model as $pay) { $payment[] = array('id' => $pay->id, 'code' => $pay->code, 'fullName' => $pay->getFullname(), 'gender' => $pay->getGender(), 'type' => 'Workholder', 'department' => $pay->department->name, 'currentPosition' => 'tes', 'hiredate' => $pay->hiredate, 'yearOfService' => '0 Thn 11 Bln 29 Hr'); } echo json_encode($payment); } } }
public function actionChooseaa() { $model = MastersEmployees::model()->findByPk(1); echo $model->getFullName(); }
public function generateEmployeeId() { $hiredate = strtotime($this->hiredate); $code = date('ym', $hiredate); $c = new CDbCriteria(); $c->condition = 'code like :code'; $c->params = array(':code' => "{$code}%"); $c->select = 'MAX(CONVERT(RIGHT(code,3),UNSIGNED INTEGER)) AS last_number'; $model = MastersEmployees::model()->find($c); $last_number = count($model) > 0 ? $model->last_number + 1 : 1; return $code . MyHelper::numberString($last_number, 3, '0'); }
<a href="#" class="widget-control-right widget-remove" data-toggle="tooltip" data-placement="top" title="Remove Widget"><span class="fa fa-times"></span></a> </div> </div> <!-- END WIDGET MESSAGES --> </div> <div class="col-md-3"> <!-- START WIDGET REGISTRED --> <div class="widget widget-default widget-item-icon" onclick="location.href='pages-address-book.html';"> <div class="widget-item-left"> <span class="fa fa-user custom-widget"></span> </div> <div class="widget-data"> <div class="widget-int num-count"><?php echo count(MastersEmployees::model()->withActive()->findAll()); ?> </div> <div class="widget-title"><?php echo at('Total Employee'); ?> </div> <div class="widget-subtitle"><?php echo at('Active Employee'); ?> </div> </div> <div class="widget-controls"> <a href="#" class="widget-control-right widget-remove" data-toggle="tooltip" data-placement="top" title="Remove Widget"><span class="fa fa-times"></span></a> </div> </div>
<?php echo CHtml::activeTextField($model, 'gender', array('size' => 60, 'maxlength' => 100, 'class' => 'validate[required] form-control')); ?> <?php echo CHtml::error($model, 'gender'); ?> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'address_id', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeDropDownList($model, 'address_id', MastersEmployees::model()->findByPk(getUser()->id)->getArrayAddress(), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'class' => 'validate[required] form-control select')); ?> <?php echo CHtml::error($model, 'address_id'); ?> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'birthplace_country_id', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeDropDownList($model, 'birthplace_country_id', CHtml::listData(ReferenceGeoCountries::model()->byOrder()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select', 'ajax' => array('type' => 'GET', 'url' => array('geography/countries/dynamicStates'), 'data' => array('id' => 'js:this.value'), 'success' => 'function(data){ updateDropdown(this, $("#' . $form_name . '_birthplace_state_id"), data);
public function fill($id) { $employee = MastersEmployees::model()->findByPk($id); $this->employee_id = $employee->id; $this->city_area_id = $employee->city_area_id; $this->department_id = $employee->department_id; $this->section_id = $employee->section_id; $this->position_id = $employee->position_id; $this->level_id = $employee->level_id; $this->grade_id = $employee->grade_id; $this->created_at = date('Y-m-d h:i:s'); $this->created_by = getUser()->role; }
public function viewChooseEmployee() { $name = ''; if ($this->employee_id != null) { $name = MastersEmployees::model()->findByPk($this->employee_id)->getFullnameWithDept(); } return $name; }
public function viewChooseEmployee() { $employee = MastersEmployees::model()->findByPk($this->employee_id); return isset($employee) && count($employee) > 0 ? $employee->getFullnameWithDept() : ''; }
public function actionSmcalendar() { $model = new SchedulleForm(); if (isset($_POST['SchedulleForm'])) { $model->attributes = $_POST['SchedulleForm']; } $employees = MastersEmployees::model()->findAllByAttributes(array('department_id' => $model->department_id)); $daysValue = $model->daysValue; $holidays = CHtml::listData(PayrollHolidayPay::model()->findAll(), 'id', 'date'); $this->renderPartial('smcalendar', array('model' => $model, 'employees' => $employees, 'daysValue' => $daysValue, 'holidays' => $holidays)); }
echo CHtml::encode($model->mobile); ?> </div> </div> </div> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-horizontal"> <div class="panel panel-default"> <div class="panel-heading"> <h3><?php echo at("Outlet's Employees"); ?> </h3> </div> <div class="panel-body"> <?php $this->widget('DTGridView', array('id' => 'masters-employees-grid', 'itemsCssClass' => 'table datatable', 'dataProvider' => MastersEmployees::model()->searchByOutlet($model->id), 'columns' => array(array('name' => 'id', 'header' => '#', 'htmlOptions' => array('style' => 'width:50px;')), array('name' => 'code', 'header' => at('NIK')), array('name' => 'email', 'header' => at('Email')), array('name' => 'firstname', 'header' => at('Full Name'), 'value' => '$data->getFullname()'), array('name' => 'gender', 'header' => at("Gender"), 'value' => 'MyHelper::viewGender($data->gender)'), array('name' => 'hiredate', 'header' => at('Hire Date')), array('name' => 'grade', 'header' => at('Grade'), 'value' => '$data->level->level.$data->grade->grade'), array('name' => 'status', 'header' => at("Status"), 'value' => '$data->viewStatus()'), array('name' => 'is_active', 'header' => at("Is Active"), 'value' => '$data->is_active == 1 ? at("Active") : at("Not Active")', 'filter' => CHtml::dropDownList('Products[is_active]', $model->is_active, array('' => '', '1' => at('Active'), '0' => at('Not Active')))), array('class' => 'CButtonColumn', 'htmlOptions' => array('style' => 'width: 70px'), 'template' => '{view}{update}{delete}{promotion}', 'buttons' => array('promotion' => array('title' => 'Promotion', 'url' => 'createUrl("employees/promotion", array("id"=>"$data->id"))')))))); ?> </div> </div> </div> </div> </div>
public function getEmployee() { return MastersEmployees::model()->findByPk($this->getState('employee_id')); }
public function getEmployees() { $employees = MastersEmployees::model()->findAllByAttributes(array('department_id' => $this->department_id)); return $employees; }
<?php // echo getUser()->id; // echo "<pre>"; // print_r(getUser()); // echo "</pre>"; // $model->employee_id = getUser()->id; $label_class = 'col-md-3 col-xs-12 control-label'; $employee = MastersEmployees::model()->findByPk(getUser()->employee_id); ?> <?php echo CHtml::beginForm('', 'post', array('class' => 'form-horizontal')); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <p class="note">Fields with <span class="required">*</span> are required.</p> </div> <div class="panel-body"> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'employee_id', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <div class="input-group"> <?php echo CHtml::textField('employee_name', $employee->fullname, array('size' => 100, 'readonly' => true, 'class' => 'validate[required] form-control disabled')); ?>