public function set_locked($lockedstate, $cascade=false, $refresh=true) {
        $this->load_grade_item();

        $result = $this->grade_item->set_locked($lockedstate, $cascade, true);

        if ($cascade) {
            //process all children - items and categories
            if ($children = grade_item::fetch_all(array('categoryid'=>$this->id))) {

                foreach ($children as $child) {
                    $child->set_locked($lockedstate, true, false);

                    if (empty($lockedstate) and $refresh) {
                        //refresh when unlocking
                        $child->refresh_grades();
                    }
                }
            }

            if ($children = grade_category::fetch_all(array('parent'=>$this->id))) {

                foreach ($children as $child) {
                    $child->set_locked($lockedstate, true, true);
                }
            }
        }

        return $result;
    }
public function set_locked($lockedstate, $cascade=false, $refresh=true) {
        $this->load_grade_item();

        $result = $this->grade_item->set_locked($lockedstate, $cascade, true);

        if ($cascade) {
            //process all children - items and categories
            if ($children = grade_item::fetch_all(array('categoryid'=>$this->id))) {

                foreach ($children as $child) {
                    $child->set_locked($lockedstate, true, false);

                    if (empty($lockedstate) and $refresh) {
                        //refresh when unlocking
                        $child->refresh_grades();
                    }
                }
            }

            if ($children = grade_category::fetch_all(array('parent'=>$this->id))) {

                foreach ($children as $child) {
                    $child->set_locked($lockedstate, true, true);
                }
            }
        }

        return $result;
    }
public function set_locked ( $ lockedstate , $ cascade = false , $ refresh = true ) { $ this -> load_grade_item ( ) ; $ result = $ this -> grade_item -> set_locked ( $ lockedstate , $ cascade , true ) ; if ( $ cascade ) { //process all children - items and categories if ( $ children = grade_item :: fetch_all ( array ( 'categoryid' => $ this -> id ) ) ) { foreach ( $ children as $ child ) { $ child -> set_locked ( $ lockedstate , true , false ) ; if ( empty ( $ lockedstate ) and $ refresh ) { //refresh when unlocking $ child -> refresh_grades ( ) ; } } } if ( $ children = grade_category :: fetch_all ( array ( 'parent' => $ this -> id ) ) ) { foreach ( $ children as $ child ) { $ child -> set_locked ( $ lockedstate , true , true ) ; } } } return $ result ; }
Sets the grade_item's locked variable and updates the grade_item.

Calls set_locked() on the categories' grade_item

@param int  $lockedstate 0, 1 or a timestamp int(10) after which date the item will be locked.
@param bool $cascade lock/unlock child objects too
@param bool $refresh refresh grades when unlocking
@return bool success if category locked (not all children mayb be locked though)
Sets the grade_item s locked variable and updates the grade_item .