Ejemplo n.º 1
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Make a new Template object
     $path = $this->pathModuleRoot . 'templates/';
     $this->template = new Template($path);
     // Store the Name of thie series:
     $seriesManager = new RowManager_SeriesManager($this->seriesID);
     $this->template->set('seriesName', $seriesManager->getTitle());
     // store the field names being displayed
     $fieldNames = explode(',', page_SeasonList::DISPLAY_FIELDS);
     $this->template->set('dataFieldList', $fieldNames);
     // store the link values
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     $this->template->set('linkValues', $this->linkValues);
     // store the Link Column information
     $title = 'Episodes';
     $label = "view";
     $link = $this->linkValues['linkEpisode'];
     $fieldName = 'season_id';
     $this->addLinkColumn($title, $label, $link, $fieldName);
     $this->template->set('linkColumns', $this->linkColumns);
     // store Data to display as an Array
     $this->template->set('dataList', $this->listManager->getDataList());
     // now load and return the template HTML
     return $this->template->fetch('07_page_SeasonList.tpl');
 }
/** 
 * loadData()
 *
 * Here we load up all the data we need to run this web page.
 */
function loadData()
{
    global $seriesArray;
    global $editLink;
    global $displayFieldList;
    global $displayFields;
    // Get a list of all the series entries in the table
    $seriesArray = array();
    $seriesManager = new RowManager_SeriesManager();
    // get all the rows in this table
    $list = $seriesManager->getListIterator();
    // for each row
    $list->setFirst();
    while ($series = $list->getNext()) {
        // the Row manager can return an array of columnName=>values
        $allValues = $series->getArrayOfValues();
        // now go through each element in our displayFields array and pull
        // out the ones we are interested in displaying
        $displayValues = array();
        for ($indx = 0; $indx < count($displayFields); $indx++) {
            $key = $displayFields[$indx];
            $displayValues[$key] = $allValues[$key];
        }
        // Now store the ARRAY of display data into our final display array
        $seriesArray[$series->getID()] = $displayValues;
    }
    // next row
    // Define the Edit link:
    // NOTE: how it ends with "seriesID="
    // it is intened for this link to be concatened with the series_id value in the
    // above array
    $editLink = 'ex_SeriesEdit_array.php?seriesID=';
}
/** 
 * loadData()
 *
 * Here we load up all the data we need to run this web page.
 */
function loadData()
{
    global $seriesID;
    global $seriesManager;
    global $formValues;
    global $formFields;
    // read in the expected seriesID from the querystring ...
    // if not set, default to -1
    $seriesID = -1;
    if (isset($_REQUEST['seriesID'])) {
        $seriesID = $_REQUEST['seriesID'];
    }
    // Load in the requested SeriesManager from the DB
    $seriesManager = new RowManager_SeriesManager($seriesID);
    // initialize the formValues from the data in the RowManager
    $formValues = $seriesManager->getArrayOfValues();
    // if the form was submitted, then load Form Data:
    if (isset($_REQUEST['submit'])) {
        // step through each field
        for ($indx = 0; $indx < count($formFields); $indx++) {
            $key = $formFields[$indx];
            // if field was found in form submission then
            if (isset($_REQUEST[$key])) {
                // update formValues with data from form
                $formValues[$key] = $_REQUEST[$key];
            }
        }
    }
}
Ejemplo n.º 4
0
 /**
  * function __construct
  * <pre>
  * Initialize the object.
  * </pre>
  * @param $pathModuleRoot [STRING] The path to the module's root dir.
  * @param $viewer [OBJECT] The viewer object.
  * @param $sortBy [STRING] Field data to sort listManager by.
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $sortBy)
 {
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     if ($sortBy == '') {
         $sortBy = 'series_title';
     }
     $seriesManager = new RowManager_SeriesManager();
     $seriesManager->setSortOrder($sortBy);
     $this->listManager = $seriesManager->getListIterator();
 }
Ejemplo n.º 5
0
/** 
 * loadData()
 *
 * Here we load up all the data we need to run this web page.
 */
function loadData()
{
    global $seriesArray;
    global $editLink;
    // Get a list of all the series entries in the table
    $seriesArray = array();
    $seriesManager = new RowManager_SeriesManager();
    // get all the rows in this table
    $list = $seriesManager->getListIterator();
    // for each row
    $list->setFirst();
    while ($series = $list->getNext()) {
        $seriesArray[$series->getID()] = $series->getTitle();
    }
    // next row
    // Define the Edit link:
    // NOTE: how it ends with "seriesID="
    // it is intened for this link to be concatened with the series_id value in the
    // above array
    $editLink = 'ex_SeriesEdit.php?seriesID=';
}
Ejemplo n.º 6
0
$pathFile = 'General/gen_Includes.php';
$extension = '';
// Attempt to find proper directory from current page to Root ...
$numAttempts = 0;
while (!file_exists($extension . $pathFile) && $numAttempts < 5) {
    $extension = '../' . $extension;
    $numAttempts++;
}
require $extension . $pathFile;
require 'SeriesManager.php';
/***
 *** Load All Data needed to make the list
 ***/
// Get a list of all the series entries in the table
$seriesArray = array();
$seriesManager = new RowManager_SeriesManager();
// get all the rows in this table
$list = $seriesManager->getListIterator();
// for each row
$list->setFirst();
while ($series = $list->getNext()) {
    $seriesArray[$series->getID()] = $series->getTitle();
}
// next row
// Define the Edit link:
// NOTE: how it ends with "seriesID="
// it is intened for this link to be concatened with the series_id value in the
// above array
$editLink = 'ex_SeriesEdit.php?seriesID=';
/***
 *** get HTML for display
Ejemplo n.º 7
0
    $extension = '../' . $extension;
    $numAttempts++;
}
require $extension . $pathFile;
require 'SeriesManager.php';
/***
 *** Load All Data needed to carry out Edit Operation
 ***/
// read in the expected seriesID from the querystring ...
// if not set, default to -1
$seriesID = -1;
if (isset($_REQUEST['seriesID'])) {
    $seriesID = $_REQUEST['seriesID'];
}
// Load in the requested SeriesManager from the DB
$seriesManager = new RowManager_SeriesManager($seriesID);
// if the form was submitted, then load Form Data:
if (isset($_REQUEST['submit'])) {
    $newTitle = $_REQUEST['title'];
}
// set default error Message
$titleError = '';
/***
 *** Process the Data
 ***/
if (isset($_REQUEST['submit'])) {
    if ($newTitle != '') {
        $seriesManager->setTitle($newTitle);
        $seriesManager->updateDBTable();
    } else {
        $titleError = 'Title can\'t be empty';
Ejemplo n.º 8
0
 * This script will attempt to load the 3 RowManagers: SeriesManager, 
 * SeasonManager, and EpisodeManager and create their tables in the DB.
 * 
 */
// load the site objects
$pathFile = 'General/gen_Includes.php';
$extension = '';
// Attempt to find proper directory from current page to Root ...
$numAttempts = 0;
while (!file_exists($extension . $pathFile) && $numAttempts < 5) {
    $extension = '../' . $extension;
    $numAttempts++;
}
require $extension . $pathFile;
/*
 * This script expects that these files are in the same directory 
 */
require 'SeriesManager.php';
require 'SeasonManager.php';
require 'EpisodeManager.php';
// Now create each RowManager and use them to create the DB tables:
$series = new RowManager_SeriesManager();
$series->dropTable();
$series->createTable();
$season = new RowManager_SeasonManager();
$season->dropTable();
$season->createTable();
$episode = new RowManager_EpisodeManager();
$episode->dropTable();
$episode->createTable();
echo 'Done!  You should now find these tables in the ' . SITE_DB_NAME . ' database.<br>';
Ejemplo n.º 9
0
if (isset($_REQUEST['Submit'])) {
    // load the site objects
    $pathFile = 'General/gen_Includes.php';
    $extension = '';
    // Attempt to find proper directory from current page to Root ...
    $numAttempts = 0;
    while (!file_exists($extension . $pathFile) && $numAttempts < 5) {
        $extension = '../' . $extension;
        $numAttempts++;
    }
    require $extension . $pathFile;
    /*
     * This script expects that these files are in the same directory 
     */
    require 'SeriesManager.php';
    $series = new RowManager_SeriesManager();
    $series->setTitle($_REQUEST['Title']);
    $series->createNewEntry();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FormExample</title>
</head>
<body>
<h1>Enter A new Series:</h1>
<form action="" method="post">
Name: <input name="title" type="text"><br>