original_string: public function process_course_module_competency($data) {
          $data = (object) $data;
  
          // Mapping the competency by ID numbers.
          $framework = \core_competency\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
          if (!$framework) {
              return;
          }
          $competency = \core_competency\competency::get_record(array('idnumber' => $data->idnumber,
              'competencyframeworkid' => $framework->get('id')));
          if (!$competency) {
              return;
          }
  
          $params = array(
              'competencyid' => $competency->get('id'),
              'cmid' => $this->task->get_moduleid()
          );
          $query = 'competencyid = :competencyid AND cmid = :cmid';
          $existing = \core_competency\course_module_competency::record_exists_select($query, $params);
  
          if (!$existing) {
              // Sortorder is ignored by precaution, anyway we should walk through the records in the right order.
              $record = (object) $params;
              $record->ruleoutcome = $data->ruleoutcome;
              $coursemodulecompetency = new \core_competency\course_module_competency(0, $record);
              $coursemodulecompetency->create();
          }
      }
code: public function process_course_module_competency($data) {
          $data = (object) $data;
  
          // Mapping the competency by ID numbers.
          $framework = \core_competency\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
          if (!$framework) {
              return;
          }
          $competency = \core_competency\competency::get_record(array('idnumber' => $data->idnumber,
              'competencyframeworkid' => $framework->get('id')));
          if (!$competency) {
              return;
          }
  
          $params = array(
              'competencyid' => $competency->get('id'),
              'cmid' => $this->task->get_moduleid()
          );
          $query = 'competencyid = :competencyid AND cmid = :cmid';
          $existing = \core_competency\course_module_competency::record_exists_select($query, $params);
  
          if (!$existing) {
              // Sortorder is ignored by precaution, anyway we should walk through the records in the right order.
              $record = (object) $params;
              $record->ruleoutcome = $data->ruleoutcome;
              $coursemodulecompetency = new \core_competency\course_module_competency(0, $record);
              $coursemodulecompetency->create();
          }
      }
code_tokens: public function process_course_module_competency ( $ data ) { $ data = ( object ) $ data ; // Mapping the competency by ID numbers. $ framework = \ core_competency \ competency_framework :: get_record ( array ( 'idnumber' => $ data -> frameworkidnumber ) ) ; if ( ! $ framework ) { return ; } $ competency = \ core_competency \ competency :: get_record ( array ( 'idnumber' => $ data -> idnumber , 'competencyframeworkid' => $ framework -> get ( 'id' ) ) ) ; if ( ! $ competency ) { return ; } $ params = array ( 'competencyid' => $ competency -> get ( 'id' ) , 'cmid' => $ this -> task -> get_moduleid ( ) ) ; $ query = 'competencyid = :competencyid AND cmid = :cmid' ; $ existing = \ core_competency \ course_module_competency :: record_exists_select ( $ query , $ params ) ; if ( ! $ existing ) { // Sortorder is ignored by precaution, anyway we should walk through the records in the right order. $ record = ( object ) $ params ; $ record -> ruleoutcome = $ data -> ruleoutcome ; $ coursemodulecompetency = new \ core_competency \ course_module_competency ( 0 , $ record ) ; $ coursemodulecompetency -> create ( ) ; } }
docstring: Process a course module competency.
  
  @param array $data The data.
docstring_tokens: Process a course module competency .