コード例 #1
0
 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" => " ↓ " . $i18n->_("Please check here") . " ↓ "));
             }
         }
         $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']));
     }
 }
コード例 #2
0
 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" => " ↓ " . $i18n->_("Please check here") . " ↓ "));
             }
         }
         $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']));
     }
 }
コード例 #3
0
 function executeList()
 {
     global $template, $i18n, $WebBaseDir, $WebTemplateDir, $controller, $ClassDir, $TemplateDir, $TimeOption, $ActiveOption;
     include_once $ClassDir . "URLHelper.class.php";
     $template->setFile(array("MAIN" => "apf_schedule_list.html"));
     $do_action = "AddSubmit";
     $template->setBlock("MAIN", "main_list", "list_block");
     //		set default day or get select day
     if ($_REQUEST['y'] && $_REQUEST['m'] && $_REQUEST['d']) {
         $select_y = $_REQUEST['y'];
         $select_m = $_REQUEST['m'];
         $select_d = $_REQUEST['d'];
     } else {
         $next_week_time = $this->getDefaultDate();
         $select_y = date("Y", $next_week_time);
         $select_m = date("m", $next_week_time);
         $select_d = date("d", $next_week_time);
     }
     $start_time = "";
     $end_time = "";
     $image_string = "";
     $active = "new";
     $used_hours_arr = array();
     $CalDailyView = $this->renderDayView($select_y, $select_m, $select_d, $used_hours_arr);
     $un_use_hour_arr = array_diff($TimeOption, $used_hours_arr);
     if ($controller->getID()) {
         $un_use_hour_arr = $TimeOption;
         $apf_schedule = DB_DataObject::factory('ApfSchedule');
         $apf_schedule->get($apf_schedule->escape($controller->getID()));
         $do_action = "UpdateSubmit";
         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_schedule->getId(), "TITLE" => $apf_schedule->getTitle(), "DESCRIPTION" => $apf_schedule->getDescription(), "PUBLISH_DATE" => $apf_schedule->getPublishDate(), "PUBLISH_STARTTIME" => $apf_schedule->getPublishStarttime(), "PUBLISH_ENDTIME" => $apf_schedule->getPublishEndtime(), "IMAGE" => $apf_schedule->getImage(), "ACTIVE" => $apf_schedule->getActive(), "ADD_IP" => $apf_schedule->getAddIp(), "CREATED_AT" => $apf_schedule->getCreatedAt(), "UPDATE_AT" => $apf_schedule->getUpdateAt()));
         $start_time = $this->shorTimeFormat($apf_schedule->getPublishStarttime());
         $end_time = $this->shorTimeFormat($apf_schedule->getPublishEndtime());
         $image_string = $apf_schedule->getImage();
         $active = $apf_schedule->getActive();
     } else {
         if ($_REQUEST['act'] == "ExportWeek") {
             $this->exportWeek();
         }
     }
     array_shift($ActiveOption);
     $template->setVar(array("WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "PUBLISHDATE" => inputDateTag("publish_date", "{$select_y}-{$select_m}-{$select_d}"), "IMAGES_FILE" => fileTag('image', $image_string), "STATUS_FIELD" => selectTag('active', $ActiveOption, $active), "PUBLISH_STARTTIME_OPTION" => selectTag('publish_starttime', $un_use_hour_arr, $start_time), "PUBLISH_ENDTIME_OPTION" => selectTag('publish_endtime', $un_use_hour_arr, $end_time), "DOACTION" => $do_action, "LEFT_CALENDAR" => $this->renderMonthView(), "DAY_VIEW" => $CalDailyView, "PUBLISH_DATE" => "{$select_y}-{$select_m}-{$select_d}", "Y" => $select_y, "M" => $select_m, "D" => $select_d));
 }
コード例 #4
0
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $ActiveOption, $DebitOption, $AddIP, $userid, $group_ids;
     $apf_finance = DB_DataObject::factory('ApfFinance');
     if ($edit_submit) {
         $apf_finance->get($apf_finance->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_finance->setCategory(stripslashes(trim($_POST['category'])));
     $apf_finance->setCreateDate(stripslashes(trim($_POST['create_date'])));
     $apf_finance->setAmount(stripslashes(trim($_POST['amount'])));
     $apf_finance->setDebit(stripslashes(trim($_POST['debit'])));
     $apf_finance->setMoney(stripslashes(trim($_POST['money'])));
     $apf_finance->setMemo(stripslashes(trim($_POST['memo'])));
     $apf_finance->setActive(stripslashes(trim($_POST['active'])));
     $apf_finance->setAddIp($AddIP);
     $apf_finance->setGroupid($group_ids);
     $apf_finance->setUserid($userid);
     $val = $apf_finance->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_finance->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_finance->update();
             $log_string = $i18n->_("Update") . $i18n->_("Finance") . "\t{$_POST['money']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("finance/apf_finance/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_finance->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_finance->insert();
             $log_string = $i18n->_("Create") . $i18n->_("Finance") . "\t{$_POST['money']}=>{$_POST['create_date']}";
             logFileString($log_string);
             $this->forward("finance/apf_finance/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_finance_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $template->setVar(array("WEBDIR" => $WebBaseDir, "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'], "CATEGORY" => $_POST['category'], "CREATE_DATE" => $_POST['create_date'], "AMOUNT" => $_POST['amount'], "DEBIT" => $_POST['debit'], "MONEY" => $_POST['money'], "MEMO" => $_POST['memo'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
         $category_arr = $this->getCategory();
         array_shift($ActiveOption);
         array_shift($DebitOption);
         $template->setVar(array("CATEGORYOPTION" => selectTag("category", $category_arr, $_POST['category']), "CREATEDATE" => inputDateTag("create_date", $_POST['create_date']), "AMOUNTTEXT" => textTag("amount", $_POST['amount']), "ACTIVEOPTION" => radioTag("active", $ActiveOption, $_POST['active']), "DEBITOPTION" => radioTag("debit", $DebitOption, $_POST['debit'])));
     }
 }
コード例 #5
0
 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']));
     }
 }
コード例 #6
0
 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']));
     }
 }
コード例 #7
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));
     }
 }
コード例 #8
0
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $GenderOption, $ActiveOption, $ClassDir, $UploadDir, $AllowUploadFilesType, $AddIP, $userid, $group_ids;
     $apf_contact = DB_DataObject::factory('ApfContact');
     if ($edit_submit) {
         $apf_contact->get($apf_contact->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_contact->setCategory(stripslashes(trim($_POST['category'])));
     $apf_contact->setCompanyId(stripslashes(trim($_POST['company_id'])));
     $apf_contact->setName(stripslashes(trim($_POST['name'])));
     $apf_contact->setGender(stripslashes(trim($_POST['gender'])));
     $apf_contact->setBirthday(stripslashes(trim($_POST['birthday'])));
     $apf_contact->setAddrees(stripslashes(trim($_POST['addrees'])));
     $apf_contact->setOfficePhone(stripslashes(trim($_POST['office_phone'])));
     $apf_contact->setPhone(stripslashes(trim($_POST['phone'])));
     $apf_contact->setFax(stripslashes(trim($_POST['fax'])));
     $apf_contact->setMobile(stripslashes(trim($_POST['mobile'])));
     $apf_contact->setEmail(stripslashes(trim($_POST['email'])));
     $apf_contact->setHomepage(stripslashes(trim($_POST['homepage'])));
     $apf_contact->setMemo(stripslashes(trim($_POST['memo'])));
     $apf_contact->setActive(stripslashes(trim($_POST['active'])));
     $apf_contact->setAddIp($AddIP);
     $apf_contact->setGroupid($group_ids);
     $apf_contact->setUserid($userid);
     if ($_POST['photo_del'] == 'Y') {
         unlink($UploadDir . $_POST['photo_old']);
         $apf_contact->setPhoto("");
         $_POST['photo_old'] = "";
     }
     if ($_POST['upload_temp']) {
         $apf_contact->setPhoto($_POST['upload_temp']);
     }
     $allow_upload_file = TRUE;
     if ($_FILES['photo']['name']) {
         require_once $ClassDir . "FileHelper.class.php";
         $upload_data = FileHelper::uploadFile("contact");
         $allow_upload_file = $upload_data["upload_state"];
         if ($allow_upload_file) {
             $photos_arr = $upload_data["upload_msg"];
             if ($photo_pic = $photos_arr['photo']) {
                 $apf_contact->setPhoto($photo_pic);
                 $_POST['upload_temp'] = $photo_pic;
             }
         } else {
             $upload_error_msg = $upload_data["upload_msg"];
         }
     }
     $val = $apf_contact->validate();
     if ($val === TRUE && $allow_upload_file === TRUE) {
         if ($edit_submit) {
             $apf_contact->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_contact->update();
             $log_string = $i18n->_("Update") . $i18n->_("Contact") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("contact/apf_contact/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_contact->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_contact->insert();
             $log_string = $i18n->_("Create") . $i18n->_("Contact") . "\t{$_POST['name']}";
             logFileString($log_string);
             $this->forward("contact/apf_contact/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_contact_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $template->setVar(array("WEBDIR" => $WebBaseDir, "DOACTION" => $do_action));
         $category_arr = $this->getCategory();
         array_shift($GenderOption);
         array_shift($ActiveOption);
         $template->setVar(array("CATEGORYOPTION" => selectTag("category", $category_arr, $_POST['category']), "BIRTHDAYDATE" => inputDateTag("birthday", $_POST['birthday']), "GENDEROPTION" => radioTag("gender", $GenderOption, $_POST['gender']), "FILEPHOTO" => fileTag("photo", $_POST['photo_old']), "ACTIVEOPTION" => radioTag("active", $ActiveOption, $_POST['active'])));
         foreach ($val as $k => $v) {
             if ($v == false) {
                 $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " &darr; " . $i18n->_("Please check here") . " &darr; "));
             }
         }
         if ($allow_upload_file !== TRUE) {
             $template->setVar(array("PHOTO_ERROR_MSG" => " &darr; {$upload_error_msg} &darr; "));
         }
         $template->setVar(array("ID" => $_POST['id'], "CATEGORY" => $_POST['category'], "COMPANY_ID" => $_POST['company_id'], "NAME" => $_POST['name'], "GENDER" => $_POST['gender'], "BIRTHDAY" => $_POST['birthday'], "ADDREES" => $_POST['addrees'], "OFFICE_PHONE" => $_POST['office_phone'], "PHONE" => $_POST['phone'], "FAX" => $_POST['fax'], "MOBILE" => $_POST['mobile'], "EMAIL" => $_POST['email'], "PHOTO" => $_POST['photo'], "HOMEPAGE" => $_POST['homepage'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }