本文整理汇总了PHP中Region::fetchRegion方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::fetchRegion方法的具体用法?PHP Region::fetchRegion怎么用?PHP Region::fetchRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::fetchRegion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$o->orgctrl = $ctrl->selectionOrg($o->createdby, $defaultorganization_id, 'N', "", 'Y');
$o->getInputForm("new", -1, $token);
$o->showRegionTable();
}
} else {
// if the token is not valid or the token is expired, it back to previous form with previous inputed data
$log->showLog(1, "Warning, '{$o->region_name}' cannot be save due to token expired");
$token = $s->createToken($tokenlife, "CREATE_STD");
$o->countryctrl = $ctrl->getSelectCountry($o->country_id, 'N');
$o->orgctrl = $ctrl->selectionOrg($o->createdby, $defaultorganization_id, 'N', "", 'Y');
$o->getInputForm("new", -1, $token);
$o->showRegionTable();
}
break;
case "edit":
if ($o->fetchRegion($o->region_id)) {
//create a new token for editing a form
//$orgwhereaccess=$orgwhereaccess
$token = $s->createToken($tokenlife, "CREATE_STD");
$o->countryctrl = $ctrl->getSelectCountry($o->country_id, 'N');
$o->orgctrl = $ctrl->selectionOrg($o->createdby, $defaultorganization_id, 'N', "", 'Y');
$o->getInputForm("edit", $o->region_id, $token);
$o->showRegionTable();
} else {
//if can't find particular region from database, return error message
redirect_header("region.php", 3, "<b style='color:red'>Some error on viewing your region data, probably database corrupted.</b>");
}
break;
case "update":
if ($s->check(true, $token, "CREATE_STD")) {
$o->updatedby = $xoopsUser->getVar('uid');
示例2: saveRegion
public function saveRegion()
{
$this->log->showLog(2, "Access saveRegion");
global $xoopsDB, $saveHandler, $createdby, $timestamp;
$tablename = "sim_region";
$pkey = "region_id";
$keyword = "Region";
$controlfieldname = "region_name";
$insertCount = $saveHandler->ReturnInsertCount();
$this->log->showLog(3, "Start Insert({$insertCount} records)");
if ($insertCount > 0) {
$arrfield = array($controlfieldname, "country_id", "isactive", "defaultlevel", "created", "createdby", "updated", "updatedby");
$arrfieldtype = array('%s', '%d', '%d', '%d', '%s', '%d', '%s', '%d');
// Yes there are INSERTs to perform...
for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
$arrvalue = array($saveHandler->ReturnInsertField($currentRecord, $controlfieldname), $saveHandler->ReturnInsertField($currentRecord, "country_id"), $saveHandler->ReturnInsertField($currentRecord, "isactive"), $saveHandler->ReturnInsertField($currentRecord, "defaultlevel"), $timestamp, $createdby, $timestamp, $createdby);
$controlvalue = $saveHandler->ReturnInsertField($currentRecord, $controlfieldname);
$this->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, $pkey);
// Now we execute this query
}
}
$updateCount = $saveHandler->ReturnUpdateCount();
$this->log->showLog(3, "Start update({$updateCount} records)");
if ($updateCount > 0) {
$arrfield = array($controlfieldname, "country_id", "isactive", "defaultlevel", "updated", "updatedby", "isdeleted");
$arrfieldtype = array('%s', '%d', '%d', '%d', '%s', '%d', '%d');
// Yes there are UPDATEs to perform...
for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
$arrvalue = array($saveHandler->ReturnUpdateField($currentRecord, $controlfieldname), $saveHandler->ReturnUpdateField($currentRecord, "country_id"), $saveHandler->ReturnUpdateField($currentRecord, "isactive"), $saveHandler->ReturnUpdateField($currentRecord, "defaultlevel"), $timestamp, $createdby, $saveHandler->ReturnUpdateField($currentRecord, "isdeleted"));
$controlvalue = $saveHandler->ReturnUpdateField($currentRecord, $controlfieldname);
$this->UpdateRecord($tablename, $pkey, $saveHandler->ReturnUpdateField($currentRecord), $arrfield, $arrvalue, $arrfieldtype, $controlvalue);
}
}
$ispurge = 0;
$deleteCount = $saveHandler->ReturnDeleteCount();
$this->log->showLog(3, "Start delete/purge({$deleteCount} records)");
include "class/{$keyword}.inc.php";
$o = new Region();
if ($deleteCount > 0) {
for ($currentRecord = 0; $currentRecord < $deleteCount; $currentRecord++) {
$record_id = $saveHandler->ReturnDeleteField($currentRecord);
$o->fetchRegion($record_id);
$controlvalue = $o->region_name;
$isdeleted = $o->isdeleted;
if ($o->allowDelete($record_id)) {
$this->DeleteRecord($tablename, $pkey, $record_id, $controlvalue, $isdeleted);
} else {
$this->failfeedback .= "Cannot delete {$keyword}: {$controlvalue} <br/>";
}
}
}
//$this->failfeedback.="asdasdpasd<br/>\n";
//$this->failfeedback.="123 3443<br/>\n";
//$this->failfeedback.="234 45656523 234<br/>\n";
if ($this->failfeedback != "") {
$this->failfeedback .= "Warning!<br/>\n" . $this->failfeedback;
}
$saveHandler->setErrorMessage($this->failfeedback);
$saveHandler->CompleteSave();
}