src/CI_Base_Model.php
public function order_by($criteria, $order = null)
    {

        if ($criteria == NULL) {
            return $this;
        }

        if (is_array($criteria)) { //Multiple order by provided!
            //check if we got single order by passed as array!!
            if (isset($criteria[1]) && (strtolower($criteria[1]) == 'asc' || strtolower($criteria[1]) == 'desc' || strtolower($criteria[1]) == 'random')) {
                $this->_database->order_by($criteria[0], $criteria[1]);
                return $this;
            }
            foreach ($criteria as $key => $value)
            {
                if(is_array($value)){
                    $this->order_by($value);
                }else{
                    $order_criteria = is_int($key) ? $value : $key;
                    $lower_key = strtolower($value);
                    $order = ($lower_key == 'asc' || $lower_key == 'desc' || $lower_key == 'random') ? $value : null;
                    $this->_database->order_by($order_criteria, $order);
                }
            }

            return $this;
        }

        $this->_database->order_by($criteria, $order); //its a string just call db order_by

        return $this;
    }
public function order_by($criteria, $order = null)
    {

        if ($criteria == NULL) {
            return $this;
        }

        if (is_array($criteria)) { //Multiple order by provided!
            //check if we got single order by passed as array!!
            if (isset($criteria[1]) && (strtolower($criteria[1]) == 'asc' || strtolower($criteria[1]) == 'desc' || strtolower($criteria[1]) == 'random')) {
                $this->_database->order_by($criteria[0], $criteria[1]);
                return $this;
            }
            foreach ($criteria as $key => $value)
            {
                if(is_array($value)){
                    $this->order_by($value);
                }else{
                    $order_criteria = is_int($key) ? $value : $key;
                    $lower_key = strtolower($value);
                    $order = ($lower_key == 'asc' || $lower_key == 'desc' || $lower_key == 'random') ? $value : null;
                    $this->_database->order_by($order_criteria, $order);
                }
            }

            return $this;
        }

        $this->_database->order_by($criteria, $order); //its a string just call db order_by

        return $this;
    }
A wrapper to $this->_database->order_by()

call the ci->db->order_by method as per provided param
The param can be string just like default order_by function expect
or can be array with set of param!!
<pre>
$model->order_by('fieldName DESC');
or
$model->order_by(array('fieldName','DESC'));
or
$model->order_by(array('fieldName'=>'DESC', 'fieldName2'=>'ASC'));
or
$model->order_by(array(array('fieldName','DESC'),'fieldName DESC'));
</pre>

@param $criteria
@param string $order
@internal param mixed $orders

@return bool