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


PHP EasyBlogHelper::getDefaultCategoryId方法代码示例

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


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

示例1: write


//.........这里部分代码省略.........
                 $meta = $metaModel->getPostMeta($blogId);
             }
         }
         $onlyPublished = empty($blogId) ? true : false;
         $isFrontendWrite = true;
         $nestedCategories = '';
         $defaultCategory = JRequest::getInt('categoryId');
         $menu = JFactory::getApplication()->getMenu()->getActive();
         if ($menu && isset($menu->params)) {
             $param = EasyBlogHelper::getRegistry();
             $param->load($menu->params);
             $catId = $param->get('categoryId');
             if ($catId) {
                 $defaultCategory = $catId;
             }
         }
         // @task: If blog is being edited, it should contain a category_id property.
         $defaultCategory = empty($blog->category_id) ? $defaultCategory : $blog->category_id;
         if ($config->get('layout_dashboardcategoryselect') == 'select') {
             $nestedCategories = EasyBlogHelper::populateCategories('', '', 'select', 'category_id', $defaultCategory, true, $onlyPublished, $isFrontendWrite);
         }
         echo $this->showToolbar(__FUNCTION__, $user);
         $tpl = new CodeThemes('dashboard');
         $blogger_id = !isset($blog->created_by) ? $user->id : $blog->created_by;
         $content = $blog->intro;
         // Append the readmore if necessary
         if (!empty($blog->intro) && !empty($blog->content)) {
             $content .= '<hr id="system-readmore" />';
         }
         $content .= $blog->content;
         $defaultCategoryName = '';
         if (empty($defaultCategory)) {
             //get default category if configured.
             $defaultCategory = EasyBlogHelper::getDefaultCategoryId();
         }
         if (!empty($defaultCategory)) {
             $categoryTbl = EasyBlogHelper::getTable('Category');
             $categoryTbl->load($defaultCategory);
             $defaultCategoryName = $categoryTbl->title;
         }
         if ($draft->id != 0 && $isDraft) {
             if (!empty($draft->external_source)) {
                 $external = true;
                 $extGroupId = $draft->external_group_id;
             }
         } else {
             if (!$loadFromSession) {
                 // If writing is for an external source, we need to tell the editor to strip down some unwanted features
                 $external = JRequest::getVar('external', false);
                 //check if this is a external group contribution.
                 $extGroupId = EasyBlogHelper::getHelper('Groups')->getGroupContribution($blog->id);
                 if (!empty($extGroupId)) {
                     $external = $extGroupId;
                     $blogSource = 'group';
                 }
                 if (!empty($uid)) {
                     $external = $uid;
                     $blogSource = 'event';
                 }
                 $externalEventId = EasyBlogHelper::getHelper('Event')->getContribution($blog->id);
                 if (!empty($externalEventId)) {
                     $external = $externalEventId;
                     $blogSource = 'event';
                 }
             }
         }
开发者ID:Tommar,项目名称:vino2,代码行数:67,代码来源:view.html.php

示例2: populateCategories

 /**
  * Generates a html code for category selection.
  *
  * @access	public
  * @param	int		$parentId	if this option spcified, it will list the parent and all its childs categories.
  * @param	int		$userId		if this option specified, it only return categories created by this userId
  * @param	string	$outType	The output type. Currently supported links and drop down selection
  * @param	string	$eleName	The element name of this populated categeries provided the outType os dropdown selection.
  * @param	string	$default	The default selected value. If given, it used at dropdown selection (auto select)
  * @param	boolean	$isWrite	Determine whether the categories list used in write new page or not.
  * @param	boolean	$isPublishedOnly	If this option is true, only published categories will fetched.
  * @param	array 	$exclusion	A list of excluded categories that it should not be including
  */
 public static function populateCategories($parentId, $userId, $outType, $eleName, $default, $isWrite = false, $isPublishedOnly = false, $isFrontendWrite = false, $exclusion = array(), $attributes = '')
 {
     $catModel = EB::model('Category');
     $parentCat = null;
     if (!empty($userId)) {
         $parentCat = $catModel->getParentCategories($userId, 'blogger', $isPublishedOnly, $isFrontendWrite, $exclusion);
     } else {
         if (!empty($parentId)) {
             $parentCat = $catModel->getParentCategories($parentId, 'category', $isPublishedOnly, $isFrontendWrite, $exclusion);
         } else {
             $parentCat = $catModel->getParentCategories('', 'all', $isPublishedOnly, $isFrontendWrite, $exclusion);
         }
     }
     $ignorePrivate = false;
     switch ($outType) {
         case 'link':
             $ignorePrivate = false;
             break;
         case 'popup':
         case 'select':
         default:
             $ignorePrivate = true;
             break;
     }
     // Now let's do a loop to find it's child categories.
     if (!empty($parentCat)) {
         for ($i = 0; $i < count($parentCat); $i++) {
             $parent =& $parentCat[$i];
             //reset
             $parent->childs = null;
             EasyBlogHelper::buildNestedCategories($parent->id, $parent, $ignorePrivate, $isPublishedOnly, $isFrontendWrite, $exclusion);
         }
     }
     if ($isWrite) {
         $defaultCatId = EasyBlogHelper::getDefaultCategoryId();
         $default = empty($default) ? $defaultCatId : $default;
     }
     $formEle = '';
     if ($outType == 'select' && $isWrite) {
         $selected = !$default ? ' selected="selected"' : '';
         $formEle .= '<option value="0"' . $selected . '>' . JText::_('COM_EASYBLOG_SELECT_A_CATEGORY') . '</option>';
     }
     if ($parentCat) {
         foreach ($parentCat as $category) {
             if ($outType == 'popup') {
                 $formEle .= '<div class="category-list-item" id="' . $category->id . '"><a href="javascript:void(0);" onclick="eblog.dashboard.selectCategory(\'' . $category->id . '\')">' . $category->title . '</a>';
                 $formEle .= '<input type="hidden" id="category-list-item-' . $category->id . '" value="' . $category->title . '" />';
                 $formEle .= '</div>';
             } else {
                 $selected = $category->id == $default ? ' selected="selected"' : '';
                 $formEle .= '<option value="' . $category->id . '" ' . $selected . '>' . JText::_($category->title) . '</option>';
             }
             EasyBlogHelper::accessNestedCategories($category, $formEle, '0', $default, $outType);
         }
     }
     $html = '';
     $html .= '<select name="' . $eleName . '" id="' . $eleName . '" class="form-control" ' . $attributes . '>';
     if (!$isWrite) {
         $html .= '<option value="0">' . JText::_('COM_EASYBLOG_SELECT_PARENT_CATEGORY') . '</option>';
     }
     $html .= $formEle;
     $html .= '</select>';
     return $html;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:77,代码来源:easyblog.php

示例3: display


//.........这里部分代码省略.........
     }
     if (count($blogContributed) > 0 && $blogContributed) {
         for ($i = 0; $i < count($teamBlogJoined); $i++) {
             $joined = $teamBlogJoined[$i];
             if ($joined->team_id == $blogContributed->team_id) {
                 $joined->selected = 1;
                 continue;
             }
         }
     }
     //get all tags ever created.
     $newTagsModel = EasyBlogHelper::getModel('Tags');
     if (isset($blog->newtags)) {
         $blog->newtags = array_merge($blog->newtags, $newTagsModel->getTags());
     } else {
         $blog->newtags = $newTagsModel->getTags();
     }
     //get tags used in this blog post
     if (!$loadFromSession && !$isDraft && $blogId) {
         $tagsModel = EasyBlogHelper::getModel('PostTag');
         $blog->tags = $tagsModel->getBlogTags($blogId);
     }
     //@task: List all trackbacks
     $trackbacksModel = EasyBlogHelper::getModel('TrackbackSent');
     $trackbacks = $trackbacksModel->getSentTrackbacks($blogId);
     // get meta tags
     if (!$loadFromSession && !$isDraft) {
         $metaModel = EasyBlogHelper::getModel('Metas');
         $meta = $metaModel->getPostMeta($blogId);
     }
     //perform some title string formatting
     $blog->title = $this->escape($blog->title);
     $blogger_id = !isset($blog->created_by) ? $my->id : $blog->created_by;
     $defaultCategory = empty($blog->category_id) ? EasyBlogHelper::getDefaultCategoryId() : $blog->category_id;
     $category = EasyBlogHelper::getTable('Category');
     $category->load($defaultCategory);
     $content = $blog->intro;
     // Append the readmore if necessary
     if (!empty($blog->intro) && !empty($blog->content)) {
         $content .= '<hr id="system-readmore" />';
     }
     $content .= $blog->content;
     //check if this is a external group contribution.
     $blog_contribute_source = 'easyblog';
     $external = false;
     $extGroupId = EasyBlogHelper::getHelper('Groups')->getGroupContribution($blog->id);
     $externalEventId = EasyBlogHelper::getHelper('Event')->getContribution($blog->id);
     $extGroupName = '';
     if (!empty($extGroupId)) {
         $external = $extGroupId;
         $blog_contribute_source = EasyBlogHelper::getHelper('Groups')->getGroupSourceType();
         $extGroupName = EasyBlogHelper::getHelper('Groups')->getGroupContribution($blog->id, $blog_contribute_source, 'name');
     }
     if (!empty($externalEventId)) {
         $external = $externalEventId;
         $blog_contribute_source = EasyBlogHelper::getHelper('Event')->getSourceType();
     }
     //site wide or team contribution
     $teamblogModel = EasyBlogHelper::getModel('TeamBlogs');
     $teams = !empty($blog->created_by) ? $teamblogModel->getTeamJoined($blog->created_by) : $teamblogModel->getTeamJoined($my->id);
     $this->assignRef('teams', $teams);
     $this->assignRef('isDraft', $isDraft);
     $joomlaVersion = EasyBlogHelper::getJoomlaVersion();
     $my = JFactory::getUser();
     $blogger_id = $my->id;
     $nestedCategories = '';
开发者ID:alexinteam,项目名称:joomla3,代码行数:67,代码来源:view.html.php


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