if (sotf_Utils::getParameter('change')) { $scope = sotf_Utils::getParameter('newscope'); } $newPattern = sotf_Utils::getParameter('newpattern'); if ($newPattern) { $scope = 6; } $page->redirect("editRole.php?roleid={$roleId}&objectid={$objectId}&pattern=" . urlencode($newPattern) . "&scope={$scope}"); } if ($roleId) { $role =& new sotf_NodeObject('sotf_object_roles', $roleId); $contact = new sotf_Contact($role->get('contact_id')); if ($contactId) { $smarty->assign("CONTACT_SELECTED", $contactId); } else { $smarty->assign("CONTACT_NAME", $contact->get('name')); $smarty->assign("CONTACT_SELECTED", $contact->get('id')); } if ($roleSelected) { $smarty->assign("ROLE_SELECTED", $roleSelected); } else { $smarty->assign("ROLE_SELECTED", $role->get('role_id')); } } if ($save) { if (!$roleSelected) { raiseError("No role selected!"); } // save if (is_object($role)) { $role->set('contact_id', $contactId);
$page->redirect("editor.php"); } else { $prg->update(); $page->redirect("editMeta.php?id={$prg->id}"); } } $smarty->assign('PRG_ID', $prgId); $smarty->assign('PRG_TITLE', $prg->get('title')); // delete role $delrole = sotf_Utils::getParameter('delrole'); $roleid = sotf_Utils::getParameter('roleid'); if ($delrole) { $role = new sotf_NodeObject('sotf_object_roles', $roleid); $c = new sotf_Contact($role->get('contact_id')); $role->delete(); $msg = $page->getlocalizedWithParams("deleted_contact", $c->get('name')); $page->addStatusMsg($msg, false); $page->redirect("editMeta.php?id={$prgId}#roles"); exit; } // delete right $delright = sotf_Utils::getParameter('delright'); $rid = sotf_Utils::getParameter('rid'); if ($delright) { $right = new sotf_NodeObject('sotf_rights', $rid); $right->delete(); //$msg = $page->getlocalizedWithParams("deleted_", $c->get('name')); //$page->addStatusMsg($msg, false); $page->redirect("editMeta.php?id={$prgId}#rights"); exit; }
// someone tries with e-mail address $contact = new sotf_Contact(); $contact->set('email', $contactId); $contact->find(); if ($contact->exists()) { $foundByEmail = 1; $contactId = $contact->id; } } if (!$foundByEmail) { $contact =& $repository->getObject($contactId); } if (!$contact) { raiseError("no_such_object", $contactId); } $smarty->assign('PAGETITLE', $contact->get('name')); $smarty->assign('CONTACT_ID', $contactId); $smarty->assign('CONTACT_NAME', $contact->get('name')); $smarty->assign('CONTACT_DATA', $contact->getAllWithIcon()); $numProgs = $contact->countProgrammes(); $progs = $page->getlocalizedWithParams('has_programs', $numProgs); $smarty->assign('PROGS', $progs); $smarty->assign('NUMPROGS', $numProgs); $refs = $contact->references(); while (list(, $row) = each($refs)) { $id = $row['object_id']; $role = $row['role_id']; if ($repository->getTable($id) != 'sotf_programmes') { $obj = $repository->getObject($id); if (!$obj) { logError("DB integrity error: role {$role} for {$id} which does not exist");