当前位置: 首页>>代码示例>>PHP>>正文


PHP DiscussHelper::getHelper方法代码示例

本文整理汇总了PHP中DiscussHelper::getHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getHelper方法的具体用法?PHP DiscussHelper::getHelper怎么用?PHP DiscussHelper::getHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DiscussHelper的用法示例。


在下文中一共展示了DiscussHelper::getHelper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 public function compile()
 {
     $config = DiscussHelper::getConfig();
     $less = DiscussHelper::getHelper('less');
     // Force compile
     $less->compileMode = 'force';
     $name = JRequest::getCmd('name', null, 'GET');
     $type = JRequest::getCmd('type', null, 'GET');
     $result = new stdClass();
     if (isset($name) && isset($type)) {
         switch ($type) {
             case "admin":
                 $result = $less->compileAdminStylesheet($name);
                 break;
             case "site":
                 $result = $less->compileSiteStylesheet($name);
                 break;
             case "module":
                 $result = $less->compileModuleStylesheet($name);
                 break;
             default:
                 $result->failed = true;
                 $result->message = "Stylesheet type is invalid.";
         }
     } else {
         $result->failed = true;
         $result->message = "Insufficient parameters provided.";
     }
     header('Content-type: text/javascript; UTF-8');
     echo json_encode($result);
     exit;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:32,代码来源:themes.php

示例2: display

 public function display($tpl = null)
 {
     $id = JRequest::getInt('id', 0);
     $badge = DiscussHelper::getTable('Badges');
     $badge->load($id);
     if (!$badge->created) {
         $date = DiscussHelper::getHelper('Date')->dateWithOffset(DiscussHelper::getDate()->toMySQL());
         $badge->created = $date->toMySQL();
     }
     // There could be some errors here.
     if (JRequest::getMethod() == 'POST') {
         $badge->bind(JRequest::get('post'));
         // Description might contain html codes
         $description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
         $badge->description = $description;
     }
     $jConfig = DiscussHelper::getJConfig();
     $editor = JFactory::getEditor($jConfig->get('editor'));
     $model = $this->getModel('Badges');
     $rules = $model->getRules();
     $badges = $this->getBadges();
     $this->assign('editor', $editor);
     $this->assign('badges', $badges);
     $this->assign('rules', $rules);
     $this->assign('badge', $badge);
     parent::display($tpl);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:27,代码来源:view.html.php

示例3: history

 /**
  * Displays the user's points achievement history
  *
  * @since	2.0
  * @access	public
  */
 public function history($tmpl = null)
 {
     $app = JFactory::getApplication();
     $id = JRequest::getInt('id');
     if (!$id) {
         DiscussHelper::setMessageQueue(JText::_('Unable to locate the id of the user.'), DISCUSS_QUEUE_ERROR);
         $app->redirect('index.php?option=com_easydiscuss');
         $app->close();
     }
     $model = DiscussHelper::getModel('Points', true);
     $history = $model->getPointsHistory($id);
     foreach ($history as $item) {
         $date = DiscussDateHelper::dateWithOffSet($item->created);
         $item->created = $date->toFormat('%A, %b %e %Y');
         $points = DiscussHelper::getHelper('Points')->getPoints($item->command);
         if ($points) {
             if ($points[0]->rule_limit < 0) {
                 $item->class = 'badge-important';
                 $item->points = $points[0]->rule_limit;
             } else {
                 $item->class = 'badge-info';
                 $item->points = '+' . $points[0]->rule_limit;
             }
         } else {
             $item->class = 'badge-info';
             $item->points = '+';
         }
     }
     $theme = new DiscussThemes();
     $theme->set('history', $history);
     echo $theme->fetch('points.history.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:view.html.php

示例4: getnews

    public function getnews()
    {
        $ajax = DiscussHelper::getHelper('Ajax');
        $news = DiscussHelper::getRecentNews();
        ob_start();
        if (!$news) {
            echo '<li class="empty">' . JText::_('COM_EASYDISCUSS_NO_NEWS_ITEM') . '</li>';
        } else {
            foreach ($news as $newsItem) {
                $dates = explode('/', $newsItem->date);
                ?>
			<li>
				<span class="updates-news">
					<a href="javascript:void(0);"><?php 
                echo $newsItem->title;
                ?>
</a>
					<span><?php 
                echo $newsItem->desc;
                ?>
</span>
				</span>
				<span class="si-date"><span><?php 
                echo $dates[0];
                ?>
</span>may</span>
				<span class="clear"></span>
			</li>
			<?php 
            }
        }
        $output = ob_get_contents();
        ob_end_clean();
        $ajax->success($output);
    }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:35,代码来源:view.ajax.php

示例5: getAuthorHTML

 /**
  * Get the author html output
  */
 private function getAuthorHTML($authors)
 {
     // @TODO: Make this option configurable
     // This option sets the limit on the number of authors to be displayed in the notification
     $limit = 3;
     $html = '';
     for ($i = 0; $i < count($authors); $i++) {
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($authors[$i]);
         $html .= ' <b>' . $profile->getName() . '</b>';
         if ($i + 1 == $limit) {
             // Calculate the balance
             $balance = count($authors) - ($i + 1);
             $html .= ' ' . DiscussHelper::getHelper('String')->getNoun('COM_EASYDISCUSS_AND_OTHERS', $balance, true);
             break;
         }
         if (isset($authors[$i + 2])) {
             $html .= JText::_(',');
         } else {
             if (isset($authors[$i + 1])) {
                 $html .= ' ' . JText::_('COM_EASYDISCUSS_AND');
             }
         }
     }
     return $html;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:29,代码来源:notifications.php

示例6: toFormat

 public function toFormat($format = '%Y-%m-%d %H:%M:%S')
 {
     if (DiscussHelper::getJoomlaVersion() >= '1.6') {
         if (JString::stristr($format, '%') !== false) {
             $format = DiscussHelper::getHelper('date')->strftimeToDate($format);
         }
         return $this->date->format($format);
     } else {
         return $this->date->toFormat($format);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:11,代码来源:date.php

示例7: count

 public function count()
 {
     $my = JFactory::getUser();
     $ajax = DiscussHelper::getHelper('Ajax');
     if ($my->id <= 0) {
         $ajax->fail('User is not logged in.');
         return;
     }
     $model = $this->getModel('Notification');
     $count = $model->getTotalNotifications($my->id);
     $ajax->success($count);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:12,代码来源:view.ajax.php

示例8: display

 public function display($tpl = null)
 {
     $my = JFactory::getUser();
     if (!$my->id) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error');
         JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
     }
     $model = $this->getModel('Notification');
     $this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_NOTIFICATIONS'));
     // Make this configurable?
     $limit = 100;
     $notifications = $model->getNotifications($my->id, false, $limit);
     DiscussHelper::getHelper('Notifications')->format($notifications, true);
     $theme = new DiscussThemes();
     $theme->set('notifications', $notifications);
     echo $theme->fetch('notifications.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:17,代码来源:view.html.php

示例9: assign

 public function assign($command, $userId)
 {
     // We don't have to give any badge to guests.
     if (!$userId || $userId == 0) {
         return;
     }
     // @task: Load necessary language files
     JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
     $config = DiscussHelper::getConfig();
     // If badges is disabled, do not proceed.
     if (!$config->get('main_badges')) {
         return;
     }
     // @task: Compute the count of the history already matches any badge for this user.
     $total = $this->getTotal($command, $userId);
     // @task: Get the badges that is relevant to this command
     $badges = $this->getBadges($command, $userId);
     if (!$badges) {
         return false;
     }
     foreach ($badges as $badge) {
         if ($total >= $badge->rule_limit) {
             $table = DiscussHelper::getTable('BadgesUsers');
             $table->set('badge_id', $badge->id);
             $table->set('user_id', $userId);
             $table->set('created', DiscussHelper::getDate()->toMySQL());
             $table->set('published', 1);
             $table->store();
             // @task: Add a new notification when they earned a new badge.
             $notification = DiscussHelper::getTable('Notifications');
             $notification->bind(array('title' => JText::sprintf('COM_EASYDISCUSS_NEW_BADGE_NOTIFICATION_TITLE', $badge->title), 'cid' => $badge->id, 'type' => DISCUSS_NOTIFICATIONS_BADGE, 'target' => $userId, 'author' => $userId, 'permalink' => 'index.php?option=com_easydiscuss&view=profile&id=' . $userId));
             $notification->store();
             //insert into JS stream.
             if ($config->get('integration_jomsocial_activity_badges', 0)) {
                 $badgeTable = DiscussHelper::getTable('Badges');
                 $badgeTable->load($badge->id);
                 $badgeTable->uniqueId = $table->id;
                 DiscussHelper::getHelper('jomsocial')->addActivityBadges($badgeTable);
             }
         }
     }
     return true;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:43,代码来源:badges.php

示例10: ajaxResetRank

 public function ajaxResetRank()
 {
     $ajax = DiscussHelper::getHelper('Ajax');
     $userid = JRequest::getInt('userid');
     $config = DiscussHelper::getConfig();
     $db = DiscussHelper::getDBO();
     $table = DiscussHelper::getTable('Ranksusers');
     // $table->load( '', $userid );
     if (!$table->load('', $userid)) {
         $ajax->reject();
         return $ajax->send();
     }
     $table->delete();
     // If after delete but rank still does not update, it might because there are multiple record of ranks in the database record.
     // Because the delete function only delete one record. (In case his db messed up, which contains multiple records.)
     DiscussHelper::getHelper('Ranks')->assignRank($userid, $config->get('main_ranking_calc_type', 'posts'));
     $ajax->resolve();
     return $ajax->send();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:19,代码来源:view.ajax.php

示例11: __construct

 public function __construct(DiscussPost $post, DiscussCategory $category)
 {
     $this->my = JFactory::getUser();
     $this->config = DiscussHelper::getConfig();
     // Creator of the post
     $this->creator = DiscussHelper::getTable('Profile');
     $this->creator->load($post->user_id);
     $this->post = $post;
     $this->parent = null;
     if (!empty($this->post->parent_id)) {
         // we now this item is a reply. let get the parent;
         $parentPost = DiscussHelper::getTable('Post');
         $parentPost->load($this->post->parent_id);
         $this->parent = $parentPost;
     }
     $this->isSiteAdmin = DiscussHelper::isSiteAdmin();
     $this->category = $category;
     $this->acl = DiscussHelper::getHelper('ACL');
     $this->isModerator = DiscussHelper::getHelper('Moderator')->isModerator($this->post->category_id);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:20,代码来源:postaccess.php

示例12: diplayRole

 public function diplayRole()
 {
     // Initialise variables
     $mainframe = JFactory::getApplication();
     $roleId = JRequest::getVar('role_id', '');
     $role = DiscussHelper::getTable('Role');
     $role->load($roleId);
     $role->title = JString::trim($role->title);
     $this->role = $role;
     // Set default values for new entries.
     if (empty($role->created_time)) {
         $date = DiscussHelper::getHelper('Date')->dateWithOffSet();
         $role->created_time = $date->toFormat();
         $role->published = true;
     }
     $groups = DiscussHelper::getJoomlaUserGroups();
     // Remove the selected usergroups
     $db = DiscussHelper::getDbo();
     $query = 'SELECT `usergroup_id` FROM `#__discuss_roles`';
     $db->setQuery($query);
     $result = $db->loadResultArray();
     if (!empty($result)) {
         foreach ($groups as $key => $group) {
             if (in_array($group->id, $result) && $group->id != $role->usergroup_id) {
                 unset($groups[$key]);
             }
         }
     }
     $usergroupList = JHTML::_('select.genericlist', $groups, 'usergroup_id', 'class="full-width"', 'id', 'name', $role->usergroup_id);
     $this->assignRef('role', $role);
     $this->assignRef('usergroupList', $usergroupList);
     $colors = array();
     $colors[] = JHTML::_('select.option', 'success', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_SUCCESS'));
     $colors[] = JHTML::_('select.option', 'warning', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_WARNING'));
     $colors[] = JHTML::_('select.option', 'important', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_IMPORTANT'));
     $colors[] = JHTML::_('select.option', 'info', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_INFO'));
     $colors[] = JHTML::_('select.option', 'inverse', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_INVERSE'));
     $colorList = JHTML::_('select.genericlist', $colors, 'colorcode', 'class="full-width"', 'value', 'text', $role->colorcode);
     $this->assignRef('colorList', $colorList);
     parent::display('edit');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:view.html.php

示例13: assign

 public function assign($command, $userId, $post = null)
 {
     // Assign points via EasySocial
     DiscussHelper::getHelper('EasySocial')->assignPoints($command, $userId, $post);
     if (!$userId) {
         return false;
     }
     $points = $this->getPoints($command);
     if (!$points) {
         return false;
     }
     $profile = DiscussHelper::getTable('Profile');
     $profile->load($userId);
     foreach ($points as $point) {
         $profile->addPoint($point->rule_limit);
     }
     $profile->store();
     // ranking
     // DiscussHelper::getHelper( 'ranks' )->assignRank( $userId, 'points' );
     return true;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:21,代码来源:points.php

示例14: addFieldOption

 public function addFieldOption()
 {
     $ajax = DiscussHelper::getHelper('Ajax');
     $addField = JRequest::getVar('activeType');
     $count = JRequest::getInt('fieldCount');
     if (!empty($id)) {
         //Get previous value
         $field = DiscussHelper::getTable('CustomFields');
         $field->load($id);
     }
     if (empty($addField)) {
         $ajax->reject();
         return $ajax->send();
     }
     switch ($addField) {
         case 'radiobtn':
             $fieldName = 'radioBtnValue[]';
             break;
         case 'checkbox':
             $fieldName = 'checkBoxValue[]';
             break;
         case 'selectlist':
             $fieldName = 'selectValue[]';
             break;
         case 'multiplelist':
             $fieldName = 'multipleValue[]';
             break;
         default:
             break;
     }
     // We need to add 1 from the previous count for the next item
     $count++;
     //We do not want add button for text and textarea
     if ($addField != 'text' || $addField != 'area') {
         //New field
         $html = '<li class="remove' . $addField . '_' . $count . '">' . '<div class="span10 remove' . $addField . '_' . $count . '">' . '<div class="input-append remove' . $addField . '_' . $count . '">' . '<input type="text" class="input-full ' . $addField . '" id="' . $addField . '_' . $count . '" name="' . $fieldName . '" value="" />' . '<button type="button" id="' . $count . '" class="btn btn-danger btn-customfield-remove" name="Remove" data-removetype="' . $addField . '"><i class="icon-remove"></i></button>' . '</div>' . '</div>' . '</li>';
     }
     $ajax->resolve($html, $count);
     return $ajax->send();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:40,代码来源:view.ajax.php

示例15: validateUserType

 public static function validateUserType($usertype)
 {
     $config = DiscussHelper::getConfig();
     $acl = DiscussHelper::getHelper('ACL', '0');
     switch ($usertype) {
         case 'guest':
             $enable = $acl->allowed('add_reply', 0);
             break;
         case 'twitter':
             $enable = $config->get('integration_twitter_enable');
             break;
         case 'facebook':
             $enable = $config->get('integration_facebook_enable1');
             break;
         case 'linkedin':
             $enable = $config->get('integration_linkedin_enable1');
             break;
         default:
             $enable = false;
     }
     return $enable;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:22,代码来源:user.php


注:本文中的DiscussHelper::getHelper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。