Overview

Packages

  • ClipIt
    • clipit
      • api
    • urjc
      • backend
  • Elgg
    • Core
      • Access
      • Authentication
      • Cache
      • Caches
      • Core
      • DataMode
        • Site
      • DataModel
        • Annotations
        • Entities
        • Extender
        • File
        • Importable
        • Loggable
        • Notable
        • Object
        • User
      • DataStorage
      • Exception
      • Exceptions
        • Stub
      • FileStore
        • Disk
      • Groups
      • Helpers
      • HMAC
      • Memcache
      • Metadata
      • Navigation
      • ODD
      • Output
      • Plugins
        • Settings
      • Sessions
      • SocialModel
        • Friendable
        • Locatable
      • WebServicesAPI
      • Widgets
      • XML
      • XMLRPC
    • Exceptions
      • Stub
  • None
  • PHP

Classes

  • ClipitActivity
  • ClipitChat
  • ClipitComment
  • ClipitEvent
  • ClipitExample
  • ClipitFile
  • ClipitGroup
  • ClipitLA
  • ClipitLabel
  • ClipitPerformanceItem
  • ClipitPerformanceRating
  • ClipitPost
  • ClipitQuiz
  • ClipitQuizQuestion
  • ClipitQuizResult
  • ClipitRating
  • ClipitRemoteTrickyTopic
  • ClipitRemoteVideo
  • ClipitResource
  • ClipitSite
  • ClipitStoryboard
  • ClipitTag
  • ClipitTagRating
  • ClipitTask
  • ClipitTrickyTopic
  • ClipitUser
  • ClipitVideo
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * ClipIt - JuxtaLearn Web Space
  4:  * PHP version:     >= 5.2
  5:  * Creation date:   2013-10-10
  6:  * Last update:     $Date$
  7:  * @author          Pablo LlinĂ¡s Arnaiz <pebs74@gmail.com>, URJC JuxtaLearn Team
  8:  * @version         $Version$
  9:  * @link            http://www.juxtalearn.eu
 10:  * @license         GNU Affero General Public License v3
 11:  * @package         ClipIt
 12:  * @subpackage      clipit_api
 13:  */
 14: 
 15: /**
 16:  * A discussion forum Post which can be a topic starter or a reply to another Post. Contains Link to the topic starter
 17:  * Post ID, and may have files and/or Resources as attachments.
 18: 
 19:  */
 20: class ClipitPost extends UBMessage {
 21:     /**
 22:      * @const string Elgg entity SUBTYPE for this class
 23:      */
 24:     const SUBTYPE = "ClipitPost";
 25:     const REL_MESSAGE_DESTINATION = "ClipitPost-destination";
 26:     const REL_MESSAGE_FILE = "ClipitPost-ClipitFile";
 27:     const REL_MESSAGE_USER = "ClipitPost-ClipitUser";
 28:     const REL_POST_STORYBOARD = "ClipitPost-ClipitStoryboard";
 29:     const REL_POST_VIDEO = "ClipitPost-ClipitVideo";
 30: 
 31:     public $topic_id = 0;
 32:     public $storyboard_array = array();
 33:     public $video_array = array();
 34: 
 35:     /**
 36:      * Loads object parameters stored in Elgg
 37:      *
 38:      * @param ElggEntity $elgg_entity Elgg Object to load parameters from.
 39:      */
 40:     protected function copy_from_elgg($elgg_entity) {
 41:         parent::copy_from_elgg($elgg_entity);
 42:         $this->topic_id = (int)$elgg_entity->get("topic_id");
 43:         $this->storyboard_array = (array)static::get_storyboards((int)$this->id);
 44:         $this->video_array = (array)static::get_videos((int)$this->id);
 45:     }
 46: 
 47:     /**
 48:      * Copy $this object parameters into an Elgg entity.
 49:      *
 50:      * @param ElggEntity $elgg_entity Elgg object instance to save $this to
 51:      */
 52:     protected function copy_to_elgg($elgg_entity) {
 53:         parent::copy_to_elgg($elgg_entity);
 54:         $elgg_entity->set("topic_id", $this->topic_id);
 55:     }
 56: 
 57:     /**
 58:      * Saves this instance to the system.
 59:      * @param  bool $double_save if $double_save is true, this object is saved twice to ensure that all properties are updated properly. E.g. the time created property can only beset on ElggObjects during an update. Defaults to false!
 60:      * @return bool|int Returns the Id of the saved instance, or false if error
 61:      */
 62:     protected function save($double_save=false) {
 63:         parent::save($double_save);
 64:         static::set_storyboards($this->id, $this->storyboard_array);
 65:         static::set_videos($this->id, $this->video_array);
 66:         return $this->id;
 67:     }
 68: 
 69:     // STORYBOARDS
 70:     static function add_storyboards($id, $storyboard_array) {
 71:         return UBCollection::add_items($id, $storyboard_array, static::REL_POST_STORYBOARD);
 72:     }
 73: 
 74:     static function set_storyboards($id, $storyboard_array) {
 75:         return UBCollection::set_items($id, $storyboard_array, static::REL_POST_STORYBOARD);
 76:     }
 77: 
 78:     static function remove_storyboards($id, $storyboard_array) {
 79:         return UBCollection::remove_items($id, $storyboard_array, static::REL_POST_STORYBOARD);
 80:     }
 81: 
 82:     static function get_storyboards($id) {
 83:         return UBCollection::get_items($id, static::REL_POST_STORYBOARD);
 84:     }
 85: 
 86:     // VIDEOS
 87:     static function add_videos($id, $video_array) {
 88:         return UBCollection::add_items($id, $video_array, static::REL_POST_VIDEO);
 89:     }
 90: 
 91:     static function set_videos($id, $video_array) {
 92:         return UBCollection::set_items($id, $video_array, static::REL_POST_VIDEO);
 93:     }
 94: 
 95:     static function remove_videos($id, $video_array) {
 96:         return UBCollection::remove_items($id, $video_array, static::REL_POST_VIDEO);
 97:     }
 98: 
 99:     static function get_videos($id) {
100:         return UBCollection::get_items($id, static::REL_POST_VIDEO);
101:     }
102: }
API documentation generated by ApiGen 2.8.0