コード例 #1
0
         $stmt->execute(array($selected_order, $user->getGroup()));
     }
     // Adding the requested skillplan to our database
     $stmt = $db->prepare('INSERT INTO skillplan_main (gid,skillplan_name,skillplan_order) VALUES (?,?,?) ON DUPLICATE KEY UPDATE skillplan_order=VALUES(skillplan_order)');
     $stmt->execute(array($user->getGroup(), $_POST['skillplan_name'], $selected_order));
 } elseif ($request['action'] == 'deleteplan' and $user->getDirectorAccess()) {
     if ($_POST['skillplan_id'] == 'Do Not Delete') {
         // Skipping this, since they accidentally clicked it. Whoops, bad user
     } else {
         Skillplan::deleteSkillPlan($_POST['skillplan_id'], $user->getGroup());
     }
 } elseif ($request['action'] == 'renameplan' and $user->getDirectorAccess()) {
     if ($_POST['skillplan_id'] == 'Do Not Rename') {
         // Skipping this, since they accidentally clicked it. Whoops, bad user
     } else {
         Skillplan::renameSkillPlan($_POST['skillplan_id'], $user->getGroup(), $_POST['new_skill_plan_name']);
     }
 } elseif ($request['action'] == 'editmode' and $user->getDirectorAccess()) {
     // We are currently in edit mode, so we will check to see if there's anything that needs doing
     if (isset($_POST['new_subgroup_name'])) {
         // We are adding a new subgroup to an existing Skill Plan
         // First we need to see what order was selected
         if ($_POST['subgroup_order'] == 'last') {
             // The user wants this skillplan at the end, so we'll first get the highest skillplan_order value
             $stmt = $db->prepare('SELECT * FROM skillplan_subgroups WHERE skillplan_id = ? ORDER BY subgroup_order DESC LIMIT 1');
             $stmt->execute(array($_POST['skillplan_id']));
             $count = $stmt->fetch(PDO::FETCH_ASSOC);
             // Now we'll add +1 to the highest previous skillplan_order value to get the skillplan_order value for this skillplan
             $selected_order = $count['subgroup_order'] + 1;
         } else {
             // The user wants this skillplan inserted into the mix, so lets see where it's going to go.