Enable searching for projects

This commit is contained in:
Karsten Heiken
2011-04-22 01:02:39 +02:00
parent c3ae2eb716
commit bfddf1af9a
2 changed files with 40 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
<?php
/**
* @author Karsten Heiken, karsten@disposed.de
*/
class Projects extends CI_Controller {
/**
@@ -67,4 +70,16 @@ class Projects extends CI_Controller {
->set_content_type('application/json')
->set_output(json_encode(array('result' => $result)));
}
/**
* Search for a specific project and return a list of possible results.
*
* @param type $needle The needle to look for in the haystack.
*/
public function search($needle) {
$results = $this->project->search($needle);
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('count' => count($results), 'results' => $results)));
}
}