コード例 #1
0
ファイル: Helper.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Gets groups matching tag string
  *
  * @param   string  $usertags
  * @param   string  $usergroups
  * @return  string
  */
 public static function getGroupsMatchingTagString($usertags, $usergroups)
 {
     //database object
     $database = \App::get('db');
     //turn users tag string into array
     $mytags = $usertags != '' ? array_map('trim', explode(',', $usertags)) : array();
     //users groups
     $mygroups = array();
     if (is_array($usergroups)) {
         foreach ($usergroups as $ug) {
             $mygroups[] = $ug->gidNumber;
         }
     }
     //query the databse for all published, type "HUB" groups
     $sql = "SELECT g.gidNumber, g.cn, g.description, g.public_desc\n\t\t\t\tFROM `#__xgroups` AS g\n\t\t\t\tWHERE g.type=1\n\t\t\t\tAND g.published=1\n\t\t\t\tAND g.discoverability=0";
     $database->setQuery($sql);
     //get all groups
     $groups = $database->loadObjectList();
     //loop through each group and see if there is a tag match
     foreach ($groups as $k => $group) {
         //get the groups tags
         $gt = new \Components\Groups\Models\Tags($group->gidNumber);
         $group->tags = $gt->render('string');
         $group->tags = array_map('trim', explode(',', $group->tags));
         //get common tags
         $group->matches = array_intersect($mytags, $group->tags);
         //remove tags from the group object since its no longer needed
         unset($group->tags);
         //if we dont have a match remove group from return results
         //or if we are already a member of the group remove from return results
         if (count($group->matches) < 1 || in_array($group->gidNumber, $mygroups)) {
             unset($groups[$k]);
         }
     }
     return $groups;
 }
コード例 #2
0
 */
// No direct access
defined('_HZEXEC_') or die;
$gparams = new \Hubzero\Config\Registry($this->group->get('params'));
$base = rtrim(str_replace('administrator', '', Request::base()), '/');
$sef = ltrim(Route::url('index.php?option=' . $this->option . '&cn=' . $this->group->get('cn')), '/');
$message = Lang::txt('Group Updated') . "\n\n";
$message .= "--------------------------------------------\n";
$message .= Lang::txt('Group:') . ' ' . strip_tags($this->group->get('description')) . "\n";
$message .= Lang::txt('Alias:') . ' ' . $this->group->get('cn') . "\n";
$message .= Lang::txt('Updated:') . ' @ ' . Date::of('now')->toLocal(Lang::txt('TIME_FORMAT_HZ1')) . ' on ' . Date::of('now')->toLocal(Lang::txt('DATE_FORMAT_HZ1')) . "\n";
$message .= Lang::txt('Updated By:') . ' ' . $this->user->get('name') . ' (' . $this->user->get('email') . ')' . "\n";
$message .= "--------------------------------------------\n\n";
$message .= "\t" . Lang::txt('Name:') . ' ' . strip_tags($this->group->get('description')) . "\n\n";
$message .= "\t" . Lang::txt('Interests (Tags):') . ' ';
$gt = new \Components\Groups\Models\Tags($this->group->get('gidNumber'));
$tags = $gt->render('string');
$message .= ($tags ? $tags : Lang::txt('[ Empty ]')) . "\n\n";
$message .= "\t" . Lang::txt('Public Description:') . ' ' . strip_tags($this->group->get('public_desc', '[ Empty ]')) . "\n\n";
$message .= "\t" . Lang::txt('Private Description:') . ' ' . strip_tags($this->group->get('private_desc', '[ Empty ]')) . "\n\n";
$message .= "\t" . Lang::txt('Logo:') . ' ' . ($this->group->get('logo') ? $base . DS . ltrim($this->group->getLogo(), DS) : '[ Not set ]') . "\n\n";
$message .= "\t" . Lang::txt('Membership Settings/Join Policy:') . ' ';
switch ($this->group->get('join_policy')) {
    case 3:
        $policy = Lang::txt('Closed');
        break;
    case 2:
        $policy = Lang::txt('Invite Only');
        break;
    case 1:
        $policy = Lang::txt('Restricted');
コード例 #3
0
ファイル: view.php プロジェクト: kevinwojo/hubzero-cms
    ?>
			</div><!-- /#page_sidebar -->

			<div id="page_main">
				<?php 
    if ($this->tab == 'overview') {
        ?>
				<div id="page_header">
					<h3>
						<?php 
        echo \Components\Groups\Helpers\View::displayTab($this->group);
        ?>
					</h3>

					<?php 
        $gt = new \Components\Groups\Models\Tags($this->group->get('gidNumber'));
        echo $gt->render();
        ?>
				</div><!-- /#page_header -->
			<?php 
    }
    ?>

				<?php 
    if (count($this->notifications) > 0) {
        ?>
					<div id="page_notifications">
						<?php 
        foreach ($this->notifications as $notification) {
            echo "<p class=\"message {$notification['type']}\">{$notification['message']}</p>";
        }
コード例 #4
0
ファイル: _list.php プロジェクト: mined-gatech/hubzero-cms
//check to see if we have any groups to show
if (!$this->groups) {
    echo '<p class="info">' . Lang::txt('COM_GROUPS_INTRO_NO_' . str_replace(' ', '_', strtoupper($this->name)), User::get('id')) . '</p>';
} else {
    //var to hold html
    $html = '<div class="grid">';
    //var to hold count
    $count = 1;
    $totalCount = 0;
    //get current user object
    $user = \Hubzero\User::getInstance();
    //loop through each group
    foreach ($this->groups as $group) {
        //get the Hubzero Group Object
        $hg = \Hubzero\User\Group::getInstance($group->gidNumber);
        $gt = new \Components\Groups\Models\Tags();
        //var to hold group description
        $description = '';
        //get the column were on
        $cls = '';
        if ($count == $num_columns) {
            $count = 0;
            $cls = 'omega';
        }
        //how many columns are we showing
        switch ($num_columns) {
            case 2:
                $columns = 'span6';
                break;
            case 3:
                $columns = 'span4';