Changeset 15

Show
Ignore:
Timestamp:
02/26/10 16:50:22 (2 years ago)
Author:
gnum
Message:

Teaher can edit participants. Added OPML download, still need to get real links to feeds to get it working properly

Location:
trunk
Files:
3 added
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/api.php

    r14 r15  
    4949                return $vcard; 
    5050        } 
     51 
     52        function edufeedrCourseOPML($educourse, $type = 'posts') { 
     53                $participants = $educourse->participants; 
     54                $participants = unserialize($participants); 
     55 
     56                $owner = $educourse->getOwnerEntity(); 
     57 
     58                $opml = '<?xml version="1.0" encoding="UTF-8"' . '?' . '>'; 
     59                $opml .= '<opml version="2.0">'; 
     60 
     61                $opml .= '<head>'; 
     62                $opml .= '<title>' . $educourse->title . '</title>'; 
     63                $opml .= '<dateCreated>' . date(DATE_RSS, $educourse->time_created) . '</dateCreated>'; 
     64                $opml .= '<ownerName>' . $owner->name . '</ownerName>'; 
     65                $opml .= '<ownerEmail>' . $owner->email . '</ownerEmail>'; 
     66                $opml .= '<ownerId>' . $owner->getURL() . '</ownerId>'; 
     67                $opml .= '</head>'; 
     68 
     69                $opml .= '<body>'; 
     70 
     71                foreach ($participants as $participant) { 
     72                        $opml .= '<outline type="rss" text="' . $participant['firstname'] . ' ' . $participant['lastname'] . '" description="" xmlUrl="' . __helperBlogFeedURL($participant['blog'], $type) . '" htmlUrl="' . $participant['blog'] . '"/>'; 
     73                } 
     74 
     75                $opml .= '</body>'; 
     76 
     77                $opml .= '</opml>'; 
     78 
     79                return $opml; 
     80        } 
     81 
     82        function __helperBlogFeedURL($url, $type = 'posts') { 
     83                if (!in_array($type, array('posts', 'comments'))) 
     84                        $type = 'posts'; 
     85 
     86                // XXX NO CODE HERE YET 
     87                return $url; 
     88        } 
    5189?> 
  • trunk/languages/en.php

    r14 r15  
    2222        /*  
    2323        File: /edufeedr/views/default/edufeedr/single_educourse_participant.php 
    24         Lines: 17 
     24        Lines: 20 
    2525        Text: Are you sure you want to remove participant %s? 
    2626        _missing_translation_ 
     
    3838        /*  
    3939        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    40         Lines: 21 
     40        Lines: 31 
    4141        Text: Course %s 
    4242        _missing_translation_ 
     
    7878        /*  
    7979        File: /edufeedr/views/default/object/educourse.php 
    80         Lines: 58 
     80        Lines: 60 
    8181        Text: Download vCard 
    8282        _missing_translation_ 
     
    8585         
    8686        /*  
    87         File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    88         Lines: 35 
     87        File: /edufeedr/views/default/object/educourse.php 
     88        Lines: 75 
     89        Text: Download comments OPML 
     90        _missing_translation_ 
     91        */ 
     92        "edufeedr:action:download:comments:opml" => "Download comments OPML", 
     93         
     94        /*  
     95        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
     96        Lines: 45 
    8997        Text: Blog 
    9098        _missing_translation_ 
     
    93101         
    94102        /*  
     103        File: /edufeedr/actions/download_educourse_opml.php 
    95104        File: /edufeedr/actions/download_educourse_vcard.php 
    96         Lines: 23 
     105        Lines: 23, 23 
    97106        Text: Download failed. 
    98107        _missing_translation_ 
     
    102111        /*  
    103112        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    104         Lines: 31 
     113        Lines: 41 
    105114        Text: E-mail 
    106115        _missing_translation_ 
     
    110119        /*  
    111120        File: /edufeedr/views/default/object/educourse.php 
    112         Lines: 91 
     121        Lines: 99 
    113122        Text: Teacher 
    114123        _missing_translation_ 
     
    119128        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    120129        File: /edufeedr/views/default/object/educourse.php 
    121         Lines: 39, 66 
     130        Lines: 49, 68 
    122131        Text: Sign up 
    123132        _missing_translation_ 
     
    143152        /*  
    144153        File: /edufeedr/views/default/object/educourse.php 
    145         Lines: 76 
     154        Lines: 84 
    146155        Text: Course participants 
    147156        _missing_translation_ 
     
    167176         
    168177        /*  
     178        File: /edufeedr/edit_participant.php 
     179        Lines: 26 
     180        Text: Edit participant %s of course %s 
     181        _missing_translation_ 
     182        */ 
     183        "edufeedr:title:edit:participant" => "Edit participant %s of course %s", 
     184         
     185        /*  
    169186        File: /edufeedr/views/default/edufeedr/forms/edit_educourse.php 
    170187        Lines: 63 
     
    191208         
    192209        /*  
     210        File: /edufeedr/views/default/object/educourse.php 
     211        Lines: 72 
     212        Text: Download posts OPML 
     213        _missing_translation_ 
     214        */ 
     215        "edufeedr:action:download:posts:opml" => "Download posts OPML", 
     216         
     217        /*  
    193218        File: /edufeedr/add_educourse.php 
    194219        Lines: 23 
     
    217242        File: /edufeedr/actions/add_educourse.php 
    218243        File: /edufeedr/actions/edit_educourse.php 
     244        File: /edufeedr/actions/edit_participant.php 
    219245        File: /edufeedr/actions/join_educourse.php 
    220         Lines: 30, 34, 26 
     246        Lines: 30, 34, 28, 26 
    221247        Text: Please fill all required fields. 
    222248        _missing_translation_ 
     
    226252        /*  
    227253        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    228         Lines: 27 
     254        Lines: 37 
    229255        Text: Last name 
    230256        _missing_translation_ 
     
    234260        /*  
    235261        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    236         Lines: 23 
     262        Lines: 33 
    237263        Text: First name 
    238264        _missing_translation_ 
    239265        */ 
    240266        "edufeedr:label:firstname" => "First name", 
     267         
     268        /*  
     269        File: /edufeedr/views/default/edufeedr/single_educourse_participant.php 
     270        Lines: 13 
     271        Text: Edit participant 
     272        _missing_translation_ 
     273        */ 
     274        "edufeedr:course:edit:participant" => "Edit participant", 
    241275         
    242276        /*  
     
    258292        /*  
    259293        File: /edufeedr/views/default/edufeedr/single_educourse_participant.php 
    260         Lines: 15 
     294        Lines: 18 
    261295        Text: Remove participant 
    262296        _missing_translation_ 
    263297        */ 
    264298        "edufeedr:course:remove:participant" => "Remove participant", 
     299         
     300        /*  
     301        File: /edufeedr/actions/delete_educourse.php 
     302        Lines: 18 
     303        Text: Course could not be deleted. 
     304        _missing_translation_ 
     305        */ 
     306        "edufeedr:error:educourse:not:deleted" => "Course could not be deleted.", 
     307         
     308        /*  
     309        File: /edufeedr/start.php 
     310        Lines: 12 
     311        Text: EduFeedr 
     312        _missing_translation_ 
     313        */ 
     314        "edufeedr:menu:edufeedr" => "EduFeedr", 
    265315         
    266316        /*  
     
    273323         
    274324        /*  
    275         File: /edufeedr/start.php 
    276         Lines: 12 
    277         Text: EduFeedr 
    278         _missing_translation_ 
    279         */ 
    280         "edufeedr:menu:edufeedr" => "EduFeedr", 
    281          
    282         /*  
    283         File: /edufeedr/actions/delete_educourse.php 
    284         Lines: 18 
    285         Text: Course could not be deleted. 
    286         _missing_translation_ 
    287         */ 
    288         "edufeedr:error:educourse:not:deleted" => "Course could not be deleted.", 
    289          
    290         /*  
    291325        File: /edufeedr/index.php 
    292326        Lines: 9 
     
    298332        /*  
    299333        File: /edufeedr/views/default/object/educourse.php 
    300         Lines: 84 
     334        Lines: 92 
    301335        Text: Blogroll 
    302336        _missing_translation_ 
     
    311345        */ 
    312346        "edufeedr:label:course_blog" => "Course blog", 
     347         
     348        /*  
     349        File: /edufeedr/actions/edit_participant.php 
     350        Lines: 41 
     351        Text: Participant information changed. 
     352        _missing_translation_ 
     353        */ 
     354        "edufeedr:message:participant:changed" => "Participant information changed.", 
    313355         
    314356    ); 
  • trunk/languages/et.php

    r14 r15  
    2222        /*  
    2323        File: /edufeedr/views/default/edufeedr/single_educourse_participant.php 
    24         Lines: 17 
     24        Lines: 20 
    2525        Text: Are you sure you want to remove participant %s? 
    2626        _missing_translation_ 
     
    3838        /*  
    3939        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    40         Lines: 21 
     40        Lines: 31 
    4141        Text: Course %s 
    4242        _missing_translation_ 
     
    7878        /*  
    7979        File: /edufeedr/views/default/object/educourse.php 
    80         Lines: 58 
     80        Lines: 60 
    8181        Text: Download vCard 
    8282        _missing_translation_ 
     
    8585         
    8686        /*  
    87         File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    88         Lines: 35 
     87        File: /edufeedr/views/default/object/educourse.php 
     88        Lines: 75 
     89        Text: Download comments OPML 
     90        _missing_translation_ 
     91        */ 
     92        "edufeedr:action:download:comments:opml" => "Download comments OPML", 
     93         
     94        /*  
     95        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
     96        Lines: 45 
    8997        Text: Blog 
    9098        _missing_translation_ 
     
    93101         
    94102        /*  
     103        File: /edufeedr/actions/download_educourse_opml.php 
    95104        File: /edufeedr/actions/download_educourse_vcard.php 
    96         Lines: 23 
     105        Lines: 23, 23 
    97106        Text: Download failed. 
    98107        _missing_translation_ 
     
    102111        /*  
    103112        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    104         Lines: 31 
     113        Lines: 41 
    105114        Text: E-mail 
    106115        _missing_translation_ 
     
    110119        /*  
    111120        File: /edufeedr/views/default/object/educourse.php 
    112         Lines: 91 
     121        Lines: 99 
    113122        Text: Teacher 
    114123        _missing_translation_ 
     
    119128        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    120129        File: /edufeedr/views/default/object/educourse.php 
    121         Lines: 39, 66 
     130        Lines: 49, 68 
    122131        Text: Sign up 
    123132        _missing_translation_ 
     
    143152        /*  
    144153        File: /edufeedr/views/default/object/educourse.php 
    145         Lines: 76 
     154        Lines: 84 
    146155        Text: Course participants 
    147156        _missing_translation_ 
     
    167176         
    168177        /*  
     178        File: /edufeedr/edit_participant.php 
     179        Lines: 26 
     180        Text: Edit participant %s of course %s 
     181        _missing_translation_ 
     182        */ 
     183        "edufeedr:title:edit:participant" => "Edit participant %s of course %s", 
     184         
     185        /*  
    169186        File: /edufeedr/views/default/edufeedr/forms/edit_educourse.php 
    170187        Lines: 63 
     
    191208         
    192209        /*  
     210        File: /edufeedr/views/default/object/educourse.php 
     211        Lines: 72 
     212        Text: Download posts OPML 
     213        _missing_translation_ 
     214        */ 
     215        "edufeedr:action:download:posts:opml" => "Download posts OPML", 
     216         
     217        /*  
    193218        File: /edufeedr/add_educourse.php 
    194219        Lines: 23 
     
    217242        File: /edufeedr/actions/add_educourse.php 
    218243        File: /edufeedr/actions/edit_educourse.php 
     244        File: /edufeedr/actions/edit_participant.php 
    219245        File: /edufeedr/actions/join_educourse.php 
    220         Lines: 30, 34, 26 
     246        Lines: 30, 34, 28, 26 
    221247        Text: Please fill all required fields. 
    222248        _missing_translation_ 
     
    226252        /*  
    227253        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    228         Lines: 27 
     254        Lines: 37 
    229255        Text: Last name 
    230256        _missing_translation_ 
     
    234260        /*  
    235261        File: /edufeedr/views/default/edufeedr/forms/join_educourse.php 
    236         Lines: 23 
     262        Lines: 33 
    237263        Text: First name 
    238264        _missing_translation_ 
    239265        */ 
    240266        "edufeedr:label:firstname" => "First name", 
     267         
     268        /*  
     269        File: /edufeedr/views/default/edufeedr/single_educourse_participant.php 
     270        Lines: 13 
     271        Text: Edit participant 
     272        _missing_translation_ 
     273        */ 
     274        "edufeedr:course:edit:participant" => "Edit participant", 
    241275         
    242276        /*  
     
    258292        /*  
    259293        File: /edufeedr/views/default/edufeedr/single_educourse_participant.php 
    260         Lines: 15 
     294        Lines: 18 
    261295        Text: Remove participant 
    262296        _missing_translation_ 
    263297        */ 
    264298        "edufeedr:course:remove:participant" => "Remove participant", 
     299         
     300        /*  
     301        File: /edufeedr/actions/delete_educourse.php 
     302        Lines: 18 
     303        Text: Course could not be deleted. 
     304        _missing_translation_ 
     305        */ 
     306        "edufeedr:error:educourse:not:deleted" => "Course could not be deleted.", 
     307         
     308        /*  
     309        File: /edufeedr/start.php 
     310        Lines: 12 
     311        Text: EduFeedr 
     312        _missing_translation_ 
     313        */ 
     314        "edufeedr:menu:edufeedr" => "EduFeedr", 
    265315         
    266316        /*  
     
    273323         
    274324        /*  
    275         File: /edufeedr/start.php 
    276         Lines: 12 
    277         Text: EduFeedr 
    278         _missing_translation_ 
    279         */ 
    280         "edufeedr:menu:edufeedr" => "EduFeedr", 
    281          
    282         /*  
    283         File: /edufeedr/actions/delete_educourse.php 
    284         Lines: 18 
    285         Text: Course could not be deleted. 
    286         _missing_translation_ 
    287         */ 
    288         "edufeedr:error:educourse:not:deleted" => "Course could not be deleted.", 
    289          
    290         /*  
    291325        File: /edufeedr/index.php 
    292326        Lines: 9 
     
    298332        /*  
    299333        File: /edufeedr/views/default/object/educourse.php 
    300         Lines: 84 
     334        Lines: 92 
    301335        Text: Blogroll 
    302336        _missing_translation_ 
     
    311345        */ 
    312346        "edufeedr:label:course_blog" => "Course blog", 
     347         
     348        /*  
     349        File: /edufeedr/actions/edit_participant.php 
     350        Lines: 41 
     351        Text: Participant information changed. 
     352        _missing_translation_ 
     353        */ 
     354        "edufeedr:message:participant:changed" => "Participant information changed.", 
    313355         
    314356    ); 
  • trunk/start.php

    r14 r15  
    7777                        include($CONFIG->pluginspath . 'edufeedr/join_educourse.php'); 
    7878                        break; 
     79                case "edit_participant": 
     80                        set_input('educourse', $page[1]); 
     81                        set_input('participant_id', $page[2]); 
     82                        include($CONFIG->pluginspath . 'edufeedr/edit_participant.php'); 
     83                        break; 
    7984                default: 
    8085                        include($CONFIG->pluginspath . 'edufeedr/index.php'); 
     
    105110        register_action('edufeedr/remove_participant', false, $CONFIG->pluginspath . 'edufeedr/actions/remove_participant.php'); 
    106111        register_action('edufeedr/download_educourse_vcard', true, $CONFIG->pluginspath . 'edufeedr/actions/download_educourse_vcard.php'); 
     112        register_action('edufeedr/download_educourse_opml', false, $CONFIG->pluginspath . 'edufeedr/actions/download_educourse_opml.php'); 
     113        register_action('edufeedr/edit_participant', true, $CONFIG->pluginspath . 'edufeedr/actions/edit_participant.php'); 
    107114?> 
  • trunk/views/default/edufeedr/forms/join_educourse.php

    r12 r15  
    22 
    33    if (isset($vars['entity']) && $vars['entity']->getSubtype() == 'educourse') { 
    4         $action = 'edufeedr/join_educourse'; 
    5                 $firstname = ''; 
    6                 $lastname = ''; 
    7                 $email = ''; 
    8                 $blog = ''; 
     4 
     5                if (isset($vars['participant'])) { 
     6                        $action = 'edufeedr/edit_participant'; 
     7                        $participant = $vars['participant']; 
     8                        $firstname = $participant['firstname']; 
     9                        $lastname = $participant['lastname']; 
     10                        $email = $participant['email']; 
     11                        $blog = $participant['blog']; 
     12                } else { 
     13            $action = 'edufeedr/join_educourse'; 
     14                    $firstname = ''; 
     15                    $lastname = ''; 
     16                    $email = ''; 
     17                    $blog = ''; 
     18                } 
    919 
    1020                if (isset($vars['join_firstname']) && !empty($vars['join_firstname'])) 
     
    3949                $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('edufeedr:submit:signup'))); 
    4050                $entity_hidden = elgg_view('input/hidden', array('internalname' => 'educourse', 'value' => $vars['entity']->getGUID())); 
     51                if (isset($vars['participant_id'])) 
     52                        $entity_hidden .= elgg_view('input/hidden', array('internalname' => 'participant_id', 'value' => $vars['participant_id'])); 
    4153 
    4254                $form_body = <<<EOT 
  • trunk/views/default/edufeedr/single_educourse_participant.php

    r12 r15  
    99 
    1010                if (edufeedrCanEditEducourse($vars['entity'])) { 
     11                        echo '&nbsp;&nbsp;'; 
     12                        /*translation:Edit participant*/ 
     13                        echo '<a href="' . $vars['url'] . 'pg/edufeedr/edit_participant/' . $vars['entity']->getGUID() . '/' . $vars['participant_number'] . '">' . elgg_echo('edufeedr:course:edit:participant') . '</a>'; 
    1114                        echo '&nbsp;&nbsp;'; 
    1215                        echo elgg_view('output/confirmlink', array( 
  • trunk/views/default/object/educourse.php

    r14 r15  
    77 
    88        if (isset($vars['full']) && $vars['full'] == true) { 
    9             echo '<div class="educourse">'; 
     9                $ts = time(); 
     10                $token = generate_action_token($ts); 
     11                echo '<div class="educourse">'; 
    1012             
    1113            echo '<h3><a href="' . $vars['entity']->getURL() . '" title="' . $vars['entity']->title . '">' . $vars['entity']->title . '</h3>'; 
     
    5557                                ); 
    5658                echo '&nbsp;&nbsp;'; 
    57                 $ts = time(); 
    58                 $token = generate_action_token($ts); 
    5959                /*translation:Download vCard*/ 
    6060                echo '<a href="' . $vars['url'] . 'action/edufeedr/download_educourse_vcard?educourse=' . $vars['entity']->getGUID() . '&__elgg_ts='. $ts . '&__elgg_token=' . $token .'">' . elgg_echo('edufeedr:action:download:vcard') . '</a>'; 
     
    6262                } 
    6363 
     64                echo '<div>'; 
    6465                // Sign up 
    6566                if (edufeedrIsEducourseOpen($vars['entity'])) { 
    66                         echo '<div>'; 
    6767                        /*translation:Sign up*/ 
    6868                        echo '<a href="' . $vars['url'] . 'pg/edufeedr/join/' . $vars['entity']->getGUID() . '">' . elgg_echo('edufeedr:submit:signup') . '</a>'; 
    69                         echo '</div>'; 
     69                        echo '&nbsp;&nbsp;'; 
    7070                } 
     71                /*translation:Download posts OPML*/ 
     72                echo '<a href="' . $vars['url'] . 'action/edufeedr/download_educourse_opml?educourse=' . $vars['entity']->getGUID() . '&type=posts&__elgg_ts=' . $ts . '&__elgg_token=' . $token . '">' . elgg_echo('edufeedr:action:download:posts:opml') . '</a>'; 
     73                echo '&nbsp;&nbsp;'; 
     74                /*translation:Download comments OPML*/ 
     75                echo '<a href="' . $vars['url'] . 'action/edufeedr/download_educourse_opml?educourse=' . $vars['entity']->getGUID() . '&type=comments&__elgg_ts=' . $ts . '&__elgg_token=' . $token . '">' . elgg_echo('edufeedr:action:download:comments:opml') . '</a>'; 
     76                echo '</div>'; 
    7177 
    7278                // Course patricipants