本文整理汇总了PHP中front::get_hash方法的典型用法代码示例。如果您正苦于以下问题:PHP front::get_hash方法的具体用法?PHP front::get_hash怎么用?PHP front::get_hash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类front
的用法示例。
在下文中一共展示了front::get_hash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getlistAction
function getlistAction()
{
$order_dir = front::$_req["dir"];
if (!in_array($order_dir, array("ASC", "DESC"))) {
$order_dir = "ASC";
}
$order_col = front::$_req["sort"];
if (!in_array($order_col, array("id", "title", "date_create"))) {
$order_col = "id";
}
$limit = front::$_req["limit"];
if (!$limit) {
$limit = 20;
}
$offset = front::$_req["start"];
if (!$offset) {
$offset = 0;
}
$totalCount = front::og("db")->select("SELECT COUNT(*) FROM corporative_blog WHERE id_blog = 0")->fetchOne();
$blogs = front::og("db")->select("SELECT c.*, u.uname, u.usurname, u.login FROM corporative_blog c JOIN users u on u.uid = c.id_user WHERE id_blog = 0 ORDER BY ?v ?v LIMIT ? OFFSET ?", $order_col, $order_dir, $limit, $offset)->fetchAll();
$bids = front::get_hash($blogs, "id", "id");
$uids = front::get_hash($blogs, "id_user", "id_user");
$comm = front::get_hash(front::og("db")->select("SELECT COUNT(id_blog) as count, id_blog FROM corporative_blog WHERE id_blog IN(?a) GROUP BY id_blog", $bids)->fetchAll(), "id_blog", "count");
$user = front::og("db")->select("SELECT uname, usurname, login, uid FROM users WHERE uid IN(?a)", $uids)->fetchAll();
//, "uid", "usname");
foreach ($user as $k => $v) {
$usr[$v['uid']] = $v;
}
$blogs = front::toUtf($blogs);
echo json_encode(array("data" => $blogs, "totalCount" => $totalCount));
}
示例2: getlistAction
public function getlistAction()
{
$order_dir = front::$_req['dir'];
if (!in_array($order_dir, array('ASC', 'DESC'))) {
$order_dir = 'ASC';
}
$order_col = front::$_req['sort'];
if (!in_array($order_col, array('id', 'title', 'date_create'))) {
$order_col = 'id';
}
$limit = front::$_req['limit'];
if (!$limit) {
$limit = 20;
}
$offset = front::$_req['start'];
if (!$offset) {
$offset = 0;
}
$totalCount = front::og('db')->select('SELECT COUNT(*) FROM corporative_blog WHERE id_blog = 0')->fetchOne();
$blogs = front::og('db')->select('SELECT c.*, u.uname, u.usurname, u.login FROM corporative_blog c JOIN users u on u.uid = c.id_user WHERE id_blog = 0 ORDER BY ?v ?v LIMIT ? OFFSET ?', $order_col, $order_dir, $limit, $offset)->fetchAll();
$bids = front::get_hash($blogs, 'id', 'id');
$uids = front::get_hash($blogs, 'id_user', 'id_user');
$comm = front::get_hash(front::og('db')->select('SELECT COUNT(id_blog) as count, id_blog FROM corporative_blog WHERE id_blog IN(?a) GROUP BY id_blog', $bids)->fetchAll(), 'id_blog', 'count');
$user = front::og('db')->select('SELECT uname, usurname, login, uid FROM users WHERE uid IN(?a)', $uids)->fetchAll();
//, "uid", "usname");
foreach ($user as $k => $v) {
$usr[$v['uid']] = $v;
}
$blogs = front::toUtf($blogs);
echo json_encode(array('data' => $blogs, 'totalCount' => $totalCount));
}
示例3: getCorporateBlog
/**
* Выборка блогов из таблицы
*
* @param int $page Страница
* @param int $count Количество на странице
*/
function getCorporateBlog($page = 1, $count = 10, $tags = false)
{
if (!$tags) {
$total = front::og("db")->select("SELECT COUNT(*) FROM corporative_blog WHERE id_blog = 0 AND (id_deleted IS NULL OR id_deleted = 0)")->fetchOne();
front::og("tpl")->page_corp = $page;
front::og("tpl")->pages_corp = ceil($total / $count);
front::og("tpl")->total_corp = $total;
$nPages = ceil($total / $count);
if (($total == 0 || $total - 1 < ($page - 1) * $count) && $this->uri[0] == 'page' || $nPages == 1 && $this->uri[0] == 'page') {
include ABS_PATH . '/404.php';
exit;
}
}
$page--;
$sql_page = $page * $count;
$blogs = front::og("db")->select("SELECT * FROM corporative_blog WHERE " . ($tags ? ' id IN(?a) AND ' : ' 0 = ? AND ') . " id_blog = 0 AND (id_deleted IS NULL OR id_deleted = 0) ORDER BY id DESC LIMIT ? OFFSET ?", $tags ? $tags : 0, $count, $sql_page)->fetchAll();
if (!$blogs && $tags) {
Header("Location: /404.php");
}
$bids = front::get_hash($blogs, "id", "id");
$uids = front::get_hash($blogs, "id_user", "id_user");
//return false;
if ($bids) {
//$comm = front::get_hash(front::og("db")->select("SELECT COUNT(id_blog) as count, id_blog FROM corporative_blog WHERE id_blog IN(?a) GROUP BY id_blog", $bids)->fetchAll(), "id_blog", "count");
$user = front::og("db")->select("SELECT uname, usurname, login, uid, role, is_pro, is_pro_test, boss_rate FROM users WHERE uid IN(?a)", $uids)->fetchAll();
//, "uid", "usname");
foreach ($blogs as $k => $v) {
$cid[$v['id']] = $v['id'];
}
if ($cid) {
$attach = front::og("db")->select("SELECT * FROM corporative_blog_attach WHERE msg_id IN(?a)", $cid)->fetchAll();
}
if ($attach) {
foreach ($attach as $key => $val) {
$res_attach[$val['msg_id']][] = $val;
}
front::og("tpl")->attach = $res_attach;
}
foreach ($user as $k => $v) {
$usr[$v['uid']] = $v;
}
list($lastDate, $upDate) = self::getViewPostsDate($bids);
}
//var_dump($lastDate);
//var_dump($upDate);
front::og("tpl")->usbank = $usr;
//front::og("tpl")->comment = $comm;
front::og("tpl")->blogs = $blogs;
front::og("tpl")->lastDate = $lastDate;
front::og("tpl")->upDate = $upDate;
front::og("tpl")->tags = self::getCorpTags();
//self::GetTags($count, 10);
//front::og("tpl")->attach = $attach;
//self::getCorpTags();
return array($blogs, $usr);
}
示例4: getCorporateBlog
/**
* Выборка блогов из таблицы
*
* @param int $page страница
* @param int $count количество на странице
*/
function getCorporateBlog($page = 1, $count = 10)
{
$total = front::og("db")->select("SELECT COUNT(*) FROM corporative_blog WHERE id_blog = 0 AND (id_deleted IS NULL OR id_deleted = 0)")->fetchOne();
front::og("tpl")->page_corp = $page;
front::og("tpl")->pages_corp = ceil($total / $count);
front::og("tpl")->total_corp = $total;
$page--;
$sql_page = $page * $count;
$blogs = front::og("db")->select("SELECT * FROM corporative_blog WHERE id_blog = 0 AND (id_deleted IS NULL OR id_deleted = 0) ORDER BY id DESC LIMIT ? OFFSET ?", $count, $sql_page)->fetchAll();
$bids = front::get_hash($blogs, "id", "id");
$uids = front::get_hash($blogs, "id_user", "id_user");
$comm = front::get_hash(front::og("db")->select("SELECT COUNT(id_blog) as count, id_blog FROM corporative_blog WHERE id_blog IN(?a) GROUP BY id_blog", $bids)->fetchAll(), "id_blog", "count");
$user = front::og("db")->select("SELECT uname, usurname, login, uid, role, is_pro, is_pro_test, boss_rate FROM users WHERE uid IN(?a)", $uids)->fetchAll();
//, "uid", "usname");
foreach ($blogs as $k => $v) {
$cid[$v['id']] = $v['id'];
}
if ($cid) {
$attach = front::og("db")->select("SELECT * FROM corporative_blog_attach WHERE msg_id IN(?a)", $cid)->fetchAll();
}
if ($attach) {
foreach ($attach as $key => $val) {
$res_attach[$val['msg_id']][] = $val;
}
front::og("tpl")->attach = $res_attach;
}
foreach ($user as $k => $v) {
$usr[$v['uid']] = $v;
}
front::og("tpl")->usbank = $usr;
front::og("tpl")->comment = $comm;
front::og("tpl")->blogs = $blogs;
//front::og("tpl")->attach = $attach;
}