This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 
<?php
defined('C5_EXECUTE') or die("Access Denied.");

class Concrete5_Controller_Profile_Friends extends Controller {
    
    public $helpers = array('html', 'form'); 
    
    public function on_start(){
        $this->error = Loader::helper('validation/error');
        $this->addHeaderItem(Loader::helper('html')->css('ccm.profile.css'));
    }
    
    public function view($userID = 0) {
        if(!ENABLE_USER_PROFILES) {
            $this->render("/page_not_found");
        }
        
        $html = Loader::helper('html');
        $canEdit = false;
        $u = new User();

        if ($userID > 0) {
            $profile = UserInfo::getByID($userID);
            if (!is_object($profile)) {
                throw new Exception('Invalid User ID.');
            }
        } else if ($u->isRegistered()) {
            $profile = UserInfo::getByID($u->getUserID());
            $canEdit = true;
        } else {
            $this->set('intro_msg', t('You must sign in order to access this page!'));
            $this->render('/login');
        }
        
        $this->set('profile', $profile);
        $this->set('av', Loader::helper('concrete/avatar'));
        $this->set('t', Loader::helper('text'));
        $this->set('canEdit',$canEdit);
    }
    
    public function add_friend($fuID=0){
        UsersFriends::addFriend( intval($fuID) );
        $this->view( );
    }
    
    public function remove_friend($fuID=0){
        UsersFriends::removeFriend( intval($fuID) );
        $this->view( );
    }
}