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 Performance item which can be linked from Resources to denote that it has been applied to them, and allows for
17:  * richer linkage, searching and context of Resources.
18:  */
19: class ClipitPerformanceItem extends UBItem {
20:     /**
21:      * @const string Elgg entity SUBTYPE for this class
22:      */
23:     const SUBTYPE = "ClipitPerformanceItem";
24: 
25:     public $example = "";
26:     public $category = "";
27:     public $category_description = "";
28: 
29:     /**
30:      * Loads object parameters stored in Elgg
31:      *
32:      * @param ElggEntity $elgg_entity Elgg Object to load parameters from.
33:      */
34:     protected function copy_from_elgg($elgg_entity) {
35:         parent::copy_from_elgg($elgg_entity);
36:         $this->example = (string)$elgg_entity->get("example");
37:         $this->category = (string)$elgg_entity->get("category");
38:         $this->category_description = (string)$elgg_entity->get("category_description");
39:     }
40: 
41:     /**
42:      * Copy $this object parameters into an Elgg entity.
43:      *
44:      * @param ElggEntity $elgg_entity Elgg object instance to save $this to
45:      */
46:     protected function copy_to_elgg($elgg_entity) {
47:         parent::copy_to_elgg($elgg_entity);
48:         $elgg_entity->set("example", (string)$this->example);
49:         $elgg_entity->set("category", (string)$this->category);
50:         $elgg_entity->set("category_description", (string)$this->category_description);
51:     }
52: 
53:     /**
54:      * Gets all Items by category, or all items grouped by category if no category is specified.
55:      *
56:      * @param string $category
57:      *
58:      * @return static[] Array of Items for the specified category
59:      */
60:     static function get_from_category($category = null) {
61:         $performance_items = static::get_all();
62:         if (empty($category)) {
63:             $return_array = array();
64:             foreach ($performance_items as $performance_item) {
65:                 $return_array[$performance_item->category][] = $performance_item;
66:             }
67:         } else {
68:             $return_array = array();
69:             foreach ($performance_items as $performance_item) {
70:                 if ($performance_item->category == $category) {
71:                     $return_array[$category][] = $performance_item;
72:                 }
73:             }
74:         }
75:         return $return_array;
76:     }
77: }
API documentation generated by ApiGen 2.8.0