/** * 取得我在班上的名次(以標註數量計算) * * @param Webpage $webpage * @param User $user * @return Int ranking * @author Wyfan 20141211 */ public function get_user_annotation_count_ranking($user, $webpage) { $webpage_id = $webpage->get_id(); $user_id = $user->get_id(); //------------------------------------- $this->db->from('user_annotation_count_ranking'); $this->db->select('rank'); $this->db->where('webpage_id', $webpage_id); $this->db->where('user_id', $user_id); //--------------------------------------- $query = $this->db->get(); //$user_annotation_count_rank = array(); $user_annotation_count_rank = 0; if ($query->num_rows() > 0) { $row = $query->row(); $user_annotation_count_rank = $row->rank; } //var_dump($row); return $user_annotation_count_rank; }
/** * log區 -使用mobile裝置瀏覽topic list- action = 40 * @param Webpage $webpage */ private function _log($webpage) { $action = 40; // webpage_id, action, user_id, array data $log_webpage_id = $webpage->get_id(); $log_user_id = null; $user = get_context_user(); if (isset($user)) { $log_user_id = $user->get_id(); } $array_data = $this->client_ip; kals_mobile_log($this->db, $log_webpage_id, $action, array('memo' => $array_data, 'user_id' => $log_user_id)); context_complete(); //寫入db }