Source for file projects.php

Documentation is available at projects.php

  1. <?php
  2. /**
  3. * Edit/create/delete projects
  4. *
  5. @author    Stuart Prescott
  6. @copyright  Copyright Stuart Prescott
  7. @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  8. @version    $Id$
  9. @package    Bumblebee
  10. @subpackage Actions
  11. *
  12. *  path (bumblebee root)/inc/actions/projects.php
  13. */
  14.  
  15. /** Load ancillary functions */
  16. require_once 'inc/typeinfo.php';
  17.  
  18. /** project object */
  19. require_once 'inc/bb/project.php';
  20. /** list of choices */
  21. require_once 'inc/formslib/anchortablelist.php';
  22. /** parent object */
  23. require_once 'inc/actions/actionaction.php';
  24.  
  25. /**
  26. * Edit/create/delete projects
  27. *
  28. @package    Bumblebee
  29. @subpackage Actions
  30. */
  31. class ActionProjects extends ActionAction {
  32.  
  33.   /**
  34.   * Initialising the class
  35.   *
  36.   * @param  BumblebeeAuth $auth  Authorisation object
  37.   * @param  array $pdata   extra state data from the call path
  38.   * @return void nothing
  39.   */
  40.   function ActionProjects($auth$pdata{
  41.     parent::ActionAction($auth$pdata);
  42.     $this->mungeInputData();
  43.   }
  44.  
  45.   function go({
  46.     if (isset($this->PD['id'])) {
  47.       $this->select(issetSet($this->PD'showdeleted'false));
  48.     elseif (isset($this->PD['delete'])) {
  49.       if ($this->readOnly{
  50.         $this->readOnlyError();
  51.       else {
  52.         $this->delete();
  53.       }
  54.     else {
  55.       if ($this->readOnly$this->_dataCleanse('id');
  56.       $this->edit();
  57.     }
  58.     echo "<br /><br /><a href='".makeURL('projects')."'>".T_('Return to project list')."</a>";
  59.   }
  60.  
  61.   function select($deleted=false{
  62.     $select new AnchorTableList(T_('Projects')T_('Select which project to view'));
  63.     $select->deleted $deleted;
  64.     $select->connectDB('projects'array('id''name''longname'));
  65.     $select->list->prepend(array('-1'T_('Create new project')));
  66.     $select->list->append(array('showdeleted'T_('Show deleted projects')));
  67.     $select->hrefbase makeURL('projects'array('id'=>'__id__'));
  68.     $select->setFormat('id''%s'array('name')' %50.50s'array('longname'));
  69.     echo $select->display();
  70.   }
  71.  
  72.   function edit({
  73.     $project new Project($this->PD['id']);
  74.     $project->update($this->PD);
  75.     $project->checkValid();
  76.     echo $this->reportAction($project->sync(),
  77.           array(
  78.               STATUS_OK =>   ($this->PD['id'T_('Project created'T_('Project updated')),
  79.               STATUS_ERR =>  T_('Project could not be changed:').' '.$project->errorMessage
  80.           )
  81.         );
  82.     echo $project->display();
  83.     if ($project->id 0{
  84.       $submit T_('Create new project');
  85.       $delete '0';
  86.     else {
  87.       $submit T_('Update entry');
  88.       $delete $project->isDeleted T_('Undelete entry'T_('Delete entry');
  89.     }
  90.     echo "<input type='submitname='submitvalue='$submit' />";
  91.     if ($deleteecho "<input type='submitname='deletevalue='$delete' />";
  92.   }
  93.  
  94.   function delete({
  95.     $project new Project($this->PD['id']);
  96.     echo $this->reportAction($project->delete(),
  97.               array(
  98.                   STATUS_OK =>   $project->isDeleted T_('Project undeleted'T_('Project deleted'),
  99.                   STATUS_ERR =>  T_('Project could not be deleted:')
  100.                                  .'<br/><br/>'.$project->errorMessage
  101.               )
  102.             );
  103.   }
  104.  
  105. }
  106.  
  107. ?>

Documentation generated on Tue, 06 Mar 2007 10:01:55 +0000 by phpDocumentor 1.3.0