PEPr
[ class tree: PEPr ] [ index: PEPr ] [ all elements ]

Source for file pepr-pplink.php

Documentation is available at pepr-pplink.php

  1. <?php
  2. /**
  3.  * Establishes the procedures, objects and variables used throughout PEPr.
  4.  *
  5.  * The <var>$proposalTypeMap</var> arrays is defined here.
  6.  *
  7.  * NOTE: Proposal constants are defined in pearweb/include/pear-config.php.
  8.  *
  9.  * This source file is subject to version 3.0 of the PHP license,
  10.  * that is bundled with this package in the file LICENSE, and is
  11.  * available through the world-wide-web at the following URI:
  12.  * http://www.php.net/license/3_0.txt.
  13.  * If you did not receive a copy of the PHP license and are unable to
  14.  * obtain it through the world-wide-web, please send a note to
  15.  * license@php.net so we can mail you a copy immediately.
  16.  *
  17.  * @category  pearweb
  18.  * @package   PEPr
  19.  * @author    Tobias Schlitt <toby@php.net>
  20.  * @author    Daniel Convissor <danielc@php.net>
  21.  * @copyright Copyright (c) 1997-2005 The PHP Group
  22.  * @license   http://www.php.net/license/3_0.txt  PHP License
  23.  * @version   $Id: pepr-pplink.php 309394 2011-03-18 15:52:40Z till $
  24.  */
  25.  
  26. global $proposalTypeMap;
  27. $proposalTypeMap = array(
  28.                          'pkg_file'             => "PEAR package file (.tgz)",
  29.                          'pkg_source'           => "Package source file (.phps/.htm)",
  30.                          'pkg_example'          => "Package example (.php)",
  31.                          'pkg_example_source'   => "Package example source (.phps/.htm)",
  32.                          'pkg_doc'              => "Package documentation");
  33.  
  34. class ppLink
  35. {
  36.     var $pkg_prop_id;
  37.     var $type;
  38.     var $url;
  39.  
  40.     function __construct($dbhResArr)
  41.     {
  42.         foreach ($dbhResArr as $name => $value{
  43.             $this->$name $value;
  44.         }
  45.     }
  46.  
  47.     function &getAll(&$dbh$proposalId)
  48.     {
  49.         $sql 'SELECT * FROM package_proposal_links WHERE pkg_prop_id = ? ORDER BY type';
  50.         $res $dbh->query($sqlarray($proposalId));
  51.         if (DB::isError($res)) {
  52.             return $res;
  53.         }
  54.         $links = array();
  55.         while ($set $res->fetchRow(DB_FETCHMODE_ASSOC)) {
  56.             $links[= new ppLink($set);
  57.         }
  58.         return $links;
  59.     }
  60.  
  61.     function deleteAll($dbh$proposalId)
  62.     {
  63.         $sql 'DELETE FROM package_proposal_links WHERE pkg_prop_id = ?';
  64.         $res $dbh->query($sqlarray($proposalId));
  65.         return $res;
  66.     }
  67.  
  68.     function store($dbh$proposalId)
  69.     {
  70.         $sql "INSERT INTO package_proposal_links (pkg_prop_id, type, url)
  71.                     VALUES (".$proposalId.", ".$dbh->quoteSmart($this->type).", ".$dbh->quoteSmart($this->url).")";
  72.         $res $dbh->query($sql);
  73.         return $res;
  74.     }
  75.  
  76.     function getType($humanReadable = false)
  77.     {
  78.         if ($humanReadable{
  79.             return $GLOBALS['proposalTypeMap'][$this->type];
  80.         }
  81.  
  82.         return $this->type;
  83.     }
  84. }

Documentation generated on Mon, 11 Mar 2019 15:44:05 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.