HOOK POINT |
METHOD |
prefilterTransform |
prefilter |
SC_FormParam_construct |
lfInitParam |
LC_Page_Entry_action_before |
entryActionBefore |
LC_Page_Entry_action_after |
entryActionAfter |
LC_Page_Entry_Kiyaku_action_before |
entryKiyakuActionBefore |
LC_Page_Entry_Kiyaku_action_after |
entryKiyakuActionAfter |
<?php
class EntryCustomize extends SC_Plugin_Base {
public $fields = array(
);
public $label = array(
);
public function __construct(array $arrSelfInfo) {
parent::__construct($arrSelfInfo);
}
function install(array $arrPlugin, SC_Plugin_Installer $installer) {
$objQuery = &SC_Query::getSingletonInstance();
$plugin_code = basename(__FILE__, ".php");
}
function uninstall(array $arrPlugin, SC_Plugin_Installer $installer) {
$objQuery = &SC_Query::getSingletonInstance();
$plugin_code = basename(__FILE__, ".php");
}
function enable(array $arrPlugin, SC_Plugin_Installer $installer) {
}
function disable(array $arrPlugin, SC_Plugin_Installer $installer) {
}
function prefilter(&$source, LC_Page_Ex $objPage, $filename) {
$objTransform = new SC_Helper_Transform($source);
$template_dir = PLUGIN_UPLOAD_REALDIR . basename(__FILE__, ".php");
try {
switch($objPage->arrPageLayout['device_type_id']) {
case DEVICE_TYPE_MOBILE :
$template_dir = $template_dir . '/templates/mobile/';
switch($filename) {
default :
break;
}
break;
case DEVICE_TYPE_SMARTPHONE :
$template_dir = $template_dir . '/templates/sphone/';
switch($filename) {
default :
break;
}
break;
case DEVICE_TYPE_PC :
$template_dir = $template_dir . '/templates/default/';
switch($filename) {
case SMARTY_TEMPLATES_REALDIR . 'default/entry/index.tpl' :
case 'entry/index.tpl' :
$arKiyaku = $this -> lfGetKiyakuData();
$textKiyaku = $this -> lfMakeKiyakuText($arKiyaku, 0, count($arKiyaku));
$html = <<<EOL
<tr>
<th>利用規約</th>
<td>
<textarea cols="80" rows="40">$textKiyaku</textarea>
</td>
</tr>
EOL;
$objTransform -> select('table') -> appendChild($html);
break;
default :
break;
}
break;
default :
case DEVICE_TYPE_ADMIN :
$template_dir = $template_dir . '/templates/admin/';
switch($filename) {
default :
break;
}
break;
}
} catch (Exception $e) {
error_log(var_export($e));
}
$source = $objTransform -> getHTML();
}
public function lfInitParam($className = "", &$objFormParam = null) {
if (isset($objFormParam)) {
switch ($className) {
case "LC_Page_Entry" :
case "LC_Page_Entry_Kiyaku" :
$this -> LC_Page_Entry($objFormParam);
}
}
}
public function LC_Page_Entry(&$objFormParam) {
}
public function entryActionBefore(&$objPage) {
$objFormParam = new SC_FormParam_Ex();
$objFormParam -> setParam($_POST);
$objFormParam -> convParam();
switch ($objPage->getMode()) {
default :
$_SERVER['HTTP_REFERER'] = ROOT_URLPATH . 'entry/kiyaku.php';
break;
}
}
public function entryActionAfter(&$objPage) {
$objFormParam = new SC_FormParam_Ex();
$objFormParam -> setParam($_POST);
$objFormParam -> convParam();
switch ($objPage->getMode()) {
default :
break;
}
}
public function entryKiyakuActionBefore(&$objPage) {
$objFormParam = new SC_FormParam_Ex();
$objFormParam -> setParam($_POST);
$objFormParam -> convParam();
switch ($objPage->getMode()) {
default :
switch($objPage->arrPageLayout['device_type_id']) {
case DEVICE_TYPE_MOBILE :
break;
case DEVICE_TYPE_SMARTPHONE :
break;
case DEVICE_TYPE_PC :
break;
default :
case DEVICE_TYPE_ADMIN :
break;
}
break;
}
}
public function entryKiyakuActionAfter(&$objPage) {
$objFormParam = new SC_FormParam_Ex();
$objFormParam -> setParam($_POST);
$objFormParam -> convParam();
switch ($objPage->getMode()) {
default :
switch($objPage->arrPageLayout['device_type_id']) {
case DEVICE_TYPE_MOBILE :
break;
case DEVICE_TYPE_SMARTPHONE :
break;
case DEVICE_TYPE_PC :
SC_Response_Ex::sendRedirect(ENTRY_URL);
break;
default :
case DEVICE_TYPE_ADMIN :
break;
}
break;
}
}
public function lfMakeKiyakuText($arrKiyaku) {
$this -> tpl_kiyaku_text = '';
foreach ($arrKiyaku as $key => $value) {
$tpl_kiyaku_text .= $value['kiyaku_title'] . "\n\n";
$tpl_kiyaku_text .= $value['kiyaku_text'] . "\n\n";
}
return $tpl_kiyaku_text;
}
public function lfGetKiyakuData() {
$objKiyaku = new SC_Helper_Kiyaku_Ex();
$arrKiyaku = $objKiyaku -> getList();
return $arrKiyaku;
}
}