function testPersonHasBeenDeleted()
 {
     $this->unlinkOldTestFile();
     $person[] = array("firstname" => "Francesco R.", "surname" => "Di Caprio");
     $file = new File($this->testfile);
     $file->insert($person);
     $personToDelete = new Person("Francesco R.", "Di Caprio");
     $file->delete($personToDelete);
     $this->assertFalse($file->search($personToDelete));
 }
 /**
  * Page de recherche
  */
 public function search($str = '')
 {
     parent::loadHeader();
     $str_to_search = NULL;
     if (!empty($str)) {
         $str_to_search = urldecode(trim(htmlspecialchars($str)));
     } else {
         // Pour valider form
         $this->load->library('form_validation');
         $this->load->helper('form');
         $this->form_validation->set_error_delimiters('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>', '</div>');
         //mise en place des regles
         $this->form_validation->set_rules('search_query', 'recherche', 'required|encode_php_tags|htmlspecialchars|trim|xss_clean|max_length[200]');
         if ($this->form_validation->run() != FALSE) {
             $str_to_search = $this->input->post('search_query');
         }
     }
     // Requête SQL de recherche
     if ($str_to_search == NULL) {
         $this->index();
     } else {
         $files = File::search($str_to_search);
         //Fabriquer tableau
         $data['files'] = $files;
         $data['query'] = $str_to_search;
         $this->load->view('flux/flux_search', $data);
     }
     parent::loadFooter();
 }
Example #3
0
 protected function getFilesOfExercise($model)
 {
     if ($model) {
         $file = new File('search');
         $file->exercise_id = $model->id;
         return $file->search();
     }
 }
Example #4
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     //		$dataProvider=new CActiveDataProvider('File');
     //		$this->render('index',array(
     //			'dataProvider'=>$dataProvider,
     $model = new File('search');
     $model->unsetAttributes();
     if (isset($_GET['File'])) {
         $model->attributes = $_GET['File'];
     }
     $this->render('index', array('dataProvider' => $model->search(), 'model' => $model));
 }