$sql .= "t.start <= '" . $date->format('Y-m-d H:i:s') . "'"; return $db->query($sql)->rows; } function SaveState($completed, $db) { foreach ($completed["email"] as $item) { $sql = "UPDATE `task_to_user` SET email_sended = 1 " . "WHERE task_id = '" . $item["task_id"] . "' AND user_id = '" . $item["user_id"] . "'; "; $db->query($sql); } foreach ($completed["phone"] as $item) { $sql = "UPDATE `task_to_user` SET phone_sended = 1 " . "WHERE task_id = '" . $item["task_id"] . "' AND user_id = '" . $item["user_id"] . "'; "; $db->query($sql); } } //получаем список тех, кому нужно сообщить о таске $task_list = GetTaskList($db); //отправляем $completed = array("email" => array(), "phone" => array()); foreach ($task_list as $item) { //если нужно отправить email if ($item["email_notify"] == 1) { if (SendEmail($item)) { //добавить в $completed array_push($completed["email"], $item); } } if ($item["phone_notify"] == 1) { if (SendSms($task)) { //добавить в $completed array_push($completed["phone"], $item); }
$entry = isset($_GET['entry']) ? $_GET['entry'] : ''; $addgoal = isset($_GET['addgoal']) ? $_GET['addgoal'] : 0; $newentry = isset($_GET['newentry']) ? $_GET['newentry'] : ''; $GoalList = isset($_GET['GoalList']) ? $_GET['GoalList'] : ''; $Value = isset($_GET['Value']) ? $_GET['Value'] : ''; $count = isset($_GET['count']) ? $_GET['count'] : ''; $activityid = isset($_GET['activityid']) ? $_GET['activityid'] : ''; $fieldid = isset($_GET['fieldid']) ? $_GET['fieldid'] : ''; $addactivity = isset($_GET['addactivity']) ? $_GET['addactivity'] : ''; $divname = isset($_GET['divname']) ? $_GET['divname'] : ''; $GoalMessage = '0'; $Duplicate = 0; $TaskContent = ""; // Used to populate the Task List on the left side of the editor if ($type === "tasklist") { $TaskContent .= GetTaskList($id); } // Handles Deletes for Tasks, Activities, and Proximities if ($id != "" && is_numeric($id) && $activityid != "" && is_numeric($activityid) && ($type === "delete" || $type === "confirmdelete" || $type === "canceldelete")) { if ($type === "confirmdelete") { if ($divname === "proximityDeleteDiv") { $exploreid = 0; $Query = 'SELECT goalid FROM activities WHERE taskid = ' . $id . ' AND activityid = ' . $activityid; $QueryResult = mysql_query($Query) or message_die('taskbuild.php', 'MYSQL_QUERY', $Query, mysql_error()); if (mysql_num_rows($QueryResult) != 0) { $row = mysql_fetch_array($QueryResult); $exploreid = $row["goalid"]; $Query = 'DELETE FROM proximities WHERE exploreid = ' . $exploreid; $QueryResult = mysql_query($Query) or message_die('taskbuild.php', 'MYSQL_QUERY', $Query, mysql_error()); } } elseif ($activityid >= 0) {