

Definition at line 438 of file og_blueprints.module.
Public Member Functions | |
| __construct () | |
| __construct ($group_type) | |
| & | __get ($member) |
| create () | |
| increment_bid_version () | |
| sort_for_display () | |
Public Attributes | |
| $bid | |
| $group_name | |
| $grouptype | |
| $orphaned_bids | |
| $release_id | |
| $vid | |
Protected Member Functions | |
| load_all_blueprints () | |
Protected Attributes | |
| $blueprints = array() | |
Private Member Functions | |
| add_new () | |
| restore () | |
| Consider adding this query for an extra validity check: db_result(db_query("SELECT vid FROM {og_bundle_revision} WHERE bid = %d ORDER BY vid DESC LIMIT 1")). | |
| og_bundle::__construct | ( | ) | [inherited] |
Reimplemented in og_bundle_master.
Definition at line 44 of file og_blueprints.module.
00044 { 00045 list($this->bid, $this->vid, $this->release_id) = array_values(db_fetch_array(db_query(<<<QUERY 00046 SELECT b.bid, b.vid, r.release_id FROM {og_bundle} AS b 00047 INNER JOIN {og_bundle_revision} AS r ON b.bid = r.bid 00048 WHERE b.grouptype = '%s' ORDER BY r.release_id DESC LIMIT 1 00049 QUERY 00050 , $this->grouptype))); 00051 $group_types = og_blueprints_group_types(TRUE); 00052 $this->group_name = $group_types[$this->grouptype]; 00053 }
| og_bundle_type_creator::__construct | ( | $ | group_type | ) |
Definition at line 441 of file og_blueprints.module.
00441 { 00442 $this->grouptype = 'master'; 00443 parent::__construct(); 00444 $this->load_all_blueprints(); 00445 $this->grouptype = $group_type; 00446 $this->orphaned_bids = variable_get('og_blueprints_orphaned_bids', array()); 00447 }
| & og_bundle::__get | ( | $ | member | ) | [inherited] |
Definition at line 73 of file og_blueprints.module.
00073 { 00074 switch (TRUE) { 00075 case (is_numeric($member) && in_array($member, array_keys(og_blueprints_list()))): 00076 return $this->blueprints[$member]; 00077 00078 case ($member == 'blueprints'): 00079 return $this->blueprints; 00080 } 00081 }
| og_bundle_type_creator::add_new | ( | ) | [private] |
Definition at line 458 of file og_blueprints.module.
00458 { 00459 // FIXME slightly hacky way of preventing there from being duplicate names. this needs to throw an error that 00460 // can be caught and then run an update and fix it appropriately. 00461 if (!db_result(db_query("SELECT bid FROM {og_bundle} WHERE grouptype = '%s'", $this->grouptype))) { 00462 $this->bid = db_next_id("{og_bundle}_bid"); 00463 $this->release_id = NULL; 00464 db_query("INSERT INTO {og_bundle} (bid, grouptype) VALUES (%d, '%s')", $this->bid, $this->grouptype); 00465 $this->increment_bid_version(); 00466 foreach ($this->blueprints as &$blueprint) { 00467 $blueprint->clone_from_master($this->bid, $this->vid); 00468 } 00469 } 00470 }
| og_bundle_type_creator::create | ( | ) |
Definition at line 449 of file og_blueprints.module.
00449 { 00450 if (isset($this->orphaned_bids[$this->grouptype])) { 00451 $this->restore(); 00452 } 00453 else { 00454 $this->add_new(); 00455 } 00456 }
| og_bundle::increment_bid_version | ( | ) | [inherited] |
Definition at line 67 of file og_blueprints.module.
00067 { 00068 db_query("INSERT INTO {og_bundle_revision} (bid) VALUES (%d)", $this->bid); 00069 db_query("UPDATE {og_bundle} SET vid = (SELECT vid FROM {og_bundle_revision} WHERE bid = %d ORDER BY vid DESC LIMIT 1) , release_id = %d WHERE bid = %d", $this->bid, $this->release_id, $this->bid); 00070 $this->vid = db_result(db_query("SELECT vid FROM {og_bundle} WHERE bid = %d", $this->bid)); // FIXME be consistent with make_release(), whichever way you go 00071 }
| og_bundle::load_all_blueprints | ( | ) | [protected, inherited] |
Definition at line 55 of file og_blueprints.module.
00055 { 00056 $blueprint_type = preg_replace('/bundle/', 'blueprint', get_class($this)); 00057 $blueprints = db_query("SELECT bpid FROM {og_blueprint} WHERE vid = %d", $this->vid); 00058 while ($blueprint = db_fetch_array($blueprints)) { 00059 $this->blueprints[$blueprint['bpid']] =& new $blueprint_type(array('bpid' => $blueprint['bpid'], 'vid' => $this->vid)); 00060 } 00061 }
| og_bundle_type_creator::restore | ( | ) | [private] |
FIXME this is ugly at the moment - need to figure out if there's a good & reasonable way to differentiate between the actions that should be taken depending on what's in $orphaned_groups['grouptype']['op']
Definition at line 479 of file og_blueprints.module.
00479 { 00480 // if ($this->orphaned_bids[$this->grouptype]['op'] == 'unset_as_group') { 00481 $this->bid = $this->orphaned_bids[$this->grouptype]['bid']; 00482 db_query("INSERT INTO {og_bundle} (bid, grouptype) VALUES (%d, '%s')", $this->bid, $this->grouptype); 00483 db_query("UPDATE {og_bundle} SET release_id = (SELECT release_id FROM {og_bundle_revision} WHERE bid = %d ORDER BY vid DESC LIMIT 1) WHERE bid = %d", $this->bid, $this->bid); 00484 unset($this->orphaned_bids[$this->grouptype]); 00485 variable_set('og_blueprints_orphaned_bids', $this->orphaned_bids); 00486 // } 00487 }
| og_bundle::sort_for_display | ( | ) | [inherited] |
og_bundle::$bid [inherited] |
Definition at line 41 of file og_blueprints.module.
og_bundle::$blueprints = array() [protected, inherited] |
Definition at line 42 of file og_blueprints.module.
og_bundle::$group_name [inherited] |
Definition at line 41 of file og_blueprints.module.
og_bundle::$grouptype [inherited] |
Definition at line 41 of file og_blueprints.module.
| og_bundle_type_creator::$orphaned_bids |
Definition at line 439 of file og_blueprints.module.
og_bundle::$release_id [inherited] |
Definition at line 41 of file og_blueprints.module.
og_bundle::$vid [inherited] |
Definition at line 41 of file og_blueprints.module.
1.5.5