Changeset 1099

Show
Ignore:
Timestamp:
05/14/07 16:04:00 (2 years ago)
Author:
ben
Message:

Communities now have widgets, although the YUI functionality isn't available to them yet.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/community/lib.php

    r1098 r1099  
    2626    global $CFG; 
    2727    global $USER; 
     28    global $metatags; 
    2829 
    2930    require_once (dirname(__FILE__)."/default_template.php"); 
    3031    require_once (dirname(__FILE__)."/lib/communities_config.php"); 
    3132 
     33    $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/community/css.css\" type=\"text/css\" media=\"screen\" />"; 
     34 
    3235    $page_owner = $profile_id; 
    3336 
     
    3538 
    3639    $username= user_info('username', $page_owner); 
    37  
    38     if (isloggedin()) { 
    39 /* 
    40         if (defined("context") && context == COMMUNITY_CONTEXT && context!="network" && $page_owner == $_SESSION['userid']) { 
    41             $PAGE->menu[] = array( 'name' => 'community', 
    42                                    'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" class=\"selected\" >" .__gettext("Your Communities").'</a></li>'); 
    43             } else { 
    44                 $PAGE->menu[] = array( 'name' => 'community', 
    45                                        'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" >" .__gettext("Your Communities").'</a></li>'); 
    46             } */ 
    47     } 
    4840 
    4941    if ($usertype == "community") { 
     
    8476                                         'html' => a_href("{$CFG->wwwroot}{$username}/community/requests", 
    8577                                                           __gettext("View membership requests"))); 
    86  
    87  
    88       /*-----------------------------------* 
    89            * O2O BEGIN modified by mac 
    90           /*-----------------------------------*/ 
    91                   /** 
    92                  *it connects to invite to a person from a group by mac 
    93                  */ 
    94                  /* 
    95                   $PAGE->menu_sub[] = array( 'name' => 'community:invite', 
    96                                          'html' => a_href( "{$CFG->wwwroot}_invite/", __gettext("Invite a friend"))); 
    97                   */ 
    98  
    99       /**---- I hypertie to contact to add a group like member  by mac --**/ 
    100       /* 
    101           $PAGE->menu_sub[] = array( 'name' => 'community:addgroup', 
    102                                      'html' => a_href("{$CFG->wwwroot}_communities/addgroup.php?profile_id=$page_owner", 
    103                                                              __gettext("Invite a Community"))); 
    104       */ 
    105       /*-----------------------------------* 
    106            * O2O BEGIN modified by mac 
    107           /*-----------------------------------*/ 
    108             } 
    109         } 
     78            } 
     79        } 
     80         
     81        if (defined("context") && context == "profile") { 
     82 
     83            if (run("permissions:check", "profile")) { 
     84                 
     85                if (!empty($CFG->uses_YUI)) { 
     86                    $PAGE->menu_sub[] = array( 'name' => 'profile:widget:manage', 
     87                        'html' => '<a href="'.$CFG->wwwroot.'mod/widget/manage_widgets.php?owner='.$page_owner.'">' 
     88                        . __gettext("Manage widgets") . '</a>'); 
     89                } else { 
     90                    $PAGE->menu_sub[] = array( 'name' => 'profile:widget:add', 
     91                        'html' => '<a href="'.$CFG->wwwroot.'mod/profile/add.php?owner='.$page_owner.'">' 
     92                        . __gettext("Add widget") . '</a>'); 
     93                 
     94            } 
     95     
     96            } 
     97        } 
     98         
    11099    } else if ($usertype == "person") { 
    111100 
     
    161150 
    162151    // 'Communities' aspect to the little menus beneath peoples' icons 
    163         $function['community:infobox:menu'][] = $CFG->dirroot . "mod/community/lib/communities_info_menu.php";   
    164152        $function['users:infobox:menu:text'][] = $CFG->dirroot . "mod/community/lib/user_info_menu_text.php"; 
    165153 
  • devel/mod/widget/manage_widgets.php

    r1046 r1099  
    1515if (isloggedin()) { 
    1616     
     17    global $profile_id, $page_owner; 
     18     
    1719    // Define context 
    1820    define("context","widget"); 
     21    $user_id = optional_param('owner',$page_owner,PARAM_INT);  
     22    $page_owner = $user_id; 
     23     
    1924    $top_bit_template = <<<END 
    2025         
     
    2934         
    3035        <script type="text/javascript"> 
    31                 var user_id = {$_SESSION['userid']}; 
     36                var user_id = {$page_owner}; 
    3237                var wwwroot = '$CFG->wwwroot'; 
    3338                 
     
    259264    $first_column_list = ''; 
    260265     
    261     if ($widgets = widget_for_user($_SESSION['userid'],'profile',0,0)) { 
     266    if ($widgets = widget_for_user($page_owner,'profile',0,0)) { 
    262267        foreach($widgets as $widget) { 
    263268            $name = 'Unknown'; 
     
    279284    $second_column_list = ''; 
    280285     
    281     if ($widgets = widget_for_user($_SESSION['userid'],'profile',0,1)) { 
     286    if ($widgets = widget_for_user($page_owner,'profile',0,1)) { 
    282287        foreach($widgets as $widget) { 
    283288            $name = 'Unknown';