function executeList()
 {
     global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $luadmin, $i18n;
     include_once $ClassDir . "URLHelper.class.php";
     $template->setFile(array("MAIN" => "apf_group_users_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $groups = $luadmin->perm->getGroups();
     $category_arr = array("" => $i18n->_("None"));
     foreach ($groups as $data) {
         $category_arr[$data['group_id']] = $data['group_define_name'];
     }
     $template->setVar(array("WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "GROUPOPTION" => selectTag("group", $category_arr, "", "onchange=\"remoteGroupUsers.inGroupUsers(this.value);remoteGroupUsers.unInGroupUsers(this.value)\""), "DOACTION" => "groupusersubmit"));
 }
 function executeList()
 {
     global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $luadmin, $i18n;
     //		Var_Dump::display($luadmin->perm->getRights());
     //		$params = array(
     //		    'fields' => array(
     //		        'right_id',
     //		        'right_define_name',
     //		        'group_id'
     //		    ),
     //		    'with' => array(
     //		        'group_id' => array(
     //		            'fields' => array(
     //		                'group_id'
     //		            ),
     //		        ),
     //		    ),
     //		    'filters' => array(
     //		        'group_id' => 3
     //		    ),
     //		    'by_group' => true,
     //		);
     //		$allGroupRights = $luadmin->perm->getRights($params);
     //
     //		$group_rights = array();
     //		if (is_array($allGroupRights) &&  count($allGroupRights)>0)
     //		{
     //			foreach($allGroupRights as $key=>$userdata)
     //			{
     //				$group_rights[$userdata['right_id']] = $userdata['right_define_name'];
     //			}
     //		}
     //		Var_Dump::display($allGroupRights);
     include_once $ClassDir . "URLHelper.class.php";
     $template->setFile(array("MAIN" => "apf_group_rights_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $groups = $luadmin->perm->getGroups();
     $category_arr = array("" => $i18n->_("None"));
     foreach ($groups as $data) {
         $category_arr[$data['group_id']] = $data['group_define_name'];
     }
     $template->setVar(array("WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "GROUPOPTION" => selectTag("group", $category_arr, "", "onchange=\"remoteGroupRights.inGroupRights(this.value);remoteGroupRights.unInGroupRights(this.value)\""), "DOACTION" => "grouprightsubmit"));
 }
 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->setPid(stripslashes(trim($_POST['pid'])));
     $apf_news_category->setCategoryName(stripslashes(trim($_POST['category_name'])));
     $apf_news_category->setActive(stripslashes(trim($_POST['active'])));
     $apf_news_category->setAddIp(stripslashes(trim($_POST['add_ip'])));
     $val = $apf_news_category->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_news_category->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_news_category->update();
             $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();
             $apf_news_category->get($insert_id);
             $apf_news_category->setOrderid($insert_id);
             $apf_news_category->update();
             $this->forward("news/apf_news_category/list/" . $_POST['pid']);
         }
     } else {
         $template->setFile(array("MAIN" => "apf_news_category_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $category_arr = array("0" => $i18n->_("None")) + ApfNews::getCategory();
         unset($category_arr[$apf_news_category->getId()]);
         array_shift($ActiveOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "CATEGORYOPTION" => selectTag("pid", $category_arr, $_POST['pid']), "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'], "PID" => $_POST['pid'], "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.º 4
0
 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"));
 }
Ejemplo n.º 5
0
 function executeList($is_related = false)
 {
     global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $i18n, $WebUploadDir, $CurrencyFormat, $ActiveOption, $userid;
     include_once $ClassDir . "URLHelper.class.php";
     require_once 'Pager/Pager.php';
     require_once 'I18N/Currency.php';
     $template->setFile(array("MAIN" => $is_related ? "apf_product_related_list.html" : "apf_product_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $currency = new I18N_Currency($CurrencyFormat);
     $category_arr = array("" => $i18n->_("All")) + $this->getCategory();
     $max_row = 30;
     $apf_product = DB_DataObject::factory('ApfProduct');
     $apf_product->orderBy('id desc');
     if (($keyword = trim($_REQUEST['q'])) != "") {
         $apf_product->whereAdd("name LIKE '%" . $apf_product->escape("{$keyword}") . "%' ");
     }
     if (($category = trim($_REQUEST['category'])) != "") {
         $apf_product->whereAdd(" category = '" . $apf_product->escape("{$category}") . "'  ");
     }
     if (($active = trim($_REQUEST['active'])) != "") {
         $apf_product->whereAdd(" active = '" . $apf_product->escape("{$active}") . "'  ");
     }
     $apf_product->setUserid($userid);
     $ToltalNum = $apf_product->count();
     $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row;
     $apf_product->limit($start_num, $max_row);
     $apf_product->find();
     $myData = array();
     while ($apf_product->fetch()) {
         $myData[] = $apf_product->toArray();
     }
     $params = array('totalItems' => $ToltalNum, 'perPage' => $max_row, 'delta' => 8, 'append' => true, 'separator' => ' | ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'prevImg' => $i18n->_("PrevPage"), 'nextImg' => $i18n->_("NextPage"), 'mode' => 'Jumping', 'extraVars' => array());
     $pager =& Pager::factory($params);
     $links = $pager->getLinks();
     $current_page = $pager->getCurrentPageID();
     $selectBox = $pager->getPageSelectBox(array('autoSubmit' => true));
     $i = 0;
     foreach ($myData as $data) {
         $i % 2 == 0 ? $list_td_class = "admin_row_0" : ($list_td_class = "admin_row_1");
         $template->setVar(array("LIST_TD_CLASS" => $list_td_class));
         $template->setVar(array("ID" => $data['id'], "CATEGORY" => $category_arr[$data['category']], "COMPANY_ID" => $data['company_id'], "NAME" => $data['name'], "PRICE" => $currency->format($data['price']), "PHOTO" => imageTag($data['photo']), "MEMO" => $data['memo'], "ACTIVE" => $ActiveOption[$data['active']], "ADD_IP" => $data['add_ip'], "CREATED_AT" => $data['created_at'], "UPDATE_AT" => $data['update_at']));
         $template->parse("list_block", "main_list", TRUE);
         $i++;
     }
     $template->setVar(array("KEYWORD" => textTag("q", $_REQUEST['q']), "CATEGORYOPTION" => selectTag("category", $category_arr, $_REQUEST['category']), "ACTIVEOPTION" => selectTag("active", $ActiveOption, $_REQUEST['active']), "WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "TOLTAL_NUM" => $ToltalNum, "CURRENT_PAGE" => $current_page, "SELECT_BOX" => $selectBox, "PAGINATION" => $links['all']));
 }
Ejemplo n.º 6
0
 /**
  * @test
  */
 public function shouldReturnSelectWhenOptionValuesStartFromZero()
 {
     //given
     $items = array(0 => 'Opt1', 1 => 'Opt2');
     $attributes = array('size' => "1");
     //when
     $result = selectTag("lab", $items, array(1), $attributes);
     //then
     $expected = '<select id="lab" name="lab" size="1"><option value="0" >Opt1</option><option value="1" selected>Opt2</option></select>';
     $this->assertEquals($expected, $result);
 }
Ejemplo n.º 7
0
 function executeList()
 {
     global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $CurrencyFormat, $ActiveOption, $i18n;
     include_once $ClassDir . "URLHelper.class.php";
     require_once 'Pager/Pager.php';
     require_once 'I18N/Currency.php';
     $template->setFile(array("MAIN" => "apf_news_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $currency = new I18N_Currency($CurrencyFormat);
     $category_arr = array("" => $i18n->_("All")) + $this->getCategory();
     $max_row = 30;
     $apf_news = DB_DataObject::factory('ApfNews');
     $apf_news->orderBy('apf_news.id desc');
     if (($keyword = trim($_REQUEST['q'])) != "") {
         $apf_news->whereAdd("title LIKE '%" . $apf_news->escape("{$keyword}") . "%' OR content LIKE '%" . $apf_news->escape("{$keyword}") . "%' ");
     }
     if (($category = trim($_REQUEST['category'])) != "") {
         $apf_news->whereAdd(" category_id = '" . $apf_news->escape("{$category}") . "'  ");
     }
     if (($active = trim($_REQUEST['active'])) != "") {
         $apf_news->whereAdd(" active = '" . $apf_news->escape("{$active}") . "'  ");
     }
     $ToltalNum = $apf_news->count();
     $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row;
     $apf_news->limit($start_num, $max_row);
     $apf_news->find();
     $i = 0;
     $myData = array();
     while ($apf_news->fetch()) {
         $myData[] = $apf_news->toArray();
         $i++;
     }
     $tmpData = $ToltalNum > $max_row ? array_pad($myData, $ToltalNum, array()) : $myData;
     $params = array('itemData' => $tmpData, 'perPage' => $max_row, 'delta' => 8, 'append' => true, 'separator' => ' | ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'mode' => 'Jumping', 'extraVars' => array());
     $pager =& Pager::factory($params);
     $page_data = $pager->getPageData();
     $links = $pager->getLinks();
     $selectBox = $pager->getPerPageSelectBox();
     $i = 0;
     foreach ($myData as $data) {
         $i % 2 == 0 ? $list_td_class = "admin_row_0" : ($list_td_class = "admin_row_1");
         $template->setVar(array("LIST_TD_CLASS" => $list_td_class));
         $template->setVar(array("ID" => $data['id'], "CATEGORY_ID" => $category_arr[$data['category_id']], "TITLE" => "<a href=\"###\" onclick=\"popOpenWindow('{$WebBaseDir}/news/apf_news/detail/{$data['id']}', '', '', 600, 600, 'yes')\">" . $data['title'] . "</a>", "CONTENT" => $data['content'], "ACTIVE" => $ActiveOption[$data['active']], "ADD_IP" => $data['add_ip'], "CREATED_AT" => $data['created_at'], "UPDATE_AT" => $data['update_at']));
         $template->parse("list_block", "main_list", TRUE);
         $i++;
     }
     $template->setVar(array("KEYWORD" => textTag("q", $_REQUEST['q']), "CATEGORYOPTION" => selectTag("category", $category_arr, $_REQUEST['category']), "ACTIVEOPTION" => selectTag("active", $ActiveOption, $_REQUEST['active']), "WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "TOLTAL_NUM" => $ToltalNum, "PAGINATION" => $links['all']));
 }
Ejemplo n.º 8
0
 function executeList()
 {
     global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $ActiveOption, $i18n, $userid;
     include_once $ClassDir . "URLHelper.class.php";
     require_once 'Pager/Pager.php';
     $template->setFile(array("MAIN" => "apf_company_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $max_row = 30;
     $apf_company = DB_DataObject::factory('ApfCompany');
     $order = $_GET['order'] ? $_GET['order'] : "DESC";
     $orderfield = $_GET['orderfield'] ? $_GET['orderfield'] : "id";
     $apf_company->orderBy($apf_company->escape($orderfield) . " " . $apf_company->escape($order));
     if (($keyword = trim($_REQUEST['q'])) != "") {
         $apf_company->whereAdd("name LIKE '%" . $apf_company->escape("{$keyword}") . "%' OR addrees LIKE '%" . $apf_company->escape("{$keyword}") . "%' OR phone LIKE '%" . $apf_company->escape("{$keyword}") . "%' OR link_man LIKE '%" . $apf_company->escape("{$keyword}") . "%' ");
     }
     if (($active = trim($_REQUEST['active'])) != "") {
         $apf_company->whereAdd(" active = '" . $apf_company->escape("{$active}") . "'  ");
     }
     $apf_company->setUserid($userid);
     $ToltalNum = $apf_company->count();
     $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row;
     $apf_company->limit($start_num, $max_row);
     $apf_company->find();
     $myData = array();
     while ($apf_company->fetch()) {
         $myData[] = $apf_company->toArray();
     }
     $params = array('totalItems' => $ToltalNum, 'perPage' => $max_row, 'delta' => 8, 'append' => true, 'separator' => ' | ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'prevImg' => $i18n->_("PrevPage"), 'nextImg' => $i18n->_("NextPage"), 'mode' => 'Jumping', 'extraVars' => array('q' => $_REQUEST['q'], 'active' => $_REQUEST['active'], 'order' => $_REQUEST['order'], 'orderfield' => $_REQUEST['orderfield']));
     $pager =& Pager::factory($params);
     $links = $pager->getLinks();
     $current_page = $pager->getCurrentPageID();
     $selectBox = $pager->getPageSelectBox(array('autoSubmit' => true));
     $page_exten = str_replace($pager->_url . "?", "", $pager->_getLinkTagUrl(null));
     $id_header_url = showHeaderLink("id", $i18n->_("ID"), $_REQUEST['orderfield'], $_GET['order'], $page_exten, $pager->_url);
     $i = 0;
     foreach ($myData as $data) {
         $i % 2 == 0 ? $list_td_class = "admin_row_0" : ($list_td_class = "admin_row_1");
         $template->setVar(array("LIST_TD_CLASS" => $list_td_class));
         $template->setVar(array("ID" => $data['id'], "NAME" => "<a href=\"{$WebBaseDir}/company/apf_company/detail/{$data['id']}\" >" . $data['name'] . "</a>", "ADDREES" => $data['addrees'], "PHONE" => $data['phone'], "FAX" => $data['fax'], "EMAIL" => showEmail($data['email']), "PHOTO" => $data['photo'], "HOMEPAGE" => $data['homepage'], "EMPLOYEE" => $data['employee'], "BANKROLL" => $data['bankroll'], "LINK_MAN" => $data['link_man'], "INCORPORATOR" => $data['incorporator'], "INDUSTRY" => $data['industry'], "PRODUCTS" => $data['products'], "MEMO" => $data['memo'], "ACTIVE" => $ActiveOption[$data['active']], "ADD_IP" => $data['add_ip'], "CREATED_AT" => $data['created_at'], "UPDATE_AT" => $data['update_at']));
         $template->parse("list_block", "main_list", TRUE);
         $i++;
     }
     $template->setVar(array("KEYWORD" => textTag("q", $_REQUEST['q']), "ACTIVEOPTION" => selectTag("active", $ActiveOption, $_REQUEST['active']), "WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "TOLTAL_NUM" => $ToltalNum, "CURRENT_PAGE" => $current_page, "SELECT_BOX" => $selectBox, "ID_HEAD_URL" => $id_header_url, "PAGINATION" => $links['all']));
 }
function vcn_admin_data($selected = null)
{
    $data = array('history' => 'Lịch sử giao dịch', 'customer' => 'Danh sách khách hàng');
    return selectTag($data, null, null, array_merge(array('name' => 'admin_data'), $selected ? array('selected' => $selected) : array()));
}
Ejemplo n.º 10
0
 public function selectField($field, array $items, $options = array(), $promptOption = null)
 {
     $attributes = $this->_generatePredefinedAttributes($field);
     $attributes = $this->_mergeAttributes($attributes, $options);
     return selectTag($this->generateName($field), $items, array($this->_object->{$field}), $attributes, $promptOption);
 }
Ejemplo n.º 11
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));
 }
Ejemplo n.º 12
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'])));
     }
 }
 function handleFormData($edit_submit = false)
 {
     global $template, $WebBaseDir, $i18n, $AddIP, $userid, $group_ids, $AccessOption, $ComplaintsStateOption;
     $apf_refundment = DB_DataObject::factory('ApfRefundment');
     if ($edit_submit) {
         $apf_refundment->get($apf_refundment->escape($_POST['ID']));
         $do_action = "updatesubmit";
     } else {
         $do_action = "addsubmit";
     }
     $apf_refundment->setCategory(stripslashes(trim($_POST['category'])));
     $apf_refundment->setCompany(stripslashes(trim($_POST['company'])));
     $apf_refundment->setRefundmenter(stripslashes(trim($_POST['refundmenter'])));
     $apf_refundment->setReasons(stripslashes(trim($_POST['reasons'])));
     $apf_refundment->setReply(stripslashes(trim($_POST['reply'])));
     $apf_refundment->setHandleman(stripslashes(trim($_POST['handleman'])));
     $apf_refundment->setHandledate(stripslashes(trim($_POST['handledate'])));
     $apf_refundment->setState(stripslashes(trim($_POST['state'])));
     $apf_refundment->setAccess(stripslashes(trim($_POST['access'])));
     $apf_refundment->setActive(stripslashes(trim($_POST['active'])));
     $apf_refundment->setAddIp($AddIP);
     $apf_refundment->setGroupid($group_ids);
     $apf_refundment->setUserid($userid);
     $val = $apf_refundment->validate();
     if ($val === TRUE) {
         if ($edit_submit) {
             $apf_refundment->setUpdateAt(DB_DataObject_Cast::dateTime());
             $apf_refundment->update();
             $log_string = $i18n->_("Update") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['ID']}";
             logFileString($log_string);
             $this->forward("refundment/apf_refundment/update/" . $_POST['ID'] . "/ok");
         } else {
             $apf_refundment->setCreatedAt(DB_DataObject_Cast::dateTime());
             $apf_refundment->insert();
             $log_string = $i18n->_("Create") . $i18n->_("ModuleName") . "\t{$_POST['name']}=>{$_POST['create_date']}";
             logFileString($log_string);
             $this->forward("refundment/apf_refundment/");
         }
     } else {
         $template->setFile(array("MAIN" => "apf_refundment_edit.html"));
         $template->setBlock("MAIN", "edit_block");
         $category_arr = $this->getCategory();
         array_shift($AccessOption);
         array_shift($ComplaintsStateOption);
         $template->setVar(array("WEBDIR" => $WebBaseDir, "CATEGORYOPTION" => selectTag("category", $category_arr, $_POST['category']), "ACCESSOPTION" => radioTag("access", $AccessOption, $_POST['access']), "STATE_OPTION" => radioTag("state", $ComplaintsStateOption, $_POST['state']), "HANDLE_DATE" => inputDateTag("handledate", $_POST['handledate']), "REASONS_TEXT" => textareaTag('reasons', $_POST['reasons'], 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'], "CATEGORY" => $_POST['category'], "COMPANY" => $_POST['company'], "REFUNDMENTER" => $_POST['refundmenter'], "REASONS" => $_POST['reasons'], "REPLY" => $_POST['reply'], "HANDLEMAN" => $_POST['handleman'], "HANDLEDATE" => $_POST['handledate'], "STATE" => $_POST['state'], "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 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']));
     }
 }
Ejemplo n.º 15
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));
     }
 }