Commits

Thejesh GN committed 581d6da

added by Contributer

  • Participants
  • Parent commits 0039d7a
  • Tags v.0.6.03

Comments (0)

Files changed (5)

File gui/basic/main.html

         <h3>PostBoxes</h3>
         <h4><a href="<?=$this->get('BASE')?>/pb/location/list/states">By Location</a></h4>
         <h4><a href="<?=$this->get('BASE')?>/pb/list/pincode">By Pincode</a></h4>
-        <h4>By Submitter</h4>
+        <h4><a href="<?=$this->get('BASE')?>/pb/contributor/list">By Contributer</a></h4>
+        
       </div>
     </div>
 

File gui/basic/sub_by_username.html

+    <table class="table table-hover">
+    <thead>
+        <tr>
+            <th> PostBox </th>
+            <th> Address </th>
+        </tr>
+    </thead>
+    <? foreach ($this->get('array_all_postboxes') as $post_box=>$post_box_array): ?>
+    <tbody>
+            <tr>
+            <td> <a href='<?= $this->get('BASE'); ?>/pb/id/<?=$post_box_array['post_id']?>'><?=$post_box_array['caption']?></a> </td>
+            <td> <?=$post_box_array['formatted_address']?> </td>
+            </tr>
+     </tbody>
+    <? endforeach; ?>
+</table>

File gui/basic/sub_list_contributors.html

+    <table class="table table-hover">
+    <thead>
+        <tr>
+            <th> Contributor </th>
+            <th> No of Postboxes </th>
+        </tr>
+    </thead>
+    <? foreach ($this->get('array_all_users') as $contributor=>$contributor_array): ?>
+    <tbody>
+            <tr>
+            <td> <a href='<?= $this->get('BASE'); ?>/pb/contributor/name/<?=$contributor_array['username']?>'><?=$contributor_array['username']?></a> </td>
+            <td> <?=$contributor_array['post_box_count']?> </td>
+            </tr>
+     </tbody>
+    <? endforeach; ?>
+</table>

File inc/contributor.php

+<?php
+class Contributor extends F3instance {
+    function listContributors() {
+        $q = 'SELECT distinct username, count(*) as post_box_count FROM post_box group by username';
+        $POSTBOX_DB=F3::get('POSTBOX_DB');
+        $POSTBOX_DB->exec($q);
+        $array_all_users = array();
+        foreach (F3::get('POSTBOX_DB->result') as $row){
+            $single_user = array();
+            $single_user['username']=   $row["username"];  
+            $single_user['post_box_count']=  $row["post_box_count"];
+            $array_all_users[$row["username"]]    = $single_user;
+        }
+
+
+        $this->set('caption','Our Contributors');     
+        $this->set('array_all_users',$array_all_users);
+        $this->set('sub','sub_list_contributors.html');
+        $out=$this->render('basic/layout.html');
+        $this->set('sub_out_put',$out);
+        $this->set('LANGUAGE','en-US');     
+        echo $this->render('basic/main.html');  
+    }
+
+    function listPostBoxByUsername(){
+        $username = $this->get('PARAMS["username"]');
+        $this->set('title','Contributor - '.$username);
+        $q = 'select * from post_box where username=:username';
+        $POSTBOX_DB=F3::get('POSTBOX_DB');
+        $POSTBOX_DB->exec($q, array(":username"=>$username));
+        $array_all_postboxes = array();
+        foreach (F3::get('POSTBOX_DB->result') as $row){
+            $single_postbox = array();
+            $single_postbox['post_id']= $row["post_id"];    
+            $single_postbox['lat']= $row["lat"];
+            $single_postbox['lan']= $row["lan"];
+            $single_postbox['pincode']= $row["pincode"];    
+            $single_postbox['caption']= $row["caption"];
+            $single_postbox['formatted_address']=   $row["formatted_address"];
+            $array_all_postboxes[$row["post_id"]]   = $single_postbox;
+        }
+
+/*        $q = 'select * from pin_code where pincode=:pincode';
+        $POSTBOX_DB=F3::get('POSTBOX_DB');
+        $POSTBOX_DB->exec($q, array(":pincode"=>$pincode));
+        foreach (F3::get('POSTBOX_DB->result') as $row1){
+            $this->set('center_lat',$row1['center_lat']);
+            $this->set('center_lan',$row1['center_long']);
+            $this->set('caption',$row1['total_post_boxes'].' postboxe(s) in this pincode area. Check <a href="'.$this->get('BASE').'/pb/pincode/map/'.$pincode.'/">Map</a> view.');
+        }
+*/
+        $this->set('caption','Post boxes by our contributor -'.$username); 
+        $this->set('array_all_postboxes',$array_all_postboxes);
+        $this->set('sub','sub_by_username.html');
+        $out=$this->render('basic/layout.html');
+        $this->set('sub_out_put',$out);
+        $this->set('LANGUAGE','en-US');     
+        echo $this->render('basic/main.html');  
+ 
+    }
+
+}
+?>
 
 $app->route('GET /pb/id/@id','Postbox->postboxById');
 $app->route('GET /pb/list/pincode','Postbox->pincode');
-$app->route('GET /pb/list/location','Postbox->location');
 $app->route('GET /pb/pincode/@pincode','Postbox->postboxListByPincode');
 $app->route('GET /pb/pincode/map/@pincode','Postbox->postboxMapByPincode');
 $app->route('GET /pb/search','Postbox->search');
+
+$app->route('GET /pb/list/location','Postbox->location');
 $app->route('GET /pb/location/list/states','Location->locationListStates');
 $app->route('GET /pb/location/list/districts/@state','Location->districtsListByState');
 
+$app->route('GET /pb/contributor/list','Contributor->listContributors');
+$app->route('GET /pb/contributor/name/@username','Contributor->listPostBoxByUsername');
+
+
 $app->route('GET /pull_data_batch','Instagram->pull_data');
 $app->route('GET /reverse_geocode_batch','GIS->reverse_geocode_batch');
 $app->route('GET /stat_update_batch','STAT->stat_update_batch');