public function get_course_ids($categories) {
        $courseids = array();
        foreach ($categories as $key=>$cat) {
            $courseids[$key] = $cat->course;
            if (!empty($cat->children)) {
                $courseids = array_merge($courseids, $this->get_course_ids($cat->children));
            }
        }
        return $courseids;
    }
public function get_course_ids($categories) {
        $courseids = array();
        foreach ($categories as $key=>$cat) {
            $courseids[$key] = $cat->course;
            if (!empty($cat->children)) {
                $courseids = array_merge($courseids, $this->get_course_ids($cat->children));
            }
        }
        return $courseids;
    }
public function get_course_ids ( $ categories ) { $ courseids = array ( ) ; foreach ( $ categories as $ key => $ cat ) { $ courseids [ $ key ] = $ cat -> course ; if ( ! empty ( $ cat -> children ) ) { $ courseids = array_merge ( $ courseids , $ this -> get_course_ids ( $ cat -> children ) ) ; } } return $ courseids ; }
gets all the courseids for the given categories

@param array categories contains category objects in  a tree representation
@return array courseids flat array in form categoryid=>courseid
gets all the courseids for the given categories