public function _index($name) { $mem = Cache::getInstance(); $postings = $mem->get($name); //var_dump($postings); $image = new image(); $image->model->lockMutiQuery(); foreach ($postings as $key => $value) { $image->model->Get_By_ImageId($key); } $image->model->MultiQuery(); $imgs = $image->model->getresult(); $favor = new favourite(); foreach ($imgs as $r2) { $url = rawurlencode($r2->imgurl); $desc = $r2->Description; $like = $favor->islikeimg($_SESSION['USERID'], $r2->ImageId); //$images.="<a href='/files/".$url."' rel='gallery' title='".$url ."'><img class='imginfo' src='/medium/".$url."' title='".$desc."'></img></a>\n"; $images .= "<img class='imginfo' src='/medium/" . $url . "' data-url='/files/" . $url . "' data-id='" . $r2->ImageId . "' title='" . $desc . "' data-desc='" . $desc . "' data-like='" . $like . "' data-like-num='" . $r2->Original . "' data-tags='" . $r2->feature . "'>"; } if (empty($images)) { $images = "<h1>还没有标签为:" . $name . "的图片!</h1>"; } $this->values = array("title" => "标签:" . $name, "images" => $images, "groupname" => "标签:" . $name, "groupdesc" => "标签为:" . $name . "的图片:"); $this->RenderTemplate('view'); }
public function _index() { $id = $_SESSION['USERID']; $image = new image(); $image->model->lockMutiQuery(); $recommender = recommender::getInstance(); //$recommender->set_rating(); $recommenduser = $recommender->get_user_similar($id); $usr = new user(); foreach ($recommenduser as $user) { $username = $usr->getuserbyid($user['member_id']); $recmduser .= '<div style="width:180px;float:left;"><div style="float:left"><a href="/user/' . $user['member_id'] . '" title="' . $username . '"><img src="/upload/avatar_small/' . $user['member_id'] . '_small.jpg"/></a></div><a href="/user/' . $user['member_id'] . '" title="' . $username . '"><h4 style="color:#09F;">' . $username . '</h4></a>喜好相似度:' . $user['sim'] . '%</div>'; } $rec = $recommender->get_item_recommend($id); foreach ($rec as $re) { $image->model->Get_By_ImageId($re['product_id']); } $image->model->MultiQuery(); $imgs = $image->model->getresult(); $favor = new favourite(); foreach ($imgs as $img) { $url = rawurlencode($img->imgurl); $desc = $img->Description; $like = $favor->islikeimg($_SESSION['USERID'], $r2->ImageId); // $recimg.='<img class="imginfo" src="/medium/'.rawurlencode($img->imgurl).'"/>'; $recimg .= "<img class='imginfo' src='/medium/" . $url . "' data-url='/files/" . $url . "' data-id='" . $img->ImageId . "' title='" . $desc . "' data-desc='" . $desc . "' data-like='" . $like . "' data-like-num='" . $img->Original . "' data-tags='" . $img->feature . "'data-author='" . $img->user->NickName . "' >"; } $this->values = array('recommenduser' => $recmduser, "title" => "ACGPIC向你推荐:", "recommendimg" => $recimg); $this->RenderTemplate('index'); }
public function _view($param) { //echo $param; if ($param) { $this->model->Get_GroupName_Description_author_By_ImagegroupID($param); $re = $this->model->getresult(); //var_dump($re) foreach ($re as $r) { $groupname = $r->GroupName; $groupdesc = $r->Description; $groupauthor = $r->author; } $author = new user(); $author->model->Get_NickName_By_UserID($groupauthor); $ren = $author->model->getresult(); foreach ($ren as $rn) { $authorname = $rn->NickName; } $img = new image(); $id = $param; $img->model->Get_imgurl_Description_Original_feature_By_GroupID($id); $re2 = $img->model->getresult(); $favor = new favourite(); foreach ($re2 as $r2) { //echo $r2['imgurl']; $url = rawurlencode($r2->imgurl); $desc = $r2->Description; $like = $favor->islikeimg($_SESSION['USERID'], $r2->ImageId); //$images.="<a href='/files/".$url."' rel='gallery' title='".$url ."'><img class='imginfo' src='/medium/".$url."' title='".$desc."'></img></a>\n"; $images .= "<img class='imginfo' src='/medium/" . $url . "' data-url='/files/" . $url . "' data-id='" . $r2->ImageId . "' title='" . $desc . "' data-desc='" . $desc . "' data-like='" . $like . "' data-like-num='" . $r2->Original . "' data-tags='" . $r2->feature . "'data-author='" . $r2->user->NickName . "' >"; } $edit = $_SESSION['USERID'] == $groupauthor; $this->values = array("title" => "画集-" . $groupname, "images" => $images, "groupname" => $groupname, "groupdesc" => $groupdesc, "authorname" => $authorname, "authorid" => $groupauthor, "userisauthor" => $edit, "groupid" => $param); $this->RenderTemplate("view"); } else { Header("Location:/404.html"); } }