Exemple #1
0
 /**
  * @RequestMapping(url="json/user_stories",type=json)
  * @RequestParams(true)
  */
 public function invokeHandler(RequestData $data)
 {
     $uid = $data->get("uid");
     $stories = new Stories();
     $author = new UserDetails($uid);
     $author->fetchDetails();
     return $author;
 }
Exemple #2
0
 public function invokeHandler(RequestData $data)
 {
     $uid = $data->get("uid");
     $stories = new Stories();
     if ($uid != NULL && is_numeric($uid)) {
         return $stories->byUser($uid);
     } else {
         return null;
     }
 }
Exemple #3
0
 public function invokeHandler(User $user, RequestData $data)
 {
     $chapid = $data->get("chapid", NULL);
     $itemid = $data->get("sid", 0);
     if ($chapid != NULL && is_numeric($chapid)) {
         return Reviews::getByChapter($itemid, $chapid);
     } else {
         return null;
     }
 }
Exemple #4
0
 public function invokeHandler(RequestData $data)
 {
     $search = $data->get("search", "");
     $response = array();
     $RDb = DBService::getDB();
     $res = $RDb->fetchAll("SELECT * FROM search_cache\n\t\t\t\tWHERE UPPER(search_text) like UPPER(%s)\n\t\t\t\tORDER BY search_text", "'%" . $search . "%'");
     if (count($res) == 0) {
         $res = $RDb->fetchAll("SELECT title as search_text FROM fanfiction_stories\n\t\t\t\t\tWHERE UPPER(title) like UPPER(%s)\n\t\t\t\t\tORDER BY title", "'%" . $search . "%'");
     }
     if (count($res) == 0) {
         $response['error'] = true;
         return false;
     } else {
         $response['data'] = $res;
         $response['error'] = false;
         return $response;
     }
 }
Exemple #5
0
 public function invokeHandler(RequestData $data, $search = "")
 {
     $order_by = $data->get("order_by", "updated");
     $search_by = $data->get("search_by", "title");
     $categories = $data->get("categories", array());
     $language = $data->get("language", "");
     $type = $data->get("type", "");
     $stories = new Stories();
     $stories->RELEVANCE = empty($search) ? 0 : 0.1;
     $stories->setCategories($categories);
     $stories->setClasses($type, $language);
     if ($search_by == 'title') {
         $stories_results = $stories->searchByTitle($search, 0, $order_by);
     } else {
         if ($search_by == 'text') {
             $stories_results = $stories->searchByText($search, 0, $order_by);
         } else {
             $stories_results = $stories->searchByAll($search, 0, $order_by);
         }
     }
     if (count($stories_results)) {
         // echo "REPLACE INTO search_cache(search_text) values(".$search.")";
         $RDb = DBService::getDB();
         $res = $RDb->update("REPLACE INTO search_cache(search_text) values('" . $search . "')");
     }
     // print_r($stories->get(0));
     return $stories_results;
 }
Exemple #6
0
 public function invokeHandler(RequestData $data, User $user)
 {
     $sid = $data->get("sid", "");
     return new Story($sid);
 }
Exemple #7
0
 /**
  * [queryDataNHC query data from view ] Get all data used by request data for download
  * @param  [integet] $requestdata_id   [request data id]
  * @return [array]           [collection of data]
  */
 public static function queryDataNHCAll($requestdata_id)
 {
     $results = RequestData::find($requestdata_id);
     $rs = QueryData::where('data_id', '=', $results->data_id)->where('cond_id', '=', $results->cond_id)->where('agency_code', '=', $results->agency_code)->select('table_name', 'condition', 'period', 'agency_code')->get();
     $result_query = $rs[0];
     if ($results->agency_code == '02005') {
         list($tb_name, $field, $datefield, $tele_id) = explode("-", $result_query->table_name);
         Config::get('nhc/site.debug_db') ? $date = Config::get('nhc/site.debug.' . $datefield) : ($date = DB::raw($result_query->condition));
         $nhc_data = DB::connection('nhc_data')->table($tb_name)->where('tele_station_id', '=', $tele_id)->where('agency_id', '=', $results->agency_code)->where(DB::raw($datefield . '::date'), '=', $date)->where(DB::raw($datefield . '::date'), '<=', $result_query->period)->orderBy($field, 'DESC')->select('*')->take(100)->get();
     } else {
         list($tb_name, $field, $datefield) = explode("-", $result_query->table_name);
         Config::get('nhc/site.debug_db') ? $date = Config::get('nhc/site.debug.' . $datefield) : ($date = DB::raw($result_query->condition));
         //echo $date;
         $nhc_data = DB::connection('nhc_data')->table($tb_name)->where('agency_id', '=', $results->agency_code)->where(DB::raw($datefield . '::date'), '=', $date)->where(DB::raw($datefield . '::date'), '<=', $result_query->period)->orderBy($field, 'DESC')->select('*')->take(100)->get();
         //->get();
     }
     return $nhc_data;
 }
 /**
  * [getRequestDataInfo description]
  * @return [type] [description]
  */
 public static function getRequestDataInfo()
 {
     $reqdata = new RequestData();
     $rs_req = $reqdata->getReqAndAppDataInfoNum();
     return $rs_req;
 }
 /**
  * Retrieve headers to be set
  *
  * @return  peer.http.Header[]
  */
 public function getHeaders()
 {
     $headers = parent::getHeaders();
     $headers[] = new Header('Content-Type', 'multipart/form-data; boundary=' . $this->boundary);
     return $headers;
 }
 /**
  * [resultSearchAction description]
  * @param  [type] $keyword [description]
  * @return [type]          [description]
  */
 public function resultSearchAction($keyword)
 {
     $req = new RequestData();
     $per_page = Config::get('nhc/site.policy_perpage');
     $rs_list = $req->getResultByKeywork($keyword, $per_page);
     //var_dump($rs_list);
     if (Request::ajax()) {
         $html = View::make('requestdata.searchresultreqlist')->with('paginator', $rs_list);
         return $html;
     }
 }
Exemple #11
0
 public function getResultByKeywork($keyword, $perPage)
 {
     $userid = Auth::getUser()->id;
     if ($keyword != 'all') {
         $rs = RequestData::where('send_userid', '=', $userid)->whereRaw('data.data_name like ? ' . 'or request_type_data.type_name like ? ' . 'or v_user_info.fname like ? ' . 'or v_user_info.lname like ? ' . 'or v_user_info.role_name like ? ' . 'or v_user_info.agency_name like ? ', array('%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%', '%' . $keyword . '%'))->where('downloaded', '=', false)->where('req_status', '=', true)->join('v_user_info', 'v_user_info.user_id', '=', 'request_data.send_userid')->join('condition', 'condition.id', '=', 'request_data.cond_id')->join('data', 'data.id', '=', 'request_data.data_id')->join('request_type_data', 'request_type_data.id', '=', 'request_data.req_type')->select('v_user_info.agency_name', 'v_user_info.code', 'data.data_name', 'condition.cond_name', 'request_data.req_status', 'request_data.req_type', 'request_type_data.type_name', 'v_user_info.user_id', 'v_user_info.fname', 'v_user_info.lname', 'v_user_info.role_name', 'request_data.send_agencyid', 'request_data.created_at', 'request_data.updated_at', 'request_data.app_userid', 'request_data.downloaded')->paginate($perPage);
     } else {
         // $rs = RequestData::where('send_userid','=',$userid)
         // 			->where('req_status','=',true) // Agency's data approved
         // 			->where('downloaded','=',false) //No action download
         // 			->join('agency','agency.code','=','request_data.agency_code')
         // 			->join('data','data.id','=','request_data.data_id')
         // 			->join('condition','condition.id','=','request_data.cond_id')
         // 			->join('usernhc','usernhc.id','=','request_data.send_userid')
         // 			->join('v_user_info','v_user_info.user_id','=','usernhc.id')
         // 			->select(
         // 				'agency.tname as agency_name',
         // 				'agency.code',
         // 				'data.data_name',
         // 				'condition.cond_name',
         // 				'request_data.req_status',
         // 				'request_data.req_type',
         // 				'usernhc.id',
         // 				'usernhc.fname',
         // 				'usernhc.lname',
         // 				'v_user_info.role_name',
         // 				'request_data.send_agencyid',
         // 				'request_data.created_at',
         // 				'request_data.updated_at',
         // 				'request_data.app_userid',
         // 				'request_data.downloaded'
         // 			)
         // 			->paginate($perPage);
         $rs = RequestData::where('send_userid', '=', $userid)->where('req_status', '=', true)->join('v_user_info', 'v_user_info.user_id', '=', 'request_data.send_userid')->join('condition', 'condition.id', '=', 'request_data.cond_id')->join('data', 'data.id', '=', 'request_data.data_id')->join('request_type_data', 'request_type_data.id', '=', 'request_data.req_type')->select('v_user_info.agency_name', 'v_user_info.code', 'data.data_name', 'condition.cond_name', 'request_data.req_status', 'request_data.req_type', 'request_type_data.type_name', 'v_user_info.user_id', 'v_user_info.fname', 'v_user_info.lname', 'v_user_info.role_name', 'request_data.send_agencyid', 'request_data.created_at', 'request_data.updated_at', 'request_data.app_userid', 'request_data.downloaded')->orderBy('request_data.downloaded', 'asc')->paginate($perPage);
     }
     //echo $rs;exit;
     //var_dump($rs);exit;
     return $rs;
 }
 function testUrlElements()
 {
     $this->requestData->setUrlElements('urlElements');
     $this->assertEquals('urlElements', $this->requestData->getUrlElements());
 }