Ejemplo n.º 1
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']));
 }
Ejemplo n.º 2
0
 function executeList()
 {
     global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $CurrencyFormat, $DebitOption, $ActiveOption, $i18n, $userid;
     include_once $ClassDir . "URLHelper.class.php";
     require_once 'Pager/Pager.php';
     require_once 'I18N/Currency.php';
     $currency = new I18N_Currency($CurrencyFormat);
     $category_arr = $this->getCategory();
     $template->setFile(array("MAIN" => "apf_finance_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $apf_finance = DB_DataObject::factory('ApfFinance');
     $order = $_GET['order'] ? $_GET['order'] : "DESC";
     $orderfield = $_GET['orderfield'] ? $_GET['orderfield'] : "id";
     $apf_finance->orderBy($apf_finance->escape($orderfield) . " " . $apf_finance->escape($order));
     $apf_finance->setUserid($userid);
     $max_row = 30;
     $ToltalNum = $apf_finance->count();
     $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row;
     $apf_finance->limit($start_num, $max_row);
     $apf_finance->find();
     $i = 0;
     $myData = array();
     while ($apf_finance->fetch()) {
         $myData[] = $apf_finance->toArray();
         $i++;
     }
     $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('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);
     $debit_header_url = showHeaderLink("debit", $i18n->_("Debit"), $_REQUEST['orderfield'], $_GET['order'], $page_exten, $pager->_url);
     $create_date_header_url = showHeaderLink("create_date", $i18n->_("CreateDate"), $_REQUEST['orderfield'], $_GET['order'], $page_exten, $pager->_url);
     $money_header_url = showHeaderLink("money", $i18n->_("Money"), $_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'], "CATEGORY" => $category_arr[$data['category']], "CREATE_DATE" => $data['create_date'], "AMOUNT" => $data['amount'], "DEBIT" => $DebitOption[$data['debit']], "MONEY" => $currency->format($data['money']), "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("WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "TOLTAL_NUM" => $ToltalNum, "CURRENT_PAGE" => $current_page, "SELECT_BOX" => $selectBox, "ID_HEADER_URL" => $id_header_url, "DEBIT_HEADER_URL" => $debit_header_url, "CREATE_DATE_HEADER_URL" => $create_date_header_url, "MONEY_HEADER_URL" => $money_header_url, "PAGINATION" => $links['all']));
 }