예제 #1
0
파일: upload.php 프로젝트: shifter/ospap2
    }
    /* Make sure that users can only edit their own pictures. */
    $objPicture->delete();
    $objPicture->save();
    header("Location: index.php?action=upload&subaction=preview");
}
if ($strSubAction == 'preview') {
    $objTemplate->setText('PAGETITLE', "Pending Pictures");
    $objBreadcrumbs->add('Upload', 'index.php?action=upload');
    $objBreadcrumbs->add('Pending', 'index.php?action=upload&subaction=preview');
    $arrPictures = clsPicture::getPending($objUser);
    print "You have <strong>" . sizeof($arrPictures) . "</strong> pictures waiting for attention" . ($objUser ? "" : " (note: unsaved images from all guests will appear here)") . ":<br><br>";
    foreach ($arrPictures as $objPicture) {
        $objPicture = new clsPicture($objPicture->get('id'));
        $objAlbum = new clsAlbum($objPicture->get('album_id'));
        $objTemplate = new clsTemplate('preview');
        $objTemplate->setText('HIDDEN', $objPicture->getHiddenField('id'));
        $objTemplate->setText('ALBUM', $objPicture->getCombo('album_id', clsDB::getOptionsFromList($objAlbum->getPostableAlbums($objUser), 'name', 'id', "Select an album")));
        $objTemplate->setText('ID', $objPicture->get('id'));
        $objTemplate->setText('IMAGE', $objPicture->getHtmlThumbnail(250, 250));
        /* TODO: Customizable? */
        $objTemplate->setText('NAME', $objPicture->get('original_name'));
        $objTemplate->setText('WIDTH', $objPicture->get('width'));
        $objTemplate->setText('HEIGHT', $objPicture->get('height'));
        $objTemplate->setText('SAVEDELETE', $objPicture->getCombo('subaction', array('confirm' => 'Keep', 'delete' => 'Don\'t keep'), null, true));
        $objTemplate->setText('TITLE', $objPicture->getTextField('title'));
        $objTemplate->setText('CAPTION', $objPicture->getTextArea('caption'));
        $objTemplate->setText('SUBMIT', $objPicture->getSubmit('Save'));
        print $objTemplate->get();
    }
}