예제 #1
0
파일: view.ejax.php 프로젝트: Tommar/vino2
 /**
  * Remove an item as featured
  *
  * @param	string	$type	The type of this item
  * @param	int		$postId	The unique id of the item
  *
  * @return	string	Json string
  **/
 function removeFeatured($type, $postId)
 {
     $ajax = new Ejax();
     $acl = EasyBlogACLHelper::getRuleset();
     // Only super admins can feature items
     if (!EasyBlogHelper::isSiteAdmin() && !$acl->rules->feature_entry) {
         $ajax->alert(JText::_('COM_EASYBLOG_NOT_ALLOWED'), '', '450');
         $ajax->send();
         return;
     }
     EasyBlogHelper::removeFeatured($type, $postId);
     $idName = '';
     $message = '';
     switch ($type) {
         case 'blogger':
             $idName = '#blogger_title_' . $postId;
             $message = JText::_('COM_EASYBLOG_BLOGGER_UNFEATURED');
             break;
         case 'teamblog':
             $idName = '#teamblog_title_' . $postId;
             $message = JText::_('COM_EASYBLOG_TEAMBLOG_UNFEATURED');
             break;
         case 'post':
         default:
             $idName = '#title_' . $postId;
             $message = JText::_('COM_EASYBLOG_BLOG_UNFEATURED');
             break;
     }
     $ajax->script('$("' . $idName . '").removeClass("featured-item");');
     $ajax->alert($message, JText::_('COM_EASYBLOG_INFO'), '450', 'auto');
     $ajax->send();
     return;
 }