Source for file SequenceView.inc
Documentation is available at SequenceView.inc
require_once $config->get('sysRoot'). 'alpha/model/types/Sequence.inc';
require_once $config->get('sysRoot'). 'alpha/view/AlphaView.inc';
* The rendering class for the Sequence class
* @author John Collins <dev@alphaframework.org>
* @version $Id: SequenceView.inc 1341 2011-03-17 15:02:02Z johnc $
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
* @copyright Copyright (c) 2011, John Collins (founder of Alpha Framework).
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the
* following conditions are met:
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
* * Neither the name of the Alpha Framework nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
private static $logger = null;
* @throws IllegalArguementException
self::$logger = new Logger('SequenceView');
self::$logger->debug('>>__construct(BO=['. var_export($BO, true). '])');
self::$logger->debug('<<__construct');
* @param array $fields Hash array of HTML fields to pass to the template.
public function listView($fields= array()) {
self::$logger->debug('>>listView(fields=['. var_export($fields, true). '])');
$this->before_listView_callback();
$fields['formAction'] = $_SERVER['REQUEST_URI'];
// work out how many columns will be in the table
$reflection = new ReflectionClass(get_class($this->BO));
$properties = array_keys($reflection->getDefaultProperties());
$fields['colCount'] = 1+ count(array_diff($properties, $this->BO->getDefaultAttributes(), $this->BO->getTransientAttributes()));
// get the class attributes
$properties = $reflection->getProperties();
foreach($properties as $propObj) {
$propName = $propObj->name;
// skip over password fields
$property = $this->BO->getPropObject($propName);
if(!($property instanceof String && $property->checkIsPassword())) {
if (!in_array($propName, $this->BO->getDefaultAttributes()) && !in_array($propName, $this->BO->getTransientAttributes())) {
$html .= ' <th>'. $this->BO->getDataLabel($propName). '</th>';
$html .= ' <th>'. $this->BO->getDataLabel($propName). '</th>';
$fields['colCount'] = $fields['colCount']- 1;
$fields['formHeadings'] = $html;
foreach($properties as $propObj) {
$propName = $propObj->name;
$property = $this->BO->getPropObject($propName);
if(!($property instanceof String && $property->checkIsPassword())) {
if (!in_array($propName, $this->BO->getDefaultAttributes()) && !in_array($propName, $this->BO->getTransientAttributes())) {
$propClass = get_class($this->BO->getPropObject($propName));
if ($propClass == 'Text') {
$html .= ' <td> '. substr($text, 0, 70). '...</td>';
$html .= ' <td> '. $text. '</td>';
}elseif($propClass == 'DEnum') {
$html .= ' <td> '. $this->BO->getPropObject($propName)->getDisplayValue(). '</td>';
$html .= ' <td> '. $this->BO->get($propName). '</td>';
$html .= ' <td> '. $this->BO->getOID(). '</td>';
$fields['formFields'] = $html;
if(strpos($_SERVER['REQUEST_URI'], '/tk/') !== false) {
$fields['viewButton'] = $button->render();
$button = new Button("document.location = '". $this->BO->get('URL'). "';", 'View', 'viewBut');
$fields['viewButton'] = $button->render();
// supressing the edit/delete buttons for Sequences
$fields['adminButtons'] = '';
// buffer security fields to $formSecurityFields variable
$this->after_listView_callback();
self::$logger->debug('<<listView');
* @param array $fields Hash array of HTML fields to pass to the template.
self::$logger->debug('>>detailedView(fields=['. var_export($fields, true). '])');
$this->before_detailedView_callback();
// we may want to display the OID regardless of class
$fields['OIDLabel'] = $this->BO->getDataLabel('OID');
$fields['OID'] = $this->BO->getOID();
// buffer form fields to $formFields
$button = new Button('history.back()', 'Back', 'backBut');
$fields['backButton'] = $button->render();
$fields['adminButtons'] = '';
$this->after_detailedView_callback();
self::$logger->debug('<<detailedView');
|