Changeset 318

Show
Ignore:
Timestamp:
06/03/08 20:30:20 (6 months ago)
Author:
juank
Message:

Structure of files of the plugin modified, added the folders, releases y trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • avatars/trunk/index.php

    r315 r318  
    1313        require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
    1414 
    15         //global $profile_id, $CFG, $PAGE, $messages, $USER; 
    1615        include (dirname(__FILE__) . "/lib/avatars_functions.php"); 
    1716        include (dirname(__FILE__) . "/lib/avatars_config.php"); 
     
    3433        $title = __gettext("Choose your avatar");  
    3534 
     35        //switching the action to do (Save, or nothing) 
    3636        if (isset($_POST["save_avatar"])) 
    3737        { 
  • avatars/trunk/lib.php

    r315 r318  
    1515 
    1616 
    17         require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
    18  
    19         run("profile:init"); 
    2017        global $CFG, $PAGE, $profile_id; 
    2118        require_once (dirname(__FILE__) . "/lib/avatars_config.php"); 
     
    2825    if (defined("context") && context == "avatars" && $page_owner == $_SESSION['userid']) { 
    2926      $PAGE->menu[] = array( 'name' => 'avatars', 
    30          'html' => '<a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a>'); 
     27         'html' => '<l1><a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a></li>'); 
    3128 
    3229 
    3330    } else { 
    3431      $PAGE->menu[] = array( 'name' => 'avatars', 
    35      'html' => '<a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a>'); 
     32     'html' => '<li><a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a></li>'); 
    3633    } 
    3734  } 
  • avatars/trunk/lib/avatars_functions.php

    r315 r318  
    1414function avatars_get_loggeduser_data() 
    1515{ 
    16         $user["name"] = $_SESSION["username"]; 
     16         
     17        // In this function we built the array $user, usefull in the update/insert process 
     18         
     19        $user["name"] = $_SESSION["username"]; 
    1720        $user["ident"] = $_SESSION["userid"]; 
    1821        $user["initial"] = substr($user["name"], 0, 1); // returns the first letter of the username logged in 
     
    2427function avatars_create_usericon_folder($user) 
    2528{ 
     29        // This function creates the folder where the avatar will be saved 
     30        // the avatar replaces the profile icon available for the chosen avatar 
    2631        global $CFG; 
    2732        require_once (dirname(__FILE__) . "/avatars_config.php"); 
     
    3035 
    3136 
     37        //Creating the folders if not exists any 
    3238        mkdir($CFG->dirroot.$icons_path.$user["initial"], 0777); 
    3339        mkdir($CFG->dirroot.$icons_path.$user["initial"]."/".$user["name"], 0777); 
     
    3743function avatars_update_icon_user($user, $profile_id) 
    3844{ 
     45         
     46        // here is, the function that updates the profile icon 
    3947        global $CFG; 
    4048        require_once (dirname(__FILE__) . "/avatars_config.php"); 
     
    4250        $icons_path = AVATARS_USERICONS_PATH; 
    4351 
     52        // preparing the data to be inserted in the elgg db 
    4453        $avatar_icon = new StdClass; 
    4554        $avatar_icon->owner = $user["ident"];  
    4655        $avatar_icon->filename = $_POST["avatar"].".gif"; 
    4756         
     57        // Inserting the icon in their respective elgg's DB table 
    4858        $icon_id = insert_record('icons', $avatar_icon); 
    4959 
     60        //Removing the old data of the profileicon changed 
    5061        unlink($CFG->dirroot.$icons_path.$user["initial"]."/".$user["name"]."/*"); 
    5162        copy($CFG->dirroot."mod/avatars/img/".$_POST["avatar"].".gif", $CFG->dirroot.$icons_path.$user["initial"]."/".$user["name"]."/".$_POST["avatar"].".gif"); 
    5263 
     64        // Preparing the data to be updated for the user 
    5365        $avatar_icon_user = new StdClass; 
    5466        $avatar_icon_user->ident = $profile_id; 
    5567        $avatar_icon_user->icon = $icon_id; 
    5668 
     69        //Updating the user data in the elgg's DB 
    5770        update_record('users', $avatar_icon_user); 
    5871}