Example #1
0
            $vals['product_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}products WHERE name='" . $_POST['product_name'] . "'");
        }
    }
    $trend['x'] = PbController::convertTextToArray($_POST['trend_data']['x']);
    $trend['y'] = PbController::convertTextToArray($_POST['trend_data']['y']);
    $vals['trend_data'] = serialize($trend);
    $vals['area_id'] = $vals['area_id3'];
    if (!empty($vals['content'])) {
        $vals['content'] = stripcslashes($vals['content']);
    }
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        $result = $marketquotes->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        $result = $marketquotes->save($vals);
    }
    if (!$result) {
        flash();
    } else {
        flash("success");
    }
}
$amount = $marketquotes->findCount(null, $conditions);
$page->setPagenav($amount);
$joins[] = "LEFT JOIN {$tb_prefix}markets m ON m.id=Quote.market_id";
$fields = "Quote.id,m.name AS marketname,Quote.title AS title,Quote.max_price AS maxprice,Quote.min_price AS minprice";
$result = $marketquotes->findAll($fields, $joins, $conditions, "Quote.id DESC", $page->firstcount, $page->displaypg);
uaAssign(array("ByPages" => $page->pagenav));
setvar("Items", $result);
template($tpl_file);
Example #2
0
            }
            $info = $pdb->GetRow("SELECT * FROM " . $tb_prefix . "quotes WHERE id=" . $id);
            $pdb->Execute("UPDATE " . $tb_prefix . "quotes SET hits=hits+1 WHERE id=" . $id);
            $info['pubdate'] = df($info['created']);
            $info['clicked'] = $info['hits'];
            setvar("item", $info);
            $tpl_file = "detail.default";
            render($tpl_file, true);
            break;
        case "search":
            if (!empty($_GET['title'])) {
                $conditions[] = "title LIKE '%" . pb_addslashes($_GET['title']) . "%'";
            }
            break;
        default:
            break;
    }
}
if (isset($_GET['catid'])) {
    $type_id = intval($_GET['catid']);
    $conditions[] = "Quote.type_id='" . $type_id . "'";
    $viewhelper->setTitle("The industry " . $type_id);
}
$quote->setCondition($conditions);
$amount = $quote->findCount(null, $conditions);
$fields = "Quote.*,Quote.created AS pubdate,ROUND((Quote.min_price+Quote.max_price)/2,2) AS price";
$result = $quote->findAll($fields, $joins, $conditions, "Quote.id DESC", $pos, $limit);
setvar("items", $result);
uaAssign(array("QuoteSearchFrom" => date("Y-m-d", strtotime("last month")), "QuoteSearchTo" => date("Y-m-d")));
setvar("paging", array('total' => $amount));
render($tpl_file);