Example #1
0
    echo "    </td>\n";
    echo "  </tr>\n";
    echo "</table>\n";
}
// process GET/POST parameters
$file = "";
if (isset($HTTP_GET_VARS["file"])) {
    $file = urldecode($HTTP_GET_VARS["file"]);
}
// parse and clean the File
cleanPath($file);
?>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<?php 
// generate the Preview
imageTag($base);
?>
<script language="javascript">
var src = '<?php 
echo strlen($file) > 0 ? imageURL($file, TRUE) : "";
?>
';

if(src.length > 0) {
   var manager = findAncestor(window.frameElement, '<?php 
echo MANAGER_NAME;
?>
', '<?php 
echo MANAGER_TAG;
?>
');
 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']));
 }
 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 executeDetail()
 {
     global $template, $ModuleDir, $ClassDir, $WebTemplateDir, $WebBaseDir, $controller, $i18n, $ActiveOption, $WebTemplateFullPath, $GenderOption, $CurrencyFormat;
     include_once $ClassDir . "URLHelper.class.php";
     require_once 'I18N/Currency.php';
     require_once $ModuleDir . 'contact/ApfContact.class.php';
     require_once $ModuleDir . 'product/ApfProduct.class.php';
     $template->setFile(array("MAIN" => "apf_company_detail.html"));
     $template->setBlock("MAIN", "detail_block");
     $apf_company = DB_DataObject::factory('Apfcompany');
     $apf_company->get($apf_company->escape($controller->getID()));
     $template->setVar(array("ID" => $apf_company->getId(), "NAME" => $apf_company->getName(), "ADDREES" => $apf_company->getAddrees(), "PHONE" => $apf_company->getPhone(), "FAX" => $apf_company->getFax(), "EMAIL" => $apf_company->getEmail(), "PHOTO" => imageTag($apf_company->getPhoto()), "HOMEPAGE" => $apf_company->getHomepage(), "EMPLOYEE" => $apf_company->getEmployee(), "BANKROLL" => $apf_company->getBankroll(), "LINK_MAN" => $apf_company->getLinkMan(), "INCORPORATOR" => $apf_company->getIncorporator(), "INDUSTRY" => $apf_company->getIndustry(), "PRODUCTS" => $apf_company->getProducts(), "MEMO" => $apf_company->getMemo(), "ACTIVE" => $apf_company->getActive(), "ADD_IP" => $apf_company->getAddIp(), "CREATED_AT" => $apf_company->getCreatedAt(), "UPDATE_AT" => $apf_company->getUpdateAt()));
     //		related contact
     $contact_category_arr = array("" => $i18n->_("All")) + ApfContact::getCategory();
     $apf_company_contact = DB_DataObject::factory('ApfCompanyContact');
     $apf_company_contact->whereAdd(" apf_company_contact.company_id = '" . $apf_company->getId() . "'  ");
     $apf_company_contact->orderBy("apf_contact.id desc");
     $apf_company_contact->buildContactJoin();
     //		$apf_company_contact->debugLevel(4);
     $apf_company_contact->find();
     $template->setBlock("MAIN", "contact_list", "contact_list_block");
     $i = 0;
     while ($apf_company_contact->fetch()) {
         $data = $apf_company_contact->toArray();
         $i % 2 == 0 ? $list_td_class = "admin_row_0" : ($list_td_class = "admin_row_1");
         $template->setVar(array("LIST_TD_CLASS" => $list_td_class));
         //			Var_Dump::display($data);
         $template->setVar(array("C_ID" => $data['id'], "C_CATEGORY" => $contact_category_arr[$data['category']], "C_NAME" => $data['name'], "C_GENDER" => $GenderOption[$data['gender']], "C_BIRTHDAY" => $data['birthday'], "C_ADDREES" => $data['addrees'], "C_OFFICE_PHONE" => $data['office_phone'], "C_PHONE" => $data['phone'], "C_FAX" => $data['fax'], "C_MOBILE" => $data['mobile'], "C_EMAIL" => $data['email'], "C_ACTIVE" => $data['active']));
         $template->parse("contact_list_block", "contact_list", TRUE);
         $i++;
     }
     $contact_total = $i;
     //		related product
     $currency = new I18N_Currency($CurrencyFormat);
     $product_category_arr = array("" => $i18n->_("All")) + ApfProduct::getCategory();
     $apf_company_product = DB_DataObject::factory('ApfCompanyProduct');
     $apf_company_product->orderBy("apf_product.id desc");
     $apf_company_product->whereAdd(" apf_company_product.company_id = '" . $apf_company->getId() . "'  ");
     $apf_company_product->buildProductJoin();
     //		$apf_company_product->debugLevel(4);
     $apf_company_product->find();
     $template->setBlock("MAIN", "product_list", "product_list_block");
     $i = 0;
     while ($apf_company_product->fetch()) {
         $data = $apf_company_product->toArray();
         //			get the last product price
         $apf_product_price = DB_DataObject::factory('ApfProductPrice');
         $apf_product_price->whereAdd("company_id ='" . $apf_company->getId() . "' ");
         $apf_product_price->whereAdd("product_id ='{$data['id']}' ");
         $apf_product_price->orderBy('created_at desc');
         //			$apf_product_price->debugLevel(4);
         $apf_product_price->find();
         $apf_product_price->fetch();
         $data['price'] = $apf_product_price->getPrice() ? $apf_product_price->getPrice() : $data['price'];
         $i % 2 == 0 ? $list_td_class = "admin_row_0" : ($list_td_class = "admin_row_1");
         $template->setVar(array("LIST_TD_CLASS" => $list_td_class));
         //			Var_Dump::display($data);
         $template->setVar(array("P_ID" => $data['id'], "P_CATEGORY" => $product_category_arr[$data['category']], "P_COMPANY_ID" => $data['company_id'], "P_NAME" => $data['name'], "P_PRICE" => "<div ondblclick=\"editPrice('" . $data['id'] . "','" . $apf_company->getId() . "','" . $data['price'] . "')\" >" . $currency->format($data['price']) . "</div>", "P_PHOTO" => imageTag($data['photo']), "P_MEMO" => $data['memo'], "P_ACTIVE" => $data['active']));
         $template->parse("product_list_block", "product_list", TRUE);
         $i++;
     }
     $product_total = $i;
     $template->setVar(array("WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "C_TOLTAL_NUM" => $contact_total, "P_TOLTAL_NUM" => $product_total, "WEBDIR" => $WebBaseDir, "COMID" => $apf_company->getId()));
 }
 function executeList()
 {
     global $template, $WebBaseDir, $i18n, $WebTemplateDir, $ClassDir, $userid, $ActiveOption;
     include_once $ClassDir . "URLHelper.class.php";
     require_once 'Pager/Pager.php';
     $template->setFile(array("MAIN" => "apf_selfproduct_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $apf_selfproduct = DB_DataObject::factory('ApfSelfproduct');
     $apf_selfproduct->orderBy('id desc');
     $max_row = 10;
     $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row;
     $apf_selfproduct->limit($start_num, $max_row);
     $apf_selfproduct->whereAdd(" userid = '{$userid}' OR access = 'public' ");
     $ToltalNum = $apf_selfproduct->count();
     $apf_selfproduct->find();
     $myData = array();
     while ($apf_selfproduct->fetch()) {
         $myData[] = $apf_selfproduct->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'], "PRODUCTNAME" => $data['productname'], "RETAILPRICE" => $data['retailprice'], "WHOLESALEPRICE" => $data['wholesaleprice'], "COSTPRICE" => $data['costprice'], "PHOTO" => imageTag($data['photo']), "RELEASEDATE" => $data['releasedate'], "MEMO" => $data['memo'], "ACCESS" => $data['access'], "ACTIVE" => $ActiveOption[$data['active']], "GROUPID" => $data['groupid'], "USERID" => $data['userid'], "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, "PAGINATION" => $links['all']));
 }