Admidio API
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Packages

  • com
    • tecnick
      • tcpdf
  • None
  • PHPMailer
    • easypeasyics
  • PHPWavUtils
  • Securimage
    • classes

Classes

  • AutoLogin
  • Component
  • ComponentUpdate
  • ConditionParser
  • Database
  • Datamatrix
  • DateTimeExtended
  • EasyPeasyICS
  • Email
  • Folder
  • FormValidation
  • FunctionClass
  • Htaccess
  • HtmlDiv
  • HtmlElement
  • HtmlForm
  • HtmlFormBasic
  • HtmlFormInstallation
  • HtmlList
  • HtmlNavbar
  • HtmlPage
  • HtmlTable
  • HtmlTableBasic
  • Image
  • Inventory
  • InventoryFields
  • Language
  • LanguageData
  • ListConfiguration
  • Menu
  • Message
  • ModuleAnnouncements
  • ModuleDates
  • ModuleLists
  • ModuleMenu
  • ModuleMessages
  • Modules
  • ModuleWeblinks
  • MyFiles
  • Navigation
  • ntlm_sasl_client_class
  • Organization
  • Participants
  • PasswordHash
  • PasswordHashing
  • PDF417
  • PHPMailer
  • PHPMailerOAuth
  • PHPMailerOAuthGoogle
  • POP3
  • ProfileFields
  • QRcode
  • RoleDependency
  • RolesRights
  • RSSfeed
  • Securimage
  • Securimage_Color
  • Session
  • SMTP
  • SystemMail
  • TableAccess
  • TableAnnouncement
  • TableCategory
  • TableDate
  • TableFile
  • TableFolder
  • TableGuestbook
  • TableGuestbookComment
  • TableInventory
  • TableInventoryField
  • TableLists
  • TableMembers
  • TableMessage
  • TablePhotos
  • TableRoles
  • TableRooms
  • TableText
  • TableUserField
  • TableUsers
  • TableWeblink
  • TCPDF
  • TCPDF2DBarcode
  • TCPDF_COLORS
  • TCPDF_FILTERS
  • TCPDF_FONT_DATA
  • TCPDF_FONTS
  • TCPDF_IMAGES
  • TCPDF_IMPORT
  • TCPDF_PARSER
  • TCPDF_STATIC
  • TCPDFBarcode
  • UploadHandlerDownload
  • UploadHandlerPhoto
  • User
  • UserRegistration
  • WavFile

Exceptions

  • AdmException
  • phpmailerException
  • WavFileException
  • WavFormatException

Functions

  • __autoload
  • admFuncAutoload
  • admFuncGeneratePagination
  • admFuncGetBytesFromSize
  • admFuncGetDirectoryEntries
  • admFuncMaxUploadSize
  • admFuncProcessableImageSize
  • admFuncShowCreateChangeInfoById
  • admFuncShowCreateChangeInfoByName
  • admFuncVariableIsValid
  • admReadTemplateFile
  • admStrIsValidFileName
  • admStrStripTagsSpecial
  • admStrToLower
  • admStrToUpper
  • bzip2Version
  • checkDatabaseVersion
  • checkPhpVersion
  • EmailAttachment
  • FileSizeNiceDisplay
  • FormattedTimeRemaining
  • FunctionIsDisabled
  • getFormerRolesFromDatabase
  • getFutureRolesFromDatabase
  • getmicrotime
  • getRoleMemberships
  • getRolesFromDatabase
  • gzipVersion
  • hasRole
  • hl_attrval
  • hl_bal
  • hl_cmtcd
  • hl_ent
  • hl_prot
  • hl_regex
  • hl_spec
  • hl_tag
  • hl_tag2
  • hl_tidy
  • hl_version
  • htmLawed
  • HTMLFilter
  • isGroupLeader
  • isMember
  • kses
  • kses_hook
  • MySQLdumpVersion
  • OutputInformation
  • PHPMailerAutoload
  • SafeExec
  • showNotice
  • str_split
  • strAddSlashesDeep
  • strNextLetter
  • strStripSlashesDeep
  • strStripTags
  • strValidCharacters
  • tln_body2div
  • tln_casenormalize
  • tln_deent
  • tln_defang
  • tln_findnxreg
  • tln_findnxstr
  • tln_fixatts
  • tln_fixstyle
  • tln_fixurl
  • tln_getnxtag
  • tln_sanitize
  • tln_skipspace
  • tln_tagprint
  • tln_unspace
  • version_compare_replacement
  • version_compare_replacement_sub
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 
<?php
/**
 ***********************************************************************************************
 * Class manages access to database table adm_lists
 *
 * @copyright 2004-2016 The Admidio Team
 * @see http://www.admidio.org/
 * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
 ***********************************************************************************************
 */

/**
 * @class TableLists
 * Diese Klasse dient dazu ein Listenobjekt zu erstellen.
 * Eine Liste kann ueber diese Klasse in der Datenbank verwaltet werden
 *
 * Beside the methods of the parent class there are the following additional methods:
 *
 * setDefault()       - Aktuelle Liste wird zur Default-Liste der Organisation
 */
class TableLists extends TableAccess
{
    /**
     * Constructor that will create an object of a recordset of the table adm_lists.
     * If the id is set than the specific list will be loaded.
     * @param \Database $database Object of the class Database. This should be the default global object @b $gDb.
     * @param int       $lst_id   The recordset of the list with this id will be loaded. If id isn't set than an empty object of the table is created.
     */
    public function __construct(&$database, $lst_id = 0)
    {
        parent::__construct($database, TBL_LISTS, 'lst', $lst_id);
    }

    /**
     * Deletes the selected list with all associated fields.
     * After that the class will be initialize.
     * @throws AdmException LST_ERROR_DELETE_DEFAULT_LIST
     * @return bool @b true if no error occurred
     */
    public function delete()
    {
        global $gPreferences;

        // if this list is the default configuration than it couldn't be deleted
        if($this->getValue('lst_id') == $gPreferences['lists_default_configuation'])
        {
            throw new AdmException('LST_ERROR_DELETE_DEFAULT_LIST', $this->getValue('lst_name'));
        }

        $this->db->startTransaction();

        // alle Spalten der Liste loeschen
        $sql = 'DELETE FROM '.TBL_LIST_COLUMNS.' WHERE lsc_lst_id = '. $this->getValue('lst_id');
        $this->db->query($sql);

        $return = parent::delete();

        $this->db->endTransaction();
        return $return;
    }

    /**
     * Save all changed columns of the recordset in table of database. Therefore the class remembers if it's
     * a new record or if only an update is necessary. The update statement will only update
     * the changed columns. If the table has columns for creator or editor than these column
     * with their timestamp will be updated.
     * Per default the organization, user and timestamp will be set.
     * @param bool $updateFingerPrint Default @b true. Will update the creator or editor of the recordset if table has columns like @b usr_id_create or @b usr_id_changed
     * @return bool If an update or insert into the database was done then return true, otherwise false.
     */
    public function save($updateFingerPrint = true)
    {
        global $gCurrentOrganization, $gCurrentUser;

        // Standardfelder fuellen
        if($this->new_record)
        {
            $this->setValue('lst_timestamp', DATETIME_NOW);
            $this->setValue('lst_usr_id', $gCurrentUser->getValue('usr_id'));
            if(strlen($this->getValue('lst_org_id')) === 0)
            {
                $this->setValue('lst_org_id', $gCurrentOrganization->getValue('org_id'));
            }
        }
        else
        {
            $this->setValue('lst_timestamp', DATETIME_NOW);
            $this->setValue('lst_usr_id', $gCurrentUser->getValue('usr_id'));
        }

        // falls nicht explizit auf global = 1 gesetzt wurde, immer auf 0 setzen
        if($this->getValue('lst_global') != 1)
        {
            $this->setValue('lst_global', 0);
        }

        return parent::save($updateFingerPrint);
    }
}
Admidio API API documentation generated by ApiGen