本文整理汇总了PHP中app\func\Proc::CreateLogin方法的典型用法代码示例。如果您正苦于以下问题:PHP Proc::CreateLogin方法的具体用法?PHP Proc::CreateLogin怎么用?PHP Proc::CreateLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\func\Proc
的用法示例。
在下文中一共展示了Proc::CreateLogin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ImportDo
static function ImportDo()
{
// Делаем запись в таблицу отчетов импорта
$logreport = new Logreport();
$Importconfig = self::GetRowsPDO('select * from importconfig where importconfig_id = 1');
if ($Importconfig['importconfig_do']) {
self::$os_start = $Importconfig['os_startrow'];
self::$mat_start = $Importconfig['mat_startrow'];
self::$gu_start = $Importconfig['gu_startrow'];
self::$Mishanya = 0;
self::$Debug = YII_DEBUG;
$starttime = microtime(true);
$logreport->logreport_date = date('Y-m-d');
$doreport = false;
self::$materialexists = Material::find()->count() > 0;
self::DeleteOldReports();
// Идем по файлам импорта из 1С (os.xls - Основные средства, mat.xls - Материалы)
foreach ([$Importconfig['emp_filename'] . '.txt', $Importconfig['os_filename'] . '.xlsx', $Importconfig['mat_filename'] . '.xlsx', $Importconfig['gu_filename'] . '.xlsx'] as $filename) {
self::$filename = dirname($_SERVER['SCRIPT_FILENAME']) . '/imp/' . $filename;
$FileType = self::$filename === dirname($_SERVER['SCRIPT_FILENAME']) . '/imp/' . $Importconfig['os_filename'] . '.xlsx' ? self::os : (self::$filename === dirname($_SERVER['SCRIPT_FILENAME']) . '/imp/' . $Importconfig['mat_filename'] . '.xlsx' ? self::mat : self::gu);
self::SetFileType($FileType);
self::Setxls();
if (file_exists(self::$filename)) {
self::$filelastdate = date("Y-m-d H:i:s", filemtime(self::$filename));
$filelastdateFromDB = self::GetMaxFileLastDate($Importconfig);
if (self::$Debug || empty($filelastdateFromDB) || strtotime(self::$filelastdate) > strtotime($filelastdateFromDB)) {
/* var_dump(self::$filename);
var_dump(self::$filelastdate);
var_dump($filelastdateFromDB);
var_dump($_SERVER);
var_dump($_ENV); */
ini_set('max_execution_time', $Importconfig['max_execution_time']);
// 1000 seconds
ini_set('memory_limit', $Importconfig['memory_limit']);
// 1Gbyte Max Memory
$logreport->save();
self::$logreport_id = $logreport->logreport_id;
$doreport = true;
// Определяем показатели импорта
self::$logreport_errors = 0;
// Не загружено записей из-за ошибок
self::$logreport_updates = 0;
// Записей изменено
self::$logreport_additions = 0;
// Записей добавлено
self::$logreport_missed = 0;
// Записей пропущено (исключены из обработки)
self::$logreport_amount = 0;
// Всего записей
if ($filename === $Importconfig['emp_filename'] . '.txt') {
self::$employee = true;
}
if (self::$employee) {
$i = 0;
$handle = @fopen(self::$filename, "r");
if ($handle) {
$UTF8deleteBOM = true;
while (($subject = fgets($handle, 4096)) !== false) {
if ($UTF8deleteBOM) {
$subject = str_replace("", '', $subject);
$UTF8deleteBOM = false;
}
$transaction = Yii::$app->db->beginTransaction();
$i++;
try {
$pattern = '/^(.*?)\\|(Поликлиника №\\s?[1,2,3] )?(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|(.*?)\\|/ui';
preg_match($pattern, $subject, $matches);
if ($matches[0] !== NULL) {
$pattern = '/(^Поликлиника №)\\s?([1,2,3])\\s?$/ui';
$matches[2] = preg_replace($pattern, 'Взрослая $1$2', mb_strtolower($matches[2], 'UTF-8'));
if ($matches[3] === 'Поликлиника профилактических осмотров') {
$matches[2] = $matches[3];
}
$pattern = '/^(.+) БУ "Нижневартовская городская поликлиника"$/ui';
$matches[3] = preg_replace($pattern, '$1', $matches[3]);
$employee_fio = $matches[1];
$location = self::AssignLocationForEmployeeImport(trim($matches[3]), trim($matches[2]));
$id_dolzh = self::AssignDolzh(trim($matches[4]));
// $sqlstr = empty($location->id_build) ? ' and id_build is null' : ' and id_build = :id_build';
$Employee = Employee::find()->joinWith('idperson')->where(array_merge(['id_dolzh' => $id_dolzh, 'id_podraz' => $location->id_podraz], empty($location->id_build) ? [] : ['id_build' => $location->id_build]))->andFilterWhere(['like', 'auth_user_fullname', $employee_fio, false])->one();
/* $Employee = self::GetRowsPDO('select employee_id, auth_user_fullname, id_dolzh, id_podraz, id_build from employee inner join auth_user on employee.id_person = auth_user.auth_user_id where auth_user_fullname like :employee_fio and id_dolzh = :id_dolzh and id_podraz = :id_podraz' . $sqlstr, array_merge([
'employee_fio' => $employee_fio,
'id_dolzh' => $id_dolzh,
'id_podraz' => $location->id_podraz,
], empty($location->id_build) ? [] : ['id_build' => $location->id_build])); */
if (empty($Employee)) {
/* var_dump('ok');
var_dump($Employee);
var_dump($employee_fio);
var_dump($location);
var_dump($id_dolzh); */
$AuthuserCount = Authuser::find()->where(['like', 'auth_user_fullname', $employee_fio, false])->count();
$Authuser = $AuthuserCount == 1 ? Authuser::find()->where(['like', 'auth_user_fullname', $employee_fio, false])->one() : false;
$newEmployee = false;
if (empty($Authuser) || $AuthuserCount > 1) {
$Authuser = new Authuser();
$Authuser->auth_user_fullname = $employee_fio;
$Authuser->auth_user_login = Proc::CreateLogin($employee_fio);
$Authuser->auth_user_password = Yii::$app->getSecurity()->generatePasswordHash('11111111');
$newEmployee = true;
//.........这里部分代码省略.........