og_bundle_new_release Class Reference

Inheritance diagram for og_bundle_new_release:

Inheritance graph
[legend]
Collaboration diagram for og_bundle_new_release:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 285 of file og_blueprints.module.


Public Member Functions

 __construct ()
 __construct ($grouptype, $release_name)
__get ($member)
 increment_bid_version ()
 sort_for_display ()

Public Attributes

 $bid
 $group_name
 $grouptype
 $linked_dids = array()
 $release_id
 $vid

Protected Member Functions

 load_all_blueprints ()

Protected Attributes

 $blueprints = array()

Private Member Functions

 make_release ()
 master_release_updates ()

Member Function Documentation

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_new_release::__construct ( grouptype,
release_name 
)

Definition at line 288 of file og_blueprints.module.

00288                                                   {
00289     $this->grouptype = $grouptype;
00290     $this->release_name = $release_name;
00291     parent::__construct();
00292     $this->load_all_blueprints();
00293     $this->make_release();
00294   }

& 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::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_new_release::make_release (  )  [private]

Definition at line 296 of file og_blueprints.module.

00296                                   {
00297     db_query("UPDATE {og_bundle_revision} SET release_id = %d , release_name = '%s' , timestamp = %d WHERE vid = %d", ++$this->release_id, $this->release_name, time(), $this->vid);
00298     $this->increment_bid_version();
00299     foreach ($this->blueprints as $bpid => &$blueprint) {
00300       $blueprint->new_version($this->vid);
00301       if ($this->bid != 1) {
00302         $blueprint->update_dids();
00303       }
00304     }
00305     if ($this->bid == 1) {
00306       $this->master_release_updates();
00307     }
00308   }

og_bundle_new_release::master_release_updates (  )  [private]

Definition at line 310 of file og_blueprints.module.

00310                                             {
00311     foreach (db_fetch_array(db_query("SELECT grouptype FROM {og_bundle} WHERE bid <> 1")) as $group_type) {
00312       $bundle = new og_bundle_typed($group_type);
00313       $bundle->load_all_blueprints();
00314       db_query("UPDATE {og_bundle_revision} SET release_id = %d , release_name = '%s' , timestamp = %d WHERE vid = (SELECT vid FROM {og_bundle} WHERE bid = %d)", ++$bundle->release_id, $this->release_name, time(), $bundle->bid);
00315       $this->increment_bid_version();
00316       foreach ($bundle->blueprints as $bpid => &$blueprint) {
00317         $blueprint->vid = $bundle->vid;
00318         $blueprint->did = $this->blueprints[$bpid]->did;
00319         $blueprint->save();
00320       }
00321     }
00322   }

og_bundle::sort_for_display (  )  [inherited]

Definition at line 63 of file og_blueprints.module.

00063                                      {
00064     uasort(&$this->blueprints, 'og_blueprints_sort_bundle');
00065   }


Member Data Documentation

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_new_release::$linked_dids = array()

Definition at line 286 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.


The documentation for this class was generated from the following file:

Generated on Sun May 18 20:36:51 2008 for Organic Groups Blueprints by  doxygen 1.5.5