本文整理汇总了PHP中Employee::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::model方法的具体用法?PHP Employee::model怎么用?PHP Employee::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadModel
public function loadModel($id)
{
if (($model = Employee::model()->findByPk($id)) === null) {
throw new CHttpException(404, Yii::t('TeamModule.team', 'Page was not found!'));
}
return $model;
}
示例2: getModel
private function getModel()
{
if (!$this->isGuest && $this->_model === null) {
$this->_model = Employee::model()->findByPk($this->id, array('select' => 'role'));
}
return $this->_model;
}
示例3: loadModel
public function loadModel($id)
{
if (($model = Employee::model()->findByPk($id)) === null) {
throw new CHttpException(404, 'Страница не найдена');
}
return $model;
}
示例4: run
public function run()
{
$models = Employee::model()->cache($this->controller->yupe->coreCacheTime)->published()->contactWidget()->findAll(['order' => 't.widget_sort']);
if (empty($models)) {
return;
}
$this->render($this->view, ['models' => $models, 'title' => $this->title]);
}
示例5: run
public function run()
{
$models = Employee::model()->published()->findAll(['order' => 't.sort']);
if (empty($models)) {
return;
}
$this->render($this->view, ['models' => $models, 'title' => $this->title]);
}
示例6: actionShow
/**
* Страница отдельного сотрудника
*/
public function actionShow($alias)
{
$model = Employee::model()->published()->with(array('department' => array('scopes' => 'published'), 'projects' => array('scopes' => 'published', 'order' => 'projects.sort ASC')))->findByAlias($alias);
if (!$model) {
throw new CHttpException(404);
}
$this->render('item', array('model' => $model));
}
示例7: getEmployeeIdFromClerkId
public function getEmployeeIdFromClerkId($clerkId, $throwException = true)
{
$e = Employee::model()->findByAttributes(array('id' => $clerkId, 'wlabel_id' => Yii::app()->user->getWhitelabelId()));
if ($e == null) {
if ($throwException) {
throw new CHttpException(400, 'Invalid request. No clerk found!');
} else {
return null;
}
}
return $e->employee_id;
}
示例8: authenticate
public function authenticate()
{
$record = Employee::model()->findByAttributes(array('name' => $this->username));
$hash = CPasswordHelper::hashPassword($record->password);
if ($record === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else {
if (!CPasswordHelper::verifyPassword($this->password, $hash)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->_id = $record->employee_id;
$this->setState('title', $record->name);
$this->errorCode = self::ERROR_NONE;
}
}
return !$this->errorCode;
}
示例9: authenticate
public function authenticate()
{
// Производим стандартную аутентификацию, описанную в руководстве.
$user = Employee::model()->find('LOWER(login)=?', array(strtolower($this->username)));
if ($user === null || md5($this->password) !== $user->password) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else {
// В качестве идентификатора будем использовать id, а не username,
// как это определено по умолчанию. Обязательно нужно переопределить
// метод getId(см. ниже).
$this->_id = $user->employee_id;
// Далее логин нам не понадобится, зато имя может пригодится
// в самом приложении. Используется как Yii::app()->user->name.
// realName есть в нашей модели. У вас это может быть name, firstName
// или что-либо ещё.
$this->username = $user->name;
$this->errorCode = self::ERROR_NONE;
}
return !$this->errorCode;
}
示例10: authenticate
/**
* 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()
{
if (strpos($this->username, "@")) {
$user = RbacUser::model()->findByAttributes(array('user_email' => $this->username));
} else {
$user = RbacUser::model()->findByAttributes(array('user_name' => $this->username));
$ph = new PasswordHash(Yii::app()->params['phpass']['iteration_count_log2'], Yii::app()->params['phpass']['portable_hashes']);
}
if ($user === null) {
if (strpos($this->username, "@")) {
$this->errorCode = self::ERROR_EMAIL_INVALID;
} else {
$this->errorCode = self::ERROR_USERNAME_INVALID;
}
} elseif (!$ph->CheckPassword($this->password, $user->user_password)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
//else if($user->status==0&&Yii::app()->getModule('user')->loginNotActiv==false)
// $this->errorCode=self::ERROR_STATUS_NOTACTIV;
} elseif ($user->status == 0) {
$this->errorCode = self::ERROR_STATUS_BAN;
} else {
$this->_id = $user->id;
$this->username = $user->user_name;
// title column as username
$this->errorCode = self::ERROR_NONE;
$employeeId = $user->employee_id;
// Store employee ID in a session:
//$this->setState('employeeid',$employeeId);
Yii::app()->session['employeeid'] = $employeeId;
Yii::app()->session['userid'] = $user->id;
$employee = Employee::model()->findByPk($employeeId);
Yii::app()->session['emp_fullname'] = $employee->first_name . ' ' . $employee->last_name;
//Saving User Login & out timing
Yii::app()->session['unique_id'] = uniqid();
$login_time = Date('Y-m-d H:i:s');
//UserLog::model()->saveUserlog(Yii::app()->session['unique_id'], Yii::app()->session->sessionID,Yii::app()->session['userid'],$employeeId,$user->user_name,$login_time);
}
return !$this->errorCode;
}
示例11: actionUpload
public function actionUpload()
{
parent::actionUpload();
$folder = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/upload/';
// folder for uploaded files
$file = $folder . basename($_FILES['uploadfile']['name']);
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
$row = 0;
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if ($row > 0) {
$empid = Employee::model()->findbyattributes(array('oldnik' => $data[0]));
$model = new Employeeschedule();
if ($empid != null) {
$model = Employeeschedule::model()->findByattributes(array('employeeid' => $empid->employeeid, 'month' => $data[2], 'year' => $data[3]));
if ($model == null) {
$model = new Employeeschedule();
}
$model->employeeid = $empid->employeeid;
$model->month = $data[2];
$model->year = $data[3];
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[4]));
if ($d != null) {
$model->d1 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[5]));
if ($d != null) {
$model->d2 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[6]));
if ($d != null) {
$model->d3 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[7]));
if ($d != null) {
$model->d4 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[8]));
if ($d != null) {
$model->d5 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[9]));
if ($d != null) {
$model->d6 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[10]));
if ($d != null) {
$model->d7 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[11]));
if ($d != null) {
$model->d8 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[12]));
if ($d != null) {
$model->d9 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[13]));
if ($d != null) {
$model->d10 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[14]));
if ($d != null) {
$model->d11 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[15]));
if ($d != null) {
$model->d12 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[16]));
if ($d != null) {
$model->d13 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[17]));
if ($d != null) {
$model->d14 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[18]));
if ($d != null) {
$model->d15 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[19]));
if ($d != null) {
$model->d16 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[20]));
if ($d != null) {
$model->d17 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[21]));
if ($d != null) {
$model->d18 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[22]));
if ($d != null) {
$model->d19 = $d->absscheduleid;
}
$d = Absschedule::model()->findbyattributes(array('absschedulename' => $data[23]));
if ($d != null) {
$model->d20 = $d->absscheduleid;
//.........这里部分代码省略.........
示例12: verifyDelete
public function verifyDelete()
{
$advertiserId = $this->advertiser_id;
if (Employee::model()->findByAttributes(array('advertiser_id' => $this->advertiser_id))) {
throw new CHttpException(400, 'You cannot delete advertiser that contains some employees!');
}
if (PurchasedPlan::model()->findByAttributes(array('advertiser_id' => $this->advertiser_id))) {
throw new CHttpException(400, 'You cannot delete advertiser that has some purchased plans!');
}
return true;
}
示例13:
echo Yii::t('TeamModule.team', 'Fields with');
?>
<span class="required">*</span>
<?php
echo Yii::t('TeamModule.team', 'are required.');
?>
</div>
<?php
echo $form->errorSummary($model);
?>
<div class="row">
<div class="col-sm-3">
<?php
echo $form->dropDownListGroup($model, 'chief_id', ['widgetOptions' => ['data' => Employee::model()->employeeList, 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('TeamModule.team', '--choose--'), 'data-original-title' => $model->getAttributeLabel('chief_id'), 'data-content' => $model->getAttributeDescription('chief_id')]]]);
?>
</div>
<div class="col-sm-4">
<?php
echo $form->dropDownListGroup($model, 'status', ['widgetOptions' => ['data' => $model->statusList, 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('TeamModule.team', '--choose--'), 'data-original-title' => $model->getAttributeLabel('status'), 'data-content' => $model->getAttributeDescription('status')]]]);
?>
</div>
</div>
<div class="row">
<div class="col-sm-7">
<?php
echo $form->textFieldGroup($model, 'title', ['widgetOptions' => ['htmlOptions' => ['data-original-title' => $model->getAttributeLabel('title'), 'data-content' => $model->getAttributeDescription('title')]]]);
?>
</div>
示例14: getEmployeeList
public function getEmployeeList()
{
return CHtml::listData(Employee::model()->findAll(), 'id', 'name');
}
示例15: array
<br>
<div class="span8">
<div class="form">
<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'officials-form', 'type' => 'horizontal', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>
<p class="note" id="requiredation">Fields with <span class="required">*</span> are required.</p>
<?php
echo $form->errorSummary($model);
?>
<?php
echo $form->dropDownListRow($model, 'emp_id', CHtml::listData(Employee::model()->findAll(array('condition' => 'position <= 3')), 'emp_id', 'Fullname'));
?>
<?php
echo $form->datePickerRow($model, 'start_date', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd')));
?>
<?php
echo $form->datePickerRow($model, 'end_date', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd')));
?>
<div class="form-actions">
<?php
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Submit' : 'Save', 'htmlOptions' => array('confirm' => 'Do you want to continue?')));
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'reset', 'type' => 'warning', 'label' => 'Reset', 'htmlOptions' => array('style' => 'margin-left:1%;')));
?>