Пример #1
0
 /** Same as getOptionsFromList, except it uses an array of arrays (such as is returned by selectQuery()).  */
 public static function getOptionsFromArray($strTableName, $arrDB, $strValueElement = 'name', $strKeyElement = 'id', $strZeroCaption = 'Please make a selection')
 {
     return clsDB::getOptionsFromList(clsDB::arrayToObjects($strTableName, $arrDB), $strValueElement, $strKeyElement, $strZeroCaption);
 }
Пример #2
0
     $objAlbum->set('mime', DEFAULT_MIME);
 }
 /* The template that looks after the edit page. */
 $objEditTemplate = new clsTemplate('editalbum');
 $objEditTemplate->setText('HIDDEN', $objAlbum->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumGuest->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumMember->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumGroup->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbum->getHiddenField('album_id'));
 $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='action' value='albums'>");
 $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='subaction' value='save'>");
 $objEditTemplate->setText('MAXWIDTH', MAX_X);
 $objEditTemplate->setText('MAXHEIGHT', MAX_Y);
 $objEditTemplate->setText('NAME', $objAlbum->getTextField('name', new clsParameters('SIZE', 40)));
 $objEditTemplate->setText('PARENT', $objParent->isNew() ? "n/a" : $objParent->get('name'));
 $objEditTemplate->setText('GROUP', $objAlbum->getCombo('group_id', clsDB::getOptionsFromList(clsGroup::getGroups($objUser), 'name', 'id', "No group.")));
 $objEditTemplate->setText('CAPTION', $objAlbum->getTextArea('caption', 4, 45));
 $objEditTemplate->setText('EXPORTKEY', $objAlbum->getTextField('export_tag', new clsParameters('SIZE', 4)));
 $objEditTemplate->setText('WIDTH', $objAlbum->getTextField('max_width', new clsParameters('SIZE', 3)));
 $objEditTemplate->setText('HEIGHT', $objAlbum->getTextField('max_height', new clsParameters('SIZE', 3)));
 $objEditTemplate->setText('MIME', $objAlbum->getTextField('mime'));
 $strGroup = '';
 $strGroup .= "View pictures? " . $objAlbumGroup->getCombo('allow_view', $arrOptions) . "<br>";
 $strGroup .= "Rate pictures? " . $objAlbumGroup->getCombo('allow_rate', $arrOptions) . "<br>";
 $strGroup .= "Post pictures? " . $objAlbumGroup->getCombo('allow_post_picture', $arrOptions) . "<br>";
 $strGroup .= "Post comments? " . $objAlbumGroup->getCombo('allow_post_comment', $arrOptions) . "<br>";
 $strGroup .= "Delete pictures? " . $objAlbumGroup->getCombo('allow_delete_picture', $arrOptions) . "<br>";
 $strGroup .= "Create sub-albums?" . $objAlbumGroup->getCombo('allow_create_subalbum', $arrOptions) . "<br>";
 $objEditTemplate->setText('GROUPPERMISSIONS', $strGroup);
 $strMember = '';
 $strMember .= "View pictures? " . $objAlbumMember->getCombo('allow_view', $arrOptions) . "<br>";
Пример #3
0
    }
    /* 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();
    }
}