File indexing completed on 2024-11-24 05:19:14

0001 <?php
0002 class RetrieveModel extends EModel {
0003 //if i use this model also to delete data i should consider to change its name
0004 public function getCategories() { 
0005   $client = new OCSClient();
0006   return $client->get("v1/content/categories");
0007 }
0008 
0009 public function getData() {
0010   $client = new OCSClient();
0011   return $client->get("v1/content/data/"); //?pagesize=1
0012 }
0013 
0014 public function getCategoryData($catid) {
0015   $client = new OCSClient();
0016   return $client->get("v1/content/data/?categories=$catid"); //?pagesize=1
0017 }
0018 public function getDataPerPage($pagenumber) {
0019   $client = new OCSClient();
0020   return $client->get("v1/content/data/?page=$pagenumber"); //pagesize=1
0021 }
0022 
0023 public function delData($id) {
0024   $client = new OCSClient();
0025   $client->set_auth_info(EHeaderDataParser::get_cookie("login"),EHeaderDataParser::get_cookie("password"));
0026   $client->post("v1/content/delete/$id");
0027   $prevpage = EPageProperties::get_previous_page();
0028         header("Location: $prevpage");
0029 }
0030 public function getSingleContentData($id) {
0031   $client = new OCSClient();
0032   return $client->get("v1/content/data/$id");
0033 }
0034 public function getComments($id) {
0035   $client = new OCSClient();
0036   return $client->get("v1/comments/data/1/$id/1");
0037 }
0038 public function getSelfInfo() {
0039   $user = new OCSClient;
0040   $pw = $_COOKIE["password"];
0041   $name = $_COOKIE["login"];
0042   $user->set_auth_info($name, $pw);
0043   return $user->get ("v1/person/self");
0044 }
0045 
0046 public function getUserInfo($id) {
0047   $user = new OCSClient;
0048   $pw = $_COOKIE["password"];
0049   $name = $_COOKIE["login"];
0050   $user->set_auth_info($name, $pw);
0051   return $user->get ("v1/person/data/$id");
0052 }
0053 
0054 public function getUserData($pagenumber) {
0055   $user = new OCSClient;
0056   $name = $_COOKIE["login"];
0057   return $user->get("v1/content/data/?user=$name&page=$pagenumber");
0058 }
0059 
0060 }
0061 
0062 ?>