Documentation is available at PS_DB.inc
- <?php
- /**
- * PrepStep Module Database API.
- * This file is part of CompInaBox.
- * @copyright Copyright 2001-2005. Eric D. Nielsen, All rights reserverd.
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @author Eric D. Nielsen <nielsene@alum.mit.edu>
- *
- * @package Database
- */
- /**
- * PrepStep Module Database API.
- * This class presents a OOP interface to the common
- * queries needed by PrepStep functionality.
- * @todo Further tease out SQL to the {@link PhraseBook}.
- * @package Database
- */
- class PS_DB extends CIB_DB
- {
- /**
- * PrepStep DB Constructor.
- * Simply call the parent constructor.
- * @todo Add a check after connecting to make sure its a central DB and
- * not a per-comp DB
- * @access public
- *
- * @param string $dbname what database do you want to connect to
- * @param string $user as what user
- * @param string $password which what password
- */
- function PS_DB($dbname, $user, $pass)
- {
- DB::DB($dbname, $user, $pass);
- }
- /**
- * Return the list of canonical levels
- * Returns a list of levels normally used by competitions of a given
- * type.
- * @param array $compTypes a list of selected "types" for this competition
- * normally a only one type is selected, at present only the last item
- * in the list is used. Sample types are "US Collegiate", "USA Dance, Inc",
- * "NDCA", etc
- * @returns array structured array listing the levels in track/index order
- * @todo handle multi-type competitions better
- * @access public
- */
- function getCanLevels($compTypes)
- {
- $useType=$compTypes[count($compTypes)-1];
- $query =<<<END_QUERY
- SELECT levelname, track, displayorder, eventfullprefix, eventshortprefix
- FROM cannonical_levels WHERE comptype='$useType' ORDER BY track, displayorder;
- END_QUERY; $result = $this->query($query);
- $num = $result->numrows();
- for ($i=0;$i<$num;$i++)
- {
- list($level,$track,$order,$full,$short) = $result->getRowAt($i);
- $levels[$track][$order]=array("Name"=>$level,
- "Short"=>$short,
- "Full"=>$full);
- }
- return $levels;
- }
- /**
- * Return the list of canonical styles
- * Returns a list of levels normally used by competitions of a given
- * type.
- * @param array $compTypes a list of selected "types" for this competition
- * normally a only one type is selected, at present only the last item
- * in the list is used. Sample types are "US Collegiate", "USA Dance, Inc",
- * "NDCA", etc
- * @returns array structured array listing the styles in order
- * @todo handle multi-type competitions better
- * @access public
- */
- function getCanStyles($compTypes)
- {
- $useType=$compTypes[count($compTypes)-1];
- $query =<<<END_QUERY
- SELECT stylename, displayorder, eventfullprefix,
- eventshortprefix, styleabbreviation
- FROM cannonical_styles WHERE comptype='$useType' ORDER BY displayorder;
- END_QUERY; $result = $this->query($query);
- $num = $result->numrows();
- for ($i=0;$i<$num;$i++)
- {
- list($style,$order,$full,$short,$abbrev) = $result->getRowAt($i);
- $styles[$order]=array("Name"=>$style,
- "Short"=>$short,
- "Full"=>$full,
- "Abbrev"=>$abbrev);
- }
- return $styles;
- }
- }
- ?>
Documentation generated on Tue, 25 Apr 2006 13:08:31 -0400 by phpDocumentor 1.3.0RC3