/** * Construct new GroupToken instance * @param $auth initialized FoodleAuth-instance * @param $foodle Initialized Foodle-instance, to work with * @param $grouprel array containing the GroupRel-configuration * @return unknown_type */ function __construct($auth, $surveyId, $grouprel) { $this->_auth = $auth; $this->_surveyId = $surveyId; $this->_grouprel = $grouprel; if (!isset(self::$cache_ttl)) { self::$cache_ttl = $grouprel['cache_ttl'] ? $grouprel['cache_ttl'] : 300; // defaults to 300s (5 minutes) } $this->_userIdAttribute = $grouprel['userIdAttribute']; // Instantiate our fetcher: if (!isset(self::$fetcher)) { $options = $grouprel['impl']; self::$fetcher = IGroupRelations::create($options); } }
$errormessage = "<strong><font color='red'>" . $clang->gT("Error") . ":</font> " . $clang->gT("Can't connect to the LDAP directory") . "</strong>\n"; formldap($errormessage); } } // OpenSocial / Conext: process selected groups if ($subaction == "uploados" && bHasSurveyPermission($surveyid, 'tokens', 'import')) { global $surveyid, $tokenoutput; require_once 'classes/GroupTokens.php'; global $grouprel_config, $as, $user_id; if (isset($as)) { $auth = array($grouprel_config['userIdAttribute'] => $user_id); } else { // developer: $auth = array($grouprel_config['userIdAttribute'] => 'urn:collab:person:test.surfguest.nl:mdobrinic'); } $o = new GroupTokens($auth, $surveyid, $grouprel_config); $invite_output = $o->invite(); $persons = $o->_allmembers; $personcount = count($persons); if ($personcount > 0) { $language = GetBaseLanguageFromSurveyID($surveyid); foreach ($persons as $p) { $iq = "INSERT INTO " . db_table_name("tokens_{$surveyid}") . " \n" . "(firstname, lastname, email, emailstatus, language) \n" . "VALUES (%1, %2, %3, 'OK', " . db_quoteall($language) . ")"; $a = $p->getAttributes(); $iq = str_replace('%1', db_quoteall($a['firstname']), $iq); $iq = str_replace('%2', db_quoteall($a['lastname']), $iq); $iq = str_replace('%3', db_quoteall($a['email']), $iq); if (true) { $ir = $connect->Execute($iq); } else { echo "Executing: '{$iq}' <br/>\n";
* Group Form presentation broker * included by admin.php broker, handler for action=osgroup * * mdobrinic@cozmanova.com */ include_once "login_check.php"; include_once "database.php"; if (!isset($surveyid)) { $surveyid = returnglobal('sid'); } if ($subaction == 'form') { global $templatesoutput, $grouprel_config, $as, $user_id; if (isset($as)) { $auth = array($grouprel_config['userIdAttribute'] => $user_id); } else { // developer: $auth = array($grouprel_config['userIdAttribute'] => 'urn:collab:person:test.surfguest.nl:mdobrinic'); } require_once 'classes/GroupTokens.php'; $o = new GroupTokens($auth, $surveyid, $grouprel_config); $relations = GroupTokens::getFreshFromSession("relations", array("userId" => $o->getSubjectUser())); $data = array("groups" => $relations, "form" => array("action" => "{$rooturl}/admin/admin.php?action=tokens&sid={$surveyid}&subaction=uploados", "method" => "POST", "selected" => array()), "hiddenfields" => array("share" => "invite", "checksessionbypost" => $_SESSION['checksessionpost']), "showsubmit" => true, "root" => "{$rooturl}/images/GroupRel"); $filename = './classes/' . 'GroupRel/View/group_form.php'; ob_start(); include $filename; $output .= ob_get_contents(); ob_end_clean(); $templatesoutput .= $output; print $templatesoutput; exit; }