original_string: protected function navigation_add_activity(navigation_node $node, $cm) {
          if (!$cm->uservisible) {
              return null;
          }
          $action = $cm->url;
          if (!$action) {
              // Do not add to navigation activity without url (i.e. labels).
              return null;
          }
          $activityname = format_string($cm->name, true, array('context' => context_module::instance($cm->id)));
          if ($cm->icon) {
              $icon = new pix_icon($cm->icon, $cm->modfullname, $cm->iconcomponent);
          } else {
              $icon = new pix_icon('icon', $cm->modfullname, $cm->modname);
          }
          $activitynode = $node->add($activityname, $action, navigation_node::TYPE_ACTIVITY, null, $cm->id, $icon);
          if (global_navigation::module_extends_navigation($cm->modname)) {
              $activitynode->nodetype = navigation_node::NODETYPE_BRANCH;
          } else {
              $activitynode->nodetype = navigation_node::NODETYPE_LEAF;
          }
          return $activitynode;
      }
code: protected function navigation_add_activity(navigation_node $node, $cm) {
          if (!$cm->uservisible) {
              return null;
          }
          $action = $cm->url;
          if (!$action) {
              // Do not add to navigation activity without url (i.e. labels).
              return null;
          }
          $activityname = format_string($cm->name, true, array('context' => context_module::instance($cm->id)));
          if ($cm->icon) {
              $icon = new pix_icon($cm->icon, $cm->modfullname, $cm->iconcomponent);
          } else {
              $icon = new pix_icon('icon', $cm->modfullname, $cm->modname);
          }
          $activitynode = $node->add($activityname, $action, navigation_node::TYPE_ACTIVITY, null, $cm->id, $icon);
          if (global_navigation::module_extends_navigation($cm->modname)) {
              $activitynode->nodetype = navigation_node::NODETYPE_BRANCH;
          } else {
              $activitynode->nodetype = navigation_node::NODETYPE_LEAF;
          }
          return $activitynode;
      }
code_tokens: protected function navigation_add_activity ( navigation_node $ node , $ cm ) { if ( ! $ cm -> uservisible ) { return null ; } $ action = $ cm -> url ; if ( ! $ action ) { // Do not add to navigation activity without url (i.e. labels). return null ; } $ activityname = format_string ( $ cm -> name , true , array ( 'context' => context_module :: instance ( $ cm -> id ) ) ) ; if ( $ cm -> icon ) { $ icon = new pix_icon ( $ cm -> icon , $ cm -> modfullname , $ cm -> iconcomponent ) ; } else { $ icon = new pix_icon ( 'icon' , $ cm -> modfullname , $ cm -> modname ) ; } $ activitynode = $ node -> add ( $ activityname , $ action , navigation_node :: TYPE_ACTIVITY , null , $ cm -> id , $ icon ) ; if ( global_navigation :: module_extends_navigation ( $ cm -> modname ) ) { $ activitynode -> nodetype = navigation_node :: NODETYPE_BRANCH ; } else { $ activitynode -> nodetype = navigation_node :: NODETYPE_LEAF ; } return $ activitynode ; }
docstring: Adds a course module to the navigation node
  
  This is basically copied from function global_navigation::load_section_activities()
  because it is not accessible from outside.
  
  @param navigation_node $node
  @param cm_info $cm
  @return null|navigation_node
docstring_tokens: Adds a course module to the navigation node