function assignTasks($AID, $TIDS) { $total = count($TIDS); for ($x = 0; $x < $total; $x++) { assignTask($AID, $TIDS[$x]); } }
<?php session_start(); require_once '../db.php'; if (!isset($_POST['groups']) || !isset($_POST['taskDescription']) || !isset($_POST['contig']) || !isset($_POST['endDate'])) { die('proper information not specified'); return; } // Require that someone is logged in first. if (!isset($_SESSION['userId'])) { die('Not logged in'); return; } $finalGroups = array(); foreach ($_POST['groups'] as $group) { $finalGroups[] = new MongoId(mongoGroupSanitize($group)); } assignTask(mongoIdSanitize($_SESSION['userId']), mongoUserSanitize($_SESSION['userName']), $finalGroups, mongoTextSanitize($_POST['taskDescription']), mongoIdSanitize($_POST['contig']), mongoNumberSanitize($_POST['endDate']));
*@date 17/12/2015 *description:file to assign a task *Code starndard: PSR */ /** *checking whether the variable cmd is empty */ if (!isset($_REQUEST['cmd'])) { echo '{"result": 0, "message": "unknown command"}'; return; } $cmd = $_REQUEST['cmd']; /*If cmd=1, it executes the assignTask method*/ switch ($cmd) { case '1': assignTask(); break; default: echo '{"result": 0, "message": "Unknown command"}'; return; break; } /** *function to receive information from the javascript page */ function assignTask() { include "assignTask.php"; $theTask = new AssignTask(); $id = $_GET['nId']; $name = $_GET['name'];