function executeList() { global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $GenderOption, $i18n, $ActiveOption; include_once $ClassDir . "URLHelper.class.php"; require_once 'Pager/Pager.php'; $template->setFile(array("MAIN" => "apf_users_list.html")); $template->setBlock("MAIN", "main_list", "list_block"); $apf_users = DB_DataObject::factory('ApfUsers'); $apf_users->orderBy('id desc'); $max_row = 30; $ToltalNum = $apf_users->count(); $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row; $apf_users->limit($start_num, $max_row); $apf_users->find(); while ($apf_users->fetch()) { $myData[] = $apf_users->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)); $user_group = $this->getGroupByUserid($data['id']); $template->setVar(array("ID" => $data['id'], "GROUP_NAME" => $user_group['group_define_name'], "USER_NAME" => $data['user_name'], "REALNAME" => $data['realname'], "USER_PWD" => $data['user_pwd'], "GENDER" => $GenderOption[$data['gender']], "ADDREES" => $data['addrees'], "PHONE" => $data['phone'], "EMAIL" => showEmail($data['email']), "PHOTO" => imageTag($data['photo']), "ROLE_ID" => $data['role_id'], "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, "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'])); }
function executeList($is_related = false) { global $template, $WebBaseDir, $WebTemplateDir, $ClassDir, $GenderOption, $ActiveOption, $i18n, $userid; include_once $ClassDir . "URLHelper.class.php"; require_once 'Pager/Pager.php'; $template->setFile(array("MAIN" => $is_related ? "apf_contact_related_list.html" : "apf_contact_list.html")); $category_arr = array("" => $i18n->_("All")) + $this->getCategory(); $template->setBlock("MAIN", "main_list", "list_block"); $max_row = 30; $apf_contact = DB_DataObject::factory('ApfContact'); if (($keyword = trim($_REQUEST['q'])) != "") { $apf_contact->whereAdd("name LIKE '%" . $apf_contact->escape("{$keyword}") . "%' OR phone LIKE '%" . $apf_contact->escape("{$keyword}") . "%' OR mobile LIKE '%" . $apf_contact->escape("{$keyword}") . "%' "); } if (($category = trim($_REQUEST['category'])) != "") { $apf_contact->whereAdd(" category = '" . $apf_contact->escape("{$category}") . "' "); } if (($active = trim($_REQUEST['active'])) != "") { $apf_contact->whereAdd(" active = '" . $apf_contact->escape("{$active}") . "' "); } if (($gender = trim($_REQUEST['gender'])) != "") { $apf_contact->whereAdd(" gender = '" . $apf_contact->escape("{$gender}") . "' "); } $apf_contact->orderBy('id desc'); $apf_contact->setUserid($userid); $ToltalNum = $apf_contact->count(); $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row; $apf_contact->limit($start_num, $max_row); $apf_contact->find(); $myData = array(); while ($apf_contact->fetch()) { $myData[] = $apf_contact->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'], 'category' => $_REQUEST['category'], 'active' => $_REQUEST['active'], 'gender' => $_REQUEST['gender'])); $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'], "GENDER" => $GenderOption[$data['gender']], "BIRTHDAY" => $data['birthday'], "ADDREES" => $data['addrees'], "OFFICE_PHONE" => $data['office_phone'], "PHONE" => $data['phone'] . $this->getCallIco($data['phone']), "FAX" => $data['fax'], "MOBILE" => $data['mobile'] . $this->getCallIco($data['mobile'], true), "EMAIL" => showEmail($data['email']), "PHOTO" => $data['photo'], "HOMEPAGE" => $data['homepage'], "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, "KEYWORD" => textTag("q", $_REQUEST['q']), "CATEGORYOPTION" => selectTag("category", $category_arr, $_REQUEST['category']), "ACTIVEOPTION" => selectTag("active", $ActiveOption, $_REQUEST['active']), "GENDEROPTION" => selectTag("gender", $GenderOption, $_REQUEST['gender']), "TOLTAL_NUM" => $ToltalNum, "CURRENT_PAGE" => $current_page, "SELECT_BOX" => $selectBox, "PAGINATION" => $links['all'])); }