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


PHP EasyBlogHelper::getModel方法代码示例

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


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

示例1: buildNestedCategories

 public function buildNestedCategories(&$parent, $ignorePrivate = false, $isPublishedOnly = true)
 {
     $catModel = EasyBlogHelper::getModel('Categories');
     $childs = $catModel->getChildCategories($parent->id, $isPublishedOnly);
     $accessibleCatsIds = EasyBlogHelper::getAccessibleCategories($parent->id);
     if (!empty($childs)) {
         for ($j = 0; $j < count($childs); $j++) {
             $child = $childs[$j];
             $child->childs = null;
             if (!$ignorePrivate) {
                 if (count($accessibleCatsIds) > 0) {
                     $access = false;
                     foreach ($accessibleCatsIds as $canAccess) {
                         if ($canAccess->id == $child->id) {
                             $access = true;
                         }
                     }
                     if (!$access) {
                         continue;
                     }
                 } else {
                     continue;
                 }
             }
             if (!$this->buildNestedCategories($child, $ignorePrivate, $isPublishedOnly)) {
                 $parent->childs[] = $child;
             }
         }
         // for $j
     } else {
         return false;
     }
 }
开发者ID:Tommar,项目名称:remate,代码行数:33,代码来源:easyblogcategories.php

示例2: getHTML

 /**
  * Retrieves the html codes for the ratings.
  *
  * @param	int	$uid	The unique id for the item that is being rated
  * @param	string	$type	The unique type for the item that is being rated
  * @param	string	$command	A textual representation to request user to vote for this item.
  * @param	string	$element	A dom element id.
  **/
 public function getHTML($uid, $type, $command, $elementId, $disabled = false)
 {
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('main_ratings')) {
         return false;
     }
     $language = JFactory::getLanguage();
     $language->load('com_easyblog', JPATH_ROOT);
     // Add ratings to the page
     $document = JFactory::getDocument();
     $rating = EasyBlogHelper::getTable('Ratings', 'Table');
     $my = JFactory::getUser();
     $hash = $my->id > 0 ? '' : JFactory::getSession()->getId();
     $voted = $rating->fill($my->id, $uid, $type, $hash);
     $locked = $voted || $my->id < 1 && !$config->get('main_ratings_guests') || $disabled;
     $model = EasyBlogHelper::getModel('Ratings');
     $ratingValue = $model->getRatingValues($uid, $type);
     $theme = new CodeThemes();
     $theme->set('voted', $voted);
     $theme->set('elementId', $elementId);
     $theme->set('rating', $ratingValue->ratings);
     $theme->set('total', $ratingValue->total);
     $theme->set('locked', $locked);
     $theme->set('command', $command);
     $theme->set('uid', $uid);
     $theme->set('type', $type);
     return $theme->fetch('ratings.form.php');
 }
开发者ID:Tommar,项目名称:vino2,代码行数:36,代码来源:ratings.php

示例3: get

 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     $config = EasyBlogHelper::getConfig();
     $id = $input->get('id', null, 'INT');
     // If we have an id try to fetch the user
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($id);
     if (!$id) {
         $this->plugin->setResponse($this->getErrorResponse(404, 'Blog id cannot be blank'));
         return;
     }
     if (!$blog->id) {
         $this->plugin->setResponse($this->getErrorResponse(404, 'Blog not found'));
         return;
     }
     $item = EasyBlogHelper::getHelper('SimpleSchema')->mapPost($blog, '<p><br><pre><a><blockquote><strong><h2><h3><em><ul><ol><li><iframe>');
     $item->isowner = $blog->created_by == $this->plugin->get('user')->id ? true : false;
     // Tags
     $modelPT = EasyBlogHelper::getModel('PostTag');
     $item->tags = $modelPT->getBlogTags($blog->id);
     //created by vishal - for show extra images
     //$item->text = preg_replace('/"images/i', '"'.JURI::root().'images', $item->text );
     $item->text = str_replace('href="', 'href="' . JURI::root(), $item->text);
     $item->text = str_replace('src="', 'src="' . JURI::root(), $item->text);
     $this->plugin->setResponse($item);
 }
开发者ID:beingsane,项目名称:com_api-plugins,代码行数:28,代码来源:blog.php

示例4: updateOrdering

 /**
  * Method to update ordering before a comment is saved.
  **/
 public function updateOrdering()
 {
     $model = EasyBlogHelper::getModel('Comment');
     $latestComment = $model->getLatestComment($this->post_id, $this->parent_id);
     // @rule: Processing child comments
     if ($this->parent_id != 0) {
         $parentComment = EasyBlogHelper::getTable('Comment');
         $parentComment->load($this->parent_id);
         $left = $parentComment->lft + 1;
         $right = $parentComment->lft + 2;
         $nodeVal = $parentComment->lft;
         if (!empty($latestComment)) {
             $left = $latestComment->rgt + 1;
             $right = $latestComment->rgt + 2;
             $nodeVal = $latestComment->rgt;
         }
         $model->updateCommentSibling($this->post_id, $nodeVal);
         $this->lft = $left;
         $this->rgt = $right;
         return true;
     }
     // @rule: Processing new comments
     $left = 1;
     $right = 2;
     if (!empty($latestComment)) {
         $left = $latestComment->rgt + 1;
         $right = $latestComment->rgt + 2;
         $model->updateCommentSibling($this->post_id, $latestComment->rgt);
     }
     $this->lft = $left;
     $this->rgt = $right;
     return true;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:36,代码来源:comment.php

示例5: get

 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $id = $input->get('id', null, 'INT');
     $search = $input->get('search', null, 'STRING');
     $posts = array();
     if (!isset($id)) {
         $categoriesmodel = EasyBlogHelper::getModel('Categories');
         $categories = $categoriesmodel->getCategoryTree('ordering');
         $this->plugin->setResponse($categories);
         return;
     }
     $category->load($id);
     // private category shouldn't allow to access.
     $privacy = $category->checkPrivacy();
     if (!$category->id || !$privacy->allowed) {
         $this->plugin->setResponse($this->getErrorResponse(404, 'Category not found'));
         return;
     }
     $catIds = array();
     $catIds[] = $category->id;
     EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
     $sorting = $this->plugin->params->get('sorting', 'latest');
     $rows = $model->getBlogsBy('category', $catIds, $sorting, 0, EBLOG_FILTER_PUBLISHED, $search);
     foreach ($rows as $k => $v) {
         $item = EasyBlogHelper::getHelper('SimpleSchema')->mapPost($v, '', 100, array('text'));
         $item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false;
         $posts[] = $item;
     }
     $this->plugin->setResponse($posts);
 }
开发者ID:beingsane,项目名称:com_api-plugins,代码行数:33,代码来源:category.php

示例6: likesComment

 function likesComment($contentId, $status, $likesId)
 {
     $my = JFactory::getUser();
     $ejax = new Ejax();
     if ($my->id <= 0) {
         $ejax->alert(JText::_('COM_EASYBLOG_NOT_ALLOWED'), '', '450');
         $ejax->send();
         return;
     }
     $jsLink = '';
     if ($status) {
         // add likes
         $id = EasyBlogHelper::addLikes($contentId, 'comment', $my->id);
         $jsLink = "<a href=\"javascript:eblog.comment.likes('" . $contentId . "', '0', '" . $id . "');\" class=\"likes\">" . JText::_('COM_EASYBLOG_UNLIKE') . "</a>";
     } else {
         // remove likes
         EasyBlogHelper::removeLikes($likesId);
         $jsLink = '<b>&middot;</b>  ' . "<a href=\"javascript:eblog.comment.likes('" . $contentId . "', '1', '0');\" class=\"likes\">" . JText::_('COM_EASYBLOG_LIKES') . "</a>";
     }
     //now reformat the likes authors
     $authors = EasyBlogHelper::getLikesAuthors($contentId, 'comment', $my->id);
     $ejax->assign('likes-' . $contentId, $jsLink);
     $ejax->assign('likes-container-' . $contentId, '<b>&middot;</b>  ' . $authors);
     if (empty($authors)) {
         $ejax->script("\$('#likes-container-" . $contentId . "').hide();");
     } else {
         $ejax->script("\$('#likes-container-" . $contentId . "').show();");
     }
     $totalLikes = EasyBlogHelper::getModel('comment')->getCommentTotalLikes($contentId);
     $ejax->script("\$('#comment-likescounter-" . $contentId . "').html('Likes: " . $totalLikes . "');");
     $ejax->script("eblog.loader.doneLoading();");
     $ejax->send();
     return;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:34,代码来源:view.ejax.php

示例7: get

 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     //$id = $input->get('id', null, 'INT');
     $id = 0;
     $search = $input->get('search', '', 'STRING');
     $featured = $input->get('featured', 0, 'INT');
     $tags = $input->get('tags', 0, 'INT');
     $user_id = $input->get('user_id', 0, 'INT');
     $posts = array();
     // If we have an id try to fetch the user
     $blog = EasyBlogHelper::table('Blog');
     $blog->load($id);
     $modelPT = EasyBlogHelper::getModel('PostTag');
     if ($tags) {
         $rows = $model->getTaggedBlogs($tags);
     } else {
         if ($featured) {
             $rows = $this->getfeature_Blog();
             $sorting = $this->plugin->params->get('sorting', 'featured');
         } else {
             if ($user_id) {
                 $blogs = EasyBlogHelper::getModel('Blog');
                 $rows = $blogs->getBlogsBy('blogger', $user_id, 'latest');
             } else {
                 //to get latest blog
                 //$sorting	= $this->plugin->params->get( 'sorting' , 'latest' );
                 //$rows 	= $model->getBlogsBy( $sorting , '' , $sorting , 0, EBLOG_FILTER_PUBLISHED, $search );
                 $rows = $model->getBlogsBy('', '', 'latest', 0, EBLOG_FILTER_PUBLISHED, null, true, array(), false, false, true, '', '', null, 'listlength', false);
                 //$rows = EB::formatter('list', $rows, false);
             }
         }
     }
     $rows = EB::formatter('list', $rows, false);
     //data mapping
     foreach ($rows as $k => $v) {
         //$item = EB::helper( 'simpleschema' )->mapPost($v,'', 100, array('text'));
         $scm_obj = new EasyBlogSimpleSchema_plg();
         $item = $scm_obj->mapPost($v, '', 100, array('text'));
         $item->tags = $modelPT->getBlogTags($item->postid);
         $item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false;
         if ($v->blogpassword != '') {
             $item->ispassword = true;
         } else {
             $item->ispassword = false;
         }
         $item->blogpassword = $v->blogpassword;
         $model = EasyBlogHelper::getModel('Ratings');
         $ratingValue = $model->getRatingValues($item->postid, 'entry');
         $item->rate = $ratingValue;
         $item->isVoted = $model->hasVoted($item->postid, 'entry', $this->plugin->get('user')->id);
         if ($item->rate->ratings == 0) {
             $item->rate->ratings = -2;
         }
         $posts[] = $item;
     }
     $this->plugin->setResponse($posts);
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:59,代码来源:latest.php

示例8: getFilterCategory

 function getFilterCategory($filter_type = '*')
 {
     $filter[] = JHTML::_('select.option', '', '- ' . JText::_('Select Category') . ' -');
     $model = EasyBlogHelper::getModel('Categories', true);
     $categories = $model->getAllCategories();
     foreach ($categories as $cat) {
         $filter[] = JHTML::_('select.option', $cat->id, $cat->title);
     }
     return JHTML::_('select.genericlist', $filter, 'filter_category', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_type);
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:10,代码来源:view.html.php

示例9: mapPost

 public function mapPost($row, $strip_tags = '', $text_length = 0, $skip = array())
 {
     $config = EasyBlogHelper::getConfig();
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($row->id);
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($row->created_by);
     $created = EasyBlogDateHelper::dateWithOffSet($row->created);
     $formatDate = true;
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         $langCode = EasyBlogStringHelper::getLangCode();
         if ($langCode != 'en-GB' || $langCode != 'en-US') {
             $formatDate = false;
         }
     }
     $blog->created = $created->toMySQL();
     $blog->text = $row->intro . $row->content;
     $config->set('max_video_width', 320);
     $config->set('max_video_width', 180);
     $blog->text = EasyBlogHelper::getHelper('Videos')->processVideos($blog->text);
     $blog->text = EasyBlogGoogleAdsense::stripAdsenseCode($blog->text);
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($row->category_id);
     $item = new PostSimpleSchema();
     $item->textplain = $blog->text;
     // @TODO : Take care of a case when strip tags and length are used together
     if ($strip_tags) {
         $item->textplain = strip_tags($blog->text, $strip_tags);
     }
     if ($text_length > 0) {
         $pos = JString::strpos(strip_tags($item->textplain), ' ', $text_length);
         $item->textplain = JString::substr(strip_tags($blog->text), 0, $pos);
     }
     $image_data = json_decode($blog->image);
     $item->postid = $blog->id;
     $item->title = $blog->title;
     $item->text = $blog->text;
     $item->textplain = $this->sanitize($item->textplain);
     $item->image = $blog->getImage();
     $item->image->url = $image_data->url;
     $item->created_date = $blog->created;
     $item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime($blog->created);
     $item->author->name = $profile->nickname;
     $item->author->photo = JURI::root() . $profile->avatar;
     $item->category->categoryid = $category->id;
     $item->category->title = $category->title;
     $item->url = JURI::root() . trim(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id), '/');
     // Tags
     $modelPT = EasyBlogHelper::getModel('PostTag');
     $item->tags = $modelPT->getBlogTags($blog->id);
     foreach ($skip as $v) {
         unset($item->{$v});
     }
     return $item;
 }
开发者ID:beingsane,项目名称:com_api-plugins,代码行数:55,代码来源:simpleschema.php

示例10: getItems

 public function getItems()
 {
     $catid = $this->get('ezb_catfilter') ? $this->get('ezb_catid', NULL) : '';
     $ordering = $this->get('ezb_ordering', 'latest');
     $user = JFactory::getUser();
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($catid);
     if ($category->private && $user->id == 0) {
         echo JText::_('This category is set to private');
         return;
     }
     if (!class_exists('EasyBlogModelBlog')) {
         jimport('joomla.application.component.model');
         JLoader::import('blog', EBLOG_ROOT . '/' . 'models');
     }
     $model = EasyBlogHelper::getModel('Blog');
     if ($this->get('ezfeatured')) {
         $items = $model->getFeaturedBlog($catid, $this->get('count'));
     } else {
         $items = $model->getBlogsBy('category', $catid, $ordering, $this->get('count'), EBLOG_FILTER_PUBLISHED, null, false);
     }
     $config = EasyBlogHelper::getConfig();
     if (!empty($items)) {
         for ($i = 0; $i < count($items); $i++) {
             $row =& $items[$i];
             $author = EasyBlogHelper::getTable('Profile', 'Table');
             $row->author = $author->load($row->created_by);
             $row->commentCount = EasyBlogHelper::getCommentCount($row->id);
             $requireVerification = false;
             if ($config->get('main_password_protect', true) && !empty($row->blogpassword)) {
                 $row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $row->title);
                 $requireVerification = true;
             }
             if ($requireVerification && !EasyBlogHelper::verifyBlogPassword($row->blogpassword, $row->id)) {
                 $theme = new CodeThemes();
                 $theme->set('id', $row->id);
                 $theme->set('return', base64_encode(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id)));
                 $row->introtext = $theme->fetch('blog.protected.php');
                 $row->content = $row->introtext;
                 $row->showRating = false;
                 $row->protect = true;
             } else {
                 $row->introtext = EasyBlogHelper::getHelper('Videos')->strip($row->content);
                 $row->showRating = true;
                 $row->protect = false;
             }
         }
         //end foreach
     }
     //XEFUtility::debug($items);
     $items = $this->prepareItems($items);
     return $items;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:53,代码来源:easyblog.php

示例11: get

 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     //$id = $input->get('id', null, 'INT');
     $search = $input->get('search', null, 'STRING');
     $featured = $input->get('featured', 0, 'INT');
     $tags = $input->get('tags', 0, 'INT');
     $user_id = $input->get('user_id', 0, 'INT');
     $posts = array();
     // If we have an id try to fetch the user
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($id);
     $modelPT = EasyBlogHelper::getModel('PostTag');
     //~ if ($id && !$tags) {
     //~ if(!$blog->id)
     //~ {
     //~ $this->plugin->setResponse( $this->getErrorResponse(404, 'Blog not found') );
     //~ return;
     //~ }
     //~ $this->plugin->setResponse( $blog );
     //~ }
     if ($tags) {
         $rows = $model->getTaggedBlogs($tags);
     } else {
         if ($featured) {
             $rows = $this->getfeature_Blog();
             $sorting = $this->plugin->params->get('sorting', 'featured');
         } else {
             if ($user_id) {
                 $blogs = EasyBlogHelper::getModel('Blog');
                 $rows = $blogs->getBlogsBy('blogger', $user_id, 'latest');
             } else {
                 //to get latest blog
                 $sorting = $this->plugin->params->get('sorting', 'latest');
                 $rows = $model->getBlogsBy($sorting, '', $sorting, 0, EBLOG_FILTER_PUBLISHED, $search);
             }
         }
     }
     //data mapping
     foreach ($rows as $k => $v) {
         $item = EasyBlogHelper::getHelper('SimpleSchema')->mapPost($v, '', 100, array('text'));
         $item->tags = $modelPT->getBlogTags($item->postid);
         $item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false;
         $posts[] = $item;
     }
     $this->plugin->setResponse($posts);
 }
开发者ID:beingsane,项目名称:com_api-plugins,代码行数:48,代码来源:latest.php

示例12: vote

 public function vote($value, $uid, $type, $elementId)
 {
     $ajax = new Ejax();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     $blog->load($uid);
     if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
         if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
             echo 'Invalid Access.';
             exit;
         }
     }
     $rating = EasyBlogHelper::getTable('Ratings', 'Table');
     // Do not allow guest to vote, or if the voter already voted.
     if ($rating->fill($my->id, $uid, $type, JFactory::getSession()->getId()) || $my->id < 1 && !$config->get('main_ratings_guests')) {
         // We wouldn't allow user to vote more than once so don't do anything here
         $ajax->send();
     }
     $rating->set('created_by', $my->id);
     $rating->set('type', $type);
     $rating->set('uid', $uid);
     $rating->set('ip', @$_SERVER['REMOTE_ADDR']);
     $rating->set('value', (int) $value);
     $rating->set('sessionid', JFactory::getSession()->getId());
     $rating->set('created', EasyBlogHelper::getDate()->toMySQL());
     $rating->set('published', 1);
     $rating->store();
     $model = EasyBlogHelper::getModel('Ratings');
     $ratingValue = $model->getRatingValues($uid, $type);
     $total = $ratingValue->total;
     $rating = $ratingValue->ratings;
     // Assign badge for users that report blog post.
     // Only give points if the viewer is viewing another person's blog post.
     EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG'));
     $ajax->script('eblog.loader.doneLoading("' . $elementId . '-command .ratings-text")');
     $ajax->script('eblog.ratings.update("' . $elementId . '", "' . $type . '" , "' . $rating . '" , "' . JText::_('COM_EASYBLOG_RATINGS_RATED_THANK_YOU') . '");');
     $ajax->assign($elementId . ' .ratings-value', '<i></i>' . $total . '<b>&radic;</b>');
     if (EasyBlogHelper::isAUPEnabled()) {
         $id = AlphaUserPointsHelper::getAnyUserReferreID($my->id);
         AlphaUserPointsHelper::newpoints('plgaup_easyblog_rate_blog', $id, '', JText::sprintf('COM_EASYBLOG_AUP_BLOG_RATED'), '');
     }
     $ajax->send();
 }
开发者ID:Tommar,项目名称:vino2,代码行数:44,代码来源:view.ejax.php

示例13: changeCategory

    public function changeCategory()
    {
        $ajax = new Ejax();
        $options = new stdClass();
        $options->title = JText::_('COM_EASYBLOG_MOVE');
        $filter[] = JHTML::_('select.option', '', '- ' . JText::_('COM_EASYBLOG_SELECT_CATEGORY') . ' -');
        $model = EasyBlogHelper::getModel('Categories', true);
        $categories = $model->getAllCategories();
        foreach ($categories as $cat) {
            $filter[] = JHTML::_('select.option', $cat->id, $cat->title);
        }
        $action = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? 'Joomla.submitbutton(\'moveCategory\');' : 'submitbutton(\'moveCategory\')';
        ob_start();
        ?>
		<p><?php 
        echo JText::_('COM_EASYBLOG_CHANGE_CATEGORY_DIALOG_INFO');
        ?>
</p>
		<div style="margin-top:10px;">
			<?php 
        echo JHTML::_('select.genericlist', $filter, 'move_category', 'class="inputbox" size="1"', 'value', 'text', '');
        ?>
		</div>
		<div class="dialog-actions">
			<input type="button" onclick="ejax.closedlg();" name="edialog-cancel" id="edialog-cancel" class="button" value="<?php 
        echo JText::_('COM_EASYBLOG_CANCEL_BUTTON');
        ?>
">
			<input type="button" onclick="<?php 
        echo $action;
        ?>
" class="button" value="<?php 
        echo JText::_('COM_EASYBLOG_MOVE_POSTS_BUTTON');
        ?>
">
		</div>
		<?php 
        $options->content = ob_get_contents();
        ob_end_clean();
        $ajax->dialog($options);
        $ajax->send();
    }
开发者ID:alexinteam,项目名称:joomla3,代码行数:42,代码来源:view.ejax.php

示例14: onUserAfterSave

 /**
  * Joomla 2.5 trigger.
  *
  * @since	3.7
  * @access	public
  */
 public function onUserAfterSave($data, $isNew, $result, $error)
 {
     //j.16
     $this->onAfterStoreUser($data);
     $userId = JArrayHelper::getValue($data, 'id', 0, 'int');
     // Process user subscription
     if ($userId && $result && isset($data['easyblog']) && count($data['easyblog'])) {
         if (!empty($data['easyblog']['subscribe']) && $data['easyblog']['subscribe'] == '1') {
             $model = EasyBlogHelper::getModel('Subscription');
             $exists = $model->isSiteSubscribedUser($userId, $data['email']);
             if ($exists) {
                 // user found update the email address
                 $model->updateSiteSubscriptionEmail($exists, $userId, $data['email']);
                 return true;
             }
             $model->addSiteSubscription($data['email'], $userId, $data['name']);
             return true;
         }
     }
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:26,代码来源:easyblogusers.php

示例15: display

 function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.acl', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     //initialise variables
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $model = EasyBlogHelper::getModel('Acl', true);
     $config = EasyBlogHelper::getConfig();
     $type = $mainframe->getUserStateFromRequest('com_easyblog.acls.filter_type', 'filter_type', 'group', 'word');
     //filtering
     $filter = new stdClass();
     $filter->type = $this->getFilterType($type);
     $filter->search = $mainframe->getUserStateFromRequest('com_easyblog.acls.search', 'search', '', 'string');
     //sorting
     $sort = new stdClass();
     $sort->order = $mainframe->getUserStateFromRequest('com_easyblog.acls.filter_order', 'filter_order', 'a.`id`', 'cmd');
     $sort->orderDirection = $mainframe->getUserStateFromRequest('com_easyblog.acls.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $rulesets = $model->getRuleSets($type);
     $pagination = $model->getPagination($type);
     if ($type == 'assigned') {
         $document->setTitle(JText::_("COM_EASYBLOG_ACL_ASSIGN_USER"));
         JToolBarHelper::title(JText::_('COM_EASYBLOG_ACL_ASSIGN_USER'), 'acl');
     } else {
         $document->setTitle(JText::_("COM_EASYBLOG_ACL_JOOMLA_USER_GROUP"));
         JToolBarHelper::title(JText::_('COM_EASYBLOG_ACL_JOOMLA_USER_GROUP'), 'acl');
     }
     $this->assignRef('config', $config);
     $this->assignRef('rulesets', $rulesets);
     $this->assignRef('filter', $filter);
     $this->assignRef('sort', $sort);
     $this->assignRef('type', $type);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:41,代码来源:view.html.php


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