示例#1
0
 static function PrivateStaticConstructor()
 {
     // todo - should be internationalized; should be easy enough with dates!
     if (!is_null(self::$REVIEW_ARRAY)) {
         return;
     }
     self::$REVIEW_ARRAY = array(UNREVIEWED, APPROVED, DECLINED, DELETE);
     self::$STRING_ARRAY = array(UNREVIEWED => "Unreviewed", APPROVED => "Approved", DECLINED => "Declined", DELETE => "Delete");
     // set up options
     // if Organizer: UnReviewed->Approve, Decline, Delete; Approve->UnReviewed, Decline; Decline->UnReviewed, Approve
     // repeat if Organizer: Delete only from UnReviewed
     // if Worker: UnReviewed->Delete
     self::$OPTIONS_UNREVIEWED[] = array(UNREVIEWED, self::$STRING_ARRAY[UNREVIEWED]);
     self::$OPTIONS_UNREVIEWED[] = array(APPROVED, self::$STRING_ARRAY[APPROVED]);
     self::$OPTIONS_UNREVIEWED[] = array(DECLINED, self::$STRING_ARRAY[DECLINED]);
     self::$OPTIONS_UNREVIEWED[] = array(DELETE, self::$STRING_ARRAY[DELETE]);
     self::$OPTIONS_APPROVED[] = array(UNREVIEWED, self::$STRING_ARRAY[UNREVIEWED]);
     self::$OPTIONS_APPROVED[] = array(APPROVED, self::$STRING_ARRAY[APPROVED]);
     self::$OPTIONS_APPROVED[] = array(DECLINED, self::$STRING_ARRAY[DECLINED]);
     self::$OPTIONS_DECLINED[] = array(UNREVIEWED, self::$STRING_ARRAY[UNREVIEWED]);
     self::$OPTIONS_DECLINED[] = array(APPROVED, self::$STRING_ARRAY[APPROVED]);
     self::$OPTIONS_DECLINED[] = array(DECLINED, self::$STRING_ARRAY[DECLINED]);
     // make getList simple
     self::$OPTIONS_STATUS[UNREVIEWED] = self::$OPTIONS_UNREVIEWED;
     self::$OPTIONS_STATUS[APPROVED] = self::$OPTIONS_APPROVED;
     self::$OPTIONS_STATUS[DECLINED] = self::$OPTIONS_DECLINED;
     self::$OPTIONS_STAFF[] = array(UNREVIEWED, self::$STRING_ARRAY[UNREVIEWED]);
     self::$OPTIONS_STAFF[] = array(DELETE, self::$STRING_ARRAY[DELETE]);
     // self::$OPTION_UNREVIEWED = array(UNREVIEWED, self::$STRING_ARRAY[UNREVIEWED]); ...
     // self::$OPTION = array(self::$OPTION_UNREVIEWED, ...
 }
示例#2
0
function makeDocumentListHTMLRow(Document $document, $position, $isEditable, $isOrganizer, Worker $worker = NULL)
{
    echo "<tr>\n<td class='fieldValueFirst'>";
    if (!is_null($worker)) {
        // reset to match up; note duplicates ok
        echo "<a href='WorkerViewPage.php?" . PARAM_LIST2_INDEX . "={$position}'>" . htmlspecialchars($worker->nameString()) . "</a>";
    }
    echo "</td>\t<td class='fieldValue'><a href='DocumentViewAction.php?" . PARAM_LIST2_INDEX . "={$position}'>" . htmlspecialchars($document->docType) . "</a></td>\n";
    $date = htmlspecialchars(swwat_format_usdate($document->uploadDate));
    echo "\t<td class='fieldValue'>{$date}</td>\n";
    // todo - should this also check (0 == strcmp(UNREVIEWED, $document->reviewStatus))?
    $date = is_null($document->reviewDate) ? "" : htmlspecialchars(swwat_format_usdate($document->reviewDate));
    echo "\t<td class='fieldValue'>{$date}</td>\n";
    echo "\t<td class='fieldValue'>";
    // permissions checks - $isEditable is like a potential to be edited
    if (!$isOrganizer) {
        // workers can only delete a non-reviewed document
        $isEditable &= 0 == strcmp(UNREVIEWED, $document->reviewStatus);
    }
    if ($isEditable) {
        echo "<form method='POST' action='WorkerDocumentAction.php'>";
        swwat_createInputHidden(PARAM_LIST2_INDEX, $position);
        // set up options
        // if Organizer: UnReviewed->Approve, Decline, Delete; Approve->UnReviewed, Decline; Decline->UnReviewed, Approve
        // repeat if Organizer: Delete only from UnReviewed
        // if Worker: UnReviewed->Delete
        $options = ReviewEnum::getList($isOrganizer, $document->reviewStatus);
        swwat_createSelect(0, PARAM_STATUSTYPE, $options, $document->reviewStatus, !$isEditable);
        echo "&nbsp;";
        swwat_createInputSubmit(is_null($worker) ? PARAM_LASTNAME : "", $isOrganizer ? "Change Status" : "Delete");
        echo "</form>";
    } else {
        echo htmlspecialchars(ReviewEnum::getString($document->reviewStatus));
    }
    echo "</td>\n</tr>\n";
    return;
}