File indexing completed on 2024-05-12 05:58:30

0001 <?php
0002 class CategoriesTabs {
0003   private $OCSCall="v1/content/categories";
0004   private $currentCategory = "null";
0005 
0006   public function __construct() {
0007     $url=$_SERVER['REQUEST_URI'];
0008     $tokens = explode('/', $url);
0009     if ($tokens[sizeof($tokens)-2]=="category"){
0010       $this->currentCategory=$tokens[sizeof($tokens)-1];
0011     }
0012   }
0013 
0014   public function getData() {
0015     $client = new OCSClient();
0016     return $client->get($this->OCSCall);
0017     
0018   }
0019     public function CategoryFilter(){
0020       $data = $this->getData();
0021       echo "
0022       <div class=\"container-fluid\">
0023         <div class=\"row\">
0024           <div class=\"col-sm-3 col-md-2 sidebar\">
0025             <ul class=\"nav nav-sidebar sidebutton\">";
0026                   foreach($data["ocs"]["data"]["category"] as $category){
0027                     if ($category["id"]==$this->currentCategory){
0028                         echo "<li class=\"active\"><a href=\"/plasmastore/home/category/".$category["id"]."\">".$category["name"]."</a></li>";
0029                       } else {
0030                         echo "<li><a href=\"/plasmastore/home/category/".$category["id"]."\">".$category["name"]."</a></li>";
0031                       }
0032                   }
0033               echo "
0034             </ul>
0035           </div>
0036         </div>
0037     </div>";
0038     }
0039 
0040 
0041 
0042 
0043 }