示例#1
0
 function display($tpl = null)
 {
     /**
     * Response values
     * ======================
     * 
     // profile: {
     // 	 name: string,
     // 	 id: int
     // },
     // groups: {
     // 	 group: {
     // 		name: string,
     // 		description: string,
     // 	 },
     // 	 params: json
     // 	 followers: {
     // 	 	follower: {
     // 	 		name: string,
     // 	 		email: string
     // 	 	}
     // 	 },
     // 	 members: {
     // 	 	member: {
     // 	 		name: string,
     // 	 		email: string
     // 	 	}
     // 	 },
     // 	 archived: boolean
     // 	 category: string
     // }		
     // 			
     */
     header('Content-Type: application/json');
     $my = JXFactory::getUser();
     $groupsModel = StreamFactory::getModel('groups');
     $filter = array();
     if (JRequest::getVar('filter', 'all') == 'joined') {
         $groupIJoin = $my->getParam('groups_member');
         $filter['id'] = $groupIJoin;
     }
     if (JRequest::getVar('filter', 'all') == 'followed') {
         $groupIJoin = $my->getParam('groups_follow');
         $filter['id'] = $groupIJoin;
     }
     if (JRequest::getVar('filter', 'all') == 'archived') {
         $filter['archived'] = 1;
     }
     if (JRequest::getVar('filter', 'all') == 'category') {
         $filter['category_id'] = JRequest::getVar('category_id', NULL);
     }
     if (JRequest::getVar('category_id')) {
         $filter['category_id'] = JRequest::getVar('category_id', NULL);
     }
     $groups = $groupsModel->getGroups($filter, NULL, JRequest::getVar('limitstart', 0));
     $total = $groupsModel->getTotal($filter);
     $output['profile']['username'] = $my->username;
     $output['profile']['id'] = $my->id;
     $Category = new StreamCategory();
     foreach ($groups as $group) {
         // dont load private group
         if ($group->access == 1) {
             continue;
         }
         $followersCsv = json_encode($group->followers);
         $followers_id = explode(',', $followersCsv);
         foreach ($followers_id as $follower_id) {
             $usr = JXFactory::getUser(intval($follower_id));
             $followers['follower']['username'] = $usr->username;
             $followers['follower']['name'] = $usr->name;
             $followers['follower']['email'] = $usr->email;
         }
         $membersCsv = json_encode($group->members);
         $members_id = explode(',', $membersCsv);
         foreach ($members_id as $member_id) {
             $usr = JXFactory::getUser(intval($member_id));
             $members['member']['username'] = $usr->username;
             $members['member']['name'] = $usr->name;
             $members['member']['email'] = $usr->email;
         }
         $category = $Category->getCategoryName($group->category_id);
         $output['groups']['group'][] = array('name' => $group->name, 'description' => $group->description, 'creator' => $group->creator, 'followers' => $followers, 'members' => $members, 'archived' => $group->archived, 'category' => $category);
         echo json_encode($output);
     }
     exit;
 }
示例#2
0
 public function categories()
 {
     JRequest::setVar('view', 'categories');
     $table = JTable::getInstance('Category', 'StreamTable');
     $c = new StreamCategory();
     $category = JRequest::getVar('category');
     $mainframe = JFactory::getApplication();
     // if this is remove action
     if (JRequest::getVar('action') == 'remove') {
         if ($table->remove($category)) {
             $mainframe->redirect(JRoute::_('index.php?option=com_account&task=categories&view=account'), JText::sprintf('COM_ACCOUNT_LABEL_SUCCESS_REMOVE_CATEGORY', $table->getCategoryNameById($category)));
         } else {
             $mainframe->redirect(JRoute::_('index.php?option=com_account&task=categories&view=account'), JText::sprintf('COM_ACCOUNT_LABEL_ERROR_REMOVE_CATEGORY', $table->getCategoryNameById($category)), 'error');
         }
     }
     if ($_POST) {
         $type = JRequest::getVar('type', null);
         if (JRequest::getVar('blog_category')) {
             $category = JRequest::getVar('blog_category');
         } else {
             if (JRequest::getVar('event_category')) {
                 $category = JRequest::getVar('event_category');
             } else {
                 if (JRequest::getVar('group_category')) {
                     $category = JRequest::getVar('group_category');
                 } else {
                     $mainframe->redirect(JRoute::_('index.php?option=com_account&task=categories&view=account'), JText::_('COM_ACCOUNT_LABEL_ERROR_CREATE'), 'error');
                     return false;
                 }
             }
         }
         if ($table->create($category, $type)) {
             $mainframe->redirect(JRoute::_('index.php?option=com_account&task=categories&view=account'), JText::_('COM_ACCOUNT_LABEL_SUCCESS_CREATE'));
         } else {
             if ($c->isExist($category, $type)) {
                 $mainframe->redirect(JRoute::_('index.php?option=com_account&task=categories&view=account'), JText::_('COM_ACCOUNT_LABEL_ALREADY_EXIST'), 'error');
             } else {
                 $mainframe->redirect(JRoute::_('index.php?option=com_account&task=categories&view=account'), JText::_('COM_ACCOUNT_LABEL_ERROR_CREATE'), 'error');
             }
         }
     }
     parent::display();
 }
示例#3
0
    echo JText::_('COM_STREAM_DEFAULT_LABEL_LONG_PAGE_HERE');
    ?>
"></textarea>
		
		<div class="stream-post-details-milestone">
			<label><?php 
    echo JText::_('COM_STREAM_DEFAULT_LABEL_CATEGORY_PROMPT');
    ?>
</label>
			<select name="blog_category">
				<option><?php 
    echo JText::_('COM_STREAM_DEFAULT_LABEL_PAGE_DEFAULT_CATEGORY');
    ?>
</option>
				<?php 
    $table = new StreamCategory();
    $blogs = $table->getBlogs();
    foreach ($blogs as $blog) {
        // add category that has been added
        ?>
				<option value="<?php 
        echo $blog->id;
        ?>
"><?php 
        echo $blog->category;
        ?>
</option>
				<?php 
    }
    ?>
			</select>
示例#4
0
 * @version     1.0.0
 * @package     com_account
 * @copyright   Copyright (C) 2011 - 2013 Slashes & Dots Sdn Bhd. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      Offiria Team
 */
// no direct access
defined('_JEXEC') or die;
?>
<div class="account-navbar">
	<?php 
echo $this->showNavBar();
?>
</div><!--profile-navbar-->
	<?php 
$Category = new StreamCategory();
$blogs = $Category->getBlogs();
$events = $Category->getEvents();
$groups = $Category->getGroups();
$listings = array('blog' => $blogs, 'event' => $events, 'group' => $groups);
foreach ($listings as $type => $lists) {
    ?>
		
	<div id="category-container">
		<h3 class="section-title"><?php 
    echo JText::_('COM_ACCOUNT_LABEL_' . strtoupper($type) . '_CATEGORIES');
    ?>
</h3>
		<table class="table table-bordered table-striped table-novborder">
			<tr>
				<td class="table-header"><?php 
示例#5
0
<?php

$my = JXFactory::getUser();
$category = new StreamCategory();
$depts = $category->getByCategory('department');
$positions = $category->getByCategory('position');
?>
<div class="alert alert-info">
	<?php 
if ($this->user->id == $my->id) {
    ?>
	<?php 
    echo JText::_('COM_PROFILE_DESCRIPTION_YOU_SHARE');
    ?>
	<?php 
} else {
    ?>
	<?php 
    echo $this->user->name;
    ?>
 <?php 
    echo JText::_('COM_PROFILE_DESCRIPTION_OTHER_SHARE');
    ?>
	<?php 
}
?>
  </div>
<?php 
$fieldSets = $this->form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) {
    ?>
示例#6
0
<?php

// get groups be available for selection
$Category = new StreamCategory();
// variable cannot be named to groups, will contaminate current $this->group
$categories = $Category->getGroups();
if ($group->id) {
    $title = JText::sprintf('COM_STREAM_LABEL_EDIT_GROUP');
} else {
    $title = JText::sprintf('COM_STREAM_LABEL_ADD_NEW_GROUP');
    $group->access = 0;
}
?>

<div class="modal group-modal" id="group-create-message-modal" style="display: none;">
	<div class="modal-header">
		<a class="close" data-dismiss="modal">×</a>
		<h3><?php 
echo $title;
?>
</h3>
	</div>
	<div class="modal-body">
		<form name="groups-edit">
			<div class="control-group">
				<label class="control-label" for="title"><?php 
echo JText::_('COM_STREAM_LABEL_GROUP_NAME');
?>
:</label>
				
				<div class="controls">
示例#7
0
		</div>
		
		<textarea id="message-box-page" name="message" class="stream-post message-page-editor" style="width:660px;resize:vertical;" cols="80" placeholder="<?php 
echo JText::_('COM_STREAM_DEFAULT_LABEL_LONG_PAGE_HERE');
?>
">
			<?php 
echo $stream->message;
?>
		</textarea>
		<input type="hidden" name="type" value="page">
		<input type="hidden" name="action" value="save" />				
	</div>
	
<?php 
$table = new StreamCategory();
$categories = $table->getBlogs();
?>
	
	<div class="stream-post-details-select">

		<label><?php 
echo JText::_('COM_STREAM_DEFAULT_LABEL_PAGE_EDIT_CATEGORY_PROMPT');
?>
</label>
		<select name="category_id">
			<option><?php 
echo JText::_('COM_STREAM_DEFAULT_LABEL_PAGE_DEFAULT_CATEGORY');
?>
</option>
			<?php 
示例#8
0
defined('_JEXEC') or die;
jimport('joomla.html.pagination');
?>

<h1 class="hidden-phone"><?php 
echo JText::_('COM_PEOPLE_LABEL_YOUR_MEMBERS');
?>
</h1>


<?php 
$namefilter = JRequest::getVar('namefilter', 'all');
$departmentId = JRequest::getVar('department_id');
$positionId = JRequest::getVar('position_id');
$get = JRequest::get('GET');
$Category = new StreamCategory();
$departments = $Category->getByCategory('department');
$positions = $Category->getByCategory('position');
// Need to get rid of 'limitstart' since we should reset the limit when
// switching to a different view
if (isset($get['limitstart'])) {
    unset($get['limitstart']);
}
if (isset($get['start'])) {
    unset($get['start']);
}
?>

<ul class="nav nav-pills filter">
	<?php 
if (!empty($positions)) {
示例#9
0
<?php

$byfilter = array('everyone' => JText::_('COM_STREAM_FILTER_LABEL_EVERYONE'), 'mine' => JText::_('COM_STREAM_LABEL_DROPDOWN_MINE'), 'mygroups' => JText::_('COM_STREAM_LABEL_DROPDOWN_MY_GROUPS'));
$filter = JRequest::getVar('filter', 'all');
$by = JRequest::getVar('by', 'everyone');
$bylabel = $byfilter[$by];
$get = JRequest::get('GET');
$Category = new StreamCategory();
$categories = $Category->getGroups();
?>
<ul class="nav nav-pills filter">
	<!-- <input type="text" class="input-medium search-query" style="float: left; width: 82px; margin: 4px 10px 4px 0px;"> -->
	
	<li <?php 
if ($filter == 'all') {
    echo 'class="active"';
}
?>
><a href="<?php 
echo JRoute::_('index.php?' . http_build_query(array_merge($get, array('filter' => 'all'))));
?>
"><?php 
echo JText::_('COM_STREAM_FILTER_LABEL_ALL_GROUPS');
?>
</a></li>
	<li <?php 
if ($filter == 'joined') {
    echo 'class="active"';
}
?>
><a href="<?php 
示例#10
0
	    </div>
		<div class="clear"></div>
	</div>   
	
	<div class="stream-post-details-milestone" style="display: none;">
	<label><?php 
echo JText::_('COM_STREAM_DEFAULT_LABEL_CATEGORY_PROMPT');
?>
</label>
	<select name="event_category">
		<option><?php 
echo JText::_('COM_STREAM_DEFAULT_LABEL_PAGE_DEFAULT_CATEGORY');
?>
</option>
		<?php 
$table = new StreamCategory();
$events = $table->getEvents();
foreach ($events as $event) {
    // add category that has been added
    ?>
		<option value="<?php 
    echo $event->id;
    ?>
"><?php 
    echo $event->category;
    ?>
</option>
		<?php 
}
?>
	</select>
示例#11
0
	</a>
</div>

<!--<div class="blue-button">
	<form name="group-actions">
		<a class="btn btn-info" onclick="S.groups.create(this);return false;" href="#createGroup"><?php 
/*echo JText::_('COM_STREAM_LABEL_CREATE_A_GROUP');*/
?>
</a>
	</form>
</div>-->

<?php 
$i = 1;
$my = JXFactory::getUser();
$Category = new StreamCategory();
foreach ($groups as $group) {
    $user = JXFactory::getUser($group->creator);
    $members = explode(',', $group->get('members'));
    $followers = explode(',', $group->get('followers'));
    $categoryName = $Category->getCategoryName($group->category_id);
    // set default group name
    $categoryName = $categoryName ? $categoryName : JText::_('COM_STREAM_LABEL_GROUP_DEFAULT_NAME');
    $isFilteredByCategory = JRequest::getVar('filter') == 'category';
    ?>

<div class="group-list">
	
	<div class="config-list-option">
		<span class="toggle"><?php 
    echo JText::_('COM_STREAM_LABEL_TOGGLE');
示例#12
0
?>
#newBlog">
		<i class="icon-plus icon-white"></i>New Blog
	</a>
</div>
<ul class="nav nav-pills filter">
	<!-- <input type="text" class="input-medium search-query" style="float: left; width: 82px; margin: 4px 10px 4px 0px;"> -->
	 <li <?php 
echo $category_id ? '' : ' class="active"';
?>
><a href="#all"><?php 
echo JText::_('COM_STREAM_BLOG_LABEL_ALL_CATEGORY');
?>
</a></li>
	<?php 
$cCategory = new StreamCategory();
// get blog entries rom database
$blogLists = $cCategory->getBlogs();
if ($blogLists) {
    $categories = array();
    // we want to sort which category contains the most entries
    foreach ($blogLists as $key => $blogs) {
        $categories[$key]['category'] = $blogs->category;
        $categories[$key]['id'] = $blogs->id;
        $categories[$key]['count'] = $cCategory->countMessageByCategoryId($blogs->id);
    }
    function sortByMessageCount(&$arr, $col)
    {
        $sortCol = array();
        foreach ($arr as $key => $row) {
            $sortCol[$key] = $row[$col];