Remove hash helper and use existing string helper instead

This commit is contained in:
Eike Foken
2011-09-21 01:08:43 +02:00
parent 11ee2107f6
commit 4439fa9dfe
11 changed files with 113 additions and 140 deletions

View File

@@ -26,6 +26,8 @@
*
* Each program has many parameters used for configuration of experiments.
*
* @package ScattPort
* @subpackage Models
* @author Eike Foken <kontakt@eikefoken.de>
*/
class Parameter extends CI_Model {
@@ -52,7 +54,7 @@ class Parameter extends CI_Model {
*/
public function getAll($programId) {
return $this->db->order_by('sort_number ASC')
->get_where('parameters', array('program_id' => $programId))->result_array();
->get_where('parameters', array('program_id' => $programId))->result_array();
}
/**
@@ -79,14 +81,12 @@ class Parameter extends CI_Model {
* the insert was unsuccessful.
*/
public function create($data) {
$this->load->helper('hash');
if (!isset($data['program_id'])) {
return false;
}
do { // generate unique hash
$data['id'] = random_hash('16');
$data['id'] = random_string('sha1', 16);
} while ($this->db->where('id', $data['id'])->from('parameters')->count_all_results() > 0);
// put new parameter to the end