require_once( "inc.php" );
try
{
$cMain = new cMain();
if( !$cMain->fMain() )
{
throw new cException( $cMain->strErrMsg );
}
}
catch( cException $cException )
{
$cException->fPrint();
}
exit();
///
class cMain
{
public $strErrMsg = "";
const CNS_STEP = "step";
public $strStep = "";
const CNS_STEP_FORM = "form";
const CNS_STEP_CONFIRM = "confirm";
const CNS_STEP_SEND = "send";
const CNS_NAME = "name";
private $strName = "";
const CNS_KANA = "kana";
private $strKana = "";
const CNS_EMAIL = "email";
private $strEmail = "";
const CNS_TEL = "tel";
private $strTel = "";
const CNS_KEITAI = "keitai";
private $strKeitai = "";
const CNS_ADDRESS = "address";
private $strAddress = "";
const CNS_SUBJECT1 = "subject1";
private $intSubject1 = 0;
const CNS_SUBJECT2 = "subject2";
private $intSubject2 = 0;
const CNS_SUBJECT3 = "subject3";
private $intSubject3 = 0;
const CNS_SUBJECT = "subject";
private $arrSubjectList = array();
const CNS_MESSAGE = "message";
private $strMessage = "";
const CNS_CONTACT = "contact";
private $intContact = 0;
private $arrContactList = array();
public $arrAlertMsg = array();
public function __construct()
{
$this->arrSubjectList[ 1 ] = "派遣スタッフ登録(お仕事をお探しの方)";
$this->arrSubjectList[ 2 ] = "派遣スタッフ雇用について";
$this->arrSubjectList[ 3 ] = "外国人スタッフ派遣について";
$this->arrContactList[ 1 ] = "電話";
$this->arrContactList[ 2 ] = "メール";
}
public function fMain()
{
if( !$this->_fEntry() )
{
return FALSE;
}
if( !$this->_fWork() )
{
return FALSE;
}
if( !$this->_fHtml() )
{
return FALSE;
}
return TRUE;
}
private function _fEntry()
{
// step
if( !cHttpPrms::fStr( self::CNS_STEP, $this->strStep, array(), DEF_METHOD_POST ) )
{
$this->strStep = self::CNS_STEP_FORM;
}
// form input value
if( !$this->_fGetFormValue() )
{
return FALSE;
}
// branch
switch( $this->strStep )
{
case self::CNS_STEP_SEND :
{
if( !$this->_fCheckFormValue() )
{
return FALSE;
}
break;
}
case self::CNS_STEP_CONFIRM :
{
if( !$this->_fCheckFormValue() )
{
return FALSE;
}
break;
}
}
return TRUE;
}
private function _fWork()
{
switch( $this->strStep )
{
case self::CNS_STEP_SEND :
{
if( !$this->_fSend() )
{
return FALSE;
}
break;
}
}
return TRUE;
}
private function _fHtml()
{
switch( $this->strStep )
{
case self::CNS_STEP_SEND :
{
$this->_fHtmlSend();
break;
}
case self::CNS_STEP_CONFIRM :
{
$this->_fHtmlConfirm();
break;
}
case self::CNS_STEP_FORM :
{
$this->_fHtmlForm();
break;
}
}
return TRUE;
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
private function _fGetFormValue()
{
$arrPrms = array(
"removenl" => FALSE,
"acompnl" => FALSE,
"removespc" => FALSE,
"acompspc" => TRUE,
"trimspc" => TRUE
);
if( !cHttpPrms::fStr( self::CNS_NAME, $this->strName, array(), DEF_METHOD_POST ) ) $this->strName = "";
if( !cHttpPrms::fStr( self::CNS_KANA, $this->strKana, array(), DEF_METHOD_POST ) ) $this->strKana = "";
if( !cHttpPrms::fStr( self::CNS_EMAIL, $this->strEmail, array(), DEF_METHOD_POST ) ) $this->strEmail = "";
if( !cHttpPrms::fStr( self::CNS_TEL, $this->strTel, array(), DEF_METHOD_POST ) ) $this->strTel = "";
if( !cHttpPrms::fStr( self::CNS_KEITAI, $this->strKeitai, array(), DEF_METHOD_POST ) ) $this->strKeitai = "";
if( !cHttpPrms::fStr( self::CNS_ADDRESS, $this->strAddress, array(), DEF_METHOD_POST ) ) $this->strAddress = "";
if( !cHttpPrms::fStr( self::CNS_ADDRESS, $this->strAddress, array(), DEF_METHOD_POST ) ) $this->strAddress = "";
if( !cHttpPrms::fNum( self::CNS_SUBJECT1, $this->intSubject1, false, false, DEF_METHOD_POST ) ) $this->intSubject1 = 0;
if( !cHttpPrms::fNum( self::CNS_SUBJECT2, $this->intSubject2, false, false, DEF_METHOD_POST ) ) $this->intSubject2 = 0;
if( !cHttpPrms::fNum( self::CNS_SUBJECT3, $this->intSubject3, false, false, DEF_METHOD_POST ) ) $this->intSubject3 = 0;
if( !cHttpPrms::fStr( self::CNS_MESSAGE, $this->strMessage, array( "removenl" => false ), DEF_METHOD_POST ) ) $this->strMessage = "";
if( !cHttpPrms::fNum( self::CNS_CONTACT, $this->intContact, false, false, DEF_METHOD_POST ) ) $this->intContact = 1;
$this->arrAlertMsg[ self::CNS_NAME ] = "";
$this->arrAlertMsg[ self::CNS_KANA ] = "";
$this->arrAlertMsg[ self::CNS_EMAIL ] = "";
$this->arrAlertMsg[ self::CNS_TEL ] = "";
$this->arrAlertMsg[ self::CNS_KEITAI ] = "";
$this->arrAlertMsg[ self::CNS_ADDRESS ] = "";
$this->arrAlertMsg[ self::CNS_SUBJECT ] = "";
$this->arrAlertMsg[ self::CNS_MESSAGE ] = "";
$this->arrAlertMsg[ self::CNS_CONTACT ] = "";
return TRUE;
}
private function _fCheckFormValue()
{
if( !strlen( $this->strName ) )
{
$this->arrAlertMsg[ self::CNS_NAME ] = "
※お名前を入力して下さい
";
}
if( !strlen( $this->strKana ) )
{
$this->arrAlertMsg[ self::CNS_KANA ] = "※フリガナを入力して下さい
";
}
if( !strlen( $this->strEmail ) )
{
$this->arrAlertMsg[ self::CNS_EMAIL ] = "※E-Mailアドレスを入力して下さい
";
}
if( !strlen( $this->strTel ) && !strlen( $this->strKeitai ) )
{
$this->arrAlertMsg[ self::CNS_TEL ] = "※電話番号を入力して下さい
";
$this->arrAlertMsg[ self::CNS_KEITAI ] = "※携帯番号を入力して下さい
";
}
if( $this->intSubject1 == 0 && $this->intSubject2 == 0 && $this->intSubject3 == 0 )
{
$this->arrAlertMsg[ self::CNS_SUBJECT ] = "※お問い合せ内容を選択して下さい
";
}
/////
if( strlen( implode( "", $this->arrAlertMsg ) ) )
{
$this->strStep = self::CNS_STEP_FORM;
}
return TRUE;
}
private function _fSend()
{
if( !$this->_fMail() )
{
$this->strErrMsg = "メールの送信に失敗しました";
return FALSE;
}
return TRUE;
}
private function _fMail()
{
mb_language( "uni" );
mb_internal_encoding( "UTF-8" );
$strFormData =
"//////////////////////\n".
"【お名前】" . $this->strName . "\n".
"【フリガナ】" . $this->strKana . "\n".
"【E-Mailアドレス】" . $this->strEmail . "\n".
"【電話番号】" . $this->strTel . "\n".
"【携帯番号】" . $this->strKeitai . "\n".
"【簡易住所】" . $this->strAddress . "\n".
"【お問い合せ内容】\n";
if( $this->intSubject1 == 1 ) $strFormData .= $this->arrSubjectList[ 1 ] . "\n";
if( $this->intSubject2 == 1 ) $strFormData .= $this->arrSubjectList[ 2 ] . "\n";
if( $this->intSubject3 == 1 ) $strFormData .= $this->arrSubjectList[ 3 ] . "\n";
$strFormData .=
"【内容詳細】\n".
$this->strMessage . "\n".
"【ご連絡方法】" . $this->arrContactList[ $this->intContact ] . "\n".
"//////////////////////\n";
// 管理者向け
$arrMailToList = array();
$arrMailToList[] = "info@tomhaken.com";
$strSubject = "派遣登録・お問い合わせフォーム";
$strHeader = "From:" . mb_encode_mimeheader( $this->strName . " 様" ) . "<" . $this->strEmail . ">";
$strMessage =
"以下の内容でお問い合わせを受け付けました。\n".
"\n".
$strFormData;
foreach( $arrMailToList as $strMail )
{
if( !mb_send_mail( $strMail, $strSubject, $strMessage, $strHeader ) )
{
return FALSE;
}
}
// サンクス
$strMail = $this->strEmail;
$strSubject = "お問合せありがとうございます-株式会社TOM";
$strHeader = "From:" . mb_encode_mimeheader( "株式会社TOM" ) . "<" . "info@tomhaken.com" . ">";
$strMessage =
$this->strName . " 様\n".
"\n".
"株式会社TOMへお問合せありがとうございます。"."\n".
"以下の内容でお問合せを受け付けました。"."\n".
"\n".
$strFormData.
"\n".
"後日、担当者よりご連絡いたしますのでしばらくお待ちください。"."\n".
"---------"."\n".
"株式会社TOM"."\n".
"〒286-0021 千葉県成田市土屋296-1"."\n".
"TEL:0476-36-4705 FAX:0476-36-4715";
if( !mb_send_mail( $strMail, $strSubject, $strMessage, $strHeader ) )
{
return FALSE;
}
return TRUE;
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
private function _fHtmlForm()
{
?>
会社概要|成田空港・千葉・茨城の人材派遣のTOM
- 社 名
- 株式会社TOM
- 所在地
- 千葉県成田市土屋296-1
TEL:0476-36-4705 FAX:0476-36-4715
- 代表者名
- 太田原 慎一
- 設 立
- 平成29年2月7日
平成28年までは特定派遣業をメインとしておりましたが、
平成29年一般派遣業免許取得致しまして㈱TOMとして新設致しました。
- 資本金
- 2,000万円
- 事業内容
一般労働者派遣業 派遣事業許可番号 派12-30021 情報提供について
労働者管理業
派遣登録・お問い合わせ
必須項目は必ずご入力下さい。
各項目をご入力いただき「確認」をクリックしてください。
}
private function _fError( $strKey )
{
if( !isset( $this->arrAlertMsg[ $strKey ] ) ) return "mfp";
if( !strlen( $this->arrAlertMsg[ $strKey ] ) ) return "mfp";
return "mfp_parent_error mfpe";
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
private function _fHtmlConfirm()
{
?>
会社概要|成田空港・千葉・茨城の人材派遣のTOM
派遣登録・お問い合わせ
下記内容で送信します。入力内容に間違いが無いかご確認の上、送信ボタンをクリックしてください。
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
private function _fHtmlSend()
{
?>
}
}