示例#1
0
 private static function executeEditPhones(&$error)
 {
     global $USER_FIELD_MANAGER;
     $userId = intval($_REQUEST['USER_ID']);
     $obUser = new CUser();
     $arFields = array("UF_VI_BACKPHONE" => $_REQUEST["UF_VI_BACKPHONE"], "UF_PHONE_INNER" => $_REQUEST["UF_PHONE_INNER"]);
     $viUser = new CVoximplantUser();
     if (isset($_REQUEST["UF_VI_PHONE"])) {
         if ($_REQUEST["UF_VI_PHONE"] == 'N') {
             $viUser->UpdateUserPassword($_REQUEST['USER_ID'], CVoxImplantUser::MODE_PHONE);
             unset($_REQUEST["UF_VI_PHONE_PASSWORD"]);
         }
         $viUser->SetPhoneActive($_REQUEST['USER_ID'], $_REQUEST["UF_VI_PHONE"] == "Y" ? true : false);
     }
     if (isset($_REQUEST["UF_VI_PHONE_PASSWORD"]) && trim($_REQUEST["UF_VI_PHONE_PASSWORD"])) {
         $pass = $viUser->UpdateUserPassword($_REQUEST['USER_ID'], CVoxImplantUser::MODE_PHONE, $_REQUEST["UF_VI_PHONE_PASSWORD"]);
         if (!$pass) {
             $error = $viUser->GetError()->msg;
         }
     }
     $USER_FIELD_MANAGER->EditFormAddFields("USER", $arFields);
     if (!$obUser->Update($userId, $arFields, true)) {
         $error = $obUser->LAST_ERROR;
     }
     $arUser = CUser::GetList($by = "ID", $order = "ASC", array('ID' => $userId), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'SECOND_NAME', 'LAST_NAME', "UF_PHONE_INNER", "UF_VI_BACKPHONE", "UF_VI_PHONE", "UF_VI_PHONE_PASSWORD"), 'SELECT' => array("UF_PHONE_INNER", "UF_VI_BACKPHONE", "UF_VI_PHONE", "UF_VI_PHONE_PASSWORD")))->fetch();
     return array('UF_VI_BACKPHONE' => $arUser['UF_VI_BACKPHONE'], 'UF_PHONE_INNER' => $arUser["UF_PHONE_INNER"], 'UF_VI_PHONE' => $arUser["UF_VI_PHONE"], 'UF_VI_PHONE_PASSWORD' => $arUser["UF_VI_PHONE_PASSWORD"]);
 }
示例#2
0
 public function OnUserDelete($ID)
 {
     VI\PhoneTable::deleteByUser($ID);
     global $USER_FIELD_MANAGER;
     if (CVoximplantUser::GetPhoneActive($ID)) {
         $viUser = new CVoximplantUser();
         $viUser->UpdateUserPassword($ID, CVoxImplantUser::MODE_PHONE);
         $viUser->SetPhoneActive($ID, false);
     }
     $USER_FIELD_MANAGER->Update("USER", $ID, array('UF_VI_PASSWORD' => '', 'UF_VI_PHONE_PASSWORD' => '', 'UF_VI_PHONE' => 'N'));
 }