Example #1
0
 static function save_course_mailing_list($course_id, $type = 'course_students')
 {
     $db = JFactory::getDBO();
     //XXX checkar q no existe ya
     $comp_params = JComponentHelper::getParams('com_joomdle');
     $ml = $comp_params->get('mailing_list_integration');
     $type_str = JoomdleHelperMailinglist::get_type_str($type);
     // Add to mailing list component
     $course_info = JoomdleHelperContent::getCourseInfo($course_id);
     switch ($ml) {
         case 'acymailing':
             $list_id = JoomdleHelperAcymailing::save_list($course_info['fullname'] . $type_str, $course_info['summary']);
             break;
         default:
             // No component selected, do nothing
             return;
     }
     // Add to joomdle table
     $mlist = new JObject();
     $mlist->course_id = $course_id;
     $mlist->list_id = $list_id;
     $mlist->type = $type;
     $status = $db->insertObject('#__joomdle_mailinglists', $mlist);
     // Add all course members to list
     JoomdleHelperMailinglist::add_list_members($course_id, $type);
 }