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']));
 }
예제 #2
0
 function executeTech()
 {
     global $template, $WebBaseDir, $WebTemplateDir, $controller, $RootDir, $web_base_name;
     require_once $RootDir . '/connect.php';
     require_once 'Pager/Pager.php';
     if ($web_base_name == "front_en.php") {
         $menu_left_category = "main_left_tech_category_en.html";
         $category = 6;
     } else {
         $menu_left_category = "main_left_tech_category.html";
         $category = 1;
     }
     $template->setFile(array("MENU_SUB" => $menu_left_category, "MAIN_LEFT" => $this->getMenuLeftTemplate(), "MAIN" => "main_tech.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $template->setBlock("MAIN_LEFT", "main_left", "left_block");
     if (!in_array($category, array(1, 6))) {
         $template->setBlock("MENU_SUB", "main_left_sub", "left_sub_block");
     }
     $max_row = 30;
     $apf_news = DB_DataObject::factory('ApfNews');
     $apf_news->orderBy('apf_news.id desc');
     $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row;
     $apf_news->limit($start_num, $max_row);
     $apf_news->whereAdd(" category_id = '" . $apf_news->escape("{$category}") . "'  ");
     $apf_news->whereAdd(" active='live' ");
     $ToltalNum = $apf_news->count();
     $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" => $data['category_id'], "TITLE" => $data['title'], "CONTENT" => $data['content'], "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']), "WEB_DIR" => $WebBaseDir, "WEB_TEMPLATE_DIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "TOLTAL_NUM" => $ToltalNum, "PAGINATION" => $links['all']));
 }
 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']));
 }
예제 #4
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']));
 }
 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'])));
     }
 }