NathanFriend.co.uk

Developers notebook

Month: September 2013

Codeigniter populate dropdown from database

Controller

$data['city_list'] = $this->City_model->get_dropdown_list();
$this->load->view('my_view_file', $data); 

Model

function get_dropdown_list()
{
$this->db->from('city');
$this->db->order_by('name');
$result = $this->db->get();
$return = array();
if($result->num_rows() > 0) {
foreach($result->result_array() as $row) {
$return[$row['id']] = $row['name'];
}
}

        return $return;

}

View

<?php echo form_dropdown('city_id', $city_list, set_value('city_id', $city_id));

Orignal source: http://ellislab.com/forums/viewthread/166284/

 

 

Find where Moodle 2+ has put your file

When you upload a file to a course it get assigned a hashvalue and stored in the /moodledata/filedir directory

To find out where, search the moodle database for the filename:

SELECT contenthash FROM mdl_files WHERE filename = ‘myfile.doc’;

This will return something like fb9d09535c7fce57abaa6f8a264137c39bea923b

Navigate to your moodledata/filedir and search for the hash:

find . -name fb9d09535c7fce57abaa6f8a264137c39bea923b

Take a copy, restoring the original name:

cp fb9d09535c7fce57abaa6f8a264137c39bea923b myfile.doc

© 2017 NathanFriend.co.uk

Theme by Anders NorenUp ↑