core/MY_Model.php
function dropdown()
    {
        $args = func_get_args();

        if(count($args) == 2)
        {
            list($key, $value) = $args;
        }
        else
        {
            $key = $this->primary_key;
            $value = $args[0];
        }

        $this->trigger('before_dropdown', array( $key, $value ));

        if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
        {
            $this->_database->where($this->soft_delete_key, FALSE);
        }

        $result = $this->_database->select(array($key, $value))
                           ->get($this->_table)
                           ->result();

        $options = array();

        foreach ($result as $row)
        {
            $options[$row->{$key}] = $row->{$value};
        }

        $options = $this->trigger('after_dropdown', $options);

        return $options;
    }
function dropdown()
    {
        $args = func_get_args();

        if(count($args) == 2)
        {
            list($key, $value) = $args;
        }
        else
        {
            $key = $this->primary_key;
            $value = $args[0];
        }

        $this->trigger('before_dropdown', array( $key, $value ));

        if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
        {
            $this->_database->where($this->soft_delete_key, FALSE);
        }

        $result = $this->_database->select(array($key, $value))
                           ->get($this->_table)
                           ->result();

        $options = array();

        foreach ($result as $row)
        {
            $options[$row->{$key}] = $row->{$value};
        }

        $options = $this->trigger('after_dropdown', $options);

        return $options;
    }
function dropdown ( ) { $ args = func_get_args ( ) ; if ( count ( $ args ) == 2 ) { list ( $ key , $ value ) = $ args ; } else { $ key = $ this -> primary_key ; $ value = $ args [ 0 ] ; } $ this -> trigger ( 'before_dropdown' , array ( $ key , $ value ) ) ; if ( $ this -> soft_delete && $ this -> _temporary_with_deleted !== TRUE ) { $ this -> _database -> where ( $ this -> soft_delete_key , FALSE ) ; } $ result = $ this -> _database -> select ( array ( $ key , $ value ) ) -> get ( $ this -> _table ) -> result ( ) ; $ options = array ( ) ; foreach ( $ result as $ row ) { $ options [ $ row -> { $ key } ] = $ row -> { $ value } ; } $ options = $ this -> trigger ( 'after_dropdown' , $ options ) ; return $ options ; }
Retrieve and generate a form_dropdown friendly array
Retrieve and generate a form_dropdown friendly array