Tuskfish API
  • Package
  • Class

Packages

  • content
  • core
  • database
  • installation
  • security
  • user
  • utilities

Classes

  • TfishAncestralObject
  • TfishAngryTree
  • TfishArticle
  • TfishArticleHandler
  • TfishAudio
  • TfishAudioHandler
  • TfishBlock
  • TfishBlockHandler
  • TfishCache
  • TfishCollection
  • TfishCollectionHandler
  • TfishContentHandler
  • TfishContentObject
  • TfishCriteria
  • TfishCriteriaItem
  • TfishDatabase
  • TfishDownload
  • TfishDownloadHandler
  • TfishFileHandler
  • TfishFilter
  • TfishImage
  • TfishImageHandler
  • TfishLogger
  • TfishMetadata
  • TfishPreference
  • TfishPreferenceHandler
  • TfishRss
  • TfishSecurityUtility
  • TfishSession
  • TfishStatic
  • TfishStaticHandler
  • TfishTag
  • TfishTagHandler
  • TfishTaglink
  • TfishTaglinkHandler
  • TfishTemplate
  • TfishUser
  • TfishUtils
  • TfishVideo
  • TfishVideoHandler
  • TfishYubikeyAuthenticator

Functions

  • getUrl
  • tfish_autoload
 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 
<?php

/**
 * TfishAudioHandler class file.
 * 
 * @copyright   Simon Wilkinson 2013-2017 (https://tuskfish.biz)
 * @license     https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html GNU General Public License (GPL) V2
 * @author      Simon Wilkinson <[email protected]>
 * @version     Release: 1.0
 * @since       1.0
 * @package     content
 */

// Enable strict type declaration.
declare(strict_types=1);

if (!defined("TFISH_ROOT_PATH")) die("TFISH_ERROR_ROOT_PATH_NOT_DEFINED");

/**
 * Handler class for audio content objects.
 *
 * @copyright   Simon Wilkinson 2013-2017 (https://tuskfish.biz)
 * @license     https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html GNU General Public License (GPL) V2
 * @author      Simon Wilkinson <[email protected]>
 * @version     Release: 1.0
 * @since       1.0
 * @package     content
 */
class TfishAudioHandler extends TfishContentHandler
{

    /**
     * Count TfishAudio objects, optionally matching conditions specified with a TfishCriteria object.
     * 
     * @param object $criteria TfishCriteria object used to build conditional database query.
     * @return int $count Number of TfishAudio objects matching conditions.
     */
    public static function getCount(TfishCriteria $criteria = null)
    {
        if (!isset($criteria)) {
            $criteria = new TfishCriteria();
        }

        // Unset any pre-existing object type criteria.
        $type_key = self::getTypeIndex($criteria->item);
        
        if (isset($type_key)) {
            $criteria->killType($type_key);
        }

        // Set new type criteria specific to this object.
        $criteria->add(new TfishCriteriaItem('type', 'TfishAudio'));
        $count = parent::getcount($criteria);

        return $count;
    }

    /**
     * Get TfishAudio objects, optionally matching conditions specified with a TfishCriteria object.
     * 
     * Note that the object type is automatically set, so it is unnecessary to set it when calling
     * TfishAudioHandler::getObjects($criteria). However, if you want to use the generic handler
     * TfishContentHandler::getObjects($criteria) then you do need to specify the object type,
     * otherwise you will get all types of content returned. It is acceptable to use either handler,
     * although good practice to use the type-specific one when you know you want a specific kind of
     * object.
     * 
     * @param object $criteria TfishCriteria object used to build conditional database query.
     * @return array $objects TfishAudio objects.
     */
    public static function getObjects(TfishCriteria $criteria = null)
    {
        if (!isset($criteria)) {
            $criteria = new TfishCriteria();
        }

        // Unset any pre-existing object type criteria.
        $type_key = self::getTypeIndex($criteria->item);
        
        if (isset($type_key)) {
            $criteria->killType($type_key);
        }

        // Set new type criteria specific to this object.
        $criteria->add(new TfishCriteriaItem('type', 'TfishAudio'));
        $objects = parent::getObjects($criteria);

        return $objects;
    }

}
Tuskfish API API documentation generated by ApiGen