Ejemplo n.º 1
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" => " ↓ " . $i18n->_("Please check here") . " ↓ "));
             }
         }
         $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'])));
     }
 }
 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" => " ↓ " . $i18n->_("Please check here") . " ↓ "));
             }
         }
         $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']));
     }
 }
Ejemplo n.º 3
0
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $ActiveOption, $AddIP, $userid, $group_ids;
     $apf_news = DB_DataObject::factory('ApfNews');
     if ($edit_submit) {
         $apf_news->get($apf_news->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_news->setCategoryId(stripslashes(trim($_POST['category_id'])));
     $apf_news->setTitle(stripslashes(trim($_POST['title'])));
     $apf_news->setContent(stripslashes(trim($_POST['content'])));
     $apf_news->setActive(stripslashes(trim($_POST['active'])));
     $apf_finance->setAddIp($AddIP);
     $apf_finance->setGroupid($group_ids);
     $apf_finance->setUserid($userid);
     $val = $apf_news->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_news->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_news->update();
             $log_string = $i18n->_("Update") . $i18n->_("News") . "\t{$_POST['title']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("news/apf_news/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_news->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_news->insert();
             $log_string = $i18n->_("Create") . $i18n->_("News") . "\t{$_POST['title']}";
             logFileString($log_string);
             $this->forward("news/apf_news/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_news_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $template->setVar(array("WEBDIR" => $WebBaseDir, "DOACTION" => $do_action));
         $category_arr = $this->getCategory();
         array_shift($ActiveOption);
         $template->setVar(array("ACTIVEOPTION" => radioTag("active", $ActiveOption, $_POST['active']), "CATEGORYOPTION" => selectTag("category_id", $category_arr, $_POST['category_id'])));
         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'], "CATEGORY_ID" => $_POST['category_id'], "TITLE" => $_POST['title'], "CONTENT" => $_POST['content'], "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, $ActiveOption;
     $apf_news_category = DB_DataObject::factory('ApfNewsCategory');
     if ($edit_submit) {
         $apf_news_category->get($apf_news_category->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_news_category->setCategoryName(stripslashes(trim($_POST['category_name'])));
     $apf_news_category->setOrderid(stripslashes(trim($_POST['orderid'])));
     $apf_news_category->setActive(stripslashes(trim($_POST['active'])));
     $apf_news_category->setAddIp(stripslashes(trim($_POST['add_ip'])));
     $apf_news_category->setCreatedAt(stripslashes(trim($_POST['created_at'])));
     $apf_news_category->setUpdateAt(stripslashes(trim($_POST['update_at'])));
     $val = $apf_news_category->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_news_category->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_news_category->update();
             $log_string = $i18n->_("Update") . $i18n->_("NewsCategory") . "\t{$_POST['category_name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("news/apf_news_category/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_news_category->setCreatedAt(DB_DataObject_Cast::dateTime());
             $insert_id = $apf_news_category->insert();
             $log_string = $i18n->_("Create") . $i18n->_("NewsCategory") . "\t{$_POST['category_name']}";
             logFileString($log_string);
             $apf_news_category->get($insert_id);
             $apf_news_category->setOrderid($insert_id);
             $apf_news_category->update();
             $this->forward("news/apf_news_category/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_news_category_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         array_shift($ActiveOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "ACTIVEOPTION" => radioTag("active", $ActiveOption, $_POST['active']), "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'], "CATEGORY_NAME" => $_POST['category_name'], "ORDERID" => $_POST['orderid'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
Ejemplo n.º 5
0
 function executeDel()
 {
     global $controller, $i18n;
     $apf_review = DB_DataObject::factory('ApfReview');
     $apf_review->get($apf_review->escape($controller->getID()));
     $apf_review->setActive('deleted');
     $apf_review->update();
     $log_string = $i18n->_("Delete") . $i18n->_("File") . "\t{$filename}";
     logFileString($log_string);
     $this->forward("review/apf_review/");
 }
 function executeDel()
 {
     global $controller, $i18n;
     $apf_complaints_category = DB_DataObject::factory('ApfComplaintsCategory');
     $apf_complaints_category->get($apf_complaints_category->escape($controller->getID()));
     $apf_complaints_category->setActive('deleted');
     $apf_complaints_category->update();
     $log_string = $i18n->_("Delete") . $i18n->_("File") . "\t{$filename}";
     logFileString($log_string);
     $this->forward("complaints/apf_complaints_category/");
 }
Ejemplo n.º 7
0
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $ActiveOption, $ClassDir, $UploadDir, $AllowUploadFilesType, $AddIP, $userid, $group_ids;
     $apf_product = DB_DataObject::factory('ApfProduct');
     if ($edit_submit) {
         $apf_product->get($apf_product->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_product->setCategory(stripslashes(trim($_POST['category'])));
     $apf_product->setCompanyId(stripslashes(trim($_POST['company_id'])));
     $apf_product->setName(stripslashes(trim($_POST['name'])));
     $apf_product->setPrice(stripslashes(trim($_POST['price'])));
     $apf_product->setMemo(stripslashes(trim($_POST['memo'])));
     $apf_product->setActive(stripslashes(trim($_POST['active'])));
     $apf_product->setAddIp($AddIP);
     $apf_product->setGroupid($group_ids);
     $apf_product->setUserid($userid);
     if ($_POST['photo_del'] == 'Y') {
         unlink($UploadDir . $_POST['photo_old']);
         $apf_product->setPhoto("");
         $_POST['photo_old'] = "";
     }
     if ($_POST['upload_temp']) {
         $apf_product->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_product->setPhoto($photo_pic);
                 $_POST['upload_temp'] = $photo_pic;
             }
         } else {
             $upload_error_msg = $upload_data["upload_msg"];
         }
     }
     $val = $apf_product->validate();
     if ($val === TRUE && $allow_upload_file === TRUE) {
         if ($edit_submit) {
             $apf_product->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_product->update();
             $log_string = $i18n->_("Update") . $i18n->_("Product") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("product/apf_product/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_product->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_product->insert();
             $log_string = $i18n->_("Create") . $i18n->_("Product") . "\t{$_POST['name']}";
             logFileString($log_string);
             $this->forward("product/apf_product/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_product_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $template->setVar(array("WEBDIR" => $WebBaseDir, "DOACTION" => $do_action));
         $category_arr = $this->getCategory();
         array_shift($ActiveOption);
         $template->setVar(array("CATEGORYOPTION" => selectTag("category", $category_arr, $_POST['category']), "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" => " ↓ " . $i18n->_("Please check here") . " ↓ "));
             }
         }
         $template->setVar(array("ID" => $_POST['id'], "CATEGORY" => $_POST['category'], "COMPANY_ID" => $_POST['company_id'], "NAME" => $_POST['name'], "PRICE" => $_POST['price'], "PHOTO" => $_POST['photo'], "MEMO" => $_POST['memo'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
Ejemplo n.º 8
0
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $ActiveOption, $UploadDir, $ClassDir, $AllowUploadFilesType, $AddIP, $userid, $group_ids;
     $apf_company = DB_DataObject::factory('ApfCompany');
     if ($edit_submit) {
         $apf_company->get($apf_company->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_company->setName(stripslashes(trim($_POST['name'])));
     $apf_company->setAddrees(stripslashes(trim($_POST['addrees'])));
     $apf_company->setPhone(stripslashes(trim($_POST['phone'])));
     $apf_company->setFax(stripslashes(trim($_POST['fax'])));
     $apf_company->setEmail(stripslashes(trim($_POST['email'])));
     $apf_company->setPhoto(stripslashes(trim($_POST['photo'])));
     $apf_company->setHomepage(stripslashes(trim($_POST['homepage'])));
     $apf_company->setEmployee(stripslashes(trim($_POST['employee'])));
     $apf_company->setBankroll(stripslashes(trim($_POST['bankroll'])));
     $apf_company->setLinkMan(stripslashes(trim($_POST['link_man'])));
     $apf_company->setIncorporator(stripslashes(trim($_POST['incorporator'])));
     $apf_company->setIndustry(stripslashes(trim($_POST['industry'])));
     $apf_company->setProducts(stripslashes(trim($_POST['products'])));
     $apf_company->setMemo(stripslashes(trim($_POST['memo'])));
     $apf_company->setActive(stripslashes(trim($_POST['active'])));
     $apf_company->setAddIp($AddIP);
     $apf_company->setGroupid($group_ids);
     $apf_company->setUserid($userid);
     if ($_POST['photo_del'] == 'Y') {
         unlink($UploadDir . $_POST['photo_old']);
         $apf_company->setPhoto("");
         $_POST['photo_old'] = "";
     }
     if ($_POST['upload_temp']) {
         $apf_company->setPhoto($_POST['upload_temp']);
     }
     $allow_upload_file = TRUE;
     if ($_FILES['photo']['name']) {
         require_once $ClassDir . "FileHelper.class.php";
         $upload_data = FileHelper::uploadFile("company");
         $allow_upload_file = $upload_data["upload_state"];
         if ($allow_upload_file) {
             $photos_arr = $upload_data["upload_msg"];
             if ($photo_pic = $photos_arr['photo']) {
                 $apf_company->setPhoto($photo_pic);
                 $_POST['upload_temp'] = $photo_pic;
             }
         } else {
             $upload_error_msg = $upload_data["upload_msg"];
         }
     }
     $val = $apf_company->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_company->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_company->update();
             $log_string = $i18n->_("Update") . $i18n->_("Company") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("company/apf_company/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_company->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_company->insert();
             $log_string = $i18n->_("Create") . $i18n->_("Company") . "\t{$_POST['name']}";
             logFileString($log_string);
             $this->forward("company/apf_company/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_company_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         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'], "NAME" => $_POST['name'], "ADDREES" => $_POST['addrees'], "PHONE" => $_POST['phone'], "FAX" => $_POST['fax'], "EMAIL" => $_POST['email'], "PHOTO" => $_POST['photo'], "HOMEPAGE" => $_POST['homepage'], "EMPLOYEE" => $_POST['employee'], "BANKROLL" => $_POST['bankroll'], "LINK_MAN" => $_POST['link_man'], "INCORPORATOR" => $_POST['incorporator'], "INDUSTRY" => $_POST['industry'], "PRODUCTS" => $_POST['products'], "MEMO" => $_POST['memo'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
         array_shift($ActiveOption);
         $template->setVar(array("FILEPHOTO" => fileTag("photo", $_POST['photo_old']), "WEBDIR" => $WebBaseDir, "ACTIVEOPTION" => radioTag("active", $ActiveOption, $_POST['active']), "DOACTION" => $do_action));
     }
 }
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $TimeOption, $ActiveOption, $AddIP, $userid, $group_ids, $ClassDir, $UploadDir;
     $apf_schedule = DB_DataObject::factory('ApfSchedule');
     if ($edit_submit) {
         $apf_schedule->get($apf_schedule->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_schedule->setTitle(stripslashes(trim($_POST['title'])));
     $apf_schedule->setDescription(stripslashes(trim($_POST['description'])));
     $apf_schedule->setPublishDate(DB_DataObject_Cast::date(stripslashes(trim($_POST['publish_date']))));
     $apf_schedule->setPublishStarttime(DB_DataObject_Cast::time(stripslashes(trim($_POST['publish_starttime']))));
     $apf_schedule->setPublishEndtime(DB_DataObject_Cast::time(stripslashes(trim($_POST['publish_endtime']))));
     $apf_schedule->setImage(stripslashes(trim($_POST['image'])));
     $apf_schedule->setActive(stripslashes(trim($_POST['active'])));
     $apf_schedule->setAddIp($AddIP);
     $apf_schedule->setGroupid($group_ids);
     $apf_schedule->setUserid($userid);
     if ($_POST['image_del'] == 'Y') {
         unlink($UploadDir . $_POST['image_old']);
         $apf_schedule->setImage("");
         $_POST['image_old'] = "";
     }
     if ($_POST['upload_temp']) {
         $apf_schedule->setImage($_POST['upload_temp']);
     }
     $allow_upload_file = TRUE;
     if ($_FILES['image']['name']) {
         require_once $ClassDir . "FileHelper.class.php";
         $upload_data = FileHelper::uploadFile("schedule");
         $allow_upload_file = $upload_data["upload_state"];
         if ($allow_upload_file) {
             $images_arr = $upload_data["upload_msg"];
             if ($image_pic = $images_arr['image']) {
                 $apf_schedule->setImage($image_pic);
                 $_POST['upload_temp'] = $image_pic;
             }
         } else {
             $upload_error_msg = $upload_data["upload_msg"];
         }
     }
     $val = $apf_schedule->validate();
     if ($val === TRUE && $allow_upload_file === TRUE) {
         if ($edit_submit) {
             $apf_schedule->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_schedule->update();
             $log_string = $i18n->_("Update") . $i18n->_("Schedule") . "\t{$_POST['title']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("schedule/apf_schedule/list/" . $_POST['ID'] . "/ok/?y=" . $_REQUEST['y'] . "&m=" . $_REQUEST['m'] . "&d=" . $_REQUEST['d'] . "");
         } else {
             $apf_schedule->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_schedule->insert();
             $log_string = $i18n->_("Create") . $i18n->_("Schedule") . "\t{$_POST['title']}";
             logFileString($log_string);
             $this->forward("schedule/apf_schedule/list/?y=" . $_REQUEST['y'] . "&m=" . $_REQUEST['m'] . "&d=" . $_REQUEST['d'] . "");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_schedule_list.html"));
         $template->setBlock("MAIN", "edit_block");
         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);
         }
         $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);
         array_shift($ActiveOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "IMAGES_FILE" => fileTag('image', $_POST['upload_temp'] ? $_POST['upload_temp'] : $_POST['image_old']), "STATUS_FIELD" => selectTag('status', $ActiveOption, $_POST['status']), "LEFT_CALENDAR" => $this->renderMonthView(), "DAY_VIEW" => $CalDailyView, "PUBLISH_STARTTIME_OPTION" => selectTag('publish_starttime', $un_use_hour_arr, $_POST['publish_starttime']), "PUBLISH_ENDTIME_OPTION" => selectTag('publish_endtime', $un_use_hour_arr, $_POST['publish_endtime']), "DOACTION" => $do_action, "PUBLISH_DATE" => "{$select_y}-{$select_m}-{$select_d}", "Y" => $select_y, "M" => $select_m, "D" => $select_d));
         if (is_array($val)) {
             foreach ($val as $k => $v) {
                 if ($v == false) {
                     $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " ↓ Please check here ↓ "));
                 }
             }
         }
         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'], "DESCRIPTION" => $_POST['description'], "PUBLISH_DATE" => $_POST['publish_date'], "PUBLISH_STARTTIME" => $_POST['publish_starttime'], "PUBLISH_ENDTIME" => $_POST['publish_endtime'], "IMAGE" => $_POST['image'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }
Ejemplo n.º 10
0
 function handleFileFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $DocumentDir, $ClassDir, $AddIP, $userid, $group_ids;
     $apf_files = DB_DataObject::factory('ApfFiles');
     if ($edit_submit) {
         $apf_files->get($apf_files->escape($_POST['ID']));
         $do_action = "updatefilesubmit";
     } else {
         $do_action = "addfilesubmit";
     }
     $apf_files->setName(stripslashes(trim($_POST['name'])));
     $apf_files->setParent(stripslashes(trim($_POST['parent'])));
     $apf_files->setDescription(stripslashes(trim($_POST['description'])));
     $apf_files->setMajorRevision(stripslashes(trim($_POST['major_revision'])));
     $apf_files->setMinorRevision(stripslashes(trim($_POST['minor_revision'])));
     $apf_files->setPassword(stripslashes(trim($_POST['password'])));
     $apf_files->setActive(stripslashes(trim($_POST['active'])));
     $apf_files->setAccess(stripslashes(trim($_POST['access'])));
     $apf_files->setAddIp($AddIP);
     $apf_files->setGroupid($group_ids);
     $apf_files->setUserid($userid);
     $UploadDocumentDir = $DocumentDir . $this->getFolderByPID($_POST['parent']);
     if ($_POST['filename_del'] == 'Y') {
         unlink($UploadDocumentDir . $_POST['filename_old']);
         $apf_files->setFilename("");
         $_POST['filename_old'] = "";
     }
     if ($_POST['upload_temp']) {
         $apf_files->setFilename($_POST['upload_temp']);
     }
     $allow_upload_file = TRUE;
     if ($_FILES['filename']['name']) {
         require_once $ClassDir . "FileHelper.class.php";
         $upload_data = FileHelper::uploadDocumentFile($UploadDocumentDir);
         //			Var_Dump::display($upload_data);
         $allow_upload_file = $upload_data["upload_state"];
         if ($allow_upload_file) {
             $filenames_arr = $upload_data["upload_msg"];
             if ($filename_pic = $filenames_arr['filename']) {
                 $apf_files->setFilename($filename_pic);
                 $apf_files->setExt($filenames_arr['exten_name']);
                 $apf_files->setFSize($filenames_arr['file_size']);
                 $_POST['upload_temp'] = $filename_pic;
             }
         } else {
             $upload_error_msg = $upload_data["upload_msg"];
         }
     }
     $val = $apf_files->validate();
     if ($val === TRUE && $allow_upload_file === TRUE) {
         if ($edit_submit) {
             $apf_files->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_files->update();
             $this->forward("document/apf_folders/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_files->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_files->insert();
             $log_string = $i18n->_("Create") . $i18n->_("File") . "\t{$_POST['name']}";
             logFileString($log_string);
             $this->forward("document/apf_folders/list/{$_POST['parent']}");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_files_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $template->setVar(array("WEBDIR" => $WebBaseDir, "DOACTION" => $do_action));
         if (is_array($val)) {
             foreach ($val as $k => $v) {
                 if ($v == false) {
                     $template->setVar(array(strtoupper($k) . "_ERROR_MSG" => " ↓ " . $i18n->_("Please check here") . " ↓ "));
                 }
             }
         }
         if ($allow_upload_file !== TRUE) {
             $template->setVar(array("FILENAME_ERROR_MSG" => " ↓ {$upload_error_msg} ↓ "));
         }
         $template->setVar(array("ID" => $_POST['id'], "NAME" => $_POST['name'], "PARENT" => $_POST['parent'], "FILENAME" => $_POST['filename'], "F_SIZE" => $_POST['f_size'], "DESCRIPTION" => $_POST['description'], "CHECKED_OUT" => $_POST['checked_out'], "MAJOR_REVISION" => $_POST['major_revision'], "MINOR_REVISION" => $_POST['minor_revision'], "URL" => $_POST['url'], "PASSWORD" => $_POST['password'], "USERID" => $_POST['userid'], "GROUPID" => $_POST['groupid'], "ACTIVE" => $_POST['active'], "ADD_IP" => $_POST['add_ip'], "CREATED_AT" => $_POST['created_at'], "UPDATE_AT" => $_POST['update_at']));
     }
 }