Overview

Packages

  • JAMA
  • None
  • PHP
  • PHPExcel
    • CachedObjectStorage
    • Calculation
    • Cell
    • Chart
      • Renderer
    • Reader
      • Excel2007
      • Excel5
    • RichText
    • Settings
    • Shared
      • Escher
      • OLE
      • Trend
      • ZipArchive
    • Style
    • Worksheet
      • Drawing
    • Writer
      • 2007
      • CSV
      • Excel2007
      • Excel5
      • HTML
      • PDF

Classes

  • CholeskyDecomposition
  • Dao
  • DateTime
  • DateTimeZone
  • DOMNode
  • EigenvalueDecomposition
  • Elemento
  • Historial
  • Irradiacion
  • Latitud
  • MotorPhp
  • Panel
  • PclZip
  • Periodo
  • PHPExcel
  • PHPExcel_Autoloader
  • PHPExcel_Best_Fit
  • PHPExcel_CachedObjectStorage_APC
  • PHPExcel_CachedObjectStorage_CacheBase
  • PHPExcel_CachedObjectStorage_DiscISAM
  • PHPExcel_CachedObjectStorage_Igbinary
  • PHPExcel_CachedObjectStorage_Memcache
  • PHPExcel_CachedObjectStorage_Memory
  • PHPExcel_CachedObjectStorage_MemoryGZip
  • PHPExcel_CachedObjectStorage_MemorySerialized
  • PHPExcel_CachedObjectStorage_PHPTemp
  • PHPExcel_CachedObjectStorage_SQLite
  • PHPExcel_CachedObjectStorage_SQLite3
  • PHPExcel_CachedObjectStorage_Wincache
  • PHPExcel_CachedObjectStorageFactory
  • PHPExcel_CalcEngine_CyclicReferenceStack
  • PHPExcel_CalcEngine_Logger
  • PHPExcel_Calculation
  • PHPExcel_Calculation_Database
  • PHPExcel_Calculation_DateTime
  • PHPExcel_Calculation_Engineering
  • PHPExcel_Calculation_ExceptionHandler
  • PHPExcel_Calculation_Financial
  • PHPExcel_Calculation_FormulaParser
  • PHPExcel_Calculation_FormulaToken
  • PHPExcel_Calculation_Function
  • PHPExcel_Calculation_Functions
  • PHPExcel_Calculation_Logical
  • PHPExcel_Calculation_LookupRef
  • PHPExcel_Calculation_MathTrig
  • PHPExcel_Calculation_Statistical
  • PHPExcel_Calculation_TextData
  • PHPExcel_Calculation_Token_Stack
  • PHPExcel_Cell
  • PHPExcel_Cell_AdvancedValueBinder
  • PHPExcel_Cell_DataType
  • PHPExcel_Cell_DataValidation
  • PHPExcel_Cell_DefaultValueBinder
  • PHPExcel_Cell_Hyperlink
  • PHPExcel_Chart
  • PHPExcel_Chart_DataSeries
  • PHPExcel_Chart_DataSeriesValues
  • PHPExcel_Chart_Layout
  • PHPExcel_Chart_Legend
  • PHPExcel_Chart_PlotArea
  • PHPExcel_Chart_Renderer_jpgraph
  • PHPExcel_Chart_Title
  • PHPExcel_Comment
  • PHPExcel_DocumentProperties
  • PHPExcel_DocumentSecurity
  • PHPExcel_Exponential_Best_Fit
  • PHPExcel_HashTable
  • PHPExcel_IOFactory
  • PHPExcel_Linear_Best_Fit
  • PHPExcel_Logarithmic_Best_Fit
  • PHPExcel_NamedRange
  • PHPExcel_Polynomial_Best_Fit
  • PHPExcel_Power_Best_Fit
  • PHPExcel_Reader_Abstract
  • PHPExcel_Reader_CSV
  • PHPExcel_Reader_DefaultReadFilter
  • PHPExcel_Reader_Excel2003XML
  • PHPExcel_Reader_Excel2007
  • PHPExcel_Reader_Excel2007_Chart
  • PHPExcel_Reader_Excel2007_Theme
  • PHPExcel_Reader_Excel5
  • PHPExcel_Reader_Excel5_Escher
  • PHPExcel_Reader_Excel5_MD5
  • PHPExcel_Reader_Excel5_RC4
  • PHPExcel_Reader_Gnumeric
  • PHPExcel_Reader_HTML
  • PHPExcel_Reader_OOCalc
  • PHPExcel_Reader_SYLK
  • PHPExcel_ReferenceHelper
  • PHPExcel_RichText
  • PHPExcel_RichText_Run
  • PHPExcel_RichText_TextElement
  • PHPExcel_Settings
  • PHPExcel_Shared_CodePage
  • PHPExcel_Shared_Date
  • PHPExcel_Shared_Drawing
  • PHPExcel_Shared_Escher
  • PHPExcel_Shared_Escher_DgContainer
  • PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  • PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
  • PHPExcel_Shared_Escher_DggContainer
  • PHPExcel_Shared_Escher_DggContainer_BstoreContainer
  • PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
  • PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
  • PHPExcel_Shared_Excel5
  • PHPExcel_Shared_File
  • PHPExcel_Shared_Font
  • PHPExcel_Shared_JAMA_LUDecomposition
  • PHPExcel_Shared_JAMA_Matrix
  • PHPExcel_Shared_JAMA_QRDecomposition
  • PHPExcel_Shared_OLE
  • PHPExcel_Shared_OLE_ChainedBlockStream
  • PHPExcel_Shared_OLE_PPS
  • PHPExcel_Shared_OLE_PPS_File
  • PHPExcel_Shared_OLE_PPS_Root
  • PHPExcel_Shared_OLERead
  • PHPExcel_Shared_PasswordHasher
  • PHPExcel_Shared_String
  • PHPExcel_Shared_TimeZone
  • PHPExcel_Shared_XMLWriter
  • PHPExcel_Shared_ZipArchive
  • PHPExcel_Shared_ZipStreamWrapper
  • PHPExcel_Style
  • PHPExcel_Style_Alignment
  • PHPExcel_Style_Border
  • PHPExcel_Style_Borders
  • PHPExcel_Style_Color
  • PHPExcel_Style_Conditional
  • PHPExcel_Style_Fill
  • PHPExcel_Style_Font
  • PHPExcel_Style_NumberFormat
  • PHPExcel_Style_Protection
  • PHPExcel_Style_Supervisor
  • PHPExcel_Worksheet
  • PHPExcel_Worksheet_AutoFilter
  • PHPExcel_Worksheet_AutoFilter_Column
  • PHPExcel_Worksheet_AutoFilter_Column_Rule
  • PHPExcel_Worksheet_BaseDrawing
  • PHPExcel_Worksheet_CellIterator
  • PHPExcel_Worksheet_ColumnDimension
  • PHPExcel_Worksheet_Drawing
  • PHPExcel_Worksheet_Drawing_Shadow
  • PHPExcel_Worksheet_HeaderFooter
  • PHPExcel_Worksheet_HeaderFooterDrawing
  • PHPExcel_Worksheet_MemoryDrawing
  • PHPExcel_Worksheet_PageMargins
  • PHPExcel_Worksheet_PageSetup
  • PHPExcel_Worksheet_Protection
  • PHPExcel_Worksheet_Row
  • PHPExcel_Worksheet_RowDimension
  • PHPExcel_Worksheet_RowIterator
  • PHPExcel_Worksheet_SheetView
  • PHPExcel_WorksheetIterator
  • PHPExcel_Writer_Abstract
  • PHPExcel_Writer_CSV
  • PHPExcel_Writer_Excel2007
  • PHPExcel_Writer_Excel2007_Chart
  • PHPExcel_Writer_Excel2007_Comments
  • PHPExcel_Writer_Excel2007_ContentTypes
  • PHPExcel_Writer_Excel2007_DocProps
  • PHPExcel_Writer_Excel2007_Drawing
  • PHPExcel_Writer_Excel2007_Rels
  • PHPExcel_Writer_Excel2007_RelsRibbon
  • PHPExcel_Writer_Excel2007_RelsVBA
  • PHPExcel_Writer_Excel2007_StringTable
  • PHPExcel_Writer_Excel2007_Style
  • PHPExcel_Writer_Excel2007_Theme
  • PHPExcel_Writer_Excel2007_Workbook
  • PHPExcel_Writer_Excel2007_Worksheet
  • PHPExcel_Writer_Excel2007_WriterPart
  • PHPExcel_Writer_Excel5
  • PHPExcel_Writer_Excel5_BIFFwriter
  • PHPExcel_Writer_Excel5_Escher
  • PHPExcel_Writer_Excel5_Font
  • PHPExcel_Writer_Excel5_Parser
  • PHPExcel_Writer_Excel5_Workbook
  • PHPExcel_Writer_Excel5_Worksheet
  • PHPExcel_Writer_Excel5_Xf
  • PHPExcel_Writer_HTML
  • PHPExcel_Writer_PDF
  • PHPExcel_Writer_PDF_Core
  • PHPExcel_Writer_PDF_DomPDF
  • PHPExcel_Writer_PDF_mPDF
  • PHPExcel_Writer_PDF_tcPDF
  • Provincia
  • Radiacion
  • SingularValueDecomposition
  • Sistema
  • trendClass
  • xajax
  • xajaxArgumentManager
  • xajaxCallableObject
  • xajaxCallableObjectPlugin
  • xajaxControl
  • xajaxControlContainer
  • xajaxCustomRequest
  • xajaxCustomResponse
  • xajaxEvent
  • xajaxEventPlugin
  • xajaxFunctionPlugin
  • xajaxIncludeClientScriptPlugin
  • xajaxLanguageManager
  • xajaxPlugin
  • xajaxPluginManager
  • xajaxRequest
  • xajaxRequestPlugin
  • xajaxResponse
  • xajaxResponseManager
  • xajaxResponsePlugin
  • xajaxScriptPlugin
  • xajaxUserFunction
  • XMLWriter

Interfaces

  • DateTimeInterface
  • Iterator
  • PHPExcel_CachedObjectStorage_ICache
  • PHPExcel_Cell_IValueBinder
  • PHPExcel_IComparable
  • PHPExcel_Reader_IReader
  • PHPExcel_Reader_IReadFilter
  • PHPExcel_RichText_ITextElement
  • PHPExcel_Writer_IWriter
  • Throwable
  • Traversable

Exceptions

  • Exception
  • PHPExcel_Calculation_Exception
  • PHPExcel_Chart_Exception
  • PHPExcel_Exception
  • PHPExcel_Reader_Exception
  • PHPExcel_Writer_Exception

Functions

  • acosh
  • agregar_elemento
  • asinh
  • atanh
  • borrar_elementos
  • borrar_gdm_ab
  • borrar_irradiacion
  • borrar_latitud
  • borrar_panel
  • borrar_periodo
  • borrar_pmp_min_pmp_max
  • borrar_radiacion
  • borrar_resumen
  • borrar_sistema
  • borrar_sombra
  • gdm_ab
  • grabar_resumen
  • historial
  • hypo
  • irradiacion
  • JAMAError
  • latitud
  • limpiar_historial
  • login
  • mb_str_replace
  • mostrar_energia_total_ch
  • mostrar_panel_md_th
  • mostrar_panel_th
  • mostrar_radiacion_md_th
  • mostrar_radiacion_th
  • mostrar_resumen_th
  • panel
  • PclZipUtilCopyBlock
  • PclZipUtilOptionText
  • PclZipUtilPathInclusion
  • PclZipUtilPathReduction
  • PclZipUtilRename
  • PclZipUtilTranslateWinPath
  • periodo
  • pmp_min_pmp_max
  • preparar_panel
  • preparar_radiacion
  • preparar_radiacion_media
  • radiacion
  • resumen
  • sistema
  • sombra
  • xajaxCompressFile
  • xajaxErrorHandler
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
  1: <?php
  2: /*
  3:     File: xajaxControl.inc.php
  4: 
  5:     Contains the base class for all controls.
  6: 
  7:     Title: xajaxControl class
  8: 
  9:     Please see <copyright.inc.php> for a detailed description, copyright
 10:     and license information.
 11: */
 12: 
 13: /*
 14:     @package xajax
 15:     @version $Id: xajaxControl.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
 16:     @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
 17:     @copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White  & J. Max Wilson
 18:     @license http://www.xajaxproject.org/bsd_license.txt BSD License
 19: */
 20: 
 21: require_once('xajaxRequest.inc.php');
 22: 
 23: /*
 24:     Constant: XAJAX_HTML_CONTROL_DOCTYPE_FORMAT
 25:     
 26:     Defines the doctype of the current document; this will effect how the HTML is formatted
 27:     when the html control library is used to construct html documents and fragments.  This can
 28:     be one of the following values:
 29:     
 30:     'XHTML' - (default)  Typical effects are that certain elements are closed with '/>'
 31:     'HTML' - Typical differences are that closing tags for certain elements cannot be '/>'
 32: */
 33: if (false == defined('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT')) define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'XHTML');
 34: 
 35: /*
 36:     Constant: XAJAX_HTML_CONTROL_DOCTYPE_VERSION
 37: */
 38: if (false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VERSION')) define('XAJAX_HTML_CONTROL_DOCTYPE_VERSION', '1.0');
 39: 
 40: /*
 41:     Constant: XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION
 42: */
 43: if (false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION')) define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
 44: 
 45: 
 46: define('XAJAX_DOMRESPONSE_APPENDCHILD', 100);
 47: define('XAJAX_DOMRESPONSE_INSERTBEFORE', 101);
 48: define('XAJAX_DOMRESPONSE_INSERTAFTER', 102);
 49: /*
 50:     Class: xajaxControl
 51: 
 52:     The base class for all xajax enabled controls.  Derived classes will generate the
 53:     HTML and javascript code that will be sent to the browser via <xajaxControl->printHTML>
 54:     or sent to the browser in a <xajaxResponse> via <xajaxControl->getHTML>.
 55: */
 56: class xajaxControl
 57: {
 58:     /*
 59:         String: sTag
 60:     */
 61:     protected $sTag;
 62:     
 63:     /*
 64:         Boolean: sEndTag
 65:         
 66:         'required' - (default) Indicates the control must have a full end tag
 67:         'optional' - The control may have an abbr. begin tag or a full end tag
 68:         'forbidden' - The control must have an abbr. begin tag and no end tag
 69:     */
 70:     protected $sEndTag;
 71:     
 72:     /*
 73:         Array: aAttributes
 74:         
 75:         An associative array of attributes that will be used in the generation
 76:         of the HMTL code for this control.
 77:     */
 78:     protected $aAttributes;
 79:     
 80:     /*
 81:         Array: aEvents
 82:         
 83:         An associative array of events that will be assigned to this control.  Each
 84:         event declaration will include a reference to a <xajaxRequest> object; it's
 85:         script will be extracted using <xajaxRequest->printScript> or 
 86:         <xajaxRequest->getScript>.
 87:     */
 88:     protected $aEvents;
 89:     
 90:     /*
 91:         String: sClass
 92:         
 93:         Contains a declaration of the class of this control.  %inline controls do not 
 94:         need to be indented, %block controls should be indented.
 95:     */
 96:     protected $sClass;
 97: 
 98:     /*
 99:         Function: xajaxControl
100:         
101:         Parameters:
102:         
103:         $aConfiguration - (array):  An associative array that contains a variety
104:             of configuration options for this <xajaxControl> object.
105:         
106:         Note:
107:         This array may contain the following entries:
108:         
109:         'attributes' - (array):  An associative array containing attributes
110:             that will be passed to the <xajaxControl->setAttribute> function.
111:         
112:         'children' - (array):  An array of <xajaxControl> derived objects that
113:             will be the children of this control.
114:     */
115:     protected function __construct($sTag, $aConfiguration=array())
116:     {
117:         $this->sTag = $sTag;
118: 
119:         $this->clearAttributes();
120:                 
121:         if (isset($aConfiguration['attributes']))
122:             if (is_array($aConfiguration['attributes']))
123:                 foreach ($aConfiguration['attributes'] as $sKey => $sValue)
124:                     $this->setAttribute($sKey, $sValue);
125: 
126:         $this->clearEvents();
127:         
128:         if (isset($aConfiguration['event']))
129:             call_user_func_array(
130:                 array($this, 'setEvent'), 
131:                 $aConfiguration['event']
132:                 );
133:         
134:         else if (isset($aConfiguration['events']))
135:             if (is_array($aConfiguration['events']))
136:                 foreach ($aConfiguration['events'] as $aEvent)
137:                     call_user_func_array(
138:                         array($this, 'setEvent'), 
139:                         $aEvent
140:                         );
141:         
142:         $this->sClass = '%block';
143:         $this->sEndTag = 'forbidden';
144:     }
145:     
146:     /*
147:         Function: getClass
148:         
149:         Returns the *adjusted* class of the element
150:     */
151:     public function getClass()
152:     {
153:         return $this->sClass;
154:     }
155: 
156:     /*
157:         Function: clearAttributes
158:         
159:         Removes all attributes assigned to this control.
160:     */
161:     public function clearAttributes()
162:     {
163:         $this->aAttributes = array();
164:     }
165: 
166:     /*
167:         Function: setAttribute
168:         
169:         Call to set various control specific attributes to be included in the HTML
170:         script that is returned when <xajaxControl->printHTML> or <xajaxControl->getHTML>
171:         is called.
172:         
173:         Parameters:
174:             $sName - (string): The attribute name to set the value.
175:             $sValue - (string): The value to be set.
176:     */
177:     public function setAttribute($sName, $sValue)
178:     {
179: //SkipDebug
180:         if (class_exists('clsValidator'))
181:         {
182:             $objValidator = clsValidator::getInstance();
183:             if (false == $objValidator->attributeValid($this->sTag, $sName)) {
184:                 $objLanguageManager = xajaxLanguageManager::getInstance();
185:                 trigger_error(
186:                     $objLanguageManager->getText('XJXCTL:IAERR:01') 
187:                     . $sName 
188:                     . $objLanguageManager->getText('XJXCTL:IAERR:02') 
189:                     . $this->sTag 
190:                     . $objLanguageManager->getText('XJXCTL:IAERR:03')
191:                     , E_USER_ERROR
192:                     );
193:             }
194:         }
195: //EndSkipDebug
196: 
197:         $this->aAttributes[$sName] = $sValue;
198:     }
199:     
200:     /*
201:         Function: getAttribute
202:         
203:         Call to obtain the value currently associated with the specified attribute
204:         if set.
205:         
206:         Parameters:
207:         
208:         sName - (string): The name of the attribute to be returned.
209:         
210:         Returns:
211:         
212:         mixed : The value associated with the attribute, or null.
213:     */
214:     public function getAttribute($sName)
215:     {
216:         if (false == isset($this->aAttributes[$sName]))
217:             return null;
218:         
219:         return $this->aAttributes[$sName];
220:     }
221:     
222:     /*
223:         Function: clearEvents
224:         
225:         Clear the events that have been associated with this object.
226:     */
227:     public function clearEvents()
228:     {
229:         $this->aEvents = array();
230:     }
231: 
232:     /*
233:         Function: setEvent
234:         
235:         Call this function to assign a <xajaxRequest> object as the handler for
236:         the specific DOM event.  The <xajaxRequest->printScript> function will 
237:         be called to generate the javascript for this request.
238:         
239:         Parameters:
240:         
241:         sEvent - (string):  A string containing the name of the event to be assigned.
242:         objRequest - (xajaxRequest object):  The <xajaxRequest> object to be associated
243:             with the specified event.
244:         aParameters - (array, optional):  An array containing parameter declarations
245:             that will be passed to this <xajaxRequest> object just before the javascript
246:             is generated.
247:         sBeforeRequest - (string, optional):  a string containing a snippet of javascript code
248:             to execute prior to calling the xajaxRequest function
249:         sAfterRequest - (string, optional):  a string containing a snippet of javascript code
250:             to execute after calling the xajaxRequest function
251:     */
252:     public function setEvent($sEvent, $objRequest, $aParameters=array(), $sBeforeRequest='', $sAfterRequest='; return false;')
253:     {
254: //SkipDebug
255:         if (false == ($objRequest instanceof xajaxRequest)) {
256:             $objLanguageManager = xajaxLanguageManager::getInstance();
257:             trigger_error(
258:                 $objLanguageManager->getText('XJXCTL:IRERR:01')
259:                 . $this->backtrace()
260:                 , E_USER_ERROR
261:                 );
262:         }
263: 
264:         if (class_exists('clsValidator')) {
265:             $objValidator = clsValidator::getInstance();
266:             if (false == $objValidator->attributeValid($this->sTag, $sEvent)) {
267:                 $objLanguageManager = xajaxLanguageManager::getInstance();
268:                 trigger_error(
269:                     $objLanguageManager->getText('XJXCTL:IEERR:01') 
270:                     . $sEvent 
271:                     . $objLanguageManager->getText('XJXCTL:IEERR:02') 
272:                     . $this->sTag 
273:                     . $objLanguageManager->getText('XJXCTL:IEERR:03')
274:                     , E_USER_ERROR
275:                     );
276:             }
277:         }
278: //EndSkipDebug
279: 
280:         $objRequest = clone($objRequest);
281: 
282:         $this->aEvents[$sEvent] = array(
283:             $objRequest,
284:             $aParameters,
285:             $sBeforeRequest,
286:             $sAfterRequest
287:             );
288:     }
289: 
290:     /*
291:         Function: getHTML
292:         
293:         Generates and returns the HTML representation of this control and 
294:         it's children.
295:         
296:         Returns:
297:         
298:         string : The HTML representation of this control.
299:     */
300:     public function getHTML($bFormat=false)
301:     {
302:         ob_start();
303:         if ($bFormat)
304:             $this->printHTML();
305:         else
306:             $this->printHTML(false);
307:         return ob_get_clean();
308:     }
309:     
310:     /*
311:         Function: printHTML
312:         
313:         Generates and prints the HTML representation of this control and 
314:         it's children.
315:         
316:         Returns:
317:         
318:         string : The HTML representation of this control.
319:     */
320:     public function printHTML($sIndent='')
321:     {
322: //SkipDebug
323:         if (class_exists('clsValidator'))
324:         {
325:             $objValidator = clsValidator::getInstance();
326:             $sMissing = '';
327:             if (false == $objValidator->checkRequiredAttributes($this->sTag, $this->aAttributes, $sMissing)) {
328:                 $objLanguageManager = xajaxLanguageManager::getInstance();
329:                 trigger_error(
330:                     $objLanguageManager->getText('XJXCTL:MAERR:01') 
331:                     . $sMissing
332:                     . $objLanguageManager->getText('XJXCTL:MAERR:02') 
333:                     . $this->sTag 
334:                     . $objLanguageManager->getText('XJXCTL:MAERR:03')
335:                     , E_USER_ERROR
336:                     );
337:             }
338:         }
339: //EndSkipDebug
340: 
341:         $sClass = $this->getClass();
342:         
343:         if ('%inline' != $sClass)
344:             // this odd syntax is necessary to detect request for no formatting
345:             if (false === (false === $sIndent))
346:                 echo $sIndent;
347:             
348:         echo '<';
349:         echo $this->sTag;
350:         echo ' ';
351:         $this->_printAttributes();
352:         $this->_printEvents();
353:         
354:         if ('forbidden' == $this->sEndTag)
355:         {
356:             if ('HTML' == XAJAX_HTML_CONTROL_DOCTYPE_FORMAT)
357:                 echo '>';
358:             else if ('XHTML' == XAJAX_HTML_CONTROL_DOCTYPE_FORMAT)
359:                 echo '/>';
360:             
361:             if ('%inline' != $sClass)
362:                 // this odd syntax is necessary to detect request for no formatting
363:                 if (false === (false === $sIndent))
364:                     echo "\n";
365:                 
366:             return;
367:         }
368:         else if ('optional' == $this->sEndTag)
369:         {
370:             echo '/>';
371:             
372:             if ('%inline' == $sClass)
373:                 // this odd syntax is necessary to detect request for no formatting
374:                 if (false === (false === $sIndent))
375:                     echo "\n";
376:                 
377:             return;
378:         }
379: //SkipDebug
380:         else
381:         {
382:             $objLanguageManager = xajaxLanguageManager::getInstance();
383:             trigger_error(
384:                 $objLanguageManager->getText('XJXCTL:IETERR:01')
385:                 . $this->backtrace()
386:                 , E_USER_ERROR
387:                 );
388:         }
389: //EndSkipDebug
390:     }
391: 
392:     public function getResponse($count, $parent, $flag=XAJAX_DOMRESPONSE_APPENDCHILD)
393:     {
394:         $variable = "xjxElm[{$count}]";
395: 
396:         $response = $this->beginGetResponse($variable, $count);
397:         $this->getResponseAttributes($response, $variable);
398:         $this->getResponseEvents($response, $variable);
399:         $this->endGetResponse($response, $variable, $count, $parent, $flag);
400: 
401:         return $response;
402:     }
403: 
404:     protected function beginGetResponse($variable, $count)
405:     {
406:         $response = new xajaxResponse();
407: 
408:         if ($count == 0)
409:             $response->domStartResponse();
410: 
411:         $response->domCreateElement($variable, $this->sTag);
412: 
413:         return $response;
414:     }
415: 
416:     protected function getResponseAttributes($response, $variable)
417:     {
418:         foreach ($this->aAttributes as $sKey => $sValue)
419:             if ('disabled' != $sKey || 'false' != $sValue)
420:                 $response->domSetAttribute($variable, $sKey, $sValue);
421:     }
422: 
423:     protected function endGetResponse($response, $variable, $count, $parent, $flag)
424:     {
425:         if ($flag == XAJAX_DOMRESPONSE_APPENDCHILD)
426:             $response->domAppendChild($parent, $variable);
427:         else if ($flag == XAJAX_DOMRESPONSE_INSERTBEFORE)
428:             $response->domInsertBefore($parent, $variable);
429:         else if ($flag == XAJAX_DOMRESPONSE_INSERTAFTER)
430:             $response->domInsertAfter($parent, $variable);
431: 
432:         if ($count == 0)
433:             $response->domEndResponse();
434:     }
435: 
436:     protected function getResponseEvents($response, $variable)
437:     {
438:         foreach (array_keys($this->aEvents) as $sKey)
439:         {
440:             $aEvent = $this->aEvents[$sKey];
441:             $objRequest = $aEvent[0];
442:             $aParameters = $aEvent[1];
443:             $sBeforeRequest = $aEvent[2];
444:             $sAfterRequest = $aEvent[3];
445: 
446:             foreach ($aParameters as $aParameter)
447:             {
448:                 $nParameter = $aParameter[0];
449:                 $sType = $aParameter[1];
450:                 $sValue = $aParameter[2];
451:                 $objRequest->setParameter($nParameter, $sType, $sValue);
452:             }
453: 
454:             $objRequest->useDoubleQuote();
455: 
456:             $response->script(
457:                 "{$variable}.{$sKey} = function(evt) { " .
458:                 "if (!evt) var evt = window.event; " .
459:                 $sBeforeRequest .
460:                 $objRequest->getScript() .
461:                 $sAfterRequest .
462:                 " } "
463:                 );
464:         }
465:     }
466: 
467:     protected function _printAttributes()
468:     {
469:         // NOTE: Special case here: disabled='false' does not work in HTML; does work in javascript
470:         foreach ($this->aAttributes as $sKey => $sValue)
471:             if ('disabled' != $sKey || 'false' != $sValue)
472:                 echo "{$sKey}='{$sValue}' ";
473:     }
474: 
475:     protected function _printEvents()
476:     {
477:         foreach (array_keys($this->aEvents) as $sKey)
478:         {
479:             $aEvent = $this->aEvents[$sKey];
480:             $objRequest = $aEvent[0];
481:             $aParameters = $aEvent[1];
482:             $sBeforeRequest = $aEvent[2];
483:             $sAfterRequest = $aEvent[3];
484: 
485:             foreach ($aParameters as $aParameter)
486:             {
487:                 $nParameter = $aParameter[0];
488:                 $sType = $aParameter[1];
489:                 $sValue = $aParameter[2];
490:                 $objRequest->setParameter($nParameter, $sType, $sValue);
491:             }
492: 
493:             $objRequest->useDoubleQuote();
494: 
495:             echo "{$sKey}='{$sBeforeRequest}";
496: 
497:             $objRequest->printScript();
498: 
499:             echo "{$sAfterRequest}' ";
500:         }
501:     }
502: 
503:     public function backtrace()
504:     {
505:         // debug_backtrace was added to php in version 4.3.0
506:         // version_compare was added to php in version 4.0.7
507:         if (0 <= version_compare(PHP_VERSION, '4.3.0'))
508:             return '<div><div>Backtrace:</div><pre>' 
509:                 . print_r(debug_backtrace(), true) 
510:                 . '</pre></div>';
511:         return '';
512:     }
513: }
514: 
515: /*
516:     Class: xajaxControlContainer
517:     
518:     This class is used as the base class for controls that will contain
519:     other child controls.
520: */
521: class xajaxControlContainer extends xajaxControl
522: {
523:     /*
524:         Array: aChildren
525:         
526:         An array of child controls.
527:     */
528:     protected $aChildren;
529: 
530:     /*
531:         Boolean: sChildClass
532:         
533:         Will contain '%inline' if all children are class = '%inline', '%block' if all children are '%block' or
534:         '%flow' if both '%inline' and '%block' elements are detected.
535:     */
536:     protected $sChildClass;
537: 
538:     /*
539:         Function: xajaxControlContainer
540:         
541:         Called to construct and configure this control.
542:         
543:         Parameters:
544:         
545:         aConfiguration - (array):  See <xajaxControl->xajaxControl> for more
546:             information.
547:     */
548:     protected function __construct($sTag, $aConfiguration=array())
549:     {
550:         parent::__construct($sTag, $aConfiguration);
551: 
552:         $this->clearChildren();
553:         
554:         if (isset($aConfiguration['child']))
555:             $this->addChild($aConfiguration['child']);
556: 
557:         else if (isset($aConfiguration['children']))
558:             $this->addChildren($aConfiguration['children']);
559:         
560:         $this->sEndTag = 'required';
561:     }
562:     
563:     /*
564:         Function: getClass
565:         
566:         Returns the *adjusted* class of the element
567:     */
568:     public function getClass()
569:     {
570:         $sClass = xajaxControl::getClass();
571:         
572:         if (0 < count($this->aChildren) && '%flow' == $sClass)
573:             return $this->getContentClass();
574:         else if (0 == count($this->aChildren) || '%inline' == $sClass || '%block' == $sClass)
575:             return $sClass;
576:         
577:         $objLanguageManager = xajaxLanguageManager::getInstance();
578:         trigger_error(
579:             $objLanguageManager->getText('XJXCTL:ICERR:01')
580:             . $this->backtrace()
581:             , E_USER_ERROR
582:             );
583:     }
584:     
585:     /*
586:         Function: getContentClass
587:         
588:         Returns the *adjusted* class of the content (children) of this element
589:     */
590:     public function getContentClass()
591:     {
592:         $sClass = '';
593:         
594:         foreach (array_keys($this->aChildren) as $sKey)
595:         {
596:             if ('' == $sClass)
597:                 $sClass = $this->aChildren[$sKey]->getClass();
598:             else if ($sClass != $this->aChildren[$sKey]->getClass())
599:                 return '%flow';
600:         }
601:         
602:         if ('' == $sClass)
603:             return '%inline';
604:             
605:         return $sClass;
606:     }
607:     
608:     /*
609:         Function: clearChildren
610:         
611:         Clears the list of child controls associated with this control.
612:     */
613:     public function clearChildren()
614:     {
615:         $this->sChildClass = '%inline';
616:         $this->aChildren = array();
617:     }
618: 
619:     /*
620:         Function: addChild
621:         
622:         Adds a control to the array of child controls.  Child controls
623:         must be derived from <xajaxControl>.
624:     */
625:     public function addChild($objControl)
626:     {
627: //SkipDebug
628:         if (false == ($objControl instanceof xajaxControl )) {
629:             $objLanguageManager = xajaxLanguageManager::getInstance();
630:             trigger_error(
631:                 $objLanguageManager->getText('XJXCTL:ICLERR:01')
632:                 . $this->backtrace()
633:                 , E_USER_ERROR
634:                 );
635:         }
636: 
637:         if (class_exists('clsValidator'))
638:         {
639:             $objValidator = clsValidator::getInstance();
640:             if (false == $objValidator->childValid($this->sTag, $objControl->sTag)) {
641:                 $objLanguageManager = xajaxLanguageManager::getInstance();
642:                 trigger_error(
643:                     $objLanguageManager->getText('XJXCTL:ICLERR:02') 
644:                     . $objControl->sTag
645:                     . $objLanguageManager->getText('XJXCTL:ICLERR:03') 
646:                     . $this->sTag 
647:                     . $objLanguageManager->getText('XJXCTL:ICLERR:04')
648:                     . $this->backtrace()
649:                     , E_USER_ERROR
650:                     );
651:             }
652:         }
653: //EndSkipDebug
654: 
655:         $this->aChildren[] = $objControl;
656:     }
657:     
658:     public function addChildren($aChildren)
659:     {
660: //SkipDebug
661:         if (false == is_array($aChildren)) {
662:             $objLanguageManager = xajaxLanguageManager::getInstance();
663:             trigger_error(
664:                 $objLanguageManager->getText('XJXCTL:ICHERR:01')
665:                 . $this->backtrace()
666:                 , E_USER_ERROR
667:                 );
668:         }
669: //EndSkipDebug
670:                 
671:         foreach (array_keys($aChildren) as $sKey)
672:             $this->addChild($aChildren[$sKey]);
673:     }
674: 
675:     public function printHTML($sIndent='')
676:     {
677: //SkipDebug
678:         if (class_exists('clsValidator'))
679:         {
680:             $objValidator = clsValidator::getInstance();
681:             $sMissing = '';
682:             if (false == $objValidator->checkRequiredAttributes($this->sTag, $this->aAttributes, $sMissing)) {
683:                 $objLanguageManager = xajaxLanguageManager::getInstance();
684:                 trigger_error(
685:                     $objLanguageManager->getText('XJXCTL:MRAERR:01') 
686:                     . $sMissing
687:                     . $objLanguageManager->getText('XJXCTL:MRAERR:02') 
688:                     . $this->sTag 
689:                     . $objLanguageManager->getText('XJXCTL:MRAERR:03')
690:                     , E_USER_ERROR
691:                     );
692:             }
693:         }
694: //EndSkipDebug
695: 
696:         $sClass = $this->getClass();
697:         
698:         if ('%inline' != $sClass)
699:             // this odd syntax is necessary to detect request for no formatting
700:             if (false === (false === $sIndent))
701:                 echo $sIndent;
702:             
703:         echo '<';
704:         echo $this->sTag;
705:         echo ' ';
706:         $this->_printAttributes();
707:         $this->_printEvents();
708:         
709:         if (0 == count($this->aChildren))
710:         {
711:             if ('optional' == $this->sEndTag)
712:             {
713:                 echo '/>';
714:                 
715:                 if ('%inline' != $sClass)
716:                     // this odd syntax is necessary to detect request for no formatting
717:                     if (false === (false === $sIndent))
718:                         echo "\n";
719:                     
720:                 return;
721:             }
722: //SkipDebug
723:             else if ('required' != $this->sEndTag)
724:                 trigger_error("Invalid end tag designation; should be optional or required.\n"
725:                     . $this->backtrace(),
726:                     E_USER_ERROR
727:                     );
728: //EndSkipDebug
729:         }
730:         
731:         echo '>';
732:         
733:         $sContentClass = $this->getContentClass();
734:         
735:         if ('%inline' != $sContentClass)
736:             // this odd syntax is necessary to detect request for no formatting
737:             if (false === (false === $sIndent))
738:                 echo "\n";
739: 
740:         $this->_printChildren($sIndent);
741:         
742:         if ('%inline' != $sContentClass)
743:             // this odd syntax is necessary to detect request for no formatting
744:             if (false === (false === $sIndent))
745:                 echo $sIndent;
746:         
747:         echo '<' . '/';
748:         echo $this->sTag;
749:         echo '>';
750:         
751:         if ('%inline' != $sClass)
752:             // this odd syntax is necessary to detect request for no formatting
753:             if (false === (false === $sIndent))
754:                 echo "\n";
755:     }
756: 
757:     protected function _printChildren($sIndent='')
758:     {
759:         if (false == ($this instanceof clsDocument ))
760:             // this odd syntax is necessary to detect request for no formatting
761:             if (false === (false === $sIndent))
762:                 $sIndent .= "\t";
763: 
764:         // children
765:         foreach (array_keys($this->aChildren) as $sKey)
766:         {
767:             $objChild = $this->aChildren[$sKey];
768:             $objChild->printHTML($sIndent);
769:         }
770:     }
771: 
772:     public function getResponse($count, $parent, $flag=XAJAX_DOMRESPONSE_APPENDCHILD)
773:     {
774:         $variable = "xjxElm[{$count}]";
775: 
776:         $response = $this->beginGetResponse($variable, $count);
777:         $this->getResponseAttributes($response, $variable);
778:         $this->getResponseEvents($response, $variable);
779:         $this->getResponseChildren($response, $variable, $count);
780:         $this->endGetResponse($response, $variable, $count, $parent, $flag);
781: 
782:         return $response;
783:     }
784: 
785:     protected function getResponseChildren($response, $variable, $count)
786:     {
787:         foreach (array_keys($this->aChildren) as $sKey)
788:         {
789:             $objChild = $this->aChildren[$sKey];
790:             $response->appendResponse(
791:                 $objChild->getResponse($count+1, $variable)
792:                 );
793:         }
794:     }
795: }
796: 
Autene API documentation generated by ApiGen