<?php

// This file provides lists of activities available from the diy
$page_title = 'Activity Listing';
echo '<p><em>This page will be used during the workshop to make it easier for everyone to share each other\'s activities.  After the workshop, this page
will be incorporated into the standard activity selection panel so that you can use them with your students.</em></p>';
/*
	$query_conditions[] = 'public = ?';
	$query_params[] = 1;
*/
$query = 'SELECT member_username FROM portal_members WHERE member_school = ?';
$params = array($_SESSION['portal']['member_school']);
$results = mystery_select_query($query, $params, 'portal_dbh');
$school_members = mystery_convert_results_to_simple_array($results, 'member_username');
//mystery_print_r($school_members);
$conditions = array();
$params = array();
switch ($_PORTAL['activity']) {
    case 'my':
        // only my activities
        $conditions[] = 'login = ?';
        $params[] = $_SESSION['portal']['member_username'];
        break;
    case 'school':
        // other's in my school activities but not mine
        $conditions[] = 'login <> ?';
        $params[] = $_SESSION['portal']['member_username'];
        $conditions[] = 'login IN ("' . implode('","', $school_members) . '")';
        break;
    case 'world':
        $conditions[] = 'login NOT IN ("' . implode('","', $school_members) . '")';
function portal_get_diy_ids_to_exclude()
{
    global $_PORTAL;
    $query = 'SELECT diy_identifier FROM portal_activities AS pa LEFT JOIN portal_units AS pu ON pa.activity_unit=pu.unit_id WHERE pu.unit_project = ?';
    $params = array($_PORTAL['project_info']['project_id']);
    $results = mystery_select_query($query, $params, 'portal_dbh');
    $ids = mystery_convert_results_to_simple_array($results, 'diy_identifier');
    return $ids;
}