Created
June 4, 2014 05:25
-
-
Save kamaulynder/08f7e0d378a0e171f89c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') OR die('No direct access allowed.'); | |
/** | |
* Ushahidi API Stats Controller | |
* | |
* @author Ushahidi Team <[email protected]> | |
* @package Ushahidi\Application\Controllers | |
* @copyright 2013 Ushahidi | |
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3) | |
*/ | |
class Controller_Api_Stats extends Ushahidi_Api { | |
/** | |
* @var string Field to sort results by | |
*/ | |
protected $_record_orderby = 'priority'; | |
/** | |
* @var string Direct to sort results | |
*/ | |
protected $_record_order = 'ASC'; | |
/** | |
* Get a count of tags,posts,sets,users | |
* | |
* GET /api/stats | |
* | |
* @return void | |
*/ | |
public function action_get_index_collection() | |
{ | |
//Count of all tags | |
$tags_query = ORM::factory('Tag') | |
->order_by($this->_record_orderby, $this->_record_order) | |
->offset($this->_record_offset) | |
->limit($this->_record_limit); | |
$tags = $tags_query->find_all(); | |
$count = $tags->count(); | |
// Respond with count | |
$this->_response_payload = array( | |
'count' => $count | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment