}
    }
}
while ($myrows = $writerDatabaseClaimTimeUpdate->fetch_array(MYSQLI_ASSOC)) {
    switch ($myrows['finalstatus']) {
        case 'Claimed':
            switch (dateCompare($myrows['ClaimedDateAndTime'], $myrows['OrderedDateAndTime'])) {
                case 'Expired':
                    mysqli_query($conn, "UPDATE writerWpRecord SET finalstatus='Timeout' WHERE ID='" . $myrows['ID'] . "'");
                    break;
                case 'CanContinue':
                    break;
            }
            break;
        case 'Uploaded':
            switch (dateCompare($myrows['ClaimedDateAndTime'], $myrows['OrderedDateAndTime'])) {
                case 'Expired':
                    mysqli_query($conn, "UPDATE writerWpRecord SET finalstatus='ResubmitTimeup' WHERE ID='" . $myrows['ID'] . "'");
                    break;
                case 'CanContinue':
                    break;
            }
            break;
    }
}
$myclaimedfindid = $conn->query("SELECT claimedOrderID FROM writerWpRecord WHERE writeremail='" . $_SESSION['username'] . "'");
$myidselectdatabase = "";
while ($st = $myclaimedfindid->fetch_array(MYSQLI_ASSOC)) {
    if ($myidselectdatabase == "") {
        $myidselectdatabase = "'" . $st['claimedOrderID'] . "' ";
    } else {
Beispiel #2
0
 /**
  * Start merging user accounts.
  *
  * @param int $OldUserID The ID of the old user.
  * @param int $NewUserID The ID of the new user.
  * @return int|null Returns the merge table ID of the merge.
  * @throws Gdn_UserException Throws an exception of there is a data validation error.
  */
 private function mergeStart($OldUserID, $NewUserID)
 {
     $Model = new Gdn_Model('UserMerge');
     // Grab the users.
     $OldUser = $this->getID($OldUserID, DATASET_TYPE_ARRAY);
     $NewUser = $this->getID($NewUserID, DATASET_TYPE_ARRAY);
     // First see if there is a record with the same merge.
     $Row = $Model->getWhere(['OldUserID' => $OldUserID, 'NewUserID' => $NewUserID])->firstRow(DATASET_TYPE_ARRAY);
     if ($Row) {
         $MergeID = $Row['MergeID'];
         // Save this merge in the log.
         if ($Row['Attributes']) {
             $Attributes = dbdecode($Row['Attributes']);
         } else {
             $Attributes = [];
         }
         $Attributes['Log'][] = ['UserID' => Gdn::session()->UserID, 'Date' => Gdn_Format::toDateTime()];
         $Row = ['MergeID' => $MergeID, 'Attributes' => $Attributes];
     } else {
         $Row = ['OldUserID' => $OldUserID, 'NewUserID' => $NewUserID];
     }
     $UserSet = [];
     $OldUserSet = [];
     if (dateCompare($OldUser['DateFirstVisit'], $NewUser['DateFirstVisit']) < 0) {
         $UserSet['DateFirstVisit'] = $OldUser['DateFirstVisit'];
     }
     if (!isset($Row['Attributes']['User']['CountVisits'])) {
         $UserSet['CountVisits'] = $OldUser['CountVisits'] + $NewUser['CountVisits'];
         $OldUserSet['CountVisits'] = 0;
     }
     if (!empty($UserSet)) {
         // Save the user information on the merge record.
         foreach ($UserSet as $Key => $Value) {
             // Only save changed values that aren't already there from a previous merge.
             if ($NewUser[$Key] != $Value && !isset($Row['Attributes']['User'][$Key])) {
                 $Row['Attributes']['User'][$Key] = $NewUser[$Key];
             }
         }
     }
     $MergeID = $Model->save($Row);
     if (val('MergeID', $Row)) {
         $MergeID = $Row['MergeID'];
     }
     if (!$MergeID) {
         throw new Gdn_UserException($Model->Validation->resultsText());
     }
     // Update the user with the new user-level data.
     $this->setField($NewUserID, $UserSet);
     if (!empty($OldUserSet)) {
         $this->setField($OldUserID, $OldUserSet);
     }
     return $MergeID;
 }
Beispiel #3
0
 public function isPast()
 {
     $date = new DateTime();
     return dateCompare($date, $this->stopTime) > 0;
 }
Beispiel #4
0
 public function isRunning()
 {
     $date = new DateTime();
     return dateCompare($date, $this->stopTime) < 0 && dateCompare($date, $this->startTime) > 0;
 }
Beispiel #5
0
function createWorkerExpoHTMLList(array $expoList, Worker $worker, $isOrganizer)
{
    $_SESSION[PARAM_LIST] = $expoList;
    $_REQUEST[PARAM_LIST_INDEX] = NULL;
    //setExpoCurrent(NULL);
    $docList = Document::selectWorker($worker->workerid);
    $_SESSION[PARAM_LIST2] = $docList;
    $_REQUEST[PARAM_LIST2_INDEX] = NULL;
    $CURRENT_TIME_STAMP = new DateTime();
    expoListWorkerTable();
    // don't need to close
    echo "<tr class='rowTitle'><td colspan='5'>Future Expos</td></tr>\n";
    $future = 0;
    for ($k = 0; $k < count($expoList); $k++) {
        $expo = $expoList[$k];
        if (dateCompare($expo->startTime, $CURRENT_TIME_STAMP) <= 0) {
            break;
        }
        expoListWorkerRow($expo, $k, $isOrganizer, $worker, $docList);
        // don't need to close
        $future++;
    }
    // $k
    if ($future == 0) {
        echo "<tr><td class='fieldError' colspan='5'>There are no future Expos.</td></tr>\n";
    }
    echo "<tr class='rowTitle'><td colspan='5'>Current Expos</td></tr>\n";
    $future = 0;
    for (; $k < count($expoList); $k++) {
        $expo = $expoList[$k];
        if (dateCompare($expo->stopTime, $CURRENT_TIME_STAMP) < 0) {
            break;
        }
        expoListWorkerRow($expo, $k, $isOrganizer, $worker, $docList);
        // don't need to close
        $future++;
    }
    // $k
    if ($future == 0) {
        echo "<tr><td class='fieldError' colspan='5'>There are no current Expos.</td></tr>\n";
    }
    echo "<tr class='rowTitle'><td colspan='5'>Past Expos</td></tr>\n";
    $future = 0;
    for (; $k < count($expoList); $k++) {
        $expo = $expoList[$k];
        expoListWorkerRow($expo, $k, $isOrganizer, $worker, $docList);
        // don't need to close
        $future++;
    }
    // $k
    if ($future == 0) {
        echo "<tr><td class='fieldError' colspan='5'>There are no past Expos.</td></tr>\n";
    }
    echo "</table>\n";
    echo "</div><!-- expolistpage_table -->\n";
}