Example #1
0
 /**
  * Render content
  */
 public function render()
 {
     CssLoader::getInstance()->load('profile', 'all');
     load_kernel_config('user_profile');
     $userData = user_get_properties($this->userId);
     $pictureUrl = '';
     if (get_conf('allow_profile_picture')) {
         $picturePath = user_get_picture_path($userData);
         if ($picturePath && file_exists($picturePath)) {
             $pictureUrl = user_get_picture_url($userData);
         } else {
             $pictureUrl = get_icon_url('nopicture');
         }
     }
     $userFullName = claro_htmlspecialchars(get_lang('%firstName %lastName', array('%firstName' => $userData['firstname'], '%lastName' => $userData['lastname'])));
     $dock = new ClaroDock('userProfileBox');
     $template = new CoreTemplate('user_profilebox.tpl.php');
     $template->assign('userId', $this->userId);
     $template->assign('pictureUrl', $pictureUrl);
     $template->assign('userFullName', $userFullName);
     $template->assign('dock', $dock);
     $template->assign('condensedMode', $this->condensedMode);
     $template->assign('userData', $userData);
     return $template->render();
 }
Example #2
0
} else {
    foreach ($searchResultList as $thisPost) {
        // PREVENT USER TO CONSULT POST FROM A GROUP THEY ARE NOT ALLOWED
        if (!is_null($thisPost['group_id']) && $is_groupPrivate && !(in_array($thisPost['group_id'], $userGroupList) || in_array($thisPost['group_id'], $tutorGroupList) || claro_is_course_manager())) {
            continue;
        } else {
            // notify if is new message
            $post_time = datetime_to_timestamp($thisPost['post_time']);
            if ($post_time < $last_visit) {
                $class = ' class="item"';
            } else {
                $class = ' class="item hot"';
            }
            // get user picture
            $userData = user_get_properties($thisPost['poster_id']);
            $picturePath = user_get_picture_path($userData);
            if ($picturePath && file_exists($picturePath)) {
                $pictureUrl = user_get_picture_url($userData);
            } else {
                $pictureUrl = null;
            }
            $out .= '<div id="post' . $thisPost['post_id'] . '" class="threadPost">' . '<div class="threadPostInfo">' . (!is_null($pictureUrl) ? '<div class="threadPosterPicture"><img src="' . $pictureUrl . '" alt=" " /></div>' : '') . "\n" . '<b>' . $thisPost['firstname'] . ' ' . $thisPost['lastname'] . '</b> ' . '<br />' . '<small>' . claro_html_localised_date(get_locale('dateTimeFormatLong'), $post_time) . '</small>' . "\n";
            $out .= '  </div>' . "\n" . '<div class="threadPostContent">' . "\n" . '<img src="' . get_icon_url('topic') . '" alt="" />' . '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $thisPost['topic_id'])) . '">' . claro_htmlspecialchars($thisPost['topic_title']) . '</a>' . "\n" . '<span class="threadPostIcon ' . $class . '"><img src="' . get_icon_url('post') . '" alt="" /></span><br />' . "\n" . claro_parse_user_text($thisPost['post_text']) . "\n";
            $out .= '</div>' . "\n" . '<div class="spacer"></div>' . "\n\n" . '</div>' . "\n";
        }
        // end else if ( ! is_null($thisPost['group_id'])
    }
}
// end for each
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Example #3
0
</span>
<?php 
}
//end not anonymous user
echo $this->topic_subject;
?>
</h4>
<?php 
foreach ($this->postList as $thisPost) {
    ?>
<div id="post<?php 
    echo $thisPost['post_id'];
    ?>
" class="threadPost">
  <?php 
    if (user_get_picture_path(user_get_properties($thisPost['poster_id'])) && file_exists(user_get_picture_path(user_get_properties($thisPost['poster_id'])))) {
        ?>
    <div class="threadPosterPicture"><img src="<?php 
        echo user_get_picture_url(user_get_properties($thisPost['poster_id']));
        ?>
" alt=" " /></div>
  <?php 
    }
    ?>
  <div class="threadPostInfo">
    <span style="font-weight: bold;"><?php 
    echo $thisPost['firstname'];
    ?>
 <?php 
    echo $thisPost['lastname'];
    ?>
Example #4
0
}
//end not anonymous user
echo $this->topic_subject;
?>
</h4>
<div id="postList">
<?php 
foreach ($this->postList as $thisPost) {
    ?>
<div id="post<?php 
    echo $thisPost['post_id'];
    ?>
" class="threadPost">
  <div class="threadPostInfo">
    <?php 
    if ('anonymous' !== $thisPost['lastname'] && user_get_picture_path(user_get_properties($thisPost['poster_id'])) && file_exists(user_get_picture_path(user_get_properties($thisPost['poster_id'])))) {
        ?>
    <div class="threadPosterPicture">
        <img src="<?php 
        echo user_get_picture_url(user_get_properties($thisPost['poster_id']));
        ?>
" alt=" " />
    </div>
    <?php 
    }
    ?>
    <?php 
    if ('anonymous' === $thisPost['lastname']) {
        ?>
<span style="font-weight: bold;"><?php 
        $userData = user_get_properties($thisPost['poster_id']);
Example #5
0
/**
 * Display form to edit or add user to the platform.
 *
 * @param $userId int
 */
function user_html_form($userId = null)
{
    // If the user exists (given user id)
    if (!empty($userId)) {
        // Get user's general informations
        $userData = user_get_properties($userId);
        // Get user's skype account
        $userData['skype'] = get_user_property($userId, 'skype');
        // Get user's picture
        $picturePath = user_get_picture_path($userData);
        if ($picturePath && file_exists($picturePath)) {
            $pictureUrl = user_get_picture_url($userData);
        } else {
            $pictureUrl = '';
        }
        // Get current language
        $currentLanguage = !empty($userData['language']) ? $userData['language'] : language::current_language();
        // A few javascript
        $htmlHeadXtra[] = '<script type="text/javascript">
            function confirmation (name)
            {
                if (confirm("' . clean_str_for_javascript(get_lang('Are you sure to delete')) . '"+ name + "?"))
                {return true;}
                else
                {return false;}
            }
            
            $(document).ready(function(){
                $("#delete").click(function(){
                    return confirmation("' . $userData['firstname'] . " " . $userData['lastname'] . '");
                }).attr("href","adminuserdeleted.php?uidToEdit=' . $userId . '&cmd=exDelete");
            });
        </script>';
    } else {
        // Initialize user's data
        $userData = user_initialise();
        // No user's picture
        $pictureUrl = '';
        // Prefered language
        $currentLanguage = language::current_language();
    }
    // Editable fields
    if (empty($userId) || claro_is_platform_admin()) {
        $editableFields = array('name', 'official_code', 'login', 'password', 'email', 'phone', 'language', 'picture', 'skype');
        if (claro_is_platform_admin()) {
            $editableFields[] = 'authSource';
        }
    } else {
        $editableFields = AuthProfileManager::getUserAuthProfile($userId)->getEditableProfileFields();
        // get_conf('profile_editable');
        // pushClaroMessage(var_export($editableFields,true), 'debug');
    }
    if (!empty($_SERVER['HTTP_REFERER'])) {
        $cancelUrl = $_SERVER['HTTP_REFERER'];
    } else {
        $cancelUrl = $_SERVER['PHP_SELF'];
    }
    // Hack to prevent autocompletion of password fields from browser
    $htmlHeadXtra[] = '<script type="text/javascript">
        $(document).ready(
            function() {
                $("#password").val("");
            }
        );
    </script>';
    $template = new CoreTemplate('user_form.tpl.php');
    $template->assign('formAction', $_SERVER['PHP_SELF']);
    $template->assign('relayContext', claro_form_relay_context());
    $template->assign('cancelUrl', claro_htmlspecialchars(Url::Contextualize($cancelUrl)));
    $template->assign('editableFields', $editableFields);
    $template->assign('data', $userData);
    $template->assign('pictureUrl', $pictureUrl);
    $template->assign('currentLanguage', $currentLanguage);
    $template->assign('languages', get_language_to_display_list());
    return $template->render();
}