本文整理汇总了PHP中FD::model方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::model方法的具体用法?PHP FD::model怎么用?PHP FD::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($item)
{
$model = FD::model('comments');
$users = $model->getParticipants($item->uid, $item->context_type);
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
$content = '';
if (count($users) == 1 && !empty($item->content)) {
$content = JString::substr(strip_tags($item->content), 0, 30);
if (JString::strlen($item->content) > 30) {
$content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
}
}
$item->content = $content;
list($element, $group, $verb) = explode('.', $item->context_type);
$streamItem = FD::table('streamitem');
$state = $streamItem->load(array('context_type' => $element, 'actor_type' => $group, 'verb' => $verb, 'context_id' => $item->uid));
if (!$state) {
return;
}
$owner = $streamItem->actor_id;
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner) {
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_COMMENTED_ON_YOUR_ITEM' . $plurality, $names);
return $item;
}
if ($item->actor_id == $owner && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_ARTICLE_OWNER_COMMENTED_ON_ITEM' . FD::user($owner)->getGenderLang(), $names);
return $item;
}
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_COMMENTED_ON_USER_ITEM' . $plurality, $names, FD::user($owner)->getName());
return $item;
}
示例2: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// Load the language file.
FD::language()->loadAdmin();
// Attach dialog's css file.
JFactory::getDocument()->addStylesheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easysocial/themes/default/styles/style.css');
// Render the headers
FD::page()->start();
$theme = FD::themes();
$label = (string) $this->element['label'];
$name = (string) $this->name;
$title = JText::_('COM_EASYSOCIAL_JFIELD_SELECT_USER');
if ($this->value) {
$model = FD::model('Users');
$id = (int) $model->getUserIdFromAlias($this->value);
$user = FD::user($id);
$title = $user->getName();
}
$theme->set('name', $name);
$theme->set('id', $this->id);
$theme->set('value', $this->value);
$theme->set('label', $label);
$theme->set('title', $title);
$output = $theme->output('admin/jfields/user');
// We do not want to process stylesheets on Joomla 2.5 and below.
$options = array();
if (FD::version()->getVersion() < 3) {
$options['processStylesheets'] = false;
}
FD::page()->end($options);
return $output;
}
示例3: execute
public function execute($item, $calendar)
{
$model = FD::model('comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Include the notification actor
$users[] = $item->actor_id;
// Exclude the current user
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
$content = '';
if (count($users) == 1 && !empty($item->content)) {
$content = JString::substr(strip_tags($item->content), 0, 30);
if (JString::strlen($item->content) > 30) {
$content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
}
}
$item->content = $content;
if ($calendar->user_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_YOUR_EVENT' . $plurality, $names);
return $item;
}
if ($calendar->user_id == $item->actor_id && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_CALENDAR_OWNER_COMMENTED_ON_EVENT' . FD::user($calendar->user_id)->getGendarLang(), $names);
return $item;
}
$item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_USER_EVENT' . $plurality, $names, FD::user($calendar->user_id)->getName());
return $item;
}
示例4: execute
/**
*
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function execute($item)
{
// Get the badge
$badge = FD::table('Badge');
$badge->load($item->uid);
// Break the namespace
list($element, $group, $verb, $owner) = explode('.', $item->context_type);
// Get the permalink of the achievement item which is the stream item
$streamItem = FD::table('StreamItem');
$streamItem->load(array('context_type' => $element, 'verb' => $verb, 'actor_type' => $group, 'actor_id' => $owner));
// Get comment participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// Get the badge image
$item->image = $badge->getAvatar();
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($owner == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_USER_BADGES_USER_COMMENTED_ON_YOUR_ACHIEVEMENT' . $plurality, $names, $badge->get('title'));
return $item;
}
if ($owner == $item->actor_id && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_BADGES_OWNER_COMMENTED_ON_ACHIEVEMENT' . FD::user($owner)->getGenderLang(), $names, $badge->get('title'));
return $item;
}
// This is for 3rd party viewers
$item->title = JText::sprintf('APP_USER_BADGES_USER_COMMENTED_ON_USERS_ACHIEVEMENT' . $plurality, $names, FD::user($stream->actor_id)->getName(), $badge->get('title'));
return $item;
}
示例5: execute
public function execute($item)
{
$model = FD::model('likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
list($element, $group, $verb) = explode('.', $item->context_type);
$streamItem = FD::table('streamitem');
$state = $streamItem->load(array('context_type' => $element, 'actor_type' => $group, 'verb' => $verb, 'context_id' => $item->uid));
if (!$state) {
return;
}
$owner = $streamItem->actor_id;
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner) {
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_LIKES_YOUR_ITEM' . $plurality, $names);
return $item;
}
if ($item->actor_id == $owner && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_ARTICLE_OWNER_LIKES_ITEM' . FD::user($owner)->getGenderLang(), $names);
return $item;
}
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_LIKES_USER_ITEM' . $plurality, $names, FD::user($owner)->getName());
return $item;
}
示例6: display
public function display($tpl = null)
{
$auth = JRequest::getString('auth');
// Get the current logged in user's information
$model = FD::model('Users');
$id = $model->getUserIdFromAuth($auth);
$userId = JRequest::getInt('userid');
// If user id is not passed in, return logged in user
if (!$userId) {
$userId = $id;
}
// If we still can't find user's details, throw an error
if (!$userId) {
$this->set('code', 403);
$this->set('message', JText::_('Invalid user id provided.'));
return parent::display();
}
$me = FD::user($id);
$user = FD::user($userId);
$this->set('id', $userId);
$this->set('isself', $id == $userId);
$this->set('isfriend', $user->isFriends($id));
$this->set('isfollower', $user->isFollowed($id));
$this->set('username', $user->username);
$this->set('friend_count', $user->getTotalFriends());
$this->set('follower_count', $user->getTotalFollowing());
$this->set('badges', $user->getTotalBadges());
$this->set('points', $user->getPoints());
$this->set('avatar_thumb', $user->getAvatar());
$birthday = $user->getFieldValue('BIRTHDAY');
if (!empty($birthday)) {
$this->set('age', $birthday->value->toAge());
}
$gender = $user->getFieldValue('GENDER');
$this->set('gender', !empty($gender) ? $gender->data : 0);
// Prepare DISPLAY custom fields
FD::language()->loadAdmin();
// FD::apps()->loadAllLanguages();
$steps = FD::model('steps')->getSteps($user->profile_id, SOCIAL_TYPE_PROFILES, SOCIAL_PROFILES_VIEW_DISPLAY);
$fields = FD::model('fields')->getCustomFields(array('profile_id' => $user->profile_id, 'data' => true, 'dataId' => $user->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_DISPLAY));
$library = FD::fields();
$args = array(&$user);
$library->trigger('onGetValue', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
// Get the step mapping first
$profileSteps = array();
foreach ($steps as $step) {
$profileSteps[$step->id] = JText::_($step->title);
}
$profileFields = array();
foreach ($fields as $field) {
$value = (string) $field->value;
if (!empty($value)) {
$data = array('group_id' => $field->step_id, 'group_name' => $profileSteps[$field->step_id], 'field_id' => $field->id, 'field_name' => JText::_($field->title), 'field_value' => (string) $field->value);
$profileFields[] = $data;
}
}
$this->set('more_info', $profileFields);
$this->set('code', 200);
parent::display();
}
示例7: sidebarBottom
public function sidebarBottom($groupId)
{
$params = $this->getParams();
if (!$params->get('widget', true)) {
return;
}
$group = FD::group($groupId);
if (!$group->getAccess()->get('events.groupevent', true)) {
return;
}
$my = FD::user();
$days = $params->get('widget_days', 14);
$total = $params->get('widget_total', 5);
$date = FD::date();
$now = $date->toSql();
$future = FD::date($date->toUnix() + $days * 24 * 60 * 60)->toSql();
$options = array();
$options['start-after'] = $now;
$options['start-before'] = $future;
$options['limit'] = $total;
$options['state'] = SOCIAL_STATE_PUBLISHED;
$options['ordering'] = 'start';
$options['group_id'] = $groupId;
$events = FD::model('Events')->getEvents($options);
if (empty($events)) {
return;
}
$theme = FD::themes();
$theme->set('events', $events);
$theme->set('app', $this->app);
echo $theme->output('themes:/apps/user/events/widgets/dashboard/upcoming');
}
示例8: execute
public function execute($item)
{
// Get comment participants
$model = FD::model('Likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
list($element, $group, $verb) = explode('.', $item->context_type);
$event = FD::event($item->uid);
$owner = FD::user($item->getParams()->get('owner_id'));
// Verbs
// makeadmin
// going
// notgoing
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_PLURAL
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner->id) {
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_' . strtoupper($verb), count($users)), $names);
return $item;
}
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_' . strtoupper($verb), count($users)), $names, $owner->getName());
return $item;
}
示例9: getGroups
/**
* Retrieves the list of groups
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function getGroups($user, $params)
{
$model = FD::model('Groups');
$isUserAViewer = FD::user()->id == $user->id ? true : false;
$groupOptions = array('uid' => $user->id, 'state' => SOCIAL_CLUSTER_PUBLISHED);
// if $user is the current viewer, we will get all the groups
if ($isUserAViewer) {
$groupOptions['types'] = 'all';
}
$groups = $model->getGroups($groupOptions);
$limit = $params->get('widget_profile_total', 5);
// Get the total groups the user owns
$groupCntOptions = array('types' => 'open');
// if $user is the current viewer, we will get all the groups
if ($isUserAViewer) {
$groupCntOptions = array();
}
$total = $user->getTotalGroups($groupCntOptions);
$theme = FD::themes();
$theme->set('user', $user);
$theme->set('limit', $limit);
$theme->set('groups', $groups);
$theme->set('total', $total);
return $theme->output('themes:/apps/user/groups/widgets/profile/groups');
}
示例10: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$group = FD::group($uid);
// Get the article item
$news = FD::table('GroupNews');
$news->load(JRequest::getInt('newsId'));
// Check if the user is really allowed to view this item
if (!$group->canViewItem()) {
return $this->redirect($group->getPermalink(false));
}
// Get the author of the article
$author = FD::user($news->created_by);
// Get the url for the article
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $this->app->getAlias(), 'articleId' => $news->id), false);
// Apply comments for the article
$comments = FD::comments($news->id, 'news', 'create', SOCIAL_APPS_GROUP_GROUP, array('url' => $url));
// Apply likes for the article
$likes = FD::likes()->get($news->id, 'news', 'create', SOCIAL_APPS_GROUP_GROUP);
// Set the page title
FD::page()->title($news->get('title'));
// Get a list of other news
$model = FD::model('Groups');
// Retrieve the params
$params = $this->app->getParams();
$this->set('params', $params);
$this->set('group', $group);
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('author', $author);
$this->set('news', $news);
echo parent::display('canvas/item');
}
示例11: getSearch
function getSearch()
{
//init variable
$app = JFactory::getApplication();
$log_user = JFactory::getUser($this->plugin->get('user')->id);
$nxt_lim = 20;
$search = $app->input->get('search', '', 'STRING');
$nxt_lim = $app->input->get('next_limit', 0, 'INT');
$mapp = new EasySocialApiMappingHelper();
$res = new stdClass();
if (empty($search)) {
$res->status = 0;
$res->message = 'Empty searchtext';
return $res;
}
$userid = $log_user->id;
$serch_obj = new EasySocialModelSearch();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$frnd_obj = new EasySocialModelFriends();
$query->select($db->quoteName(array('su.user_id')));
$query->from($db->quoteName('#__social_users', 'su'));
$query->join('LEFT', $db->quoteName('#__users', 'u') . ' ON (' . $db->quoteName('su.user_id') . ' = ' . $db->quoteName('u.id') . ')');
//->where(($db->quoteName('u.username') . ' LIKE '. $db->quote('\'% '.$search.'%\'') ).'OR' .( $db->quoteName('u.name') . ' LIKE '. $db->quote('\'%'.$search.'%\'') ).'OR'.( $db->quoteName('u.email') . ' LIKE '. $db->quote('\'%'.$search.'%\'')))
if (!empty($search)) {
$query->where("(u.username LIKE '%" . $search . "%' ) OR ( u.name LIKE '%" . $search . "%') OR ( u.email LIKE '%" . $search . "%')");
}
$query->order($db->quoteName('u.id') . 'ASC');
$db->setQuery($query);
$tdata = $db->loadObjectList();
$susers = array();
foreach ($tdata as $ky => $val) {
$susers[] = FD::user($val->user_id);
}
$base_obj = $mapp->mapItem($susers, 'user', $log_user->id);
$list['user'] = $this->createSearchObj($base_obj);
//for group
$query1 = $db->getQuery(true);
$query1->select($db->quoteName(array('cl.id')));
$query1->from($db->quoteName('#__social_clusters', 'cl'));
if (!empty($search)) {
$query1->where("(cl.title LIKE '%" . $search . "%' )");
}
$query1->order($db->quoteName('cl.id') . 'ASC');
$db->setQuery($query1);
$gdata = $db->loadObjectList();
$grp_model = FD::model('Groups');
$group = array();
foreach ($gdata as $grp) {
$group[] = FD::group($grp->id);
}
$list['group'] = $mapp->mapItem($group, 'group', $log_user->id);
if (empty($list['group'])) {
$ret_arr = new stdClass();
$ret_arr->status = false;
$ret_arr->message = "No group found in search";
$list['group'] = $ret_arr;
}
return $list;
}
示例12: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($groupId = null, $docType = null)
{
$group = FD::group($groupId);
// Render the rss model
$model = FD::model('RSS');
$result = $model->getItems($group->id, SOCIAL_TYPE_GROUP);
// If there are tasks, we need to bind them with the table.
$feeds = array();
if ($result) {
foreach ($result as $row) {
// Bind the result back to the note object.
$rss = FD::table('Rss');
$rss->bind($row);
// Initialize the parser.
$parser = @JFactory::getFeedParser($rss->url);
$rss->parser = $parser;
$rss->total = @$parser->get_item_quantity();
$rss->items = @$parser->get_items();
$feeds[] = $rss;
}
}
// Get the app params
$params = $this->app->getParams();
$limit = $params->get('total', 5);
$this->set('totalDisplayed', $limit);
$this->set('appId', $this->app->id);
$this->set('group', $group);
$this->set('feeds', $feeds);
echo parent::display('views/default');
}
示例13: display
/**
* Displays the application output in the canvas.
*
* @since 1.2
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($groupId = null, $docType = null)
{
$group = FD::group($groupId);
// Check if the viewer is allowed here.
if (!$group->canViewItem()) {
return $this->redirect($group->getPermalink(false));
}
// Get app params
$params = $this->app->getParams();
// Load the milestone
$id = JRequest::getInt('milestoneId');
$milestone = FD::table('Milestone');
$milestone->load($id);
FD::page()->title(JText::_('APP_GROUP_TASKS_TITLE_CREATE_MILESTONE'));
if ($id && $milestone->id) {
FD::page()->title(JText::_('APP_GROUP_TASKS_TITLE_EDITING_MILESTONE'));
}
// Get a list of members from the group
$groupModel = FD::model('Groups');
$members = $groupModel->getMembers($group->id);
$this->set('members', $members);
$this->set('milestone', $milestone);
$this->set('params', $params);
$this->set('group', $group);
echo parent::display('views/form');
}
示例14: execute
/**
*
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function execute($item)
{
// Get the owner of the stream item since we need to notify the person
$stream = FD::table('Stream');
$stream->load($item->uid);
// Get comment participants
$model = FD::model('Likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
// Include the actor of the stream item as the recipient
$users = array_merge(array($item->actor_id), $users);
// Ensure that the values are unique
$users = array_unique($users);
$users = array_values($users);
// Exclude myself from the list of users.
$index = array_search(FD::user()->id, $users);
if ($index !== false) {
unset($users[$index]);
$users = array_values($users);
}
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : 'SINGULAR';
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($stream->actor_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_USER_PROFILES_USER_LIKES_YOUR_PROFILE_UPDATES' . $plurality, $names);
return $item;
}
if ($stream->actor_id == $item->actor_id && count($users)) {
$item->title = JText::sprintf('APP_USER_PROFILES_OWNER_LIKES_PROFILE_UPDATE' . FD::user($stream->actor_id)->getGenderLang(), $names);
}
// This is for 3rd party viewers
$item->title = JText::sprintf('APP_USER_PROFILES_USER_LIKES_USER_PROFILE_UPDATES' . $plurality, $names, FD::user($stream->actor_id)->getName());
return $item;
}
示例15: getParents
public function getParents()
{
FD::checkToken();
$type = $this->input->get('type', '', 'string');
$parents = FD::model('Regions')->getRegions(array('type' => $type, 'state' => SOCIAL_STATE_PUBLISHED));
return $this->view->call(__FUNCTION__, $parents);
}