Exemple #1
0
    if (!$member->hasAccess($consoleObj)) {
        exit;
    }
}
include_once $prevFolder . "classes/squad.php";
$cID = $_GET['cID'];
$squadObj = new Squad($mysqli);
$dispError = "";
$countErrors = 0;
if ($_POST['submit']) {
    // Check Squad
    if (!$squadObj->select($_POST['squad'])) {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid squad!<br>";
    } else {
        $outstandingApps = $squadObj->getOutstandingApplications();
        if (in_array($memberInfo['member_id'], $outstandingApps)) {
            $countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You have already applied to this squad!  Please wait for a decision to be made before re-applying.<br>";
        }
    }
    if ($countErrors == 0) {
        $squadInfo = $squadObj->get_info_filtered();
        $squadAppObj = new Basic($mysqli, "squadapps", "squadapp_id");
        $arrColumns = array("member_id", "squad_id", "message", "applydate", "status");
        $arrValues = array($memberInfo['member_id'], $_POST['squad'], $_POST['message'], time(), 0);
        if ($squadAppObj->addNew($arrColumns, $arrValues)) {
            $arrRecruiterMembers = $squadObj->getRecruiterMembers();
            foreach ($arrRecruiterMembers as $recruiterID) {
                $member->select($recruiterID);
                $member->postNotification("A new member has applied to join the squad <b><a href='" . $MAIN_ROOT . "squads/profile.php?sID=" . $squadInfo['squad_id'] . "'>" . $squadInfo['name'] . "</a></b>.  <a href='" . $MAIN_ROOT . "members/squads/managesquad.php?sID=" . $squadInfo['squad_id'] . "&pID=AcceptApps'>Click Here</a> to review squad applications.");