function executeSendsubmit()
 {
     global $template, $WebBaseDir, $ClassDir, $controller, $i18n, $ActiveOption, $LU;
     require_once $ClassDir . "SendEmail.php";
     $arr = sendEmail(trim($_POST['to']), $LU->getProperty("email"), $LU->getProperty("handle"), $LU->getProperty("email"), trim($_POST['title']), trim($_POST['content']), trim($_POST['content']));
     $template->setFile(array("MAIN" => "apf_mail_write.html"));
     $template->setBlock("MAIN", "edit_block");
     $template->setVar(array("WEBDIR" => $WebBaseDir, "SENT_MSG" => "<h2>" . $arr["msg"] . "</h2>", "SUCCESS_CLASS" => "save-ok", "TEXTAREACONTENT" => textareaTag("content", "", true), "DOACTION" => "sendsubmit"));
 }
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $ActiveOption, $StateOption, $AddIP, $userid, $group_ids;
     $apf_opportunity = DB_DataObject::factory('ApfOpportunity');
     if ($edit_submit) {
         $apf_opportunity->get($apf_opportunity->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_opportunity->setTitle(stripslashes(trim($_POST['title'])));
     $apf_opportunity->setAddrees(stripslashes(trim($_POST['addrees'])));
     $apf_opportunity->setPhone(stripslashes(trim($_POST['phone'])));
     $apf_opportunity->setFax(stripslashes(trim($_POST['fax'])));
     $apf_opportunity->setEmail(stripslashes(trim($_POST['email'])));
     $apf_opportunity->setHomepage(stripslashes(trim($_POST['homepage'])));
     $apf_opportunity->setLinkMan(stripslashes(trim($_POST['link_man'])));
     $apf_opportunity->setMemo(stripslashes(trim($_POST['memo'])));
     $apf_opportunity->setState(stripslashes(trim($_POST['state'])));
     $apf_opportunity->setActive(stripslashes(trim($_POST['active'])));
     $apf_opportunity->setAddIp($AddIP);
     $apf_opportunity->setGroupid($group_ids);
     $apf_opportunity->setUserid($userid);
     $val = $apf_opportunity->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_opportunity->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_opportunity->update();
             $log_string = $i18n->_("Update") . $i18n->_("Opportunity") . "\t{$_POST['title']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("opportunity/apf_opportunity/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_opportunity->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_opportunity->insert();
             $log_string = $i18n->_("Create") . $i18n->_("Opportunity") . "\t{$_POST['title']}";
             logFileString($log_string);
             $this->forward("opportunity/apf_opportunity/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_opportunity_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         array_shift($ActiveOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "ACTIVEOPTION" => radioTag("active", $ActiveOption, $_POST['active']), "STATE_OPTION" => radioTag("state", $StateOption, $_POST['state']), "MEMO_TEXT" => textareaTag("memo", $_POST['memo'], false, "ROWS=\"15\" COLS=\"60\" "), "DOACTION" => $do_action));
         foreach ($val as $k => $v) {
             if ($v == false) {
                 $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " &darr; " . $i18n->_("Please check here") . " &darr; "));
             }
         }
         $template->setVar(array("ID" => $_POST['id'], "TITLE" => $_POST['title'], "ADDREES" => $_POST['addrees'], "PHONE" => $_POST['phone'], "FAX" => $_POST['fax'], "EMAIL" => $_POST['email'], "HOMEPAGE" => $_POST['homepage'], "LINK_MAN" => $_POST['link_man'], "MEMO" => $_POST['memo'], "STATE" => $_POST['state'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $AddIP, $userid, $group_ids, $AccessOption, $ReviewwayOption;
     $apf_review = DB_DataObject::factory('ApfReview');
     if ($edit_submit) {
         $apf_review->get($apf_review->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_review->setCompany(stripslashes(trim($_POST['company'])));
     $apf_review->setLinkman(stripslashes(trim($_POST['linkman'])));
     $apf_review->setReviewdate(stripslashes(trim($_POST['reviewdate'])));
     $apf_review->setCategory(stripslashes(trim($_POST['category'])));
     $apf_review->setContent(stripslashes(trim($_POST['content'])));
     $apf_review->setAccess(stripslashes(trim($_POST['access'])));
     $apf_review->setActive(stripslashes(trim($_POST['active'])));
     $apf_review->setAddIp($AddIP);
     $apf_review->setGroupid($group_ids);
     $apf_review->setUserid($userid);
     $val = $apf_review->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_review->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_review->update();
             $log_string = $i18n->_("Update") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("review/apf_review/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_review->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_review->insert();
             $log_string = $i18n->_("Create") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['create_date']}";
             logFileString($log_string);
             $this->forward("review/apf_review/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_review_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         array_shift($AccessOption);
         array_shift($ReviewwayOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "REVIEW_DATE" => inputDateTag("reviewdate", $_POST['reviewdate']), "ACCESSOPTION" => radioTag("access", $AccessOption, $_POST['access']), "CATEGORY_OPTION" => radioTag("category", $ReviewwayOption, $_POST['category']), "CONTENT_TEXT" => textareaTag('content', $_POST['content'], false, "ROWS=\"8\" COLS=\"40\""), "DOACTION" => $do_action));
         foreach ($val as $k => $v) {
             if ($v == false) {
                 $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " &darr; " . $i18n->_("Please check here") . " &darr; "));
             }
         }
         $template->setVar(array("ID" => $_POST['id'], "COMPANY" => $_POST['company'], "LINKMAN" => $_POST['linkman'], "REVIEWDATE" => $_POST['reviewdate'], "CATEGORY" => $_POST['category'], "CONTENT" => $_POST['content'], "GROUPID" => $_POST['groupid'], "USERID" => $_POST['userid'], "ACCESS" => $_POST['access'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
 function executeUpdate()
 {
     global $template, $WebBaseDir, $controller, $i18n;
     $template->setFile(array("MAIN" => "apf_selfcompany_edit.html"));
     $template->setBlock("MAIN", "edit_block");
     $apf_selfcompany = DB_DataObject::factory('ApfSelfcompany');
     //		$apf_selfcompany->get($apf_selfcompany->escape($controller->getID()));
     $apf_selfcompany->find();
     $apf_selfcompany->fetch();
     if ($controller->getURLParam(1) == "ok") {
         $template->setVar(array("SUCCESS_CLASS" => "save-ok", "SUCCESS_MSG" => "<h2>" . $i18n->_("Your modifications have been saved") . "</h2>"));
     }
     $template->setVar(array("ID" => $apf_selfcompany->getId(), "NAME" => $apf_selfcompany->getName(), "ADDREES" => $apf_selfcompany->getAddrees(), "PHONE" => $apf_selfcompany->getPhone(), "FAX" => $apf_selfcompany->getFax(), "EMAIL" => $apf_selfcompany->getEmail(), "PHOTO" => $apf_selfcompany->getPhoto(), "HOMEPAGE" => $apf_selfcompany->getHomepage(), "EMPLOYEE" => $apf_selfcompany->getEmployee(), "BANKROLL" => $apf_selfcompany->getBankroll(), "LINK_MAN" => $apf_selfcompany->getLinkMan(), "INCORPORATOR" => $apf_selfcompany->getIncorporator(), "INDUSTRY" => $apf_selfcompany->getIndustry(), "TAXACCOUNTS" => $apf_selfcompany->getTaxaccounts(), "BANKACCOUNTS" => $apf_selfcompany->getBankaccounts(), "PRODUCTS" => $apf_selfcompany->getProducts(), "MEMO" => $apf_selfcompany->getMemo(), "ACTIVE" => $apf_selfcompany->getActive(), "ACCESS" => $apf_selfcompany->getAccess(), "GROUPID" => $apf_selfcompany->getGroupid(), "USERID" => $apf_selfcompany->getUserid(), "ADD_IP" => $apf_selfcompany->getAddIp(), "CREATED_AT" => $apf_selfcompany->getCreatedAt(), "UPDATE_AT" => $apf_selfcompany->getUpdateAt()));
     $template->setVar(array("WEBDIR" => $WebBaseDir, "FILEPHOTO" => fileTag("photo", $apf_selfcompany->getPhoto()), "BANKACCOUNTS_TEXT" => textareaTag('bankaccounts', $apf_selfcompany->getBankaccounts(), false, "ROWS=\"4\" COLS=\"40\""), "PRODUCTS_TEXT" => textareaTag('products', $apf_selfcompany->getProducts(), false, "ROWS=\"4\" COLS=\"40\""), "MEMO_TEXT" => textareaTag('memo', $apf_selfcompany->getMemo(), false, "ROWS=\"8\" COLS=\"40\""), "DOACTION" => "updatesubmit"));
 }
 function executeUpdate()
 {
     global $template, $WebBaseDir, $controller, $i18n, $ActiveOption;
     $template->setFile(array("MAIN" => "apf_news_edit.html"));
     $template->setBlock("MAIN", "edit_block");
     $template->setVar(array("WEBDIR" => $WebBaseDir, "DOACTION" => "updatesubmit"));
     $apf_news = DB_DataObject::factory('ApfNews');
     $apf_news->get($apf_news->escape($controller->getID()));
     if ($controller->getURLParam(1) == "ok") {
         $template->setVar(array("SUCCESS_CLASS" => "save-ok", "SUCCESS_MSG" => "<h2>" . $i18n->_("Your modifications have been saved") . "</h2>"));
     }
     $template->setVar(array("ID" => $apf_news->getId(), "CATEGORY_ID" => $apf_news->getCategoryId(), "TITLE" => $apf_news->getTitle(), "CONTENT" => $apf_news->getContent(), "ACTIVE" => $apf_news->getActive(), "ADD_IP" => $apf_news->getAddIp(), "CREATED_AT" => $apf_news->getCreatedAt(), "UPDATE_AT" => $apf_news->getUpdateAt()));
     $category_arr = $this->getCategory();
     array_shift($ActiveOption);
     $template->setVar(array("ACTIVEOPTION" => radioTag("active", $ActiveOption, $apf_news->getActive()), "CATEGORYOPTION" => selectTag("category_id", $category_arr, $apf_news->getCategoryId()), "TEXTAREACONTENT" => textareaTag("content", $apf_news->getContent(), true)));
 }
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $AddIP, $userid, $group_ids;
     $apf_dailyreport = DB_DataObject::factory('ApfDailyreport');
     if ($edit_submit) {
         $apf_dailyreport->get($apf_dailyreport->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_dailyreport->setTitle(stripslashes(trim($_POST['title'])));
     $apf_dailyreport->setContent(stripslashes(trim($_POST['content'])));
     $apf_dailyreport->setFilldate(stripslashes(trim($_POST['filldate'])));
     $apf_dailyreport->setActive(stripslashes(trim($_POST['active'])));
     $apf_dailyreport->setAddIp($AddIP);
     $apf_dailyreport->setGroupid($group_ids);
     $apf_dailyreport->setUserid($userid);
     $val = $apf_dailyreport->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_dailyreport->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_dailyreport->update();
             $log_string = $i18n->_("Update") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("dailyreport/apf_dailyreport/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_dailyreport->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_dailyreport->insert();
             $log_string = $i18n->_("Create") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['create_date']}";
             logFileString($log_string);
             $this->forward("dailyreport/apf_dailyreport/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_dailyreport_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $template->setVar(array("WEBDIR" => $WebBaseDir, "FILL_DATE" => inputDateTag("filldate", $_POST['filldate']), "TEXTAREACONTENT" => textareaTag("content", $_POST['content'], true), "DOACTION" => $do_action));
         foreach ($val as $k => $v) {
             if ($v == false) {
                 $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " &darr; " . $i18n->_("Please check here") . " &darr; "));
             }
         }
         $template->setVar(array("ID" => $_POST['id'], "TITLE" => $_POST['title'], "CONTENT" => $_POST['content'], "FILLDATE" => $_POST['filldate'], "ACTIVE" => $_POST['active'], "GROUPID" => $_POST['groupid'], "USERID" => $_POST['userid'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
 function executeUpdate()
 {
     global $template, $userid, $luadmin, $LU, $i18n, $WebBaseDir, $ClassDir, $controller, $GenderOption, $ActiveOption, $WebTemplateDir;
     include_once $ClassDir . "URLHelper.class.php";
     $template->setFile(array("MAIN" => "apf_users_edit.html"));
     $template->setBlock("MAIN", "edit_block");
     $apf_users = DB_DataObject::factory('ApfUsers');
     $apf_users->get($apf_users->escape($controller->getID()));
     if ($controller->getURLParam(1) == "ok") {
         $template->setVar(array("SUCCESS_CLASS" => "save-ok", "SUCCESS_MSG" => "<h2>Your modifications have been saved</h2>"));
     }
     $groups = $luadmin->perm->getGroups();
     foreach ($groups as $data) {
         $category_arr[$data['group_id']] = $data['group_define_name'];
     }
     $user_group = $this->getGroupByUserid($controller->getID());
     $group_id = $user_group['group_id'];
     array_shift($GenderOption);
     array_shift($ActiveOption);
     $template->setVar(array("ID" => $apf_users->getId(), "USER_NAME" => $apf_users->getUserName(), "REALNAME" => $apf_users->getRealname(), "OLD_PASSWORD" => $apf_users->getUserPwd(), "GENDER" => $apf_users->getGender(), "ADDREES" => $apf_users->getAddrees(), "PHONE" => $apf_users->getPhone(), "EMAIL" => $apf_users->getEmail(), "PHOTO" => $apf_users->getPhoto(), "ROLE_ID" => $apf_users->getRoleId(), "ACTIVE" => $apf_users->getActive(), "ADD_IP" => $apf_users->getAddIp(), "CREATED_AT" => $apf_users->getCreatedAt(), "UPDATE_AT" => $apf_users->getUpdateAt()));
     $template->setVar(array("WEBDIR" => $WebBaseDir, "OLD_GROUP" => $group_id, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "GENDEROPTION" => radioTag("gender", $GenderOption, $apf_users->getGender()), "ACTIVEOPTION" => radioTag("active", $ActiveOption, $apf_users->getActive()), "FILEPHOTO" => fileTag("photo", $apf_users->getPhoto()), "MEMO_TEXT" => textareaTag('memo', $apf_users->getMemo(), false, "ROWS=\"8\" COLS=\"40\""), "GROUPOPTION" => selectTag("group", $category_arr, $group_id), "WEBDIR" => $WebBaseDir, "DOACTION" => "updatesubmit"));
 }
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $AddIP, $userid, $UploadDir, $ClassDir, $group_ids;
     $apf_selfproduct = DB_DataObject::factory('ApfSelfproduct');
     if ($edit_submit) {
         $apf_selfproduct->get($apf_selfproduct->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_selfproduct->setProductname(stripslashes(trim($_POST['productname'])));
     $apf_selfproduct->setRetailprice(stripslashes(trim($_POST['retailprice'])));
     $apf_selfproduct->setWholesaleprice(stripslashes(trim($_POST['wholesaleprice'])));
     $apf_selfproduct->setCostprice(stripslashes(trim($_POST['costprice'])));
     $apf_selfproduct->setReleasedate(stripslashes(trim($_POST['releasedate'])));
     $apf_selfproduct->setMemo(stripslashes(trim($_POST['memo'])));
     $apf_selfproduct->setAccess(stripslashes(trim($_POST['access'])));
     $apf_selfproduct->setActive(stripslashes(trim($_POST['active'])));
     $apf_selfproduct->setAddIp($AddIP);
     $apf_selfproduct->setGroupid($group_ids);
     $apf_selfproduct->setUserid($userid);
     if ($_POST['photo_del'] == 'Y') {
         unlink($UploadDir . $_POST['photo_old']);
         $apf_selfproduct->setPhoto("");
         $_POST['photo_old'] = "";
     }
     if ($_POST['upload_temp']) {
         $apf_selfproduct->setPhoto($_POST['upload_temp']);
     }
     $allow_upload_file = TRUE;
     if ($_FILES['photo']['name']) {
         require_once $ClassDir . "FileHelper.class.php";
         $upload_data = FileHelper::uploadFile("product");
         $allow_upload_file = $upload_data["upload_state"];
         if ($allow_upload_file) {
             $photos_arr = $upload_data["upload_msg"];
             if ($photo_pic = $photos_arr['photo']) {
                 $apf_selfproduct->setPhoto($photo_pic);
                 $_POST['upload_temp'] = $photo_pic;
             }
         } else {
             $upload_error_msg = $upload_data["upload_msg"];
         }
     }
     $val = $apf_selfproduct->validate();
     if ($val === TRUE && $allow_upload_file === TRUE) {
         if ($edit_submit) {
             $apf_selfproduct->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_selfproduct->update();
             $log_string = $i18n->_("Update") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("selfproduct/apf_selfproduct/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_selfproduct->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_selfproduct->insert();
             $log_string = $i18n->_("Create") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['create_date']}";
             logFileString($log_string);
             $this->forward("selfproduct/apf_selfproduct/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_selfproduct_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $template->setVar(array("WEBDIR" => $WebBaseDir, "RELEASE_DATE" => inputDateTag("releasedate", $_POST['releasedate']), "FILEPHOTO" => fileTag("photo", $_POST['photo']), "MEMOTEXT" => textareaTag('memo', $_POST['memo'], false, "ROWS=\"8\" COLS=\"40\""), "DOACTION" => $do_action));
         foreach ($val as $k => $v) {
             if ($v == false) {
                 $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " &darr; " . $i18n->_("Please check here") . " &darr; "));
             }
         }
         $template->setVar(array("ID" => $_POST['id'], "PRODUCTNAME" => $_POST['productname'], "RETAILPRICE" => $_POST['retailprice'], "WHOLESALEPRICE" => $_POST['wholesaleprice'], "COSTPRICE" => $_POST['costprice'], "PHOTO" => $_POST['photo'], "RELEASEDATE" => $_POST['releasedate'], "MEMO" => $_POST['memo'], "ACCESS" => $_POST['access'], "ACTIVE" => $_POST['active'], "GROUPID" => $_POST['groupid'], "USERID" => $_POST['userid'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $AddIP, $userid, $group_ids, $AccessOption;
     $apf_agreement = DB_DataObject::factory('ApfAgreement');
     if ($edit_submit) {
         $apf_agreement->get($apf_agreement->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_agreement->setNoid(stripslashes(trim($_POST['noid'])));
     $apf_agreement->setCategory(stripslashes(trim($_POST['category'])));
     $apf_agreement->setEffectdate(stripslashes(trim($_POST['effectdate'])));
     $apf_agreement->setExpireddate(stripslashes(trim($_POST['expireddate'])));
     $apf_agreement->setBuyer(stripslashes(trim($_POST['buyer'])));
     $apf_agreement->setVender(stripslashes(trim($_POST['vender'])));
     $apf_agreement->setBuyersignature(stripslashes(trim($_POST['buyersignature'])));
     $apf_agreement->setVendersignature(stripslashes(trim($_POST['vendersignature'])));
     $apf_agreement->setDescription(stripslashes(trim($_POST['description'])));
     $apf_agreement->setAccess(stripslashes(trim($_POST['access'])));
     $apf_agreement->setActive(stripslashes(trim($_POST['active'])));
     $apf_agreement->setAddIp($AddIP);
     $apf_agreement->setGroupid($group_ids);
     $apf_agreement->setUserid($userid);
     $val = $apf_agreement->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_agreement->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_agreement->update();
             $log_string = $i18n->_("Update") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("agreement/apf_agreement/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_agreement->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_agreement->insert();
             $log_string = $i18n->_("Create") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['create_date']}";
             logFileString($log_string);
             $this->forward("agreement/apf_agreement/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_agreement_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $category_arr = $this->getCategory();
         array_shift($AccessOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "CATEGORYOPTION" => selectTag("category", $category_arr, $_POST['category']), "EFFECT_DATE" => inputDateTag("effectdate", $_POST['effectdate']), "EXPIRED_DATE" => inputDateTag("expireddate", $_POST['expireddate']), "ACCESSOPTION" => radioTag("access", $AccessOption, $_POST['access']), "DESCRIPTION_TEXT" => textareaTag('description', $_POST['description'], false, "ROWS=\"8\" COLS=\"40\""), "DOACTION" => $do_action));
         foreach ($val as $k => $v) {
             if ($v == false) {
                 $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " &darr; " . $i18n->_("Please check here") . " &darr; "));
             }
         }
         $template->setVar(array("ID" => $_POST['id'], "NOID" => $_POST['noid'], "CATEGORY" => $_POST['category'], "EFFECTDATE" => $_POST['effectdate'], "EXPIREDDATE" => $_POST['expireddate'], "BUYER" => $_POST['buyer'], "VENDER" => $_POST['vender'], "BUYERSIGNATURE" => $_POST['buyersignature'], "VENDERSIGNATURE" => $_POST['vendersignature'], "DESCRIPTION" => $_POST['description'], "GROUPID" => $_POST['groupid'], "USERID" => $_POST['userid'], "ACCESS" => $_POST['access'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
Esempio n. 10
0
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $AddIP, $userid, $group_ids, $OrderStateOption, $AccessOption, $PaywayOption, $DeliverywayOption;
     $apf_order = DB_DataObject::factory('ApfOrder');
     if ($edit_submit) {
         $apf_order->get($apf_order->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_order->setNoid(stripslashes(trim($_POST['noid'])));
     $apf_order->setCategory(stripslashes(trim($_POST['category'])));
     $apf_order->setContactid(stripslashes(trim($_POST['contactid'])));
     $apf_order->setProduct(stripslashes(trim($_POST['product'])));
     $apf_order->setAmount(stripslashes(trim($_POST['amount'])));
     $apf_order->setMoney(stripslashes(trim($_POST['money'])));
     $apf_order->setDiscount(stripslashes(trim($_POST['discount'])));
     $apf_order->setPayway(stripslashes(trim($_POST['payway'])));
     $apf_order->setDeliveryway(stripslashes(trim($_POST['deliveryway'])));
     $apf_order->setDeliverydatetime(stripslashes(trim($_POST['deliverydatetime'])));
     $apf_order->setState(stripslashes(trim($_POST['state'])));
     $apf_order->setMemo(stripslashes(trim($_POST['memo'])));
     $apf_order->setAccess(stripslashes(trim($_POST['access'])));
     $apf_order->setActive(stripslashes(trim($_POST['active'])));
     $apf_order->setAddIp($AddIP);
     $apf_order->setGroupid($group_ids);
     $apf_order->setUserid($userid);
     $val = $apf_order->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_order->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_order->update();
             $log_string = $i18n->_("Update") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("order/apf_order/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_order->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_order->insert();
             $log_string = $i18n->_("Create") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['create_date']}";
             logFileString($log_string);
             $this->forward("order/apf_order/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_order_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         foreach ($val as $k => $v) {
             if ($v == false) {
                 $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " &darr; " . $i18n->_("Please check here") . " &darr; "));
             }
         }
         $template->setVar(array("ID" => $_POST['id'], "NOID" => $_POST['noid'], "CATEGORY" => $_POST['category'], "CONTACTID" => $_POST['contactid'], "PRODUCT" => $_POST['product'], "AMOUNT" => $_POST['amount'], "MONEY" => $_POST['money'], "DISCOUNT" => $_POST['discount'], "PAYWAY" => $_POST['payway'], "DELIVERYWAY" => $_POST['deliveryway'], "DELIVERYDATETIME" => $_POST['deliverydatetime'], "STATE" => $_POST['state'], "MEMO" => $_POST['memo'], "GROUPID" => $_POST['groupid'], "USERID" => $_POST['userid'], "ACCESS" => $_POST['access'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
         $category_arr = $this->getCategory();
         array_shift($AccessOption);
         array_shift($OrderStateOption);
         array_shift($PaywayOption);
         array_shift($DeliverywayOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "CATEGORYOPTION" => selectTag("category", $category_arr, $_POST['category']), "ACCESSOPTION" => radioTag("access", $AccessOption, $_POST['access']), "DELIVERYDATE" => inputDateTag("deliverydatetime", $_POST['deliverydatetime']), "MEMOTEXT" => textareaTag('memo', $_POST['memo'], false, "ROWS=\"8\" COLS=\"40\""), "PAYWAY_OPTION" => radioTag("payway", $PaywayOption, $_POST['payway']), "DELIVERY_OPTION" => radioTag("deliveryway", $DeliverywayOption, $_POST['deliveryway']), "STATE_OPTION" => radioTag("state", $OrderStateOption, $_POST['state']), "DOACTION" => $do_action));
     }
 }