original_string: public function can_move_content_to($newcatid) {
          global $CFG;
          require_once($CFG->libdir . '/questionlib.php');
          $context = $this->get_context();
          if (!$this->is_uservisible() ||
                  !has_capability('moodle/category:manage', $context)) {
              return false;
          }
          $testcaps = array();
          // If this category has courses in it, user must have 'course:create' capability in target category.
          if ($this->has_courses()) {
              $testcaps[] = 'moodle/course:create';
          }
          // If this category has subcategories or questions, user must have 'category:manage' capability in target category.
          if ($this->has_children() || question_context_has_any_questions($context)) {
              $testcaps[] = 'moodle/category:manage';
          }
          if (!empty($testcaps)) {
              return has_all_capabilities($testcaps, context_coursecat::instance($newcatid));
          }
  
          // There is no content but still return true.
          return true;
      }
code: public function can_move_content_to($newcatid) {
          global $CFG;
          require_once($CFG->libdir . '/questionlib.php');
          $context = $this->get_context();
          if (!$this->is_uservisible() ||
                  !has_capability('moodle/category:manage', $context)) {
              return false;
          }
          $testcaps = array();
          // If this category has courses in it, user must have 'course:create' capability in target category.
          if ($this->has_courses()) {
              $testcaps[] = 'moodle/course:create';
          }
          // If this category has subcategories or questions, user must have 'category:manage' capability in target category.
          if ($this->has_children() || question_context_has_any_questions($context)) {
              $testcaps[] = 'moodle/category:manage';
          }
          if (!empty($testcaps)) {
              return has_all_capabilities($testcaps, context_coursecat::instance($newcatid));
          }
  
          // There is no content but still return true.
          return true;
      }
code_tokens: public function can_move_content_to ( $ newcatid ) { global $ CFG ; require_once ( $ CFG -> libdir . '/questionlib.php' ) ; $ context = $ this -> get_context ( ) ; if ( ! $ this -> is_uservisible ( ) || ! has_capability ( 'moodle/category:manage' , $ context ) ) { return false ; } $ testcaps = array ( ) ; // If this category has courses in it, user must have 'course:create' capability in target category. if ( $ this -> has_courses ( ) ) { $ testcaps [ ] = 'moodle/course:create' ; } // If this category has subcategories or questions, user must have 'category:manage' capability in target category. if ( $ this -> has_children ( ) || question_context_has_any_questions ( $ context ) ) { $ testcaps [ ] = 'moodle/category:manage' ; } if ( ! empty ( $ testcaps ) ) { return has_all_capabilities ( $ testcaps , context_coursecat :: instance ( $ newcatid ) ) ; } // There is no content but still return true. return true ; }
docstring: Checks if user has capability to move all category content to the new parent before
  removing this category
  
  @param int $newcatid
  @return bool
docstring_tokens: Checks if user has capability to move all category content to the new parent before removing this category