airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [3/5] airavata-php-gateway git commit: Pagination and Browse support for Projects and Experiments
Date Tue, 05 May 2015 15:20:02 GMT
Pagination and Browse support for Projects and Experiments


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/5be987ef
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/5be987ef
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/5be987ef

Branch: refs/heads/master
Commit: 5be987ef69a0859d9be78f93b2950de3df9d6965
Parents: ba5b1a1
Author: Supun Nakandala <supun.nakandala@gmail.com>
Authored: Tue May 5 02:29:23 2015 +0530
Committer: Supun Nakandala <supun.nakandala@gmail.com>
Committed: Tue May 5 02:29:23 2015 +0530

----------------------------------------------------------------------
 app/controllers/ExperimentController.php |   53 +-
 app/controllers/ProjectController.php    |   54 +-
 app/libraries/Airavata/API/Airavata.php  | 4756 ++++++++++++++++++++++---
 app/libraries/utilities.php              |  235 +-
 app/routes.php                           |    7 +
 app/views/experiment/browse.blade.php    |  183 +
 app/views/experiment/search.blade.php    |   37 +-
 app/views/project/browse.blade.php       |  102 +
 app/views/project/search.blade.php       |   31 +-
 9 files changed, 4962 insertions(+), 496 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5be987ef/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index de79704..a67dc30 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -2,6 +2,12 @@
 
 class ExperimentController extends BaseController {
 
+    /**
+     * Limit used in fetching paginated results
+     * @var int
+     */
+    var $limit = 1;
+
 	/**
 	*    Instantiate a new ExperimentController Instance
 	**/
@@ -241,10 +247,30 @@ class ExperimentController extends BaseController {
 
 	public function searchSubmit()
 	{
-		$expContainer = Utilities::get_expsearch_results( Input::all() );
+        $search = Input::get('search');
+        if(isset($search)){
+            $pageNo = 1;
+        }else{
+            $pageNo = Input::get('pageNo');
+            $prev = Input::get('prev');
+            if(empty($pageNo)){
+                $pageNo = 1;
+            }else{
+                if(isset($prev)){
+                    $pageNo -= 1;
+                }else{
+                    $pageNo += 1;
+                }
+            }
+        }
+
+        $expContainer = Utilities::get_expsearch_results_with_pagination( Input::all(), $this->limit,
+            ($pageNo-1)*$this->limit);
 
 		$experimentStates = Utilities::getExpStates();
 		return View::make('experiment/search', array(
+                                                    'pageNo' => $pageNo,
+                                                    'limit' => $this->limit,
 													'expStates' => $experimentStates,
 													'expContainer' => $expContainer 
 												));
@@ -261,6 +287,29 @@ class ExperimentController extends BaseController {
 							);
 		return View::make("partials/experiment-queue-block", array( "queues" => $queues, "queueDefaults"
=> $queueDefaults) );
 	}
-}
 
+    public function browseView()
+    {
+        $pageNo = Input::get('pageNo');
+        $prev = Input::get('prev');
+        if(empty($pageNo)){
+            $pageNo = 1;
+        }else{
+            if(isset($prev)){
+                $pageNo -= 1;
+            }else{
+                $pageNo += 1;
+            }
+        }
+
+        $expContainer = Utilities::get_all_user_experiments_with_pagination($this->limit,
($pageNo-1)*$this->limit);
+        $experimentStates = Utilities::getExpStates();
+        return View::make('experiment/browse', array(
+            'pageNo' => $pageNo,
+            'limit' => $this->limit,
+            'expStates' => $experimentStates,
+            'expContainer' => $expContainer
+        ));
+    }
+}
 ?>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/5be987ef/app/controllers/ProjectController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php
index 2a8a934..4c29b5c 100755
--- a/app/controllers/ProjectController.php
+++ b/app/controllers/ProjectController.php
@@ -2,6 +2,12 @@
 
 class ProjectController extends BaseController {
 
+    /**
+     * Limit used in fetching paginated results
+     * @var int
+     */
+    var $limit = 1;
+
 	/**
 	*    Instantiate a new ProjectController Instance
 	**/
@@ -77,10 +83,54 @@ class ProjectController extends BaseController {
 
 	public function searchSubmit()
 	{
-        $projects = Utilities::get_projsearch_results( Input::get("search-key"), Input::get("search-value"));
-		return View::make( 'project/search', array('projects' => $projects));
+        $search = Input::get('search');
+        if(isset($search)){
+            $pageNo = 1;
+        }else{
+            $pageNo = Input::get('pageNo');
+            $prev = Input::get('prev');
+            if(empty($pageNo)){
+                $pageNo = 1;
+            }else{
+                if(isset($prev)){
+                    $pageNo -= 1;
+                }else{
+                    $pageNo += 1;
+                }
+            }
+        }
+
+        $projects = Utilities::get_projsearch_results_with_pagination( Input::get("search-key"),
+            Input::get("search-value"), $this->limit, ($pageNo-1)*$this->limit);
+		return View::make( 'project/search', array(
+            'pageNo' => $pageNo,
+            'limit' => $this->limit,
+            'projects' => $projects)
+        );
 	}
 
+    public function browseView()
+    {
+        $pageNo = Input::get('pageNo');
+        $prev = Input::get('prev');
+        if(empty($pageNo)){
+            $pageNo = 1;
+        }else{
+            if(isset($prev)){
+                $pageNo -= 1;
+            }else{
+                $pageNo += 1;
+            }
+        }
+
+        $projects = Utilities::get_all_user_projects_with_pagination( $this->limit, ($pageNo-1)*$this->limit);
+        return View::make('project/browse', array(
+            'pageNo' => $pageNo,
+            'limit' => $this->limit,
+            'projects' => $projects
+        ));
+    }
+
 }
 
 ?>


Mime
View raw message