コード例 #1
0
ファイル: group.php プロジェクト: bendroid/pligg-cms
function group_print_summary($requestID)
{
    global $db, $main_smarty, $the_template;
    if (!is_numeric($requestID)) {
        die;
    }
    $index = 0;
    $group = $db->get_row("SELECT group_id,group_creator, group_status, group_members, group_date, group_name, group_safename, group_description, group_privacy, group_avatar FROM " . table_groups . " WHERE group_id = {$requestID}");
    if ($group) {
        $group_id = $group->group_id;
        $group_name = $group->group_name;
        $group_safename = $group->group_safename;
        $group_description = $group->group_description;
        $group_creator = $group->group_creator;
        $group_status = $group->group_status;
        $group_members = $group->group_members;
        $group_date = $group->group_date;
        $group_privacy = $group->group_privacy;
        $group_avatar = $group->group_avatar;
        //$group_date = date('M j, Y', $group->group_date);
        $date = $db->get_var(" SELECT DATE_FORMAT(group_date, '%b, %e %Y') from " . table_groups . " WHERE group_id = {$group->group_id}");
        //echo $date;
        $group_date = $date;
        //smarty variables
        $main_smarty->assign('group_id', $group_id);
        $main_smarty->assign('group_name', $group_name);
        $main_smarty->assign('group_safename', $group_safename);
        $main_smarty->assign('group_description', $group_description);
        $main_smarty->assign('group_creator', $group_creator);
        $main_smarty->assign('group_status', $group_status);
        $main_smarty->assign('group_members', $group_members);
        $main_smarty->assign('group_privacy', $group_privacy);
        $main_smarty->assign('group_avatar', $group_avatar);
        $main_smarty->assign('group_date', $group_date);
        //get group avatar path
        if ($group_avatar == "uploaded" && file_exists(mnmpath . "avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg")) {
            $imgsrc = my_base_url . my_pligg_base . "/avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg";
        } else {
            $imgsrc = my_base_url . my_pligg_base . "/templates/" . $the_template . "/img/group_large.gif";
        }
        $main_smarty->assign('imgsrc', $imgsrc);
        //get group creator and his url
        $g_name = get_group_username($group_creator);
        $main_smarty->assign('group_submitter', $g_name);
        $submitter_profile_url = getmyurl('user', $g_name);
        $main_smarty->assign('submitter_profile_url', $submitter_profile_url);
        $main_smarty->assign('group_avatar_url', getmyurl('group_avatar', $group_id));
        //check group admin
        global $current_user;
        if ($current_user->user_id == $group_creator) {
            $main_smarty->assign('is_group_admin', 1);
        }
        //language
        $lang_Created_By = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_By");
        $lang_Created_On = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_On");
        $lang_Member = $main_smarty->get_config_vars("PLIGG_Visual_Group_Member");
        //check member
        //include_once(mnminclude.'group.php');
        $main_smarty->assign('is_group_member', isMember($group_id));
        // Joining and unjoining member links
        // Set the url to an empty string if the user has already joined the maximum
        // allowable number of groups
        if (reached_max_joinable_groups($db, $current_user)) {
            $join_url = '';
        } else {
            $join_url = getmyurl("join_group", $group_id);
        }
        $main_smarty->assign('join_group_url', $join_url);
        $main_smarty->assign('unjoin_group_url', getmyurl("unjoin_group", $group_id));
        //check logged or not
        $main_smarty->assign('user_logged_in', $current_user->user_login);
        //sidebar
        $main_smarty = do_sidebar($main_smarty);
        //$main_smarty->assign('form_action', $_SERVER["PHP_SELF"]);
        $group_story_url = getmyurl("group_story_title", $group_safename);
        $main_smarty->assign('group_story_url', $group_story_url);
        $group_edit_url = getmyurl("editgroup", $group_id);
        $group_delete_url = getmyurl("deletegroup", $group_id);
        $group_output .= $main_smarty->fetch(The_Template . '/group_summary.tpl');
        $index++;
    }
    return $group_output;
}
コード例 #2
0
ファイル: group.php プロジェクト: pantofla/waterfan
function group_print_summary($requestID)
{
    global $db, $main_smarty, $the_template;
    if (!is_numeric($requestID)) {
        die;
    }
    $index = 0;
    $group = $db->get_row("SELECT group_id,group_creator, group_status, group_members, group_date, group_name, group_safename, group_description, group_privacy, group_avatar FROM " . table_groups . " WHERE group_id = {$requestID}");
    if ($group) {
        $group_id = $group->group_id;
        $group_name = $group->group_name;
        $group_safename = $group->group_safename;
        $group_description = $group->group_description;
        $group_creator = $group->group_creator;
        $group_status = $group->group_status;
        $group_members = $group->group_members;
        $group_date = $group->group_date;
        $group_privacy = $group->group_privacy;
        $group_avatar = $group->group_avatar;
        //$group_date = date('M j, Y', $group->group_date);
        $date = $db->get_var(" SELECT DATE_FORMAT(group_date, '%b, %e %Y') from " . table_groups . " WHERE group_id = {$group->group_id}");
        //echo $date;
        $group_date = $date;
        //smarty variables
        $main_smarty->assign('group_id', $group_id);
        $main_smarty->assign('group_name', $group_name);
        $main_smarty->assign('group_safename', $group_safename);
        $main_smarty->assign('group_description', $group_description);
        $main_smarty->assign('group_creator', $group_creator);
        $main_smarty->assign('group_status', $group_status);
        $main_smarty->assign('group_privacy', $group_privacy);
        $main_smarty->assign('group_avatar', $group_avatar);
        $main_smarty->assign('group_date', $group_date);
        //get group avatar path
        if ($group_avatar == "uploaded") {
            $imgsrc = my_base_url . my_pligg_base . "/avatars/groups_uploaded/" . $group_id . "_" . group_avatar_size_width . ".jpg";
        } else {
            $imgsrc = my_base_url . my_pligg_base . "/templates/" . $the_template . "/images/group_large.gif";
        }
        $main_smarty->assign('imgsrc', $imgsrc);
        //get group creator and his url
        $g_name = get_group_username($group_creator);
        $main_smarty->assign('group_submitter', $g_name);
        //$main_smarty->assign('submitter_profile_url', getmyurl('user', $g_name));
        $submitter_profile_url = getmyurl('user', $g_name);
        $main_smarty->assign('group_avatar_url', getmyurl('group_avatar', $group_id));
        //check group admin
        global $current_user;
        if ($current_user->user_id == $group_creator) {
            $main_smarty->assign('is_group_admin', 1);
        }
        //language
        $lang_Created_By = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_By");
        $lang_Created_On = $main_smarty->get_config_vars("PLIGG_Visual_Group_Created_On");
        $lang_Member = $main_smarty->get_config_vars("PLIGG_Visual_Group_Member");
        //check member
        //include_once(mnminclude.'group.php');
        $main_smarty->assign('is_group_member', isMember($group_id));
        //joinig unjoining member link
        $main_smarty->assign('join_group_url', getmyurl("join_group", $group_id));
        $main_smarty->assign('unjoin_group_url', getmyurl("unjoin_group", $group_id));
        //check logged or not
        $main_smarty->assign('user_logged_in', $current_user->user_login);
        //sidebar
        $main_smarty = do_sidebar($main_smarty);
        //$main_smarty->assign('form_action', $_SERVER["PHP_SELF"]);
        $group_story_url = getmyurl("group_story_title", $group_safename);
        $group_edit_url = getmyurl("editgroup", $group_id);
        $group_delete_url = getmyurl("deletegroup", $group_id);
        $group_output .= '<div class ="group_container">
			<div class ="group_left">
				<span>
					<img src="' . $imgsrc . '" alt="group_avatar" />
				</span>
			</div>
			<div class ="group_right">
				<div class="toptitle"><a href="' . $group_story_url . '">' . $group_name . '</a></div>
				<span class ="ls_created_by">' . $lang_Created_By . ' </span>
				<a href="' . $submitter_profile_url . '">' . $g_name . '</a> ' . $lang_Created_On . ' ' . $group_date . '<br/>
				' . $group_description . '<br/>
				' . $lang_Member . ' : ' . $group_members . ($group_status == 'disable' ? "<br><button onclick='document.location=\"?approve={$group_id}\"'>Approve</button>" : "") . '
			</div>
		</div>';
        $index++;
    }
    return $group_output;
}