本文整理汇总了PHP中Foundry类的典型用法代码示例。如果您正苦于以下问题:PHP Foundry类的具体用法?PHP Foundry怎么用?PHP Foundry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Foundry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Displays the application output in the canvas.
*
* @param int The user id that is currently being viewed.
* @param string layout path
* @since 1.0
* @access public
*/
public function display($userId = null, $docType = null)
{
// Get the user params
$params = $this->getUserParams($userId);
// Get the app params
$appParams = $this->app->getParams();
// Get the blog model
$total = (int) $params->get('total', $appParams->get('total', 5));
$pin_width = (int) $appParams->get('pin_width', 145);
$pin_padding = (int) $appParams->get('pin_padding', 3);
// Get list of all products created by the user on the site.
$input = JFactory::getApplication()->input;
$storeid = $input->get('storeid', '', 'INT');
$model = $this->getModel('q2cmyproducts');
$products = $model->getItems($userId, $total, $storeid);
$productsCount = $model->getProductsCount($userId, $storeid);
$user = Foundry::user($userId);
// Get store list of user
require_once JPATH_ROOT . '/components/com_quick2cart/helpers/storeHelper.php';
$storeHelper = new storeHelper();
$storelist = $storeHelper->getUserStore($userId);
$this->set('user', $user);
$this->set('userId', $userId);
$this->set('total', $total);
$this->set('pin_width', $pin_width);
$this->set('pin_padding', $pin_padding);
$this->set('products', $products);
$this->set('productsCount', $productsCount);
$this->set('storelists', $storelist);
echo parent::display('profile/default');
}
示例2: onPromoteData
function onPromoteData($id)
{
$db = JFactory::getDBO();
$Itemid = JRequest::getInt('Itemid');
$eschk = $this->_chkextension();
if (!empty($eschk)) {
/*$query = "SELECT cf.id FROM #__community_fields as cf
LEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id
WHERE cf.name like '%About me%' AND cfv.user_id=".$id;
$db->setQuery($query);
$fieldid = $db->loadresult();
*/
$query = "SELECT u.name AS title\n\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\tWHERE u.id =" . $id;
$db->setQuery($query);
$previewdata = $db->loadobjectlist();
//if($fieldid)
//$query .= " AND cfv.field_id=".$fieldid;
require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
$user = Foundry::user($id);
//easysocial data for user
$activitysocialintegrationprofiledata = new activitysocialintegrationprofiledata();
$img_path = $activitysocialintegrationprofiledata->getUserAvatar('EasySocial', JFactory::getUser($id));
$link = $activitysocialintegrationprofiledata->getUserProfileUrl('EasySocial', $id);
$previewdata[0]->image = $img_path;
$previewdata[0]->url = JUri::root() . substr(JRoute::_($link, false), strlen(JUri::base(true)) + 1);
$previewdata[0]->bodytext = '';
return $previewdata;
} else {
return '';
}
}
示例3: activate
/**
* Allows user to activate their account.
*
* @since 1.0
* @access public
*/
public function activate()
{
$my = FD::user();
// Get current view.
$view = $this->getCurrentView();
// Get the id from the request
$id = JRequest::getInt('userid');
$currentUser = FD::user($id);
// If user is already logged in, redirect to the dashboard.
if ($my->isLoggedIn()) {
return $view->call(__FUNCTION__, $currentUser);
}
$token = JRequest::getVar('token', '');
// If token is empty, warn the user.
if (empty($token) || strlen($token) !== 32) {
$view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATION_ACTIVATION_TOKEN_INVALID'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__, $currentUser);
}
// Retrieve registration model
$model = FD::model('Registration');
// Activate the token.
$user = $model->activate($token);
if ($user === false) {
$view->setMessage($model->getError(), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__, $currentUser);
}
// @points: user.register
// Assign points when user registers on the site.
$points = Foundry::points();
$points->assign('user.registration', 'com_easysocial', $this->id);
// @badge: registration.create
// Assign badge for the person that initiated the friend request.
$badge = FD::badges();
$badge->log('com_easysocial', 'registration.create', $user->id, JText::_('COM_EASYSOCIAL_REGISTRATION_BADGE_REGISTERED'));
// Get configuration object.
$config = FD::config();
// Add activity logging when a uer registers on the site.
// Get the application params
$app = FD::table('App');
$app->load(array('element' => 'profiles', 'group' => SOCIAL_TYPE_USER));
$params = $app->getParams();
// If not allowed, we will not want to proceed here.
if ($params->get('stream_register', true)) {
$stream = FD::stream();
$streamTemplate = $stream->getTemplate();
// Set the actor
$streamTemplate->setActor($user->id, SOCIAL_TYPE_USER);
// Set the context
$streamTemplate->setContext($user->id, SOCIAL_TYPE_PROFILES);
// Set the verb
$streamTemplate->setVerb('register');
// set sitewide
$streamTemplate->setSiteWide();
$streamTemplate->setAccess('core.view');
// Add stream template.
$stream->add($streamTemplate);
}
$view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATION_ACTIVATION_COMPLETED_SUCCESS'), SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__, $user);
}
示例4: getHTML
/**
* Shares a story through 3rd party oauth clients
*
* @param TableBlog $blog A blog table object
* @param string $type The type of oauth client
*
* @return boolean True on success and false otherwise.
**/
public function getHTML($bloggerid = "")
{
$html = '';
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
if ($config->get('main_jomsocial_messaging') && $my->id != $bloggerid) {
$file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
$file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'messaging.php';
if (file_exists($file_core) && file_exists($file_messaging)) {
require_once $file_core;
require_once $file_messaging;
CMessaging::load();
$html = '<a href="javascript:void(0);" onclick="' . CMessaging::getPopup($bloggerid) . '" class="author-message" title="' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '"><span>' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '</span></a>';
}
}
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_conversations') && $easysocial->exists() && $my->id != $bloggerid) {
$easysocial->init();
$user = Foundry::user($bloggerid);
$theme = new CodeThemes();
$theme->set('user', $user);
$html = $theme->fetch('easysocial.conversation.php');
}
return $html;
}
示例5: getLink
public function getLink()
{
$user = Foundry::user($this->profile->id);
if ($this->komentoprofile) {
return JRoute::_('index.php?option=com_komento&view=profile&id=' . $this->profile->id);
}
return $user->getPermalink();
}
示例6: display
/**
* Responsible to display the generic login form.
*
* @since 1.0
* @access public
*/
public function display($tpl = null)
{
$my = FD::user();
// If user is already logged in, they should not see this page.
if ($my->id > 0) {
return $this->redirect(FRoute::dashboard(array(), false));
}
// Add page title
FD::page()->title(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_TITLE'));
// Add breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_BREADCRUMB'));
// Facebook codes.
$facebook = FD::oauth('Facebook');
$config = FD::config();
$loginMenu = $config->get('general.site.login');
// Get any callback urls.
$return = FD::getCallback();
// If return value is empty, always redirect back to the dashboard
if (!$return) {
// Determine if there's a login redirection
$urlFromCaller = FD::input()->getVar('return', '');
if ($urlFromCaller) {
$return = $urlFromCaller;
} else {
if ($loginMenu != 'null') {
$return = FRoute::getMenuLink($loginMenu);
} else {
$return = FRoute::dashboard(array(), false);
}
$return = base64_encode($return);
}
} else {
$return = base64_encode($return);
}
if ($config->get('registrations.enabled')) {
$profileId = $config->get('registrations.mini.profile', 'default');
if ($profileId === 'default') {
$profileId = Foundry::model('profiles')->getDefaultProfile()->id;
}
$options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
$fieldsModel = Foundry::model('fields');
$fields = $fieldsModel->getCustomFields($options);
if (!empty($fields)) {
FD::language()->loadAdmin();
$fieldsLib = FD::fields();
$session = JFactory::getSession();
$registration = FD::table('Registration');
$registration->load($session->getId());
$data = $registration->getValues();
$args = array(&$data, &$registration);
$fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
$this->set('fields', $fields);
}
}
$this->set('return', $return);
$this->set('facebook', $facebook);
return parent::display('site/login/default');
}
示例7: _getAvatar
function _getAvatar($profile)
{
$easysocial = EasyBlogHelper::getHelper('EasySocial');
$easysocial->init();
$user = Foundry::user($profile->id);
$avatar = new stdClass();
$avatar->link = $user->getAvatar();
return $avatar;
}
示例8: getAvatar
public function getAvatar($profile)
{
$easysocial = EB::easysocial();
if (!$easysocial->exists()) {
return false;
}
// Load the user
$user = Foundry::user($profile->id);
return $user->getAvatar();
}
示例9: isValidNode
public function isValidNode()
{
if (!$this->group->id) {
$this->lib->setError(JText::_('Sorry, but the group id provided is not a valid group id.'));
return false;
}
if (Foundry::user()->id != $this->group->creator_uid) {
if (FD::user()->isBlockedBy($this->group->creator_uid)) {
return JError::raiseError(404, JText::_('COM_EASYSOCIAL_GROUPS_GROUP_NOT_FOUND'));
}
}
return true;
}
示例10: main
public function main()
{
$db = Foundry::db();
$sql = $db->sql();
$query = "update `#__social_stream` as a";
$query .= ' inner join `#__social_clusters` as b on a.`cluster_id` = b.`id`';
$query .= ' set a.`cluster_access` = b.`type`';
$query .= ' where a.`cluster_id` != 0 and a.`cluster_access` = 1';
$sql->raw($query);
$db->setQuery($sql);
$state = $db->query();
return $state;
}
示例11: form
/**
* Responsible to display the generic login form via ajax
*
* @since 1.0
* @access public
*/
public function form($tpl = null)
{
$ajax = FD::ajax();
$my = FD::user();
// If user is already logged in, they should not see this page.
if ($my->id > 0) {
$this->setMessage(JText::_('COM_EASYSOCIAL_LOGIN_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR);
return $ajax->reject($this->getMessage());
}
// Facebook codes.
$facebook = FD::oauth('Facebook');
// Get any callback urls.
$return = FD::getCallback();
// If return value is empty, always redirect back to the dashboard
if (!$return) {
$return = FRoute::dashboard(array(), false);
}
// Determine if there's a login redirection
$config = FD::config();
$loginMenu = $config->get('general.site.login');
if ($loginMenu != 'null') {
$return = FD::get('toolbar')->getRedirectionUrl($loginMenu);
}
$return = base64_encode($return);
$this->set('return', $return);
$this->set('facebook', $facebook);
if ($config->get('registrations.enabled')) {
$profileId = $config->get('registrations.mini.profile', 'default');
if ($profileId === 'default') {
$profileId = Foundry::model('profiles')->getDefaultProfile()->id;
}
$options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
$fieldsModel = FD::model('Fields');
$fields = $fieldsModel->getCustomFields($options);
if (!empty($fields)) {
FD::language()->loadAdmin();
$fieldsLib = FD::fields();
$session = JFactory::getSession();
$registration = FD::table('Registration');
$registration->load($session->getId());
$data = $registration->getValues();
$args = array(&$data, &$registration);
$fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
$this->set('fields', $fields);
}
}
$contents = parent::display('site/login/dialog.login');
return $ajax->resolve($contents);
}
示例12: getHTML
public function getHTML($bloggerid = "")
{
$config = EB::config();
$html = '';
$easysocial = EB::easysocial();
if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
$easysocial->init();
$user = Foundry::user($bloggerid);
$badges = $user->getBadges();
$theme = EB::template();
$theme->set('badges', $badges);
$html = $theme->output('site/easysocial/achievements');
}
return $html;
}
示例13: getHTML
public function getHTML($bloggerid = "")
{
$config = EasyBlogHelper::getConfig();
$html = '';
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
$easysocial->init();
$user = Foundry::user($bloggerid);
$badges = $user->getBadges();
$theme = new CodeThemes();
$theme->set('badges', $badges);
$html = $theme->fetch('easysocial.achievements.php');
}
return $html;
}
示例14: getProductsCount
public function getProductsCount($userId, $storeid = '')
{
$db = Foundry::db();
$sql = $db->sql();
$sql = 'SELECT COUNT(i.item_id)
FROM `#__kart_items` as i, `#__kart_store` as s
WHERE s.id = i.store_id
AND i.state = 1
AND `owner` = ' . $userId;
if ($storeid) {
$sql .= ' AND i.store_id = ' . $storeid;
}
$sql .= " AND i.parent = 'com_quick2cart'";
$db->setQuery($sql);
$result = $db->loadResult();
return $result;
}
示例15: getAlbums
/**
* Display the list of photos a user has uploaded
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getAlbums($user)
{
$params = $this->getUserParams($user->id);
$appParam = $this->app->getParams();
$albums = array();
// Load up albums model
$model = FD::model('Albums');
$sorting = $params->get('ordering', $appParam->get('ordering', 'latest'));
$options = array('order' => 'assigned_date', 'direction' => $sorting == 'latest' ? 'desc' : 'asc');
$options['excludeblocked'] = 1;
// privacy lib
$privacy = Foundry::privacy(Foundry::user()->id);
$results = $model->getAlbums($user->id, SOCIAL_TYPE_USER, $options);
if ($results) {
foreach ($results as $item) {
// we need to check the photo's album privacy to see if user allow to view or not.
if ($privacy->validate('albums.view', $item->id, SOCIAL_TYPE_ALBUM, $item->user_id)) {
$albums[] = $item;
}
}
}
if (empty($albums)) {
return;
}
// If sorting is set to random, then we shuffle the albums
if ($sorting == 'random') {
shuffle($albums);
}
// since we are getting all albums belong to user,
// we do not need to run another query to count the albums.
// just do array count will be fine.
// $total = $model->getTotalAlbums($options);
$total = count($albums);
$limit = $params->get('limit', $appParam->get('limit', 10));
$this->set('total', $total);
$this->set('appParams', $appParam);
$this->set('params', $params);
$this->set('user', $user);
$this->set('albums', $albums);
$this->set('limit', $limit);
$this->set('privacy', $privacy);
return parent::display('widgets/profile/albums');
}